Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 363fa2d5 authored by Sunny Goyal's avatar Sunny Goyal
Browse files

Adding IntDef annotations to some flag based properties

Bug: 74408961
Test: N/A
Change-Id: I4320c5e265b52338eb2f4b2e5ea80ea05b9ca28f
parent fd36a5dd
Loading
Loading
Loading
Loading
+32 −0
Original line number Diff line number Diff line
@@ -16,6 +16,7 @@

package android.appwidget;

import android.annotation.IntDef;
import android.annotation.NonNull;
import android.app.PendingIntent;
import android.content.ComponentName;
@@ -32,6 +33,9 @@ import android.os.UserHandle;
import android.util.DisplayMetrics;
import android.util.TypedValue;

import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;

/**
 * Describes the meta data for an installed AppWidget provider.  The fields in this class
 * correspond to the fields in the <code>&lt;appwidget-provider&gt;</code> xml tag.
@@ -55,6 +59,14 @@ public class AppWidgetProviderInfo implements Parcelable {
     */
    public static final int RESIZE_BOTH = RESIZE_HORIZONTAL | RESIZE_VERTICAL;

    /** @hide */
    @IntDef(flag = true, prefix = { "FLAG_" }, value = {
            RESIZE_HORIZONTAL,
            RESIZE_VERTICAL,
    })
    @Retention(RetentionPolicy.SOURCE)
    public @interface ResizeModeFlags {}

    /**
     * Indicates that the widget can be displayed on the home screen. This is the default value.
     */
@@ -70,6 +82,15 @@ public class AppWidgetProviderInfo implements Parcelable {
     */
    public static final int WIDGET_CATEGORY_SEARCHBOX = 4;

    /** @hide */
    @IntDef(flag = true, prefix = { "FLAG_" }, value = {
            WIDGET_CATEGORY_HOME_SCREEN,
            WIDGET_CATEGORY_KEYGUARD,
            WIDGET_CATEGORY_SEARCHBOX,
    })
    @Retention(RetentionPolicy.SOURCE)
    public @interface CategoryFlags {}

    /**
     * The widget can be reconfigured anytime after it is bound by starting the
     * {@link #configure} activity.
@@ -87,6 +108,14 @@ public class AppWidgetProviderInfo implements Parcelable {
     */
    public static final int WIDGET_FEATURE_HIDE_FROM_PICKER = 2;

    /** @hide */
    @IntDef(flag = true, prefix = { "FLAG_" }, value = {
            WIDGET_FEATURE_RECONFIGURABLE,
            WIDGET_FEATURE_HIDE_FROM_PICKER,
    })
    @Retention(RetentionPolicy.SOURCE)
    public @interface FeatureFlags {}

    /**
     * Identity of this AppWidget component.  This component should be a {@link
     * android.content.BroadcastReceiver}, and it will be sent the AppWidget intents
@@ -215,6 +244,7 @@ public class AppWidgetProviderInfo implements Parcelable {
     * <p>This field corresponds to the <code>android:resizeMode</code> attribute in
     * the AppWidget meta-data file.
     */
    @ResizeModeFlags
    public int resizeMode;

    /**
@@ -226,6 +256,7 @@ public class AppWidgetProviderInfo implements Parcelable {
     * <p>This field corresponds to the <code>widgetCategory</code> attribute in
     * the AppWidget meta-data file.
     */
    @CategoryFlags
    public int widgetCategory;

    /**
@@ -235,6 +266,7 @@ public class AppWidgetProviderInfo implements Parcelable {
     * @see #WIDGET_FEATURE_RECONFIGURABLE
     * @see #WIDGET_FEATURE_HIDE_FROM_PICKER
     */
    @FeatureFlags
    public int widgetFeatures;

    /** @hide */