From a401dc515c7aff0128ee3f17a1089939f9c9c201 Mon Sep 17 00:00:00 2001 From: Steven Ng Date: Fri, 15 Jan 2021 19:24:45 +0000 Subject: [PATCH] Add a new widget feature value, configuration_optional If configuration_optional is present, the widget provides a default configuration. The host may decide not to launch the provided configuration activity. Design doc: go/deferrable-widget-config Test: Successfully built blueline-userdebug. Since this CL only adds a new value for an existing field, no unit test will be added at this point. Once we introduce unit tests for widget configurations xml, we will add related unit tests. Bug: 177977976 Change-Id: I507cba0b9b8900f9b9616d76c48eb0ed9c50ed72 --- core/api/current.txt | 1 + core/java/android/appwidget/AppWidgetProviderInfo.java | 10 ++++++++++ core/res/res/values/attrs.xml | 3 +++ 3 files changed, 14 insertions(+) diff --git a/core/api/current.txt b/core/api/current.txt index b6a15343dedab..6a12a26334e96 100644 --- a/core/api/current.txt +++ b/core/api/current.txt @@ -8342,6 +8342,7 @@ package android.appwidget { field public static final int WIDGET_CATEGORY_HOME_SCREEN = 1; // 0x1 field public static final int WIDGET_CATEGORY_KEYGUARD = 2; // 0x2 field public static final int WIDGET_CATEGORY_SEARCHBOX = 4; // 0x4 + field public static final int WIDGET_FEATURE_CONFIGURATION_OPTIONAL = 3; // 0x3 field public static final int WIDGET_FEATURE_HIDE_FROM_PICKER = 2; // 0x2 field public static final int WIDGET_FEATURE_RECONFIGURABLE = 1; // 0x1 field public int autoAdvanceViewId; diff --git a/core/java/android/appwidget/AppWidgetProviderInfo.java b/core/java/android/appwidget/AppWidgetProviderInfo.java index c4333ac44e345..062076bb15ef3 100644 --- a/core/java/android/appwidget/AppWidgetProviderInfo.java +++ b/core/java/android/appwidget/AppWidgetProviderInfo.java @@ -112,10 +112,19 @@ public class AppWidgetProviderInfo implements Parcelable { */ public static final int WIDGET_FEATURE_HIDE_FROM_PICKER = 2; + /** + * The widget provides a default configuration. The host may choose not to launch the provided + * configuration activity. + * + * @see #widgetFeatures + */ + public static final int WIDGET_FEATURE_CONFIGURATION_OPTIONAL = 3; + /** @hide */ @IntDef(flag = true, prefix = { "FLAG_" }, value = { WIDGET_FEATURE_RECONFIGURABLE, WIDGET_FEATURE_HIDE_FROM_PICKER, + WIDGET_FEATURE_CONFIGURATION_OPTIONAL }) @Retention(RetentionPolicy.SOURCE) public @interface FeatureFlags {} @@ -269,6 +278,7 @@ public class AppWidgetProviderInfo implements Parcelable { * * @see #WIDGET_FEATURE_RECONFIGURABLE * @see #WIDGET_FEATURE_HIDE_FROM_PICKER + * @see #WIDGET_FEATURE_CONFIGURATION_OPTIONAL */ @FeatureFlags public int widgetFeatures; diff --git a/core/res/res/values/attrs.xml b/core/res/res/values/attrs.xml index ef54db1a422c6..ebe232f31d777 100644 --- a/core/res/res/values/attrs.xml +++ b/core/res/res/values/attrs.xml @@ -7985,6 +7985,9 @@ + +