From 7c500166b24f5da015c60a94795514f04fbbfde5 Mon Sep 17 00:00:00 2001 From: Winson Chung Date: Wed, 14 Jun 2023 18:58:27 +0000 Subject: [PATCH] Reset the static preloaded icon result once launcher is hidden - In the case where the system does not play the requested animation we can still ensure that this doesn't result in a leak of the activity by resetting the result when launcher is hidden (which happens after the launch transition) Bug: 285995223 Test: Presubmit Test: Take heapdump after repro steps in b/285995223#comment6 and verify there are no lingering static icon load results Change-Id: I1d169df158cfaab64fbe1f4ce597d8f73d86a1c1 --- src/com/android/launcher3/Launcher.java | 1 + src/com/android/launcher3/views/FloatingIconView.java | 9 ++++++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/com/android/launcher3/Launcher.java b/src/com/android/launcher3/Launcher.java index 37a20bf679..25eb16079f 100644 --- a/src/com/android/launcher3/Launcher.java +++ b/src/com/android/launcher3/Launcher.java @@ -1074,6 +1074,7 @@ public class Launcher extends StatefulActivity logStopAndResume(false /* isResume */); mAppWidgetHolder.setActivityStarted(false); NotificationListener.removeNotificationsChangedListener(getPopupDataProvider()); + FloatingIconView.resetIconLoadResult(); } @Override diff --git a/src/com/android/launcher3/views/FloatingIconView.java b/src/com/android/launcher3/views/FloatingIconView.java index 4d0e2aff2d..6b5c8df954 100644 --- a/src/com/android/launcher3/views/FloatingIconView.java +++ b/src/com/android/launcher3/views/FloatingIconView.java @@ -571,6 +571,13 @@ public class FloatingIconView extends FrameLayout implements return result; } + /** + * Resets the static icon load result used for preloading the icon for a launching app. + */ + public static void resetIconLoadResult() { + sIconLoadResult = null; + } + /** * Creates a floating icon view for {@param originalView}. * @param originalView The view to copy @@ -608,7 +615,7 @@ public class FloatingIconView extends FrameLayout implements } view.setOriginalDrawableBackground(view.mIconLoadResult.btvDrawable); } - sIconLoadResult = null; + resetIconLoadResult(); // Match the position of the original view. view.matchPositionOf(launcher, originalView, isOpening, positionOut);