summaryrefslogtreecommitdiffstats
path: root/core/java/android/appwidget
diff options
context:
space:
mode:
authorRomain Guy <romainguy@android.com>2009-11-05 13:36:15 -0800
committerRomain Guy <romainguy@android.com>2009-11-05 15:40:35 -0800
commitae8dd29c035fffa6e302bd485d0552f97db39127 (patch)
treed9a191e0fd8a775d8fbf25081da3563c5c1e0f9d /core/java/android/appwidget
parent4ab2c7770c8e55072ee7a083fa84e318e07c8c3e (diff)
downloadframeworks_base-ae8dd29c035fffa6e302bd485d0552f97db39127.zip
frameworks_base-ae8dd29c035fffa6e302bd485d0552f97db39127.tar.gz
frameworks_base-ae8dd29c035fffa6e302bd485d0552f97db39127.tar.bz2
Prevent crash in Home when using widgets whose ids collide with Home's
resources. Bug #2228943. Approved by mcleron, triaged by ryanpc. Change-Id: Idf40f3b09502ae5d0d3b9a6a72c265a2de2ffca2
Diffstat (limited to 'core/java/android/appwidget')
-rw-r--r--core/java/android/appwidget/AppWidgetHostView.java11
1 files changed, 9 insertions, 2 deletions
diff --git a/core/java/android/appwidget/AppWidgetHostView.java b/core/java/android/appwidget/AppWidgetHostView.java
index bb0cbe9..2f719f3 100644
--- a/core/java/android/appwidget/AppWidgetHostView.java
+++ b/core/java/android/appwidget/AppWidgetHostView.java
@@ -123,8 +123,15 @@ public class AppWidgetHostView extends FrameLayout {
@Override
protected void dispatchRestoreInstanceState(SparseArray<Parcelable> container) {
- ParcelableSparseArray jail = (ParcelableSparseArray) container.get(generateId());
+ final Parcelable parcelable = container.get(generateId());
+
+ ParcelableSparseArray jail = null;
+ if (parcelable != null && parcelable instanceof ParcelableSparseArray) {
+ jail = (ParcelableSparseArray) parcelable;
+ }
+
if (jail == null) jail = new ParcelableSparseArray();
+
super.dispatchRestoreInstanceState(jail);
}
@@ -140,7 +147,7 @@ public class AppWidgetHostView extends FrameLayout {
/**
* Process a set of {@link RemoteViews} coming in as an update from the
- * AppWidget provider. Will animate into these new views as needed.
+ * AppWidget provider. Will animate into these new views as needed
*/
public void updateAppWidget(RemoteViews remoteViews) {
if (LOGD) Log.d(TAG, "updateAppWidget called mOld=" + mOld);