diff options
| author | 2022-05-06 13:05:53 +0000 | |
|---|---|---|
| committer | 2022-05-06 13:05:53 +0000 | |
| commit | 7ecba896fa5978dbf18ccdc48908b1d091fff98e (patch) | |
| tree | b2657353d6b48c4abb228661cdb814c3475cd436 | |
| parent | db2310a284655ddda35437d15bf9f788e36639ed (diff) | |
| parent | ccff27878090bf5a145df33d5de8dc4383aaaf59 (diff) | |
Merge "Start edge extension animations in sync" into tm-dev
| -rw-r--r-- | services/core/java/com/android/server/wm/SurfaceAnimationRunner.java | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/services/core/java/com/android/server/wm/SurfaceAnimationRunner.java b/services/core/java/com/android/server/wm/SurfaceAnimationRunner.java index 4068a97a881a..c7f8a1e2068a 100644 --- a/services/core/java/com/android/server/wm/SurfaceAnimationRunner.java +++ b/services/core/java/com/android/server/wm/SurfaceAnimationRunner.java @@ -158,7 +158,7 @@ class SurfaceAnimationRunner { void continueStartingAnimations() { synchronized (mLock) { mAnimationStartDeferred = false; - if (!mPendingAnimations.isEmpty()) { + if (!mPendingAnimations.isEmpty() && mPreProcessingAnimations.isEmpty()) { mChoreographer.postFrameCallback(this::startAnimations); } } @@ -204,7 +204,7 @@ class SurfaceAnimationRunner { mPreProcessingAnimations.remove(animationLeash); mPendingAnimations.put(animationLeash, runningAnim); - if (!mAnimationStartDeferred) { + if (!mAnimationStartDeferred && mPreProcessingAnimations.isEmpty()) { mChoreographer.postFrameCallback(this::startAnimations); } } @@ -214,7 +214,7 @@ class SurfaceAnimationRunner { if (!requiresEdgeExtension) { mPendingAnimations.put(animationLeash, runningAnim); - if (!mAnimationStartDeferred) { + if (!mAnimationStartDeferred && mPreProcessingAnimations.isEmpty()) { mChoreographer.postFrameCallback(this::startAnimations); } @@ -330,6 +330,14 @@ class SurfaceAnimationRunner { private void startAnimations(long frameTimeNanos) { synchronized (mLock) { + if (!mPreProcessingAnimations.isEmpty()) { + // We only want to start running animations once all mPreProcessingAnimations have + // been processed to ensure preprocessed animations start in sync. + // NOTE: This means we might delay running animations that require preprocessing if + // new animations that also require preprocessing are requested before the previous + // ones have finished (see b/227449117). + return; + } startPendingAnimationsLocked(); } mPowerManagerInternal.setPowerBoost(Boost.INTERACTION, 0); @@ -553,4 +561,4 @@ class SurfaceAnimationRunner { return mAnimationHandler; } } -} +}
\ No newline at end of file |