diff options
| author | 2014-09-18 16:12:05 +0000 | |
|---|---|---|
| committer | 2014-09-18 16:12:06 +0000 | |
| commit | 2bc75f0821a509e22b23f6718cb5f0543bc4ad4d (patch) | |
| tree | ae0c848b477799d5a8ed6a5f50088e819dd54afb | |
| parent | 72cc3702d252db7440c1d1fa63e7d81c8d0e8ffd (diff) | |
| parent | cf5a9530f7ded49e830a064526f4290f3a81062c (diff) | |
Merge "Fix crash from USER_PRESENT broadcast in sysui" into lmp-dev
| -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 9af893d79e5f..4af84994c708 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. @@ -1145,8 +1147,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; +            } +        }      }      /** @@ -1406,6 +1414,12 @@ public class KeyguardViewMediator extends SystemUI {      public void onBootCompleted() {          mUpdateMonitor.dispatchBootCompleted(); +        synchronized (this) { +            mBootCompleted = true; +            if (mBootSendUserPresent) { +                sendUserPresentBroadcast(); +            } +        }      }      public StatusBarKeyguardViewManager registerStatusBar(PhoneStatusBar phoneStatusBar, |