OSDN Git Service

Revert accidental API change to RemoteViews.
authorDaniel Sandler <dsandler@android.com>
Tue, 13 Jun 2017 18:32:46 +0000 (18:32 +0000)
committerDaniel Sandler <dsandler@android.com>
Wed, 14 Jun 2017 20:10:18 +0000 (20:10 +0000)
This reverts commit 7f09ce1a238ad5a647da913e275fd637ac75ab49 (but
retains the bug fix)

Change-Id: Ib4700ada5aa0b5dab7e43f895b48eb7058308869
Fixes: 62543637
Bug: 62181033

core/java/android/widget/RemoteViews.java

index 7117137..aa6ffce 100644 (file)
@@ -2342,24 +2342,26 @@ public class RemoteViews implements Parcelable, Filter {
     }
 
 
-    public synchronized RemoteViews clone() {
-        Preconditions.checkState(mIsRoot, "RemoteView has been attached to another RemoteView. "
-                + "May only clone the root of a RemoteView hierarchy.");
+    public RemoteViews clone() {
+        synchronized (this) {
+            Preconditions.checkState(mIsRoot, "RemoteView has been attached to another RemoteView. "
+                    + "May only clone the root of a RemoteView hierarchy.");
 
-        Parcel p = Parcel.obtain();
+            Parcel p = Parcel.obtain();
 
-        // Do not parcel the Bitmap cache - doing so creates an expensive copy of all bitmaps.
-        // Instead pretend we're not owning the cache while parceling.
-        mIsRoot = false;
-        writeToParcel(p, PARCELABLE_ELIDE_DUPLICATES);
-        p.setDataPosition(0);
-        mIsRoot = true;
+            // Do not parcel the Bitmap cache - doing so creates an expensive copy of all bitmaps.
+            // Instead pretend we're not owning the cache while parceling.
+            mIsRoot = false;
+            writeToParcel(p, PARCELABLE_ELIDE_DUPLICATES);
+            p.setDataPosition(0);
+            mIsRoot = true;
 
-        RemoteViews rv = new RemoteViews(p, mBitmapCache.clone(), mApplication, 0);
-        rv.mIsRoot = true;
+            RemoteViews rv = new RemoteViews(p, mBitmapCache.clone(), mApplication, 0);
+            rv.mIsRoot = true;
 
-        p.recycle();
-        return rv;
+            p.recycle();
+            return rv;
+        }
     }
 
     public String getPackage() {