Pause expensive view updates before setting hw/sw layers.

Prevents widgets from updating mid animation.
Also pauses view updates during app close animation.

Bug: 220939231
Bug: 230617085
Bug: 226171754
Test: manual

Change-Id: I0138d57e6a7b2c22fd9a029e971b3e27c7e9f22e
This commit is contained in:
Jon Miranda
2022-06-02 11:34:15 -07:00
parent c2c1fdad54
commit 46ecc0ca08
4 changed files with 27 additions and 6 deletions
+14 -1
View File
@@ -3229,11 +3229,24 @@ public class Launcher extends StatefulActivity<LauncherState>
public void pauseExpensiveViewUpdates() {
// Pause page indicator animations as they lead to layer trashing.
getWorkspace().getPageIndicator().pauseAnimations();
getWorkspace().mapOverItems((info, view) -> {
if (view instanceof LauncherAppWidgetHostView) {
((LauncherAppWidgetHostView) view).beginDeferringUpdates();
}
return false; // Return false to continue iterating through all the items.
});
}
/** Resumes view updates at the end of the app launch animation. */
public void resumeExpensiveViewUpdates() {
getWorkspace().getPageIndicator().skipAnimationsToEnd();
}
getWorkspace().mapOverItems((info, view) -> {
if (view instanceof LauncherAppWidgetHostView) {
((LauncherAppWidgetHostView) view).endDeferringUpdates();
}
return false; // Return false to continue iterating through all the items.
});
}
}