From a455113a2b5e3d965c134312d59b1d9d4d59f84f Mon Sep 17 00:00:00 2001 From: Robert Snoeberger Date: Tue, 14 Jul 2020 15:00:11 -0400 Subject: [PATCH] Prevent NotificationIconContainer$3 from retaining NotificationEntry It has been observed in heap dumps that NotificationIconContainer$3 can retain a NotificationEntry after the entry has been dismissed. To prevent this, this change breaks the reference chain between NotificationIconConatiner$3 and the IconState for the status bar icon. The cut is performed by setting the animation end action to null after the animation is started. Fixes: 160588607 Bug: 161119435 Test: manual - Clear all notifications. Take heap dump. Verify that weakref in AnimationEndAction has been collected (ie. is null). Change-Id: I32184a30df89a5172876a43da4896a2e06e3c86c --- .../systemui/statusbar/phone/NotificationIconContainer.java | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationIconContainer.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationIconContainer.java index 07eaaa187fbe1..bf858520c3380 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationIconContainer.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationIconContainer.java @@ -19,8 +19,6 @@ package com.android.systemui.statusbar.phone; import static com.android.systemui.statusbar.phone.HeadsUpAppearanceController.CONTENT_FADE_DELAY; import static com.android.systemui.statusbar.phone.HeadsUpAppearanceController.CONTENT_FADE_DURATION; -import android.animation.Animator; -import android.animation.AnimatorListenerAdapter; import android.content.Context; import android.content.res.Configuration; import android.graphics.Canvas; @@ -807,6 +805,7 @@ public class NotificationIconContainer extends AlphaOptimizedFrameLayout { } else { super.applyToView(view); } + sTempProperties.setAnimationEndAction(null); boolean inShelf = iconAppearAmount == 1.0f; icon.setIsInShelf(inShelf); }