Skip to content

Commit 545043e

Browse files
committed
Fix reboot loop caused by keyguard appwidget cleanup
Bug: 7591092
1 parent 007c64f commit 545043e

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

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

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@ public class KeyguardHostView extends KeyguardViewBase {
8181
private int mAppWidgetToShow;
8282

8383
private boolean mCheckAppWidgetConsistencyOnBootCompleted = false;
84+
private boolean mCleanupAppWidgetsOnBootCompleted = false;
8485

8586
protected OnDismissAction mDismissAction;
8687

@@ -155,6 +156,12 @@ public KeyguardHostView(Context context, AttributeSet attrs) {
155156
}
156157

157158
private void cleanupAppWidgetIds() {
159+
// Since this method may delete a widget (which we can't do until boot completed) we
160+
// may have to defer it until after boot complete.
161+
if (!KeyguardUpdateMonitor.getInstance(mContext).hasBootCompleted()) {
162+
mCleanupAppWidgetsOnBootCompleted = true;
163+
return;
164+
}
158165
// Clean up appWidgetIds that are bound to lockscreen, but not actually used
159166
// This is only to clean up after another bug: we used to not call
160167
// deleteAppWidgetId when a user manually deleted a widget in keyguard. This code
@@ -190,6 +197,10 @@ public void onBootCompleted() {
190197
mSwitchPageRunnable.run();
191198
mCheckAppWidgetConsistencyOnBootCompleted = false;
192199
}
200+
if (mCleanupAppWidgetsOnBootCompleted) {
201+
cleanupAppWidgetIds();
202+
mCleanupAppWidgetsOnBootCompleted = false;
203+
}
193204
}
194205
};
195206

0 commit comments

Comments
 (0)