Respect bar transition delay of remote animation

So the light bar animation can fit at proper timing with app launch
animation. It also avoids CPU contention such as the bar animation
won't overlap with app creation at the initial ~280ms.

Bug: 235323163
Bug: 223397410

Test: adb shell setprop persist.wm.debug.shell_transit 1; reboot
      Set wallpaper to pure white (status bar text color is black).
      Launch Clock (black background) from launcher. The status
      bar text color will change to white until the animation is
      close to the end.
Change-Id: Ic090abdccaa583d66a04354d7b21ad8f3f38f9a0
This commit is contained in:
Riddle Hsu
2022-06-24 23:29:01 +08:00
parent d9fa425f92
commit 1ec55c29a8
3 changed files with 15 additions and 3 deletions

View File

@@ -4727,6 +4727,8 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A
if (mPendingRemoteAnimation != null) {
mDisplayContent.mAppTransition.overridePendingAppTransitionRemote(
mPendingRemoteAnimation);
mTransitionController.setStatusBarTransitionDelay(
mPendingRemoteAnimation.getStatusBarTransitionDelay());
} else {
if (mPendingOptions == null
|| mPendingOptions.getAnimationType() == ANIM_SCENE_TRANSITION) {

View File

@@ -202,6 +202,9 @@ class Transition extends Binder implements BLASTSyncEngine.TransactionReadyListe
private boolean mNavBarAttachedToApp = false;
private int mRecentsDisplayId = INVALID_DISPLAY;
/** The delay for light bar appearance animation. */
long mStatusBarTransitionDelay;
/** @see #setCanPipOnFinish */
private boolean mCanPipOnFinish = true;
@@ -870,7 +873,7 @@ class Transition extends Binder implements BLASTSyncEngine.TransactionReadyListe
}
buildFinishTransaction(mFinishTransaction, info.getRootLeash());
if (mController.getTransitionPlayer() != null) {
mController.dispatchLegacyAppTransitionStarting(info);
mController.dispatchLegacyAppTransitionStarting(info, mStatusBarTransitionDelay);
try {
ProtoLog.v(ProtoLogGroup.WM_DEBUG_WINDOW_TRANSITIONS,
"Calling onTransitionReady: %s", info);

View File

@@ -462,6 +462,12 @@ class TransitionController {
}, true /* traverseTopToBottom */);
}
/** @see Transition#mStatusBarTransitionDelay */
void setStatusBarTransitionDelay(long delay) {
if (mCollectingTransition == null) return;
mCollectingTransition.mStatusBarTransitionDelay = delay;
}
/** @see Transition#setOverrideAnimation */
void setOverrideAnimation(TransitionInfo.AnimationOptions options,
@Nullable IRemoteCallback startCallback, @Nullable IRemoteCallback finishCallback) {
@@ -600,13 +606,14 @@ class TransitionController {
}
}
void dispatchLegacyAppTransitionStarting(TransitionInfo info) {
void dispatchLegacyAppTransitionStarting(TransitionInfo info, long statusBarTransitionDelay) {
final boolean keyguardGoingAway = info.isKeyguardGoingAway();
for (int i = 0; i < mLegacyListeners.size(); ++i) {
// TODO(shell-transitions): handle (un)occlude transition.
mLegacyListeners.get(i).onAppTransitionStartingLocked(keyguardGoingAway,
false /* keyguardOcclude */, 0 /* durationHint */,
SystemClock.uptimeMillis(), AnimationAdapter.STATUS_BAR_TRANSITION_DURATION);
SystemClock.uptimeMillis() + statusBarTransitionDelay,
AnimationAdapter.STATUS_BAR_TRANSITION_DURATION);
}
}