@@ -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