Skip to content

Commit 4eb36cf

Browse files
author
Adam Cohen
committed
Storing boot completed in KeyguardUpdateMonitor so it is persistent (issue 7492235)
Change-Id: I736816dac8cea47632fbdbc75b367f2c6216dff7
1 parent e41dd0f commit 4eb36cf

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
@@ -75,7 +75,6 @@ public class KeyguardHostView extends KeyguardViewBase {
7575
private SecurityMode mCurrentSecuritySelection = SecurityMode.Invalid;
7676
private int mAppWidgetToShow;
7777

78-
private boolean mBootCompleted = false;
7978
private boolean mCheckAppWidgetConsistencyOnBootCompleted = false;
8079

8180
protected Runnable mLaunchRunnable;
@@ -147,7 +146,6 @@ public KeyguardHostView(Context context, AttributeSet attrs) {
147146
new KeyguardUpdateMonitorCallback() {
148147
@Override
149148
public void onBootCompleted() {
150-
mBootCompleted = true;
151149
if (mCheckAppWidgetConsistencyOnBootCompleted) {
152150
checkAppWidgetConsistency();
153151
mSwitchPageRunnable.run();
@@ -1107,7 +1105,7 @@ private int allocateIdForDefaultAppWidget() {
11071105
public void checkAppWidgetConsistency() {
11081106
// Since this method may bind a widget (which we can't do until boot completed) we
11091107
// may have to defer it until after boot complete.
1110-
if (!mBootCompleted) {
1108+
if (!KeyguardUpdateMonitor.getInstance(mContext).hasBootCompleted()) {
11111109
mCheckAppWidgetConsistencyOnBootCompleted = true;
11121110
return;
11131111
}

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)