summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Jurka <mikejurka@google.com>2013-02-19 22:10:48 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2013-02-19 22:10:48 +0000
commitf9b9ead5d4f7bee34ec8a6b083065b624a7f6809 (patch)
treed8d57fc1368958ecfc7c2cb12991aa9ec231b1f1
parent32a4fd8e144e50166a543b006c6dc5c74558b70d (diff)
parentfc2dbb2f3a148ee90727c4319adf56c04002f3fa (diff)
Merge "Fix bug with clock when keyguard widgets disabled"
-rw-r--r--policy/src/com/android/internal/policy/impl/keyguard/KeyguardHostView.java44
1 files changed, 24 insertions, 20 deletions
diff --git a/policy/src/com/android/internal/policy/impl/keyguard/KeyguardHostView.java b/policy/src/com/android/internal/policy/impl/keyguard/KeyguardHostView.java
index 27d808b4c463..a0a5f5abc1de 100644
--- a/policy/src/com/android/internal/policy/impl/keyguard/KeyguardHostView.java
+++ b/policy/src/com/android/internal/policy/impl/keyguard/KeyguardHostView.java
@@ -136,21 +136,23 @@ public class KeyguardHostView extends KeyguardViewBase {
mAppWidgetHost = new AppWidgetHost(
context, APPWIDGET_HOST_ID, mOnClickHandler, Looper.myLooper());
mAppWidgetHost.setUserId(mUserId);
- cleanupAppWidgetIds();
-
- mAppWidgetManager = AppWidgetManager.getInstance(mContext);
- mSecurityModel = new KeyguardSecurityModel(context);
-
- mViewStateManager = new KeyguardViewStateManager(this);
DevicePolicyManager dpm =
- (DevicePolicyManager) mContext.getSystemService(Context.DEVICE_POLICY_SERVICE);
+ (DevicePolicyManager) mContext.getSystemService(Context.DEVICE_POLICY_SERVICE);
if (dpm != null) {
mDisabledFeatures = getDisabledFeatures(dpm);
mCameraDisabled = dpm.getCameraDisabled(null);
}
mSafeModeEnabled = LockPatternUtils.isSafeModeEnabled();
+
+ cleanupAppWidgetIds();
+
+ mAppWidgetManager = AppWidgetManager.getInstance(mContext);
+ mSecurityModel = new KeyguardSecurityModel(context);
+
+ mViewStateManager = new KeyguardViewStateManager(this);
+
mUserSetupCompleted = Settings.Secure.getIntForUser(mContext.getContentResolver(),
Settings.Secure.USER_SETUP_COMPLETE, 0, UserHandle.USER_CURRENT) != 0;
@@ -172,19 +174,21 @@ public class KeyguardHostView extends KeyguardViewBase {
mCleanupAppWidgetsOnBootCompleted = true;
return;
}
- // Clean up appWidgetIds that are bound to lockscreen, but not actually used
- // This is only to clean up after another bug: we used to not call
- // deleteAppWidgetId when a user manually deleted a widget in keyguard. This code
- // shouldn't have to run more than once per user. AppWidgetProviders rely on callbacks
- // that are triggered by deleteAppWidgetId, which is why we're doing this
- int[] appWidgetIdsInKeyguardSettings = mLockPatternUtils.getAppWidgets();
- int[] appWidgetIdsBoundToHost = mAppWidgetHost.getAppWidgetIds();
- for (int i = 0; i < appWidgetIdsBoundToHost.length; i++) {
- int appWidgetId = appWidgetIdsBoundToHost[i];
- if (!contains(appWidgetIdsInKeyguardSettings, appWidgetId)) {
- Log.d(TAG, "Found a appWidgetId that's not being used by keyguard, deleting id "
- + appWidgetId);
- mAppWidgetHost.deleteAppWidgetId(appWidgetId);
+ if (!mSafeModeEnabled && !widgetsDisabledByDpm()) {
+ // Clean up appWidgetIds that are bound to lockscreen, but not actually used
+ // This is only to clean up after another bug: we used to not call
+ // deleteAppWidgetId when a user manually deleted a widget in keyguard. This code
+ // shouldn't have to run more than once per user. AppWidgetProviders rely on callbacks
+ // that are triggered by deleteAppWidgetId, which is why we're doing this
+ int[] appWidgetIdsInKeyguardSettings = mLockPatternUtils.getAppWidgets();
+ int[] appWidgetIdsBoundToHost = mAppWidgetHost.getAppWidgetIds();
+ for (int i = 0; i < appWidgetIdsBoundToHost.length; i++) {
+ int appWidgetId = appWidgetIdsBoundToHost[i];
+ if (!contains(appWidgetIdsInKeyguardSettings, appWidgetId)) {
+ Log.d(TAG, "Found a appWidgetId that's not being used by keyguard, deleting id "
+ + appWidgetId);
+ mAppWidgetHost.deleteAppWidgetId(appWidgetId);
+ }
}
}
}