diff options
| -rw-r--r-- | api/current.txt | 12 | ||||
| -rw-r--r-- | core/java/android/appwidget/AppWidgetHostView.java | 12 | ||||
| -rw-r--r-- | core/java/android/appwidget/AppWidgetManager.java | 74 | ||||
| -rw-r--r-- | core/java/android/appwidget/AppWidgetProviderInfo.java | 65 | ||||
| -rw-r--r-- | core/java/com/android/internal/appwidget/IAppWidgetService.aidl | 4 | ||||
| -rwxr-xr-x | core/res/res/values/attrs.xml | 18 | ||||
| -rw-r--r-- | core/res/res/values/public.xml | 3 | ||||
| -rw-r--r-- | services/java/com/android/server/AppWidgetService.java | 11 | ||||
| -rw-r--r-- | services/java/com/android/server/AppWidgetServiceImpl.java | 79 |
9 files changed, 257 insertions, 21 deletions
diff --git a/api/current.txt b/api/current.txt index 1e3e2bb..2cfa003 100644 --- a/api/current.txt +++ b/api/current.txt @@ -555,6 +555,7 @@ package android { field public static final int indicatorRight = 16843022; // 0x101010e field public static final int inflatedId = 16842995; // 0x10100f3 field public static final int initOrder = 16842778; // 0x101001a + field public static final int initialKeyguardLayout = 16843714; // 0x10103c2 field public static final int initialLayout = 16843345; // 0x1010251 field public static final int innerRadius = 16843359; // 0x101025f field public static final int innerRadiusRatio = 16843163; // 0x101019b @@ -1120,6 +1121,7 @@ package android { field public static final int weekNumberColor = 16843589; // 0x1010345 field public static final int weekSeparatorLineColor = 16843590; // 0x1010346 field public static final int weightSum = 16843048; // 0x1010128 + field public static final int widgetFeatures = 16843715; // 0x10103c3 field public static final int widgetLayout = 16843243; // 0x10101eb field public static final int width = 16843097; // 0x1010159 field public static final int windowActionBar = 16843469; // 0x10102cd @@ -4399,6 +4401,7 @@ package android.appwidget { public class AppWidgetManager { method public boolean bindAppWidgetIdIfAllowed(int, android.content.ComponentName); + method public boolean bindAppWidgetIdIfAllowed(int, android.content.ComponentName, android.os.Bundle); method public int[] getAppWidgetIds(android.content.ComponentName); method public android.appwidget.AppWidgetProviderInfo getAppWidgetInfo(int); method public android.os.Bundle getAppWidgetOptions(int); @@ -4428,6 +4431,7 @@ package android.appwidget { field public static final java.lang.String EXTRA_CUSTOM_INFO = "customInfo"; field public static final int INVALID_APPWIDGET_ID = 0; // 0x0 field public static final java.lang.String META_DATA_APPWIDGET_PROVIDER = "android.appwidget.provider"; + field public static final java.lang.String OPTION_APPWIDGET_HOST_CATEGORY = "appWidgetCategory"; field public static final java.lang.String OPTION_APPWIDGET_MAX_HEIGHT = "appWidgetMaxHeight"; field public static final java.lang.String OPTION_APPWIDGET_MAX_WIDTH = "appWidgetMaxWidth"; field public static final java.lang.String OPTION_APPWIDGET_MIN_HEIGHT = "appWidgetMinHeight"; @@ -4454,9 +4458,15 @@ package android.appwidget { field public static final int RESIZE_HORIZONTAL = 1; // 0x1 field public static final int RESIZE_NONE = 0; // 0x0 field public static final int RESIZE_VERTICAL = 2; // 0x2 + 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_FEATURES_CLOCK = 1; // 0x1 + field public static final int WIDGET_FEATURES_NONE = 0; // 0x0 + field public static final int WIDGET_FEATURES_STATUS = 2; // 0x2 field public int autoAdvanceViewId; field public android.content.ComponentName configure; field public int icon; + field public int initialKeyguardLayout; field public int initialLayout; field public java.lang.String label; field public int minHeight; @@ -4467,6 +4477,8 @@ package android.appwidget { field public android.content.ComponentName provider; field public int resizeMode; field public int updatePeriodMillis; + field public int widgetCategory; + field public int widgetFeatures; } } diff --git a/core/java/android/appwidget/AppWidgetHostView.java b/core/java/android/appwidget/AppWidgetHostView.java index 603ceb7..c86826f 100644 --- a/core/java/android/appwidget/AppWidgetHostView.java +++ b/core/java/android/appwidget/AppWidgetHostView.java @@ -513,7 +513,17 @@ public class AppWidgetHostView extends FrameLayout { theirContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE); inflater = inflater.cloneInContext(theirContext); inflater.setFilter(sInflaterFilter); - defaultView = inflater.inflate(mInfo.initialLayout, this, false); + AppWidgetManager manager = AppWidgetManager.getInstance(mContext); + Bundle options = manager.getAppWidgetOptions(mAppWidgetId); + + int layoutId = mInfo.initialLayout; + if (options.containsKey(AppWidgetManager.OPTION_APPWIDGET_HOST_CATEGORY)) { + int category = options.getInt(AppWidgetManager.OPTION_APPWIDGET_HOST_CATEGORY); + if (category == AppWidgetProviderInfo.WIDGET_CATEGORY_KEYGUARD) { + layoutId = mInfo.initialKeyguardLayout; + } + } + defaultView = inflater.inflate(layoutId, this, false); } else { Log.w(TAG, "can't inflate defaultView because mInfo is missing"); } diff --git a/core/java/android/appwidget/AppWidgetManager.java b/core/java/android/appwidget/AppWidgetManager.java index 2df675e..100a2b8 100644 --- a/core/java/android/appwidget/AppWidgetManager.java +++ b/core/java/android/appwidget/AppWidgetManager.java @@ -150,26 +150,34 @@ public class AppWidgetManager { public static final String EXTRA_APPWIDGET_ID = "appWidgetId"; /** - * An bundle extra that contains the lower bound on the current width, in dips, of a widget instance. + * A bundle extra that contains the lower bound on the current width, in dips, of a widget instance. */ public static final String OPTION_APPWIDGET_MIN_WIDTH = "appWidgetMinWidth"; /** - * An bundle extra that contains the lower bound on the current height, in dips, of a widget instance. + * A bundle extra that contains the lower bound on the current height, in dips, of a widget instance. */ public static final String OPTION_APPWIDGET_MIN_HEIGHT = "appWidgetMinHeight"; /** - * An bundle extra that contains the upper bound on the current width, in dips, of a widget instance. + * A bundle extra that contains the upper bound on the current width, in dips, of a widget instance. */ public static final String OPTION_APPWIDGET_MAX_WIDTH = "appWidgetMaxWidth"; /** - * An bundle extra that contains the upper bound on the current width, in dips, of a widget instance. + * A bundle extra that contains the upper bound on the current width, in dips, of a widget instance. */ public static final String OPTION_APPWIDGET_MAX_HEIGHT = "appWidgetMaxHeight"; /** + * A bundle extra that hints to the AppWidgetProvider the category of host that owns this + * this widget. Can have the value {@link + * AppWidgetProviderInfo#WIDGET_CATEGORY_HOME_SCREEN} or {@link + * AppWidgetProviderInfo#WIDGET_CATEGORY_KEYGUARD}. + */ + public static final String OPTION_APPWIDGET_HOST_CATEGORY = "appWidgetCategory"; + + /** * An intent extra which points to a bundle of extra information for a particular widget id. * In particular this bundle can contain EXTRA_APPWIDGET_WIDTH and EXTRA_APPWIDGET_HEIGHT. */ @@ -568,7 +576,31 @@ public class AppWidgetManager { */ public void bindAppWidgetId(int appWidgetId, ComponentName provider) { try { - sService.bindAppWidgetId(appWidgetId, provider); + sService.bindAppWidgetId(appWidgetId, provider, null); + } + catch (RemoteException e) { + throw new RuntimeException("system server dead?", e); + } + } + + /** + * Set the component for a given appWidgetId. + * + * <p class="note">You need the BIND_APPWIDGET permission or the user must have enabled binding + * widgets always for your component. This method is used by the AppWidget picker and + * should not be used by other apps. + * + * @param appWidgetId The AppWidget instance for which to set the RemoteViews. + * @param provider The {@link android.content.BroadcastReceiver} that will be the AppWidget + * provider for this AppWidget. + * @param options Bundle containing options for the AppWidget. See also + * {@link #updateAppWidgetOptions(int, Bundle)} + * + * @hide + */ + public void bindAppWidgetId(int appWidgetId, ComponentName provider, Bundle options) { + try { + sService.bindAppWidgetId(appWidgetId, provider, options); } catch (RemoteException e) { throw new RuntimeException("system server dead?", e); @@ -594,7 +626,37 @@ public class AppWidgetManager { } try { return sService.bindAppWidgetIdIfAllowed( - mContext.getPackageName(), appWidgetId, provider); + mContext.getPackageName(), appWidgetId, provider, null); + } + catch (RemoteException e) { + throw new RuntimeException("system server dead?", e); + } + } + + /** + * Set the component for a given appWidgetId. + * + * <p class="note">You need the BIND_APPWIDGET permission or the user must have enabled binding + * widgets always for your component. Should be used by apps that host widgets; if this + * method returns false, call {@link #ACTION_APPWIDGET_BIND} to request permission to + * bind + * + * @param appWidgetId The AppWidget instance for which to set the RemoteViews. + * @param provider The {@link android.content.BroadcastReceiver} that will be the AppWidget + * provider for this AppWidget. + * @param options Bundle containing options for the AppWidget. See also + * {@link #updateAppWidgetOptions(int, Bundle)} + * + * @return true if this component has permission to bind the AppWidget + */ + public boolean bindAppWidgetIdIfAllowed(int appWidgetId, ComponentName provider, + Bundle options) { + if (mContext == null) { + return false; + } + try { + return sService.bindAppWidgetIdIfAllowed( + mContext.getPackageName(), appWidgetId, provider, options); } catch (RemoteException e) { throw new RuntimeException("system server dead?", e); diff --git a/core/java/android/appwidget/AppWidgetProviderInfo.java b/core/java/android/appwidget/AppWidgetProviderInfo.java index c33681d..5ef3d39 100644 --- a/core/java/android/appwidget/AppWidgetProviderInfo.java +++ b/core/java/android/appwidget/AppWidgetProviderInfo.java @@ -44,6 +44,34 @@ public class AppWidgetProviderInfo implements Parcelable { public static final int RESIZE_BOTH = RESIZE_HORIZONTAL | RESIZE_VERTICAL; /** + * Indicates that the widget can be displayed on the home screen. This is the default value. + */ + public static final int WIDGET_CATEGORY_HOME_SCREEN = 1; + + /** + * Indicates that the widget can be displayed on the keyguard. + */ + public static final int WIDGET_CATEGORY_KEYGUARD = 2; + + /** + * Indicates that the widget supports no special features. + */ + public static final int WIDGET_FEATURES_NONE = 0; + + /** + * Indicates that the widget displays the current time. The host may use this as a hint to not + * display the time in other places. + */ + public static final int WIDGET_FEATURES_CLOCK = 1; + + /** + * Indicates that the widget is output only, ie. has nothing clickable. This may be enforced by + * the host. Presently, this flag is used by the keyguard to indicate that it can be placed + * in the first position. + */ + public static final int WIDGET_FEATURES_STATUS = 2; + + /** * Identity of this AppWidget component. This component should be a {@link * android.content.BroadcastReceiver}, and it will be sent the AppWidget intents * {@link android.appwidget as described in the AppWidget package documentation}. @@ -111,6 +139,16 @@ public class AppWidgetProviderInfo implements Parcelable { public int initialLayout; /** + * The resource id of the initial layout for this AppWidget when it is displayed on keyguard. + * This parameter only needs to be provided if the widget can be displayed on the keyguard, + * see {@link #widgetCategory}. + * + * <p>This field corresponds to the <code>android:initialKeyguardLayout</code> attribute in + * the AppWidget meta-data file. + */ + public int initialKeyguardLayout; + + /** * The activity to launch that will configure the AppWidget. * * <p>This class name of field corresponds to the <code>android:configure</code> attribute in @@ -164,6 +202,27 @@ public class AppWidgetProviderInfo implements Parcelable { */ public int resizeMode; + /** + * Determines whether this widget can be displayed on the home screen, the keyguard, or both. + * A widget which is displayed on both needs to ensure that it follows the design guidelines + * for both widget classes. This can be achieved by querying the AppWidget options in its + * widget provider's update method. + * + * <p>This field corresponds to the <code>widgetCategory</code> attribute in + * the AppWidget meta-data file. + */ + public int widgetCategory; + + /** + * A field which specifies any special features that this widget supports. See + * {@link #WIDGET_FEATURES_NONE}, {@link #WIDGET_FEATURES_CLOCK}, + * {@link #WIDGET_FEATURES_STATUS}. + * + * <p>This field corresponds to the <code>widgetFeatures</code> attribute in + * the AppWidget meta-data file. + */ + public int widgetFeatures; + public AppWidgetProviderInfo() { } @@ -180,6 +239,7 @@ public class AppWidgetProviderInfo implements Parcelable { this.minResizeHeight = in.readInt(); this.updatePeriodMillis = in.readInt(); this.initialLayout = in.readInt(); + this.initialKeyguardLayout = in.readInt(); if (0 != in.readInt()) { this.configure = new ComponentName(in); } @@ -188,6 +248,8 @@ public class AppWidgetProviderInfo implements Parcelable { this.previewImage = in.readInt(); this.autoAdvanceViewId = in.readInt(); this.resizeMode = in.readInt(); + this.widgetCategory = in.readInt(); + this.widgetFeatures = in.readInt(); } public void writeToParcel(android.os.Parcel out, int flags) { @@ -203,6 +265,7 @@ public class AppWidgetProviderInfo implements Parcelable { out.writeInt(this.minResizeHeight); out.writeInt(this.updatePeriodMillis); out.writeInt(this.initialLayout); + out.writeInt(this.initialKeyguardLayout); if (this.configure != null) { out.writeInt(1); this.configure.writeToParcel(out, flags); @@ -214,6 +277,8 @@ public class AppWidgetProviderInfo implements Parcelable { out.writeInt(this.previewImage); out.writeInt(this.autoAdvanceViewId); out.writeInt(this.resizeMode); + out.writeInt(this.widgetCategory); + out.writeInt(this.widgetFeatures); } public int describeContents() { diff --git a/core/java/com/android/internal/appwidget/IAppWidgetService.aidl b/core/java/com/android/internal/appwidget/IAppWidgetService.aidl index 7df45cf..cfb16fa 100644 --- a/core/java/com/android/internal/appwidget/IAppWidgetService.aidl +++ b/core/java/com/android/internal/appwidget/IAppWidgetService.aidl @@ -52,9 +52,9 @@ interface IAppWidgetService { AppWidgetProviderInfo getAppWidgetInfo(int appWidgetId); boolean hasBindAppWidgetPermission(in String packageName); void setBindAppWidgetPermission(in String packageName, in boolean permission); - void bindAppWidgetId(int appWidgetId, in ComponentName provider); + void bindAppWidgetId(int appWidgetId, in ComponentName provider, in Bundle options); boolean bindAppWidgetIdIfAllowed( - in String packageName, int appWidgetId, in ComponentName provider); + in String packageName, int appWidgetId, in ComponentName provider, in Bundle options); void bindRemoteViewsService(int appWidgetId, in Intent intent, in IBinder connection); void unbindRemoteViewsService(int appWidgetId, in Intent intent); int[] getAppWidgetIds(in ComponentName provider); diff --git a/core/res/res/values/attrs.xml b/core/res/res/values/attrs.xml index e6fd538..3dacc61 100755 --- a/core/res/res/values/attrs.xml +++ b/core/res/res/values/attrs.xml @@ -5180,6 +5180,8 @@ <attr name="updatePeriodMillis" format="integer" /> <!-- A resource id of a layout. --> <attr name="initialLayout" format="reference" /> + <!-- A resource id of a layout. --> + <attr name="initialKeyguardLayout" format="reference" /> <!-- A class name in the AppWidget's package to be launched to configure. If not supplied, then no activity will be launched. --> <attr name="configure" format="string" /> @@ -5190,12 +5192,26 @@ by the widget's host. --> <attr name="autoAdvanceViewId" format="reference" /> <!-- Optional parameter which indicates if and how this widget can be - resized. --> + resized. Supports combined values using | operator. --> <attr name="resizeMode" format="integer"> <flag name="none" value="0x0" /> <flag name="horizontal" value="0x1" /> <flag name="vertical" value="0x2" /> </attr> + <!-- Optional parameter which indicates where this widget can be shown, + ie. home screen, keyguard or both. + resized. Supports combined values using | operator. --> + <attr name="widgetCategory" format="integer"> + <flag name="home_screen" value="0x1" /> + <flag name="keyguard" value="0x2" /> + </attr> + <!-- Optional parameter which indicates any feature(s) that this widget + supports. Supports combined values using | operator. --> + <attr name="widgetFeatures" format="integer"> + <flag name="none" value="0x0" /> + <flag name="clock" value="0x1" /> + <flag name="status" value="0x2" /> + </attr> </declare-styleable> <!-- =============================== --> diff --git a/core/res/res/values/public.xml b/core/res/res/values/public.xml index 139715c..d74fb5f 100644 --- a/core/res/res/values/public.xml +++ b/core/res/res/values/public.xml @@ -3782,5 +3782,8 @@ <public type="attr" name="singleUser" /> <public type="attr" name="presentationTheme" /> <public type="attr" name="subtypeId"/> + <public type="attr" name="initialKeyguardLayout" /> + <public type="attr" name="widgetFeatures" /> + <public type="attr" name="widgetCategory" /> </resources> diff --git a/services/java/com/android/server/AppWidgetService.java b/services/java/com/android/server/AppWidgetService.java index 343e70d..385681e 100644 --- a/services/java/com/android/server/AppWidgetService.java +++ b/services/java/com/android/server/AppWidgetService.java @@ -215,15 +215,18 @@ class AppWidgetService extends IAppWidgetService.Stub } @Override - public void bindAppWidgetId(int appWidgetId, ComponentName provider) throws RemoteException { - getImplForUser(UserHandle.getCallingUserId()).bindAppWidgetId(appWidgetId, provider); + public void bindAppWidgetId(int appWidgetId, ComponentName provider, Bundle options) + throws RemoteException { + getImplForUser(UserHandle.getCallingUserId()).bindAppWidgetId(appWidgetId, provider, + options); } @Override public boolean bindAppWidgetIdIfAllowed( - String packageName, int appWidgetId, ComponentName provider) throws RemoteException { + String packageName, int appWidgetId, ComponentName provider, Bundle options) + throws RemoteException { return getImplForUser(UserHandle.getCallingUserId()).bindAppWidgetIdIfAllowed( - packageName, appWidgetId, provider); + packageName, appWidgetId, provider, options); } @Override diff --git a/services/java/com/android/server/AppWidgetServiceImpl.java b/services/java/com/android/server/AppWidgetServiceImpl.java index 57ab921..95d7623 100644 --- a/services/java/com/android/server/AppWidgetServiceImpl.java +++ b/services/java/com/android/server/AppWidgetServiceImpl.java @@ -316,6 +316,8 @@ class AppWidgetServiceImpl { pw.print(info.updatePeriodMillis); pw.print(" resizeMode="); pw.print(info.resizeMode); + pw.print(info.widgetCategory); + pw.print(info.widgetFeatures); pw.print(" autoAdvanceViewId="); pw.print(info.autoAdvanceViewId); pw.print(" initialLayout=#"); @@ -527,7 +529,7 @@ class AppWidgetServiceImpl { } } - private void bindAppWidgetIdImpl(int appWidgetId, ComponentName provider) { + private void bindAppWidgetIdImpl(int appWidgetId, ComponentName provider, Bundle options) { final long ident = Binder.clearCallingIdentity(); try { synchronized (mAppWidgetIds) { @@ -550,6 +552,17 @@ class AppWidgetServiceImpl { } id.provider = p; + if (options == null) { + options = new Bundle(); + } + id.options = options; + + // We need to provide a default value for the widget category if it is not specified + if (!options.containsKey(AppWidgetManager.OPTION_APPWIDGET_HOST_CATEGORY)) { + options.putInt(AppWidgetManager.OPTION_APPWIDGET_HOST_CATEGORY, + AppWidgetProviderInfo.WIDGET_CATEGORY_HOME_SCREEN); + } + p.instances.add(id); int instancesSize = p.instances.size(); if (instancesSize == 1) { @@ -572,14 +585,14 @@ class AppWidgetServiceImpl { } } - public void bindAppWidgetId(int appWidgetId, ComponentName provider) { + public void bindAppWidgetId(int appWidgetId, ComponentName provider, Bundle options) { mContext.enforceCallingPermission(android.Manifest.permission.BIND_APPWIDGET, "bindAppWidgetId appWidgetId=" + appWidgetId + " provider=" + provider); - bindAppWidgetIdImpl(appWidgetId, provider); + bindAppWidgetIdImpl(appWidgetId, provider, options); } public boolean bindAppWidgetIdIfAllowed( - String packageName, int appWidgetId, ComponentName provider) { + String packageName, int appWidgetId, ComponentName provider, Bundle options) { try { mContext.enforceCallingPermission(android.Manifest.permission.BIND_APPWIDGET, null); } catch (SecurityException se) { @@ -587,7 +600,7 @@ class AppWidgetServiceImpl { return false; } } - bindAppWidgetIdImpl(appWidgetId, provider); + bindAppWidgetIdImpl(appWidgetId, provider, options); return true; } @@ -873,15 +886,18 @@ class AppWidgetServiceImpl { if (id == null) { return; } + Provider p = id.provider; - id.options = options; + // Merge the options + id.options.putAll(options); // send the broacast saying that this appWidgetId has been deleted Intent intent = new Intent(AppWidgetManager.ACTION_APPWIDGET_OPTIONS_CHANGED); intent.setComponent(p.info.provider); intent.putExtra(AppWidgetManager.EXTRA_APPWIDGET_ID, id.appWidgetId); - intent.putExtra(AppWidgetManager.EXTRA_APPWIDGET_OPTIONS, options); + intent.putExtra(AppWidgetManager.EXTRA_APPWIDGET_OPTIONS, id.options); mContext.sendBroadcastAsUser(intent, new UserHandle(mUserId)); + saveStateLocked(); } } @@ -1325,6 +1341,8 @@ class AppWidgetServiceImpl { com.android.internal.R.styleable.AppWidgetProviderInfo_updatePeriodMillis, 0); info.initialLayout = sa.getResourceId( com.android.internal.R.styleable.AppWidgetProviderInfo_initialLayout, 0); + info.initialKeyguardLayout = sa.getResourceId(com.android.internal.R.styleable. + AppWidgetProviderInfo_initialKeyguardLayout, 0); String className = sa .getString(com.android.internal.R.styleable.AppWidgetProviderInfo_configure); if (className != null) { @@ -1339,6 +1357,12 @@ class AppWidgetServiceImpl { info.resizeMode = sa.getInt( com.android.internal.R.styleable.AppWidgetProviderInfo_resizeMode, AppWidgetProviderInfo.RESIZE_NONE); + info.widgetCategory = sa.getInt( + com.android.internal.R.styleable.AppWidgetProviderInfo_resizeMode, + AppWidgetProviderInfo.WIDGET_CATEGORY_HOME_SCREEN); + info.widgetFeatures = sa.getInt( + com.android.internal.R.styleable.AppWidgetProviderInfo_resizeMode, + AppWidgetProviderInfo.WIDGET_FEATURES_NONE); sa.recycle(); } catch (Exception e) { @@ -1476,6 +1500,18 @@ class AppWidgetServiceImpl { if (id.provider != null) { out.attribute(null, "p", Integer.toHexString(id.provider.tag)); } + if (id.options != null) { + out.attribute(null, "min_width", Integer.toHexString(id.options.getInt( + AppWidgetManager.OPTION_APPWIDGET_MIN_WIDTH))); + out.attribute(null, "min_height", Integer.toHexString(id.options.getInt( + AppWidgetManager.OPTION_APPWIDGET_MIN_HEIGHT))); + out.attribute(null, "max_width", Integer.toHexString(id.options.getInt( + AppWidgetManager.OPTION_APPWIDGET_MAX_WIDTH))); + out.attribute(null, "max_height", Integer.toHexString(id.options.getInt( + AppWidgetManager.OPTION_APPWIDGET_MAX_HEIGHT))); + out.attribute(null, "host_category", Integer.toHexString(id.options.getInt( + AppWidgetManager.OPTION_APPWIDGET_HOST_CATEGORY))); + } out.endTag(null, "g"); } @@ -1496,6 +1532,7 @@ class AppWidgetServiceImpl { } } + @SuppressWarnings("unused") void readStateFromFileLocked(FileInputStream stream) { boolean success = false; try { @@ -1569,6 +1606,34 @@ class AppWidgetServiceImpl { mNextAppWidgetId = id.appWidgetId + 1; } + Bundle options = new Bundle(); + String minWidthString = parser.getAttributeValue(null, "min_width"); + if (minWidthString != null) { + options.putInt(AppWidgetManager.OPTION_APPWIDGET_MIN_WIDTH, + Integer.parseInt(minWidthString, 16)); + } + String minHeightString = parser.getAttributeValue(null, "min_height"); + if (minWidthString != null) { + options.putInt(AppWidgetManager.OPTION_APPWIDGET_MIN_HEIGHT, + Integer.parseInt(minHeightString, 16)); + } + String maxWidthString = parser.getAttributeValue(null, "max_height"); + if (minWidthString != null) { + options.putInt(AppWidgetManager.OPTION_APPWIDGET_MAX_WIDTH, + Integer.parseInt(maxWidthString, 16)); + } + String maxHeightString = parser.getAttributeValue(null, "max_height"); + if (minWidthString != null) { + options.putInt(AppWidgetManager.OPTION_APPWIDGET_MAX_HEIGHT, + Integer.parseInt(maxHeightString, 16)); + } + String categoryString = parser.getAttributeValue(null, "host_category"); + if (minWidthString != null) { + options.putInt(AppWidgetManager.OPTION_APPWIDGET_HOST_CATEGORY, + Integer.parseInt(categoryString, 16)); + } + id.options = options; + String providerString = parser.getAttributeValue(null, "p"); if (providerString != null) { // there's no provider if it hasn't been bound yet. |
