Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit fe195e6f authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "RemoteViews: fix BitmapCache after immutable Bitmap switch" into tm-qpr-dev

parents 1a51c351 c9307272
Loading
Loading
Loading
Loading
+8 −3
Original line number Diff line number Diff line
@@ -1587,7 +1587,13 @@ public class RemoteViews implements Parcelable, Filter {

        public BitmapCache(Parcel source) {
            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) {
@@ -1603,7 +1609,7 @@ public class RemoteViews implements Parcelable, Filter {
                        b = b.asShared();
                    }
                    mBitmaps.add(b);
                    mBitmapHashes.put(mBitmaps.size() - 1, hash);
                    mBitmapHashes.put(hash, mBitmaps.size() - 1);
                    mBitmapMemory = -1;
                    return (mBitmaps.size() - 1);
                }
@@ -1620,7 +1626,6 @@ public class RemoteViews implements Parcelable, Filter {

        public void writeBitmapsToParcel(Parcel dest, int flags) {
            dest.writeTypedList(mBitmaps, flags);
            dest.writeSparseIntArray(mBitmapHashes);
        }

        public int getBitmapMemory() {