From d2db2a579440608453994b64eb5b425840f5307a Mon Sep 17 00:00:00 2001 From: Patrick Dubroy Date: Wed, 23 Jun 2010 14:56:28 -0700 Subject: [PATCH] Add a new attribute to allow widgets to specify a preview image. Change-Id: I0d79c85c6a2fc477af17eda05eabaa3151b0bef5 --- api/current.xml | 11 +++++++++++ .../android/appwidget/AppWidgetProviderInfo.java | 13 +++++++++++++ core/res/res/values/attrs.xml | 3 +++ core/res/res/values/public.xml | 1 + .../java/com/android/server/AppWidgetService.java | 3 +++ 5 files changed, 31 insertions(+) diff --git a/api/current.xml b/api/current.xml index dc4ba2c9bc5da..8f07408f9e9ce 100644 --- a/api/current.xml +++ b/api/current.xml @@ -7555,6 +7555,17 @@ visibility="public" > + + This field corresponds to the android:previewImage attribute in + * the <receiver> element in the AndroidManifest.xml file. + * + * @hide Pending API approval + */ + public int previewImage; public AppWidgetProviderInfo() { } @@ -130,6 +141,7 @@ public class AppWidgetProviderInfo implements Parcelable { } this.label = in.readString(); this.icon = in.readInt(); + this.previewImage = in.readInt(); } @@ -152,6 +164,7 @@ public class AppWidgetProviderInfo implements Parcelable { } out.writeString(this.label); out.writeInt(this.icon); + out.writeInt(this.previewImage); } public int describeContents() { diff --git a/core/res/res/values/attrs.xml b/core/res/res/values/attrs.xml index 3d31c2785d16e..7470eca5fb56e 100755 --- a/core/res/res/values/attrs.xml +++ b/core/res/res/values/attrs.xml @@ -3585,6 +3585,9 @@ + + diff --git a/core/res/res/values/public.xml b/core/res/res/values/public.xml index 3d2db3919553e..e98c8afc95468 100644 --- a/core/res/res/values/public.xml +++ b/core/res/res/values/public.xml @@ -1299,6 +1299,7 @@ + diff --git a/services/java/com/android/server/AppWidgetService.java b/services/java/com/android/server/AppWidgetService.java index 3ed6c12371ed0..16742215938ab 100644 --- a/services/java/com/android/server/AppWidgetService.java +++ b/services/java/com/android/server/AppWidgetService.java @@ -741,6 +741,9 @@ class AppWidgetService extends IAppWidgetService.Stub } info.label = activityInfo.loadLabel(mPackageManager).toString(); info.icon = ri.getIconResource(); + info.previewImage = sa.getResourceId( + com.android.internal.R.styleable.AppWidgetProviderInfo_previewImage, 0); + sa.recycle(); } catch (Exception e) { // Ok to catch Exception here, because anything going wrong because