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
This commit is contained in:
Steven Ng
2021-01-15 19:24:45 +00:00
parent f44439cde8
commit a401dc515c
3 changed files with 14 additions and 0 deletions

View File

@@ -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;

View File

@@ -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;

View File

@@ -7985,6 +7985,9 @@
<!-- The widget is added directly by the app, and does not need to appear in
the global list of available widgets -->
<flag name="hide_from_picker" value="0x2" />
<!-- The widget provides a default configuration. The host may decide not to launch
the provided configuration activity. -->
<flag name="configuration_optional" value="0x3" />
</attr>
</declare-styleable>