Fix TaskView bind and orientation state called multiple times

DWB toast initialization is being called 3 times for every TaskView. Twice during the TaskView bind (setOrientationState and bind), and for every TaskView loaded in applyLoadPlan the bind and the setOrientationState are invoked. This CL removes the excessive calls in the TaskView bind and applyLoadPlan.
The DWB for the focused task view is still being called twice due to orientation update for the focused task.

Bug: 281980412
Flag: N/A
Test: atest DigitalWellBeingToastTest
Change-Id: Id301b53b9cb0dfc23a81debec67a6de9a35485b9
This commit is contained in:
Jordan Silva committed 2023-05-24 16:29:54 +00:00
1 parent d88ce20005
commit 8554f90ea6
2 files changed
+7 -2

No files matched your search

@@ -1631,6 +1631,10 @@ public abstract class RecentsView<ACTIVITY_TYPE extends StatefulActivity<STATE_T
int[] runningTaskId = getTaskIdsForTaskViewId(mRunningTaskViewId);
int[] focusedTaskId = getTaskIdsForTaskViewId(mFocusedTaskViewId);
// Reset the focused task to avoiding initializing TaskViews layout as focused task during
// binding. The focused task view will be updated after all the TaskViews are bound.
mFocusedTaskViewId = INVALID_TASK_ID;
// Removing views sets the currentPage to 0, so we save this and restore it after
// the new set of views are added
int previousCurrentPage = mCurrentPage;
@@ -1737,7 +1741,9 @@ public abstract class RecentsView<ACTIVITY_TYPE extends StatefulActivity<STATE_T
mFocusedTaskViewId = newFocusedTaskView != null && !ENABLE_GRID_ONLY_OVERVIEW.get()
? newFocusedTaskView.getTaskViewId() : INVALID_TASK_ID;
updateTaskSize();
updateChildTaskOrientations();
if (newFocusedTaskView != null) {
newFocusedTaskView.setOrientationState(mOrientationState);
}
TaskView newRunningTaskView = null;
if (hasAnyValidTaskIds(runningTaskId)) {
@@ -579,7 +579,6 @@ public class TaskView extends FrameLayout implements Reusable {
mIconView, STAGE_POSITION_UNDEFINED);
mSnapshotView.bind(task);
setOrientationState(orientedState);
mDigitalWellBeingToast.initialize(mTask);
}
/**