Skip close activity transition since no closing app can be visible

The layer of transition animation is usually shift to animation layer,
so when transition controller going to apply a activity close
transition to a bottom activity, the closing animation surface will be
on top of the task, then suddenly occludes the top activity.
An easy fix is to skip the close activity transtion if there is no
closing activity can be visible.

Bug: 186860966
Test: atest AppTransitionTests AppTransitionControllerTest
Change-Id: I3869530fc1eaa87ed1403fed86ff68a1e4de5b23
This commit is contained in:
wilsonshih
2021-06-04 20:32:31 +08:00
parent d377bbc227
commit c32b60099a
2 changed files with 25 additions and 1 deletions

View File

@@ -412,7 +412,13 @@ public class AppTransitionController {
return TRANSIT_OLD_TASK_CLOSE;
}
if (isActivityClosing) {
return TRANSIT_OLD_ACTIVITY_CLOSE;
for (int i = closingApps.size() - 1; i >= 0; i--) {
if (closingApps.valueAt(i).visibleIgnoringKeyguard) {
return TRANSIT_OLD_ACTIVITY_CLOSE;
}
}
// Skip close activity transition since no closing app can be visible
return WindowManager.TRANSIT_OLD_UNSET;
}
}
if (appTransition.containsTransitRequest(TRANSIT_RELAUNCH)

View File

@@ -77,6 +77,24 @@ public class AppTransitionControllerTest extends WindowTestsBase {
return r;
}
@Test
public void testSkipOccludedActivityCloseTransition() {
final ActivityRecord behind = createActivityRecord(mDisplayContent,
WINDOWING_MODE_FULLSCREEN, ACTIVITY_TYPE_STANDARD);
final ActivityRecord topOpening = createActivityRecord(behind.getTask());
topOpening.setOccludesParent(true);
topOpening.setVisible(true);
mDisplayContent.prepareAppTransition(TRANSIT_OPEN);
mDisplayContent.prepareAppTransition(TRANSIT_CLOSE);
mDisplayContent.mClosingApps.add(behind);
assertEquals(WindowManager.TRANSIT_OLD_UNSET,
AppTransitionController.getTransitCompatType(mDisplayContent.mAppTransition,
mDisplayContent.mOpeningApps, mDisplayContent.mClosingApps,
null, null, false));
}
@Test
@FlakyTest(bugId = 131005232)
public void testTranslucentOpen() {