diff --git a/core/api/current.txt b/core/api/current.txt index 8fe79e6ee9991..c7710fcf79686 100644 --- a/core/api/current.txt +++ b/core/api/current.txt @@ -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; diff --git a/core/java/android/appwidget/AppWidgetProviderInfo.java b/core/java/android/appwidget/AppWidgetProviderInfo.java index 42214d0477405..d893a5e49aa9f 100644 --- a/core/java/android/appwidget/AppWidgetProviderInfo.java +++ b/core/java/android/appwidget/AppWidgetProviderInfo.java @@ -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}). + * + *
This field corresponds to the android:maxResizeWidth 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}).
+ *
+ *
This field corresponds to the android:maxResizeHeight 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.
+ *
+ *
This field corresponds to the android:targetCellWidth 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.
+ *
+ *
This field corresponds to the android:targetCellHeight 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);
}
/**
diff --git a/core/res/res/values/attrs.xml b/core/res/res/values/attrs.xml
index 67b810e4ebdf5..69bb20cf9c1ee 100644
--- a/core/res/res/values/attrs.xml
+++ b/core/res/res/values/attrs.xml
@@ -8010,6 +8010,14 @@