Merge "RemoteViews: fix BitmapCache after immutable Bitmap switch" into tm-qpr-dev am: fe195e6f74
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/19450080 Change-Id: I7ea562c9433a85dcad6cb3241954140dcb8905b2 Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
@@ -1587,7 +1587,13 @@ public class RemoteViews implements Parcelable, Filter {
|
|||||||
|
|
||||||
public BitmapCache(Parcel source) {
|
public BitmapCache(Parcel source) {
|
||||||
mBitmaps = source.createTypedArrayList(Bitmap.CREATOR);
|
mBitmaps = source.createTypedArrayList(Bitmap.CREATOR);
|
||||||
mBitmapHashes = source.readSparseIntArray();
|
mBitmapHashes = new SparseIntArray();
|
||||||
|
for (int i = 0; i < mBitmaps.size(); i++) {
|
||||||
|
Bitmap b = mBitmaps.get(i);
|
||||||
|
if (b != null) {
|
||||||
|
mBitmapHashes.put(b.hashCode(), i);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getBitmapId(Bitmap b) {
|
public int getBitmapId(Bitmap b) {
|
||||||
@@ -1603,7 +1609,7 @@ public class RemoteViews implements Parcelable, Filter {
|
|||||||
b = b.asShared();
|
b = b.asShared();
|
||||||
}
|
}
|
||||||
mBitmaps.add(b);
|
mBitmaps.add(b);
|
||||||
mBitmapHashes.put(mBitmaps.size() - 1, hash);
|
mBitmapHashes.put(hash, mBitmaps.size() - 1);
|
||||||
mBitmapMemory = -1;
|
mBitmapMemory = -1;
|
||||||
return (mBitmaps.size() - 1);
|
return (mBitmaps.size() - 1);
|
||||||
}
|
}
|
||||||
@@ -1620,7 +1626,6 @@ public class RemoteViews implements Parcelable, Filter {
|
|||||||
|
|
||||||
public void writeBitmapsToParcel(Parcel dest, int flags) {
|
public void writeBitmapsToParcel(Parcel dest, int flags) {
|
||||||
dest.writeTypedList(mBitmaps, flags);
|
dest.writeTypedList(mBitmaps, flags);
|
||||||
dest.writeSparseIntArray(mBitmapHashes);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getBitmapMemory() {
|
public int getBitmapMemory() {
|
||||||
|
|||||||
Reference in New Issue
Block a user