Use intra wallaper transition animation for move to front/back transition.

Bug: 193741133
Test: atest AppTransitionControllerTest
Change-Id: I5c6d02dc272c197368603455d4b0d4d5316d57f0
This commit is contained in:
Issei Suzuki
2021-07-16 16:17:53 +02:00
parent 9a9741b90c
commit 0247eefe9d
2 changed files with 67 additions and 0 deletions

View File

@@ -362,8 +362,10 @@ public class AppTransitionController {
ProtoLog.v(WM_DEBUG_APP_TRANSITIONS, "Wallpaper animation!");
switch (firstTransit) {
case TRANSIT_OPEN:
case TRANSIT_TO_FRONT:
return TRANSIT_OLD_WALLPAPER_INTRA_OPEN;
case TRANSIT_CLOSE:
case TRANSIT_TO_BACK:
return TRANSIT_OLD_WALLPAPER_INTRA_CLOSE;
}
} else if (oldWallpaper != null && !openingApps.isEmpty()

View File

@@ -19,6 +19,7 @@ package com.android.server.wm;
import static android.app.WindowConfiguration.ACTIVITY_TYPE_STANDARD;
import static android.app.WindowConfiguration.WINDOWING_MODE_FREEFORM;
import static android.app.WindowConfiguration.WINDOWING_MODE_FULLSCREEN;
import static android.view.WindowManager.LayoutParams.FLAG_SHOW_WALLPAPER;
import static android.view.WindowManager.LayoutParams.TYPE_BASE_APPLICATION;
import static android.view.WindowManager.TRANSIT_CHANGE;
import static android.view.WindowManager.TRANSIT_CLOSE;
@@ -27,6 +28,7 @@ import static android.view.WindowManager.TRANSIT_OLD_KEYGUARD_UNOCCLUDE;
import static android.view.WindowManager.TRANSIT_OLD_TASK_CHANGE_WINDOWING_MODE;
import static android.view.WindowManager.TRANSIT_OLD_TASK_OPEN;
import static android.view.WindowManager.TRANSIT_OPEN;
import static android.view.WindowManager.TRANSIT_TO_FRONT;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
@@ -167,6 +169,69 @@ public class AppTransitionControllerTest extends WindowTestsBase {
assertFalse(mAppTransitionController.isTransitWithinTask(TRANSIT_OLD_TASK_OPEN, task));
}
@Test
public void testIntraWallpaper_open() {
final ActivityRecord opening = createActivityRecord(mDisplayContent,
WINDOWING_MODE_FULLSCREEN, ACTIVITY_TYPE_STANDARD);
opening.setVisible(false);
final WindowManager.LayoutParams attrOpening = new WindowManager.LayoutParams(
TYPE_BASE_APPLICATION);
attrOpening.setTitle("WallpaperOpening");
attrOpening.flags |= FLAG_SHOW_WALLPAPER;
final TestWindowState appWindowOpening = createWindowState(attrOpening, opening);
opening.addWindow(appWindowOpening);
final ActivityRecord closing = createActivityRecord(mDisplayContent,
WINDOWING_MODE_FULLSCREEN, ACTIVITY_TYPE_STANDARD);
final WindowManager.LayoutParams attrClosing = new WindowManager.LayoutParams(
TYPE_BASE_APPLICATION);
attrOpening.setTitle("WallpaperClosing");
attrClosing.flags |= FLAG_SHOW_WALLPAPER;
final TestWindowState appWindowClosing = createWindowState(attrClosing, closing);
closing.addWindow(appWindowClosing);
mDisplayContent.prepareAppTransition(TRANSIT_OPEN);
mDisplayContent.mOpeningApps.add(opening);
mDisplayContent.mClosingApps.add(closing);
assertEquals(WindowManager.TRANSIT_OLD_WALLPAPER_INTRA_OPEN,
AppTransitionController.getTransitCompatType(mDisplayContent.mAppTransition,
mDisplayContent.mOpeningApps, mDisplayContent.mClosingApps,
appWindowClosing, null, false));
}
@Test
public void testIntraWallpaper_toFront() {
final ActivityRecord opening = createActivityRecord(mDisplayContent,
WINDOWING_MODE_FULLSCREEN, ACTIVITY_TYPE_STANDARD);
opening.setVisible(false);
final WindowManager.LayoutParams attrOpening = new WindowManager.LayoutParams(
TYPE_BASE_APPLICATION);
attrOpening.setTitle("WallpaperOpening");
attrOpening.flags |= FLAG_SHOW_WALLPAPER;
final TestWindowState appWindowOpening = createWindowState(attrOpening, opening);
opening.addWindow(appWindowOpening);
final ActivityRecord closing = createActivityRecord(mDisplayContent,
WINDOWING_MODE_FULLSCREEN, ACTIVITY_TYPE_STANDARD);
final WindowManager.LayoutParams attrClosing = new WindowManager.LayoutParams(
TYPE_BASE_APPLICATION);
attrOpening.setTitle("WallpaperClosing");
attrClosing.flags |= FLAG_SHOW_WALLPAPER;
final TestWindowState appWindowClosing = createWindowState(attrClosing, closing);
closing.addWindow(appWindowClosing);
mDisplayContent.prepareAppTransition(TRANSIT_TO_FRONT);
mDisplayContent.mOpeningApps.add(opening);
mDisplayContent.mClosingApps.add(closing);
assertEquals(WindowManager.TRANSIT_OLD_WALLPAPER_INTRA_OPEN,
AppTransitionController.getTransitCompatType(mDisplayContent.mAppTransition,
mDisplayContent.mOpeningApps, mDisplayContent.mClosingApps,
appWindowClosing, null, false));
}
@Test
public void testGetAnimationTargets_visibilityAlreadyUpdated() {
// [DisplayContent] -+- [Task1] - [ActivityRecord1] (opening, visible)