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
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user