diff options
| author | 2023-09-11 16:11:51 +0000 | |
|---|---|---|
| committer | 2023-09-11 16:11:51 +0000 | |
| commit | 1a33f318aaff55e6d246f6bf7770989f09b83256 (patch) | |
| tree | 0e50c33ff07ee97ca1fb5bbed3e5e47291c35506 /libs | |
| parent | ed35afbc26e661a517da0dcea726a8890cc52f4b (diff) | |
Optimize the order of setting remote animating state
When starting recents or back to home, the recents/home is already
the top-app, so setRunningRemoteTransitionDelegate doesn't need to
be called before dispatching animation.
Also if an app is started via core with RemoteTransition set in
ActivityOptions (e.g. launch app from home), then the remote animator
will be set by TransitionController#updateRunningRemoteAnimation.
Because the most common cases already have the top-app/animating state
for the remote animator, it is fine to notify starting animating first
to avoid potential latency of setRunningRemoteTransitionDelegate,
such as scheduling of binder thread and lock contention on core.
Bug: 279437990
Bug: 297493149
Test: Home has top schedule group before starting animation.
E.g. Launch app from home, swipe to home,
press home key to home, press back key to home.
Change-Id: I6454e519951eeeda48c7d4a7d582dfa08dec7459
Diffstat (limited to 'libs')
| -rw-r--r-- | libs/WindowManager/Shell/src/com/android/wm/shell/recents/RecentsTransitionHandler.java | 3 | ||||
| -rw-r--r-- | libs/WindowManager/Shell/src/com/android/wm/shell/transition/RemoteTransitionHandler.java | 2 |
2 files changed, 3 insertions, 2 deletions
diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/recents/RecentsTransitionHandler.java b/libs/WindowManager/Shell/src/com/android/wm/shell/recents/RecentsTransitionHandler.java index dc6dc7910feb..016771d5ad9c 100644 --- a/libs/WindowManager/Shell/src/com/android/wm/shell/recents/RecentsTransitionHandler.java +++ b/libs/WindowManager/Shell/src/com/android/wm/shell/recents/RecentsTransitionHandler.java @@ -171,13 +171,14 @@ public class RecentsTransitionHandler implements Transitions.TransitionHandler { return false; } final RecentsController controller = mControllers.get(controllerIdx); - Transitions.setRunningRemoteTransitionDelegate(mAnimApp); + final IApplicationThread animApp = mAnimApp; mAnimApp = null; if (!controller.start(info, startTransaction, finishTransaction, finishCallback)) { ProtoLog.v(ShellProtoLogGroup.WM_SHELL_RECENTS_TRANSITION, "RecentsTransitionHandler.startAnimation: failed to start animation"); return false; } + Transitions.setRunningRemoteTransitionDelegate(animApp); return true; } diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/transition/RemoteTransitionHandler.java b/libs/WindowManager/Shell/src/com/android/wm/shell/transition/RemoteTransitionHandler.java index bbf67a6155d7..a90edf20f94e 100644 --- a/libs/WindowManager/Shell/src/com/android/wm/shell/transition/RemoteTransitionHandler.java +++ b/libs/WindowManager/Shell/src/com/android/wm/shell/transition/RemoteTransitionHandler.java @@ -137,7 +137,6 @@ public class RemoteTransitionHandler implements Transitions.TransitionHandler { }); } }; - Transitions.setRunningRemoteTransitionDelegate(remote.getAppThread()); try { // If the remote is actually in the same process, then make a copy of parameters since // remote impls assume that they have to clean-up native references. @@ -149,6 +148,7 @@ public class RemoteTransitionHandler implements Transitions.TransitionHandler { remote.getRemoteTransition().startAnimation(transition, remoteInfo, remoteStartT, cb); // assume that remote will apply the start transaction. startTransaction.clear(); + Transitions.setRunningRemoteTransitionDelegate(remote.getAppThread()); } catch (RemoteException e) { Log.e(Transitions.TAG, "Error running remote transition.", e); unhandleDeath(remote.asBinder(), finishCallback); |