diff options
| author | 2014-09-17 16:22:19 -0400 | |
|---|---|---|
| committer | 2014-09-18 11:02:19 -0400 | |
| commit | cf5a9530f7ded49e830a064526f4290f3a81062c (patch) | |
| tree | a7bf5951a8f8c6bb40381c55ccb80407ee3757af | |
| parent | 2911b2046a7a398791623f835686f8eda60b5a78 (diff) | |
Fix crash from USER_PRESENT broadcast in sysui
Since sending the USER_PRESENT broadcast too early in the boot
process can result in a SecurityException, don't do auto-unlock
until after the boot has completed.
Bug: 17464800
Change-Id: Iee3d0b9723ed38abddf0bdde009f95331881008b
| -rw-r--r-- | packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java | 18 | 
1 files changed, 16 insertions, 2 deletions
| diff --git a/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java b/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java index 50ba68e566cf..2628b3ed76c7 100644 --- a/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java +++ b/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java @@ -170,6 +170,8 @@ public class KeyguardViewMediator extends SystemUI {      private boolean mSwitchingUser;      private boolean mSystemReady; +    private boolean mBootCompleted; +    private boolean mBootSendUserPresent;      // Whether the next call to playSounds() should be skipped.  Defaults to      // true because the first lock (on boot) should be silent. @@ -1146,8 +1148,14 @@ public class KeyguardViewMediator extends SystemUI {      }      private void sendUserPresentBroadcast() { -        final UserHandle currentUser = new UserHandle(mLockPatternUtils.getCurrentUser()); -        mContext.sendBroadcastAsUser(USER_PRESENT_INTENT, currentUser); +        synchronized (this) { +            if (mBootCompleted) { +                final UserHandle currentUser = new UserHandle(mLockPatternUtils.getCurrentUser()); +                mContext.sendBroadcastAsUser(USER_PRESENT_INTENT, currentUser); +            } else { +                mBootSendUserPresent = true; +            } +        }      }      /** @@ -1407,6 +1415,12 @@ public class KeyguardViewMediator extends SystemUI {      public void onBootCompleted() {          mUpdateMonitor.dispatchBootCompleted(); +        synchronized (this) { +            mBootCompleted = true; +            if (mBootSendUserPresent) { +                sendUserPresentBroadcast(); +            } +        }      }      public StatusBarKeyguardViewManager registerStatusBar(PhoneStatusBar phoneStatusBar, |