Send onUnlockUser() before PRE_BOOT broadcasts.

Before this change, a PRE_BOOT_COMPLETED receiver could try calling
back into the system to ask for AccountManager details, only to be
told the user wasn't unlocked yet.  If the broadcast code was probing
in a loop, it would force us to wait around for the 60-second ANR
timeout.  Since typical devices have ~7 PRE_BOOT receivers, this
would delay BOOT_COMPLETED and other operations, like mounting the
SD card, for up to 7 minutes.

Bug: 28024024

Change-Id: Ibf8611e6fe94b0deb5ae5715c86f897ff6779088
This commit is contained in:
Jeff Sharkey
2016-04-06 14:07:09 -06:00
parent 3855e9ce49
commit 083807d61c

View File

@@ -260,6 +260,9 @@ final class UserController {
mUserManager.onBeforeUnlockUser(userId);
progress.setProgress(20);
// Dispatch unlocked to system services
mHandler.sendMessage(mHandler.obtainMessage(SYSTEM_USER_UNLOCK_MSG, userId, 0));
// Send PRE_BOOT broadcasts if fingerprint changed
final UserInfo info = getUserInfo(userId);
if (!Objects.equals(info.lastLoggedInFingerprint, Build.FINGERPRINT)) {
@@ -302,9 +305,6 @@ final class UserController {
// Remember that we logged in
mUserManager.onUserLoggedIn(userId);
// Dispatch unlocked to system services
mHandler.sendMessage(mHandler.obtainMessage(SYSTEM_USER_UNLOCK_MSG, userId, 0));
// Dispatch unlocked to external apps
final Intent unlockedIntent = new Intent(Intent.ACTION_USER_UNLOCKED);
unlockedIntent.putExtra(Intent.EXTRA_USER_HANDLE, userId);