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
diff --git a/policy/src/com/android/internal/policy/impl/keyguard/KeyguardViewMediator.java b/policy/src/com/android/internal/policy/impl/keyguard/KeyguardViewMediator.java
index 416a0bb..212a6bb 100644
--- a/policy/src/com/android/internal/policy/impl/keyguard/KeyguardViewMediator.java
+++ b/policy/src/com/android/internal/policy/impl/keyguard/KeyguardViewMediator.java
@@ -339,7 +339,7 @@
@Override
public void onDeviceProvisioned() {
- mContext.sendBroadcast(mUserPresentIntent);
+ sendUserPresentBroadcast();
}
@Override
@@ -511,6 +511,9 @@
mUpdateMonitor.registerCallback(mUpdateCallback);
doKeyguardLocked();
}
+ // Most services aren't available until the system reaches the ready state, so we
+ // send it here when the device first boots.
+ maybeSendUserPresentBroadcast();
}
/**
@@ -606,6 +609,17 @@
notifyScreenOnLocked(showListener);
}
}
+ maybeSendUserPresentBroadcast();
+ }
+
+ private void maybeSendUserPresentBroadcast() {
+ if (mSystemReady && mLockPatternUtils.isLockScreenDisabled()
+ && mUserManager.getUsers(true).size() == 1) {
+ // Lock screen is disabled because the user has set the preference to "None".
+ // In this case, send out ACTION_USER_PRESENT here instead of in
+ // handleKeyguardDone()
+ sendUserPresentBroadcast();
+ }
}
/**
@@ -1093,6 +1107,10 @@
}
mWakeLock.release();
+ sendUserPresentBroadcast();
+ }
+
+ private void sendUserPresentBroadcast() {
if (!(mContext instanceof Activity)) {
final UserHandle currentUser = new UserHandle(mLockPatternUtils.getCurrentUser());
mContext.sendBroadcastAsUser(mUserPresentIntent, currentUser);