diff options
author | Sunny Goyal <sunnygoyal@google.com> | 2014-10-08 10:47:28 -0700 |
---|---|---|
committer | Sunny Goyal <sunnygoyal@google.com> | 2014-10-16 11:20:41 -0700 |
commit | 9b4b0812fec41c40d81d507cfdb528ba87663f5f (patch) | |
tree | a1bcada0f9173ddbb7caa6593b27bf46dff51621 /src/com/android/launcher3/Launcher.java | |
parent | d37a1f5abec5a442508d850a0e26c96ece225f91 (diff) | |
download | android_packages_apps_Trebuchet-9b4b0812fec41c40d81d507cfdb528ba87663f5f.tar.gz android_packages_apps_Trebuchet-9b4b0812fec41c40d81d507cfdb528ba87663f5f.tar.bz2 android_packages_apps_Trebuchet-9b4b0812fec41c40d81d507cfdb528ba87663f5f.zip |
Showing widgets in a disabled state, when running in safe mode
Bug: 15172107
Change-Id: I7209836ca4ffacde7b7b232e230e9b9f1a0e54bb
Diffstat (limited to 'src/com/android/launcher3/Launcher.java')
-rw-r--r-- | src/com/android/launcher3/Launcher.java | 26 |
1 files changed, 18 insertions, 8 deletions
diff --git a/src/com/android/launcher3/Launcher.java b/src/com/android/launcher3/Launcher.java index d5cb55b03..444a4bc1b 100644 --- a/src/com/android/launcher3/Launcher.java +++ b/src/com/android/launcher3/Launcher.java @@ -2538,6 +2538,11 @@ public class Launcher extends Activity * Event handler for the app widget view which has not fully restored. */ public void onClickPendingWidget(final PendingAppWidgetHostView v) { + if (mIsSafeModeEnabled) { + Toast.makeText(this, R.string.safemode_widget_error, Toast.LENGTH_SHORT).show(); + return; + } + final LauncherAppWidgetInfo info = (LauncherAppWidgetInfo) v.getTag(); if (v.isReadyForClickSetup()) { int widgetId = info.appWidgetId; @@ -2790,10 +2795,13 @@ public class Launcher extends Activity */ protected void onClickAddWidgetButton(View view) { if (LOGD) Log.d(TAG, "onClickAddWidgetButton"); - showAllApps(true, AppsCustomizePagedView.ContentType.Widgets, true); - - if (mLauncherCallbacks != null) { - mLauncherCallbacks.onClickAddWidgetButton(view); + if (mIsSafeModeEnabled) { + Toast.makeText(this, R.string.safemode_widget_error, Toast.LENGTH_SHORT).show(); + } else { + showAllApps(true, AppsCustomizePagedView.ContentType.Widgets, true); + if (mLauncherCallbacks != null) { + mLauncherCallbacks.onClickAddWidgetButton(view); + } } } @@ -4591,8 +4599,9 @@ public class Launcher extends Activity final Workspace workspace = mWorkspace; AppWidgetProviderInfo appWidgetInfo; - if (((item.restoreStatus & LauncherAppWidgetInfo.FLAG_PROVIDER_NOT_READY) == 0) && - ((item.restoreStatus & LauncherAppWidgetInfo.FLAG_ID_NOT_VALID) != 0)) { + if (!mIsSafeModeEnabled + && ((item.restoreStatus & LauncherAppWidgetInfo.FLAG_PROVIDER_NOT_READY) == 0) + && ((item.restoreStatus & LauncherAppWidgetInfo.FLAG_ID_NOT_VALID) != 0)) { appWidgetInfo = mModel.findAppWidgetProviderInfoWithComponent(this, item.providerName); if (appWidgetInfo == null) { @@ -4642,7 +4651,7 @@ public class Launcher extends Activity LauncherModel.updateItemInDatabase(this, item); } - if (item.restoreStatus == LauncherAppWidgetInfo.RESTORE_COMPLETED) { + if (!mIsSafeModeEnabled && item.restoreStatus == LauncherAppWidgetInfo.RESTORE_COMPLETED) { final int appWidgetId = item.appWidgetId; appWidgetInfo = mAppWidgetManager.getAppWidgetInfo(appWidgetId); if (DEBUG_WIDGETS) { @@ -4652,7 +4661,8 @@ public class Launcher extends Activity item.hostView = mAppWidgetHost.createView(this, appWidgetId, appWidgetInfo); } else { appWidgetInfo = null; - PendingAppWidgetHostView view = new PendingAppWidgetHostView(this, item); + PendingAppWidgetHostView view = new PendingAppWidgetHostView(this, item, + mIsSafeModeEnabled); view.updateIcon(mIconCache); item.hostView = view; item.hostView.updateAppWidget(null); |