summaryrefslogtreecommitdiffstats
path: root/src/com/android/launcher3/Launcher.java
diff options
context:
space:
mode:
authorSunny Goyal <sunnygoyal@google.com>2014-10-08 10:47:28 -0700
committerDanesh M <daneshm90@gmail.com>2015-09-27 15:51:23 -0700
commit4e4f8a775170fc282ea129a266075522057d29e1 (patch)
tree5d1a0751c802c44641c6e2fca3caa7ce183a01d9 /src/com/android/launcher3/Launcher.java
parent19379be35a571865201691eb9878d79a34eae860 (diff)
downloadandroid_packages_apps_Trebuchet-4e4f8a775170fc282ea129a266075522057d29e1.tar.gz
android_packages_apps_Trebuchet-4e4f8a775170fc282ea129a266075522057d29e1.tar.bz2
android_packages_apps_Trebuchet-4e4f8a775170fc282ea129a266075522057d29e1.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.java26
1 files changed, 18 insertions, 8 deletions
diff --git a/src/com/android/launcher3/Launcher.java b/src/com/android/launcher3/Launcher.java
index 4627ddc44..0d964e206 100644
--- a/src/com/android/launcher3/Launcher.java
+++ b/src/com/android/launcher3/Launcher.java
@@ -2968,6 +2968,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;
@@ -3253,10 +3258,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);
+ }
}
}
@@ -5309,8 +5317,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) {
@@ -5360,7 +5369,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) {
@@ -5370,7 +5379,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);