diff options
| author | 2023-03-21 00:53:28 +0800 | |
|---|---|---|
| committer | 2023-03-21 20:48:32 +0800 | |
| commit | 27626413cd4fa9d6c441429effd3bee82feda5e8 (patch) | |
| tree | e2e490046d5c31c5370094518197e990e7cd0840 | |
| parent | 7e9609b4582b525093f0cf81ba0d3a1adb53b14b (diff) | |
Abort tf transition if window transaction is no-op
Otherwise TaskFragmentOrganizerController#onTransactionHandled
-> onTransactionFinished may trigger transition ready too early
that causes an empty transition and misses to collect the
later visibility changes, which breaks the animation.
For example, the transaction only calls createTaskFragment, but it
is failed by SecurityException for different owner task uid. And
then the client organizer will use the standard startActivity to
handle the rejection. With the abort, the failed wct can be no-op
completely and run the normal transition from startActivity.
Bug: 273422767
Test: TaskFragmentOrganizerControllerTest
Change-Id: If5e915ed3914b38273669f3d8ad715448a45f896
| -rw-r--r-- | services/core/java/com/android/server/wm/WindowOrganizerController.java | 24 |
1 files changed, 16 insertions, 8 deletions
diff --git a/services/core/java/com/android/server/wm/WindowOrganizerController.java b/services/core/java/com/android/server/wm/WindowOrganizerController.java index 8b0ef6cb94b4..c74af8291142 100644 --- a/services/core/java/com/android/server/wm/WindowOrganizerController.java +++ b/services/core/java/com/android/server/wm/WindowOrganizerController.java @@ -439,7 +439,11 @@ class WindowOrganizerController extends IWindowOrganizerController.Stub // multiple sync at the same time because it may cause conflict. // Create a new transition when there is no active sync to collect the changes. final Transition transition = mTransitionController.createTransition(type); - applyTransaction(wct, -1 /* syncId */, transition, caller); + if (applyTransaction(wct, -1 /* syncId */, transition, caller) + == TRANSACT_EFFECTS_NONE && transition.mParticipants.isEmpty()) { + transition.abort(); + return; + } mTransitionController.requestStartTransition(transition, null /* startTask */, null /* remoteTransition */, null /* displayChange */); transition.setAllReady(); @@ -476,24 +480,26 @@ class WindowOrganizerController extends IWindowOrganizerController.Stub // calls startSyncSet. () -> mTransitionController.moveToCollecting(nextTransition), () -> { - if (mTaskFragmentOrganizerController.isValidTransaction(wct)) { - applyTransaction(wct, -1 /*syncId*/, nextTransition, caller); + if (mTaskFragmentOrganizerController.isValidTransaction(wct) + && (applyTransaction(wct, -1 /* syncId */, nextTransition, caller) + != TRANSACT_EFFECTS_NONE + || !nextTransition.mParticipants.isEmpty())) { mTransitionController.requestStartTransition(nextTransition, null /* startTask */, null /* remoteTransition */, null /* displayChange */); nextTransition.setAllReady(); - } else { - nextTransition.abort(); + return; } + nextTransition.abort(); }); } finally { Binder.restoreCallingIdentity(ident); } } - private void applyTransaction(@NonNull WindowContainerTransaction t, int syncId, + private int applyTransaction(@NonNull WindowContainerTransaction t, int syncId, @Nullable Transition transition, @NonNull CallerInfo caller) { - applyTransaction(t, syncId, transition, caller, null /* finishTransition */); + return applyTransaction(t, syncId, transition, caller, null /* finishTransition */); } /** @@ -501,8 +507,9 @@ class WindowOrganizerController extends IWindowOrganizerController.Stub * @param transition A transition to collect changes into. * @param caller Info about the calling process. * @param finishTransition The transition that is currently being finished. + * @return The effects of the window container transaction. */ - private void applyTransaction(@NonNull WindowContainerTransaction t, int syncId, + private int applyTransaction(@NonNull WindowContainerTransaction t, int syncId, @Nullable Transition transition, @NonNull CallerInfo caller, @Nullable Transition finishTransition) { int effects = TRANSACT_EFFECTS_NONE; @@ -639,6 +646,7 @@ class WindowOrganizerController extends IWindowOrganizerController.Stub mService.mTaskSupervisor.setDeferRootVisibilityUpdate(false /* deferUpdate */); mService.continueWindowLayout(); } + return effects; } private int applyChanges(@NonNull WindowContainer<?> container, |