diff options
| -rw-r--r-- | services/core/java/com/android/server/wm/Transition.java | 13 | ||||
| -rw-r--r-- | services/core/java/com/android/server/wm/TransitionController.java | 9 |
2 files changed, 21 insertions, 1 deletions
diff --git a/services/core/java/com/android/server/wm/Transition.java b/services/core/java/com/android/server/wm/Transition.java index f620a9743eb4..2accf9a2a43a 100644 --- a/services/core/java/com/android/server/wm/Transition.java +++ b/services/core/java/com/android/server/wm/Transition.java @@ -2841,6 +2841,19 @@ class Transition implements BLASTSyncEngine.TransactionReadyListener { } } + /** Returns {@code true} if the display should use high performance hint for this transition. */ + boolean shouldUsePerfHint(@NonNull DisplayContent dc) { + if (mOverrideOptions != null + && mOverrideOptions.getType() == ActivityOptions.ANIM_SCENE_TRANSITION + && mType == TRANSIT_TO_BACK && mParticipants.size() == 1) { + // This should be from convertFromTranslucent that makes the occluded activity invisible + // without animation. So do not use perf hint (especially early-wakeup) that may disturb + // SurfaceFlinger scheduling around the last frame. + return false; + } + return mTargetDisplays.contains(dc); + } + /** * Returns {@code true} if the transition and the corresponding transaction should be applied * on display thread. Currently, this only checks for display rotation change because the order diff --git a/services/core/java/com/android/server/wm/TransitionController.java b/services/core/java/com/android/server/wm/TransitionController.java index 708d63e27ec2..59e3350d5c13 100644 --- a/services/core/java/com/android/server/wm/TransitionController.java +++ b/services/core/java/com/android/server/wm/TransitionController.java @@ -1237,8 +1237,15 @@ class TransitionController { // enableHighPerfTransition(true) is also called in Transition#recordDisplay. for (int i = mAtm.mRootWindowContainer.getChildCount() - 1; i >= 0; i--) { final DisplayContent dc = mAtm.mRootWindowContainer.getChildAt(i); - if (isTransitionOnDisplay(dc)) { + if (mCollectingTransition != null && mCollectingTransition.shouldUsePerfHint(dc)) { dc.enableHighPerfTransition(true); + continue; + } + for (int j = mPlayingTransitions.size() - 1; j >= 0; j--) { + if (mPlayingTransitions.get(j).shouldUsePerfHint(dc)) { + dc.enableHighPerfTransition(true); + break; + } } } // Usually transitions put quite a load onto the system already (with all the things |