From f03e5f377857c044ad579d9e91b72a58af636444 Mon Sep 17 00:00:00 2001 From: Jordan Silva Date: Mon, 24 Apr 2023 20:26:24 +0100 Subject: [PATCH] Fix digital wellbeing toast being initialized multiple times Digital Wellbeing toast state was being updated several times together with the app icon unnecessarily. This was causing a recreation of the Digital Wellbeing and replacing the banner attached to the TaskView multiple times, leading to heavy UI thread work and jumpy animations in some cases. Bug: 271428408 Test: manual Change-Id: I1a2a1423924efb0fb3c1e66826e3ab11211dcfb7 --- quickstep/src/com/android/quickstep/views/TaskView.java | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/quickstep/src/com/android/quickstep/views/TaskView.java b/quickstep/src/com/android/quickstep/views/TaskView.java index 42589ced5d..53660b5040 100644 --- a/quickstep/src/com/android/quickstep/views/TaskView.java +++ b/quickstep/src/com/android/quickstep/views/TaskView.java @@ -581,6 +581,7 @@ public class TaskView extends FrameLayout implements Reusable { mIconView, STAGE_POSITION_UNDEFINED); mSnapshotView.bind(task); setOrientationState(orientedState); + mDigitalWellBeingToast.initialize(mTask); } /** @@ -984,10 +985,7 @@ public class TaskView extends FrameLayout implements Reusable { } if (needsUpdate(changes, FLAG_UPDATE_ICON)) { mIconLoadRequest = iconCache.updateIconInBackground(mTask, - (task) -> { - setIcon(mIconView, task.icon); - mDigitalWellBeingToast.initialize(mTask); - }); + (task) -> setIcon(mIconView, task.icon)); } } else { if (needsUpdate(changes, FLAG_UPDATE_THUMBNAIL)) {