Merge "Revert accidental API change to RemoteViews." into oc-dev

am: 0e6a5f8d7e

Change-Id: I7e00e745c8aa2ddb6232747d4371dc3194be28ef
This commit is contained in:
Daniel Sandler
2017-06-14 20:18:56 +00:00
committed by android-build-merger

View File

@@ -2342,24 +2342,26 @@ public class RemoteViews implements Parcelable, Filter {
} }
public synchronized RemoteViews clone() { public RemoteViews clone() {
Preconditions.checkState(mIsRoot, "RemoteView has been attached to another RemoteView. " synchronized (this) {
+ "May only clone the root of a RemoteView hierarchy."); 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. // 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. // Instead pretend we're not owning the cache while parceling.
mIsRoot = false; mIsRoot = false;
writeToParcel(p, PARCELABLE_ELIDE_DUPLICATES); writeToParcel(p, PARCELABLE_ELIDE_DUPLICATES);
p.setDataPosition(0); p.setDataPosition(0);
mIsRoot = true; mIsRoot = true;
RemoteViews rv = new RemoteViews(p, mBitmapCache.clone(), mApplication, 0); RemoteViews rv = new RemoteViews(p, mBitmapCache.clone(), mApplication, 0);
rv.mIsRoot = true; rv.mIsRoot = true;
p.recycle(); p.recycle();
return rv; return rv;
}
} }
public String getPackage() { public String getPackage() {