Skip to content

Commit 3fd47af

Browse files
author
Jim Miller
committed
Send USER_PRESENT for keyguard choice "None"
This enables sending ACTION_USER_PRESENT when the user has selected "None" for their keyguard screen. When this happens, we delegate sending the event to onScreenTurnedOn(). Tested: - None -> sends broadcast in onSystemReady() the first time after boot and in onScreenTurnedOn() there after. - Slide -> sends broadcast only once when screen is dismissed - Pattern -> sends broadcast only once when screen is dismissed Fixes bug 7029707 Change-Id: I785c3255b15e2ee598a10d7d3580ba5c03dd0068
1 parent 6eeff85 commit 3fd47af

File tree

1 file changed

+19
-1
lines changed

1 file changed

+19
-1
lines changed

policy/src/com/android/internal/policy/impl/keyguard/KeyguardViewMediator.java

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -339,7 +339,7 @@ public void onClockVisibilityChanged() {
339339

340340
@Override
341341
public void onDeviceProvisioned() {
342-
mContext.sendBroadcast(mUserPresentIntent);
342+
sendUserPresentBroadcast();
343343
}
344344

345345
@Override
@@ -511,6 +511,9 @@ public void onSystemReady() {
511511
mUpdateMonitor.registerCallback(mUpdateCallback);
512512
doKeyguardLocked();
513513
}
514+
// Most services aren't available until the system reaches the ready state, so we
515+
// send it here when the device first boots.
516+
maybeSendUserPresentBroadcast();
514517
}
515518

516519
/**
@@ -606,6 +609,17 @@ public void onScreenTurnedOn(KeyguardViewManager.ShowListener showListener) {
606609
notifyScreenOnLocked(showListener);
607610
}
608611
}
612+
maybeSendUserPresentBroadcast();
613+
}
614+
615+
private void maybeSendUserPresentBroadcast() {
616+
if (mSystemReady && mLockPatternUtils.isLockScreenDisabled()
617+
&& mUserManager.getUsers(true).size() == 1) {
618+
// Lock screen is disabled because the user has set the preference to "None".
619+
// In this case, send out ACTION_USER_PRESENT here instead of in
620+
// handleKeyguardDone()
621+
sendUserPresentBroadcast();
622+
}
609623
}
610624

611625
/**
@@ -1093,6 +1107,10 @@ private void handleKeyguardDone(boolean wakeup) {
10931107
}
10941108
mWakeLock.release();
10951109

1110+
sendUserPresentBroadcast();
1111+
}
1112+
1113+
private void sendUserPresentBroadcast() {
10961114
if (!(mContext instanceof Activity)) {
10971115
final UserHandle currentUser = new UserHandle(mLockPatternUtils.getCurrentUser());
10981116
mContext.sendBroadcastAsUser(mUserPresentIntent, currentUser);

0 commit comments

Comments
 (0)