diff options
author | Adam Cohen <adamcohen@google.com> | 2012-09-26 14:07:57 -0700 |
---|---|---|
committer | Adam Cohen <adamcohen@google.com> | 2012-09-26 18:00:12 -0700 |
commit | 3ff2d867d46067132890a5a6ad68be8a4314d7f6 (patch) | |
tree | 60c4d3cc69dd2eded1ea7615f7926f6384641831 /core/java/android/widget/RemoteViews.java | |
parent | fea9df6386d66089b004719f194625e159bb344a (diff) | |
download | frameworks_base-3ff2d867d46067132890a5a6ad68be8a4314d7f6.zip frameworks_base-3ff2d867d46067132890a5a6ad68be8a4314d7f6.tar.gz frameworks_base-3ff2d867d46067132890a5a6ad68be8a4314d7f6.tar.bz2 |
Fixing AppWidgetService / AppWidgetHost to work in system process
-> Fixes issue 7208464
-> Fixed issue with partial update as well, should address
issue 7214731
Change-Id: Ib8d9d5bee68b4fa7d6b4fbbc2f6609c287689958
Diffstat (limited to 'core/java/android/widget/RemoteViews.java')
-rw-r--r-- | core/java/android/widget/RemoteViews.java | 28 |
1 files changed, 8 insertions, 20 deletions
diff --git a/core/java/android/widget/RemoteViews.java b/core/java/android/widget/RemoteViews.java index 4b5dfb8..a822400 100644 --- a/core/java/android/widget/RemoteViews.java +++ b/core/java/android/widget/RemoteViews.java @@ -237,12 +237,11 @@ public class RemoteViews implements Parcelable, Filter { * @hide */ public void mergeRemoteViews(RemoteViews newRv) { + if (newRv == null) return; // We first copy the new RemoteViews, as the process of merging modifies the way the actions // reference the bitmap cache. We don't want to modify the object as it may need to // be merged and applied multiple times. - Parcel p = Parcel.obtain(); - newRv.writeToParcel(p, 0); - RemoteViews copy = new RemoteViews(p); + RemoteViews copy = newRv.clone(); HashMap<String, Action> map = new HashMap<String, Action>(); if (mActions == null) { @@ -261,7 +260,7 @@ public class RemoteViews implements Parcelable, Filter { for (int i = 0; i < count; i++) { Action a = newActions.get(i); String key = newActions.get(i).getUniqueKey(); - int mergeBehavior = map.get(key).mergeBehavior(); + int mergeBehavior = newActions.get(i).mergeBehavior(); if (map.containsKey(key) && mergeBehavior == Action.MERGE_REPLACE) { mActions.remove(map.get(key)); map.remove(key); @@ -1579,23 +1578,12 @@ public class RemoteViews implements Parcelable, Filter { recalculateMemoryUsage(); } - @Override - public RemoteViews clone() { - RemoteViews that; - if (!hasLandscapeAndPortraitLayouts()) { - that = new RemoteViews(mPackage, mLayoutId); - if (mActions != null) { - that.mActions = (ArrayList<Action>)mActions.clone(); - } - } else { - RemoteViews land = mLandscape.clone(); - RemoteViews port = mPortrait.clone(); - that = new RemoteViews(land, port); - } - // update the memory usage stats of the cloned RemoteViews - that.recalculateMemoryUsage(); - return that; + public RemoteViews clone() { + Parcel p = Parcel.obtain(); + writeToParcel(p, 0); + p.setDataPosition(0); + return new RemoteViews(p); } public String getPackage() { |