summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Robert Snoeberger <snoeberger@google.com> 2019-11-08 12:22:06 -0500
committer Robert Snoeberger <snoeberger@google.com> 2019-11-11 11:39:01 -0500
commita9593e965db697da3018f600bbe70581fbdf34fc (patch)
tree7c3a943a620a99fabb9ce92d92cba32b35c52a2b
parent052a83953b7f5162380d04776a077e405704130c (diff)
Break strong ref to ExpandableNotificationRow
Since AnimationRunner requires two GCs to be collected, one in the binding process and then one in system ui, the source notification can be retained for longer than expected. To avoid this, break the strong reference to the source notification after the animation has finished or is cancelled. Ideally, AnimationRunner would be marked as static to avoid the outer class from being retained longer than necessary. Unfortunately, this requires more code changes. To keep this change focused on the largest contributor, the notification, I'm holding off on that change. Bug: 144109427 Test: Dumped java heap after clicking on notification to open app. Checked that ExpandableNotificationRow wasn't retained by AnimationRunner. Change-Id: I69ab16cf0dff2fa96e2b0205c670e4e0d666dd14
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/notification/ActivityLaunchAnimator.java20
1 files changed, 11 insertions, 9 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/ActivityLaunchAnimator.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/ActivityLaunchAnimator.java
index 9b312341c583..e48e81957225 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/ActivityLaunchAnimator.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/ActivityLaunchAnimator.java
@@ -125,22 +125,21 @@ public class ActivityLaunchAnimator {
return mAnimationRunning;
}
- class AnimationRunner extends IRemoteAnimationRunner.Stub {
+ private class AnimationRunner extends IRemoteAnimationRunner.Stub {
- private final ExpandableNotificationRow mSourceNotification;
- private final ExpandAnimationParameters mParams;
+ private ExpandableNotificationRow mSourceNotification;
+ private final ExpandAnimationParameters mParams = new ExpandAnimationParameters();
private final Rect mWindowCrop = new Rect();
private final float mNotificationCornerRadius;
private float mCornerRadius;
private boolean mIsFullScreenLaunch = true;
private final SyncRtSurfaceTransactionApplier mSyncRtTransactionApplier;
- public AnimationRunner(ExpandableNotificationRow sourceNofitication) {
- mSourceNotification = sourceNofitication;
- mParams = new ExpandAnimationParameters();
- mSyncRtTransactionApplier = new SyncRtSurfaceTransactionApplier(mSourceNotification);
- mNotificationCornerRadius = Math.max(mSourceNotification.getCurrentTopRoundness(),
- mSourceNotification.getCurrentBottomRoundness());
+ AnimationRunner(ExpandableNotificationRow sourceNotification) {
+ mSourceNotification = sourceNotification;
+ mSyncRtTransactionApplier = new SyncRtSurfaceTransactionApplier(sourceNotification);
+ mNotificationCornerRadius = Math.max(sourceNotification.getCurrentTopRoundness(),
+ sourceNotification.getCurrentBottomRoundness());
}
@Override
@@ -155,6 +154,7 @@ public class ActivityLaunchAnimator {
setAnimationPending(false);
invokeCallback(iRemoteAnimationFinishedCallback);
mNotificationPanel.collapse(false /* delayed */, 1.0f /* speedUpFactor */);
+ mSourceNotification = null;
return;
}
@@ -254,6 +254,7 @@ public class ActivityLaunchAnimator {
mCallback.onExpandAnimationFinished(mIsFullScreenLaunch);
applyParamsToNotification(null);
applyParamsToNotificationList(null);
+ mSourceNotification = null;
}
}
@@ -281,6 +282,7 @@ public class ActivityLaunchAnimator {
mSourceNotification.post(() -> {
setAnimationPending(false);
mCallback.onLaunchAnimationCancelled();
+ mSourceNotification = null;
});
}
};