Merge "Copy caches when initializing RemoteViews" into sc-v2-dev am: 45cf23a6a4

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/16422417

Change-Id: I965ad2bc3ddf198d96440b0a363a5fc76ea64be0
This commit is contained in:
Stevie Kideckel
2021-12-08 23:03:33 +00:00
committed by Automerger Merge Worker

View File

@@ -3696,18 +3696,21 @@ public class RemoteViews implements Parcelable, Filter {
} }
private void initializeFrom(@NonNull RemoteViews src, @Nullable RemoteViews hierarchyRoot) { 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 (hierarchyRoot == null || src.mIsRoot) {
// If there's no provided root, or if src was itself a root, then this RemoteViews is // If there's no provided root, or if src was itself a root, then this RemoteViews is
// the root of the new hierarchy. // the root of the new hierarchy.
mIsRoot = true; mIsRoot = true;
mBitmapCache = new BitmapCache();
mApplicationInfoCache = new ApplicationInfoCache();
hierarchyRoot = this; hierarchyRoot = this;
} else { } else {
// Otherwise, we're a descendant in the hierarchy. // Otherwise, we're a descendant in the hierarchy.
mIsRoot = false; mIsRoot = false;
mBitmapCache = hierarchyRoot.mBitmapCache;
mApplicationInfoCache = hierarchyRoot.mApplicationInfoCache;
} }
mApplication = src.mApplication; mApplication = src.mApplication;
mLayoutId = src.mLayoutId; mLayoutId = src.mLayoutId;