summaryrefslogtreecommitdiffstats
path: root/src/com/android/launcher3/LauncherAppWidgetInfo.java
diff options
context:
space:
mode:
authorSunny Goyal <sunnygoyal@google.com>2014-07-23 13:58:07 -0700
committerSunny Goyal <sunnygoyal@google.com>2014-08-08 14:29:02 -0700
commitff572277112ec3d6a6a8c1be274d6fa1019e3648 (patch)
tree85212d0b7f7b217beb80892917ea88a7ac180947 /src/com/android/launcher3/LauncherAppWidgetInfo.java
parent6075170b838bfe7a040bbff25c2c22859b7d6ee5 (diff)
downloadandroid_packages_apps_Trebuchet-ff572277112ec3d6a6a8c1be274d6fa1019e3648.tar.gz
android_packages_apps_Trebuchet-ff572277112ec3d6a6a8c1be274d6fa1019e3648.tar.bz2
android_packages_apps_Trebuchet-ff572277112ec3d6a6a8c1be274d6fa1019e3648.zip
Adding support to restore widgets even for jelly beans.
> Show 'widget-not-ready' until the widget app is installed > Once the app is installed, bind a new widget id (not required on L if id-remap was received). **Remove the widget if bind failed > If the widget has no configuration screen, show the widget, otherwise show 'setup-widget'. > Clicking 'setup-widget' shows the config screen, and updates the widget on RESULT_OK. issue: 10779035 Change-Id: I2f8b06d09dd6acbc498cdd93edc59c26e5ce17af
Diffstat (limited to 'src/com/android/launcher3/LauncherAppWidgetInfo.java')
-rw-r--r--src/com/android/launcher3/LauncherAppWidgetInfo.java18
1 files changed, 14 insertions, 4 deletions
diff --git a/src/com/android/launcher3/LauncherAppWidgetInfo.java b/src/com/android/launcher3/LauncherAppWidgetInfo.java
index b3ac12b37..c1535abae 100644
--- a/src/com/android/launcher3/LauncherAppWidgetInfo.java
+++ b/src/com/android/launcher3/LauncherAppWidgetInfo.java
@@ -33,12 +33,17 @@ public class LauncherAppWidgetInfo extends ItemInfo {
/**
* This is set during the package backup creation.
*/
- public static final int RESTORE_REMAP_PENDING = 1;
+ public static final int FLAG_ID_NOT_VALID = 1;
/**
- * Widget provider is not yet installed.
+ * Indicates that the provider is not available yet.
*/
- public static final int RESTORE_PROVIDER_PENDING = 2;
+ public static final int FLAG_PROVIDER_NOT_READY = 2;
+
+ /**
+ * Indicates that the widget UI is not yet ready, and user needs to set it up again.
+ */
+ public static final int FLAG_UI_NOT_READY = 4;
/**
* Indicates that the widget hasn't been instantiated yet.
@@ -89,6 +94,7 @@ public class LauncherAppWidgetInfo extends ItemInfo {
super.onAddToDatabase(context, values);
values.put(LauncherSettings.Favorites.APPWIDGET_ID, appWidgetId);
values.put(LauncherSettings.Favorites.APPWIDGET_PROVIDER, providerName.flattenToString());
+ values.put(LauncherSettings.Favorites.RESTORED, restoreStatus);
}
/**
@@ -121,6 +127,10 @@ public class LauncherAppWidgetInfo extends ItemInfo {
}
public final boolean isWidgetIdValid() {
- return restoreStatus != RESTORE_REMAP_PENDING;
+ return (restoreStatus & FLAG_ID_NOT_VALID) == 0;
+ }
+
+ public final boolean hasRestoreFlag(int flag) {
+ return (restoreStatus & flag) == flag;
}
}