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

Commit cdb4ebd9 authored by Yogisha Dixit's avatar Yogisha Dixit Committed by Android (Google) Code Review
Browse files

Merge "Add new attributes for widget sizing controls." into sc-dev

parents 94bfa64f b9806031
Loading
Loading
Loading
Loading
+8 −0
Original line number Diff line number Diff line
@@ -960,6 +960,8 @@ package android {
    field public static final int maxLines = 16843091; // 0x1010153
    field public static final int maxLongVersionCode = 16844163; // 0x1010583
    field public static final int maxRecents = 16843846; // 0x1010446
    field public static final int maxResizeHeight = 16844339; // 0x1010633
    field public static final int maxResizeWidth = 16844338; // 0x1010632
    field public static final int maxRows = 16843059; // 0x1010133
    field public static final int maxSdkVersion = 16843377; // 0x1010271
    field public static final int maxWidth = 16843039; // 0x101011f
@@ -1394,6 +1396,8 @@ package android {
    field public static final int tabWidgetStyle = 16842883; // 0x1010083
    field public static final int tag = 16842961; // 0x10100d1
    field public static final int targetActivity = 16843266; // 0x1010202
    field public static final int targetCellHeight = 16844341; // 0x1010635
    field public static final int targetCellWidth = 16844340; // 0x1010634
    field public static final int targetClass = 16842799; // 0x101002f
    field @Deprecated public static final int targetDescriptions = 16843680; // 0x10103a0
    field public static final int targetId = 16843740; // 0x10103dc
@@ -8428,6 +8432,8 @@ package android.appwidget {
    field public int initialKeyguardLayout;
    field public int initialLayout;
    field @Deprecated public String label;
    field public int maxResizeHeight;
    field public int maxResizeWidth;
    field public int minHeight;
    field public int minResizeHeight;
    field public int minResizeWidth;
@@ -8436,6 +8442,8 @@ package android.appwidget {
    field @IdRes public int previewLayout;
    field public android.content.ComponentName provider;
    field public int resizeMode;
    field public int targetCellHeight;
    field public int targetCellWidth;
    field public int updatePeriodMillis;
    field public int widgetCategory;
    field public int widgetFeatures;
+53 −1
Original line number Diff line number Diff line
@@ -178,6 +178,44 @@ public class AppWidgetProviderInfo implements Parcelable {
     */
    public int minResizeHeight;

    /**
     * Maximum width (in dp) which the widget can be resized to. This field has no effect if it is
     * smaller than minWidth or if horizontal resizing isn't enabled (see {@link #resizeMode}).
     *
     * <p>This field corresponds to the <code>android:maxResizeWidth</code> attribute in the
     * AppWidget meta-data file.
     */
    @SuppressLint("MutableBareField")
    public int maxResizeWidth;

    /**
     * Maximum height (in dp) which the widget can be resized to. This field has no effect if it is
     * smaller than minHeight or if vertical resizing isn't enabled (see {@link #resizeMode}).
     *
     * <p>This field corresponds to the <code>android:maxResizeHeight</code> attribute in the
     * AppWidget meta-data file.
     */
    @SuppressLint("MutableBareField")
    public int maxResizeHeight;

    /**
     * The default width of a widget when added to a host, in units of launcher grid cells.
     *
     * <p>This field corresponds to the <code>android:targetCellWidth</code> attribute in the
     * AppWidget meta-data file.
     */
    @SuppressLint("MutableBareField")
    public int targetCellWidth;

    /**
     * The default height of a widget when added to a host, in units of launcher grid cells.
     *
     * <p>This field corresponds to the <code>android:targetCellHeight</code> attribute in the
     * AppWidget meta-data file.
     */
    @SuppressLint("MutableBareField")
    public int targetCellHeight;

    /**
     * How often, in milliseconds, that this AppWidget wants to be updated.
     * The AppWidget manager may place a limit on how often a AppWidget is updated.
@@ -330,6 +368,10 @@ public class AppWidgetProviderInfo implements Parcelable {
        this.minHeight = in.readInt();
        this.minResizeWidth = in.readInt();
        this.minResizeHeight = in.readInt();
        this.maxResizeWidth = in.readInt();
        this.maxResizeHeight = in.readInt();
        this.targetCellWidth = in.readInt();
        this.targetCellHeight = in.readInt();
        this.updatePeriodMillis = in.readInt();
        this.initialLayout = in.readInt();
        this.initialKeyguardLayout = in.readInt();
@@ -440,6 +482,10 @@ public class AppWidgetProviderInfo implements Parcelable {
        out.writeInt(this.minHeight);
        out.writeInt(this.minResizeWidth);
        out.writeInt(this.minResizeHeight);
        out.writeInt(this.maxResizeWidth);
        out.writeInt(this.maxResizeHeight);
        out.writeInt(this.targetCellWidth);
        out.writeInt(this.targetCellHeight);
        out.writeInt(this.updatePeriodMillis);
        out.writeInt(this.initialLayout);
        out.writeInt(this.initialKeyguardLayout);
@@ -463,8 +509,12 @@ public class AppWidgetProviderInfo implements Parcelable {
        that.provider = this.provider == null ? null : this.provider.clone();
        that.minWidth = this.minWidth;
        that.minHeight = this.minHeight;
        that.minResizeWidth = this.minResizeHeight;
        that.minResizeWidth = this.minResizeWidth;
        that.minResizeHeight = this.minResizeHeight;
        that.maxResizeWidth = this.maxResizeWidth;
        that.maxResizeHeight = this.maxResizeHeight;
        that.targetCellWidth = this.targetCellWidth;
        that.targetCellHeight = this.targetCellHeight;
        that.updatePeriodMillis = this.updatePeriodMillis;
        that.initialLayout = this.initialLayout;
        that.initialKeyguardLayout = this.initialKeyguardLayout;
@@ -512,6 +562,8 @@ public class AppWidgetProviderInfo implements Parcelable {
        minHeight = TypedValue.complexToDimensionPixelSize(minHeight, displayMetrics);
        minResizeWidth = TypedValue.complexToDimensionPixelSize(minResizeWidth, displayMetrics);
        minResizeHeight = TypedValue.complexToDimensionPixelSize(minResizeHeight, displayMetrics);
        maxResizeWidth = TypedValue.complexToDimensionPixelSize(maxResizeWidth, displayMetrics);
        maxResizeHeight = TypedValue.complexToDimensionPixelSize(maxResizeHeight, displayMetrics);
    }

    /**
+8 −0
Original line number Diff line number Diff line
@@ -8010,6 +8010,14 @@
        <attr name="minResizeWidth" format="dimension"/>
        <!-- Minimum height that the AppWidget can be resized to. -->
        <attr name="minResizeHeight" format="dimension"/>
        <!-- Maximum width that the AppWidget can be resized to. -->
        <attr name="maxResizeWidth" format="dimension"/>
        <!-- Maximum height that the AppWidget can be resized to. -->
        <attr name="maxResizeHeight" format="dimension"/>
        <!-- Default width of the AppWidget in units of launcher grid cells. -->
        <attr name="targetCellWidth" format="integer"/>
        <!-- Default height of the AppWidget in units of launcher grid cells. -->
        <attr name="targetCellHeight" format="integer"/>
        <!-- Update period in milliseconds, or 0 if the AppWidget will update itself. -->
        <attr name="updatePeriodMillis" format="integer" />
        <!-- A resource id of a layout. -->
+4 −0
Original line number Diff line number Diff line
@@ -3072,6 +3072,10 @@
    <public name="windowSplashScreenBrandingImage"/>
    <public name="splashScreenTheme" />
    <public name="rippleStyle" />
    <public name="maxResizeWidth" />
    <public name="maxResizeHeight" />
    <public name="targetCellWidth" />
    <public name="targetCellHeight" />
  </public-group>

  <public-group type="drawable" first-id="0x010800b5">
+14 −0
Original line number Diff line number Diff line
@@ -2624,12 +2624,26 @@ class AppWidgetServiceImpl extends IAppWidgetService.Stub implements WidgetBacku
            info.minWidth = value != null ? value.data : 0;
            value = sa.peekValue(com.android.internal.R.styleable.AppWidgetProviderInfo_minHeight);
            info.minHeight = value != null ? value.data : 0;

            value = sa.peekValue(
                    com.android.internal.R.styleable.AppWidgetProviderInfo_minResizeWidth);
            info.minResizeWidth = value != null ? value.data : info.minWidth;
            value = sa.peekValue(
                    com.android.internal.R.styleable.AppWidgetProviderInfo_minResizeHeight);
            info.minResizeHeight = value != null ? value.data : info.minHeight;

            value = sa.peekValue(
                    com.android.internal.R.styleable.AppWidgetProviderInfo_maxResizeWidth);
            info.maxResizeWidth = value != null ? value.data : 0;
            value = sa.peekValue(
                    com.android.internal.R.styleable.AppWidgetProviderInfo_maxResizeHeight);
            info.maxResizeHeight = value != null ? value.data : 0;

            info.targetCellWidth = sa.getInt(
                    com.android.internal.R.styleable.AppWidgetProviderInfo_targetCellWidth, 0);
            info.targetCellHeight = sa.getInt(
                    com.android.internal.R.styleable.AppWidgetProviderInfo_targetCellHeight, 0);

            info.updatePeriodMillis = sa.getInt(
                    com.android.internal.R.styleable.AppWidgetProviderInfo_updatePeriodMillis, 0);
            info.initialLayout = sa.getResourceId(
Loading