Loading policy/src/com/android/internal/policy/impl/keyguard/KeyguardHostView.java +16 −2 Original line number Diff line number Diff line Loading @@ -144,7 +144,6 @@ 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); Loading @@ -158,6 +157,7 @@ public class KeyguardHostView extends KeyguardViewBase { mCameraDisabled = dpm.getCameraDisabled(null); } cleanupAppWidgetIds(); mSafeModeEnabled = LockPatternUtils.isSafeModeEnabled(); mUserSetupCompleted = Settings.Secure.getIntForUser(mContext.getContentResolver(), Settings.Secure.USER_SETUP_COMPLETE, 0, UserHandle.USER_CURRENT) != 0; Loading Loading @@ -187,9 +187,22 @@ public class KeyguardHostView extends KeyguardViewBase { // that are triggered by deleteAppWidgetId, which is why we're doing this int[] appWidgetIdsInKeyguardSettings = mLockPatternUtils.getAppWidgets(); int[] appWidgetIdsBoundToHost = mAppWidgetHost.getAppWidgetIds(); int fallbackWidgetId = mLockPatternUtils.getFallbackAppWidgetId(); for (int i = 0; i < appWidgetIdsBoundToHost.length; i++) { int appWidgetId = appWidgetIdsBoundToHost[i]; if (!contains(appWidgetIdsInKeyguardSettings, appWidgetId)) { if (appWidgetId == fallbackWidgetId) { if (widgetsDisabledByDpm()) { // Ignore attempts to delete the fallback widget when widgets // are disabled continue; } else { // Reset fallback widget id in the event that widgets have been // enabled, and fallback widget is being deleted mLockPatternUtils.writeFallbackAppWidgetId( AppWidgetManager.INVALID_APPWIDGET_ID); } } Log.d(TAG, "Found a appWidgetId that's not being used by keyguard, deleting id " + appWidgetId); mAppWidgetHost.deleteAppWidgetId(appWidgetId); Loading Loading @@ -447,7 +460,8 @@ public class KeyguardHostView extends KeyguardViewBase { if (deletePermanently) { final int appWidgetId = ((KeyguardWidgetFrame) v).getContentAppWidgetId(); if (appWidgetId != AppWidgetManager.INVALID_APPWIDGET_ID && appWidgetId != LockPatternUtils.ID_DEFAULT_STATUS_WIDGET) { appWidgetId != LockPatternUtils.ID_DEFAULT_STATUS_WIDGET && appWidgetId != mLockPatternUtils.getFallbackAppWidgetId()) { mAppWidgetHost.deleteAppWidgetId(appWidgetId); } } Loading Loading
policy/src/com/android/internal/policy/impl/keyguard/KeyguardHostView.java +16 −2 Original line number Diff line number Diff line Loading @@ -144,7 +144,6 @@ 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); Loading @@ -158,6 +157,7 @@ public class KeyguardHostView extends KeyguardViewBase { mCameraDisabled = dpm.getCameraDisabled(null); } cleanupAppWidgetIds(); mSafeModeEnabled = LockPatternUtils.isSafeModeEnabled(); mUserSetupCompleted = Settings.Secure.getIntForUser(mContext.getContentResolver(), Settings.Secure.USER_SETUP_COMPLETE, 0, UserHandle.USER_CURRENT) != 0; Loading Loading @@ -187,9 +187,22 @@ public class KeyguardHostView extends KeyguardViewBase { // that are triggered by deleteAppWidgetId, which is why we're doing this int[] appWidgetIdsInKeyguardSettings = mLockPatternUtils.getAppWidgets(); int[] appWidgetIdsBoundToHost = mAppWidgetHost.getAppWidgetIds(); int fallbackWidgetId = mLockPatternUtils.getFallbackAppWidgetId(); for (int i = 0; i < appWidgetIdsBoundToHost.length; i++) { int appWidgetId = appWidgetIdsBoundToHost[i]; if (!contains(appWidgetIdsInKeyguardSettings, appWidgetId)) { if (appWidgetId == fallbackWidgetId) { if (widgetsDisabledByDpm()) { // Ignore attempts to delete the fallback widget when widgets // are disabled continue; } else { // Reset fallback widget id in the event that widgets have been // enabled, and fallback widget is being deleted mLockPatternUtils.writeFallbackAppWidgetId( AppWidgetManager.INVALID_APPWIDGET_ID); } } Log.d(TAG, "Found a appWidgetId that's not being used by keyguard, deleting id " + appWidgetId); mAppWidgetHost.deleteAppWidgetId(appWidgetId); Loading Loading @@ -447,7 +460,8 @@ public class KeyguardHostView extends KeyguardViewBase { if (deletePermanently) { final int appWidgetId = ((KeyguardWidgetFrame) v).getContentAppWidgetId(); if (appWidgetId != AppWidgetManager.INVALID_APPWIDGET_ID && appWidgetId != LockPatternUtils.ID_DEFAULT_STATUS_WIDGET) { appWidgetId != LockPatternUtils.ID_DEFAULT_STATUS_WIDGET && appWidgetId != mLockPatternUtils.getFallbackAppWidgetId()) { mAppWidgetHost.deleteAppWidgetId(appWidgetId); } } Loading