summaryrefslogtreecommitdiffstats
path: root/src/com/android/launcher3/LauncherAppWidgetInfo.java
diff options
context:
space:
mode:
authorSunny Goyal <sunnygoyal@google.com>2014-06-30 14:15:31 -0700
committerSunny Goyal <sunnygoyal@google.com>2014-07-21 10:34:21 -0700
commit651077bdd603bb182be039925fd17bdf0da15016 (patch)
treea8707757fd1c77ecf0de554dab61090a72e7cbb8 /src/com/android/launcher3/LauncherAppWidgetInfo.java
parent82cc3fe6c77322d93ff74b25354e4bca77ab4a83 (diff)
downloadandroid_packages_apps_Trebuchet-651077bdd603bb182be039925fd17bdf0da15016.tar.gz
android_packages_apps_Trebuchet-651077bdd603bb182be039925fd17bdf0da15016.tar.bz2
android_packages_apps_Trebuchet-651077bdd603bb182be039925fd17bdf0da15016.zip
Adding app widget restore support in Launcher3 for android L
When the app is restored, it displays placeholders for all pending widgets. These placeholders can be moved and removed similar to a widget (size is fixed to what defined in backup). Once the system notifies the launcher of the new widget ids, the place holders are replaced with actual widgets. issue: 10779035 Change-Id: I68cbe4da01e9ca2978cb4471a7c645d2aa592055
Diffstat (limited to 'src/com/android/launcher3/LauncherAppWidgetInfo.java')
-rw-r--r--src/com/android/launcher3/LauncherAppWidgetInfo.java22
1 files changed, 22 insertions, 0 deletions
diff --git a/src/com/android/launcher3/LauncherAppWidgetInfo.java b/src/com/android/launcher3/LauncherAppWidgetInfo.java
index bec1f9eb3..b3ac12b37 100644
--- a/src/com/android/launcher3/LauncherAppWidgetInfo.java
+++ b/src/com/android/launcher3/LauncherAppWidgetInfo.java
@@ -28,6 +28,18 @@ import com.android.launcher3.compat.UserHandleCompat;
*/
public class LauncherAppWidgetInfo extends ItemInfo {
+ public static final int RESTORE_COMPLETED = 0;
+
+ /**
+ * This is set during the package backup creation.
+ */
+ public static final int RESTORE_REMAP_PENDING = 1;
+
+ /**
+ * Widget provider is not yet installed.
+ */
+ public static final int RESTORE_PROVIDER_PENDING = 2;
+
/**
* Indicates that the widget hasn't been instantiated yet.
*/
@@ -45,6 +57,11 @@ public class LauncherAppWidgetInfo extends ItemInfo {
int minWidth = -1;
int minHeight = -1;
+ /**
+ * Indicates the restore status of the widget.
+ */
+ int restoreStatus;
+
private boolean mHasNotifiedInitialWidgetSizeChanged;
/**
@@ -64,6 +81,7 @@ public class LauncherAppWidgetInfo extends ItemInfo {
spanY = -1;
// We only support app widgets on current user.
user = UserHandleCompat.myUserHandle();
+ restoreStatus = RESTORE_COMPLETED;
}
@Override
@@ -101,4 +119,8 @@ public class LauncherAppWidgetInfo extends ItemInfo {
super.unbind();
hostView = null;
}
+
+ public final boolean isWidgetIdValid() {
+ return restoreStatus != RESTORE_REMAP_PENDING;
+ }
}