summaryrefslogtreecommitdiffstats
path: root/src/com/android/launcher3/PendingAppWidgetHostView.java
diff options
context:
space:
mode:
authorSunny Goyal <sunnygoyal@google.com>2016-04-01 12:04:16 -0700
committerSunny Goyal <sunnygoyal@google.com>2016-05-26 17:44:29 -0700
commitd478c83fd6abebe6ce3f066d392a28f8ba9be100 (patch)
tree5b99d0d5a53c9804339a43d8a40f7fff73654c07 /src/com/android/launcher3/PendingAppWidgetHostView.java
parent3c62137adf79673abb5400da7e310df11f61c932 (diff)
downloadandroid_packages_apps_Trebuchet-d478c83fd6abebe6ce3f066d392a28f8ba9be100.tar.gz
android_packages_apps_Trebuchet-d478c83fd6abebe6ce3f066d392a28f8ba9be100.tar.bz2
android_packages_apps_Trebuchet-d478c83fd6abebe6ce3f066d392a28f8ba9be100.zip
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
Diffstat (limited to 'src/com/android/launcher3/PendingAppWidgetHostView.java')
-rw-r--r--src/com/android/launcher3/PendingAppWidgetHostView.java14
1 files changed, 12 insertions, 2 deletions
diff --git a/src/com/android/launcher3/PendingAppWidgetHostView.java b/src/com/android/launcher3/PendingAppWidgetHostView.java
index 1c0290417..a455026fa 100644
--- a/src/com/android/launcher3/PendingAppWidgetHostView.java
+++ b/src/com/android/launcher3/PendingAppWidgetHostView.java
@@ -189,9 +189,19 @@ public class PendingAppWidgetHostView extends LauncherAppWidgetHostView implemen
}
}
+ /**
+ * A pending widget is ready for setup after the provider is installed and
+ * 1) Widget id is not valid: the widget id is not yet bound to the provider, probably
+ * because the launcher doesn't have appropriate permissions.
+ * Note that we would still have an allocated id as that does not
+ * require any permissions and can be done during view inflation.
+ * 2) UI is not ready: the id is valid and the bound. But the widget has a configure activity
+ * which needs to be called once.
+ */
public boolean isReadyForClickSetup() {
- return (mInfo.restoreStatus & LauncherAppWidgetInfo.FLAG_PROVIDER_NOT_READY) == 0
- && (mInfo.restoreStatus & LauncherAppWidgetInfo.FLAG_UI_NOT_READY) != 0;
+ return !mInfo.hasRestoreFlag(LauncherAppWidgetInfo.FLAG_PROVIDER_NOT_READY)
+ && (mInfo.hasRestoreFlag(LauncherAppWidgetInfo.FLAG_UI_NOT_READY)
+ || mInfo.hasRestoreFlag(LauncherAppWidgetInfo.FLAG_ID_NOT_VALID));
}
private void updateDrawableBounds() {