Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit f03e5f37 authored by Jordan Silva's avatar Jordan Silva
Browse files

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
parent 955555a3
Loading
Loading
Loading
Loading
+2 −4
Original line number Diff line number Diff line
@@ -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)) {