Adding support for pending widgets in AutoInstall layout
> Pending widgets whill show a loading progress while the app
is being installed.
> Extra bind options can be defined using the tub tags
<extra key="key-name" value="key-value" />
These are sent as widget options when the widget is bound.
> If the widget has any config activity, it is not shown
> Required attributes:
className, packageName, x, y, spanY, spanY & screen
Bug: 30279609
Change-Id: I1338618bfa5d86967339dffb68c12b1add6eb5d7
diff --git a/src/com/android/launcher3/LauncherAppWidgetInfo.java b/src/com/android/launcher3/LauncherAppWidgetInfo.java
index 99210fd..f22c2a4 100644
--- a/src/com/android/launcher3/LauncherAppWidgetInfo.java
+++ b/src/com/android/launcher3/LauncherAppWidgetInfo.java
@@ -20,6 +20,7 @@
import android.content.ComponentName;
import android.content.ContentValues;
import android.content.Context;
+import android.content.Intent;
import com.android.launcher3.compat.UserHandleCompat;
@@ -57,6 +58,12 @@
public static final int FLAG_ID_ALLOCATED = 16;
/**
+ * Indicates that the widget does not need to show config activity, even if it has a
+ * configuration screen. It can also optionally have some extras which are sent during bind.
+ */
+ public static final int FLAG_DIRECT_CONFIG = 32;
+
+ /**
* Indicates that the widget hasn't been instantiated yet.
*/
static final int NO_ID = -1;
@@ -84,6 +91,11 @@
*/
int installProgress = -1;
+ /**
+ * Optional extras sent during widget bind. See {@link #FLAG_DIRECT_CONFIG}.
+ */
+ public Intent bindOptions;
+
private boolean mHasNotifiedInitialWidgetSizeChanged;
LauncherAppWidgetInfo(int appWidgetId, ComponentName providerName) {
@@ -115,6 +127,8 @@
values.put(LauncherSettings.Favorites.APPWIDGET_ID, appWidgetId);
values.put(LauncherSettings.Favorites.APPWIDGET_PROVIDER, providerName.flattenToString());
values.put(LauncherSettings.Favorites.RESTORED, restoreStatus);
+ values.put(LauncherSettings.Favorites.INTENT,
+ bindOptions == null ? null : bindOptions.toUri(0));
}
/**