Skip to content

Commit 8f837a6

Browse files
Adam CohenAndroid (Google) Code Review
authored andcommitted
Merge "Storing boot completed in KeyguardUpdateMonitor so it is persistent (issue 7492235)" into jb-mr1-lockscreen-dev
2 parents db60b67 + 4eb36cf commit 8f837a6

File tree

2 files changed

+11
-3
lines changed

2 files changed

+11
-3
lines changed

policy/src/com/android/internal/policy/impl/keyguard/KeyguardHostView.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,6 @@ public class KeyguardHostView extends KeyguardViewBase {
7777
private SecurityMode mCurrentSecuritySelection = SecurityMode.Invalid;
7878
private int mAppWidgetToShow;
7979

80-
private boolean mBootCompleted = false;
8180
private boolean mCheckAppWidgetConsistencyOnBootCompleted = false;
8281

8382
protected OnDismissAction mDismissAction;
@@ -149,7 +148,6 @@ public KeyguardHostView(Context context, AttributeSet attrs) {
149148
new KeyguardUpdateMonitorCallback() {
150149
@Override
151150
public void onBootCompleted() {
152-
mBootCompleted = true;
153151
if (mCheckAppWidgetConsistencyOnBootCompleted) {
154152
checkAppWidgetConsistency();
155153
mSwitchPageRunnable.run();
@@ -1111,7 +1109,7 @@ private int allocateIdForDefaultAppWidget() {
11111109
public void checkAppWidgetConsistency() {
11121110
// Since this method may bind a widget (which we can't do until boot completed) we
11131111
// may have to defer it until after boot complete.
1114-
if (!mBootCompleted) {
1112+
if (!KeyguardUpdateMonitor.getInstance(mContext).hasBootCompleted()) {
11151113
mCheckAppWidgetConsistencyOnBootCompleted = true;
11161114
return;
11171115
}

policy/src/com/android/internal/policy/impl/keyguard/KeyguardUpdateMonitor.java

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,7 @@ public class KeyguardUpdateMonitor {
9595
private int mRingMode;
9696
private int mPhoneState;
9797
private boolean mKeyguardIsVisible;
98+
private boolean mBootCompleted;
9899

99100
// Device provisioning state
100101
private boolean mDeviceProvisioned;
@@ -431,6 +432,7 @@ protected void handleUserSwitched(int userId, IRemoteCallback reply) {
431432
* Handle {@link #MSG_BOOT_COMPLETED}
432433
*/
433434
protected void handleBootCompleted() {
435+
mBootCompleted = true;
434436
for (int i = 0; i < mCallbacks.size(); i++) {
435437
KeyguardUpdateMonitorCallback cb = mCallbacks.get(i).get();
436438
if (cb != null) {
@@ -439,6 +441,14 @@ protected void handleBootCompleted() {
439441
}
440442
}
441443

444+
/**
445+
* We need to store this state in the KeyguardUpdateMonitor since this class will not be
446+
* destroyed.
447+
*/
448+
public boolean hasBootCompleted() {
449+
return mBootCompleted;
450+
}
451+
442452
/**
443453
* Handle {@link #MSG_USER_SWITCHED}
444454
*/

0 commit comments

Comments
 (0)