Showing a permission dialog when a restored widget is not yet bound, and launcher
does not has the permission to bind the widget
Change-Id: I51d32b9958f82671b928d559105129261fb8f268
diff --git a/src/com/android/launcher3/LauncherAppWidgetInfo.java b/src/com/android/launcher3/LauncherAppWidgetInfo.java
index 42d6468..4c8fedf 100644
--- a/src/com/android/launcher3/LauncherAppWidgetInfo.java
+++ b/src/com/android/launcher3/LauncherAppWidgetInfo.java
@@ -51,6 +51,12 @@
public static final int FLAG_RESTORE_STARTED = 8;
/**
+ * Indicates that the widget has been allocated an Id. The id is still not valid, as it has
+ * not been bound yet.
+ */
+ public static final int FLAG_ID_ALLOCATED = 16;
+
+ /**
* Indicates that the widget hasn't been instantiated yet.
*/
static final int NO_ID = -1;
@@ -127,8 +133,9 @@
return "AppWidget(id=" + Integer.toString(appWidgetId) + ")";
}
- public final boolean isWidgetIdValid() {
- return (restoreStatus & FLAG_ID_NOT_VALID) == 0;
+ public final boolean isWidgetIdAllocated() {
+ return (restoreStatus & FLAG_ID_NOT_VALID) == 0 ||
+ (restoreStatus & FLAG_ID_ALLOCATED) == FLAG_ID_ALLOCATED;
}
public final boolean hasRestoreFlag(int flag) {