From 789a6a95cc4f087f5fe5e1c8202e0ee03ffcab8c Mon Sep 17 00:00:00 2001 From: Schneider Victor-tulias Date: Fri, 4 Mar 2022 12:06:09 -0800 Subject: [PATCH] Add method to pause expensive view updates during the app launch aimation Fixes: 220922269 Test: Manual Change-Id: I39066f575c0ddfc4868ab9e27149e2bd9492b39c --- .../android/launcher3/QuickstepTransitionManager.java | 6 +++--- src/com/android/launcher3/Launcher.java | 11 +++++++++++ 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/quickstep/src/com/android/launcher3/QuickstepTransitionManager.java b/quickstep/src/com/android/launcher3/QuickstepTransitionManager.java index c4a3fb5572..803dee4beb 100644 --- a/quickstep/src/com/android/launcher3/QuickstepTransitionManager.java +++ b/quickstep/src/com/android/launcher3/QuickstepTransitionManager.java @@ -579,8 +579,8 @@ public class QuickstepTransitionManager implements OnDeviceProfileChangeListener } } - // Pause page indicator animations as they lead to layer trashing. - mLauncher.getWorkspace().getPageIndicator().pauseAnimations(); + // Pause expensive view updates as they can lead to layer thrashing and skipped frames. + mLauncher.pauseExpensiveViewUpdates(); endListener = () -> { viewsToAnimate.forEach(view -> { @@ -590,7 +590,7 @@ public class QuickstepTransitionManager implements OnDeviceProfileChangeListener if (scrimEnabled) { mLauncher.getScrimView().setBackgroundColor(Color.TRANSPARENT); } - mLauncher.getWorkspace().getPageIndicator().skipAnimationsToEnd(); + mLauncher.resumeExpensiveViewUpdates(); }; } diff --git a/src/com/android/launcher3/Launcher.java b/src/com/android/launcher3/Launcher.java index 8fb2f53ec6..5c5aee579d 100644 --- a/src/com/android/launcher3/Launcher.java +++ b/src/com/android/launcher3/Launcher.java @@ -3192,4 +3192,15 @@ public class Launcher extends StatefulActivity implements Launche public ArrowPopup getOptionsPopup() { return findViewById(R.id.popup_container); } + + /** Pauses view updates that should not be run during the app launch animation. */ + public void pauseExpensiveViewUpdates() { + // Pause page indicator animations as they lead to layer trashing. + getWorkspace().getPageIndicator().pauseAnimations(); + } + + /** Resumes view updates at the end of the app launch animation. */ + public void resumeExpensiveViewUpdates() { + getWorkspace().getPageIndicator().skipAnimationsToEnd(); + } }