Fix flag value for configuration_optional widget feature.

The flag value should be 4 and not 3 so that we can use bitwise
operations to determine the existence of a flag.

For example, we want to use the following to determine if a widget is
reconfigurable:
(providerInfo.widgetFeatures & WIDGET_FEATURE_RECONFIGURABLE) != 0
But if the value of WIDGET_FEATURE_CONFIGURATION_OPTIONAL is 3, the
above check would fail.

Test: atest FrameworksServicesTests:AppWidgetServiceImplTest, atest
CtsAppWidgetTestCases
Bug: 177977976

Change-Id: I15d4baae5e17acb9a0b936485a53f9b3359d65ca
This commit is contained in:
Yogisha Dixit
2021-03-03 20:53:45 +00:00
parent cdef99ec13
commit cb4c7c1286
3 changed files with 3 additions and 3 deletions

View File

@@ -8474,7 +8474,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_CONFIGURATION_OPTIONAL = 4; // 0x4
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

@@ -121,7 +121,7 @@ public class AppWidgetProviderInfo implements Parcelable {
*
* @see #widgetFeatures
*/
public static final int WIDGET_FEATURE_CONFIGURATION_OPTIONAL = 3;
public static final int WIDGET_FEATURE_CONFIGURATION_OPTIONAL = 4;
/** @hide */
@IntDef(flag = true, prefix = { "FLAG_" }, value = {

View File

@@ -8154,7 +8154,7 @@
<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" />
<flag name="configuration_optional" value="0x4" />
</attr>
<!-- A resource identifier for a string containing a short description of the widget. -->
<attr name="description" />