summaryrefslogtreecommitdiff
path: root/core/java/android/widget/RemoteViews.java
diff options
context:
space:
mode:
authorStevie Kideckel <kideckel@google.com>2021-12-08 18:35:32 +0000
committerStevie Kideckel <kideckel@google.com>2021-12-08 18:38:08 +0000
commit8d3c1aa054295471569f1c89192d376b77ff012a (patch)
tree363d7740b0df6ccd3c3dc319c01af9fc9d70b8a4 /core/java/android/widget/RemoteViews.java
parent56b6a1936d3daa673fedab5c8496ff1394612869 (diff)
Copy caches when initializing RemoteViews
If the BitmapCache is not copied when cloning RemoteViews, then Bitmaps will be dropped. Fix: 208865678 Test: cts, verified locally Change-Id: I7547ab3a60ac3ee16b9cfb8d592988d0e410172d
Diffstat (limited to 'core/java/android/widget/RemoteViews.java')
-rw-r--r--core/java/android/widget/RemoteViews.java11
1 files changed, 7 insertions, 4 deletions
diff --git a/core/java/android/widget/RemoteViews.java b/core/java/android/widget/RemoteViews.java
index 3d4d9eca6b16..dfd853acaf0d 100644
--- a/core/java/android/widget/RemoteViews.java
+++ b/core/java/android/widget/RemoteViews.java
@@ -3696,18 +3696,21 @@ public class RemoteViews implements Parcelable, Filter {
}
private void initializeFrom(@NonNull RemoteViews src, @Nullable RemoteViews hierarchyRoot) {
+ if (hierarchyRoot == null) {
+ mBitmapCache = src.mBitmapCache;
+ mApplicationInfoCache = src.mApplicationInfoCache;
+ } else {
+ mBitmapCache = hierarchyRoot.mBitmapCache;
+ mApplicationInfoCache = hierarchyRoot.mApplicationInfoCache;
+ }
if (hierarchyRoot == null || src.mIsRoot) {
// If there's no provided root, or if src was itself a root, then this RemoteViews is
// the root of the new hierarchy.
mIsRoot = true;
- mBitmapCache = new BitmapCache();
- mApplicationInfoCache = new ApplicationInfoCache();
hierarchyRoot = this;
} else {
// Otherwise, we're a descendant in the hierarchy.
mIsRoot = false;
- mBitmapCache = hierarchyRoot.mBitmapCache;
- mApplicationInfoCache = hierarchyRoot.mApplicationInfoCache;
}
mApplication = src.mApplication;
mLayoutId = src.mLayoutId;