Include TaskFragment bounds change in app transition
Bug: 196173550 Test: behave currently with demo app Change-Id: I9a0f5b7033e5575806d904196594466004458c34
This commit is contained in:
@@ -332,6 +332,12 @@ public interface WindowManager extends ViewManager {
|
|||||||
*/
|
*/
|
||||||
int TRANSIT_OLD_TASK_FRAGMENT_CLOSE = 29;
|
int TRANSIT_OLD_TASK_FRAGMENT_CLOSE = 29;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A window of task fragment is changing bounds.
|
||||||
|
* @hide
|
||||||
|
*/
|
||||||
|
int TRANSIT_OLD_TASK_FRAGMENT_CHANGE = 30;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @hide
|
* @hide
|
||||||
*/
|
*/
|
||||||
@@ -359,7 +365,8 @@ public interface WindowManager extends ViewManager {
|
|||||||
TRANSIT_OLD_CRASHING_ACTIVITY_CLOSE,
|
TRANSIT_OLD_CRASHING_ACTIVITY_CLOSE,
|
||||||
TRANSIT_OLD_TASK_CHANGE_WINDOWING_MODE,
|
TRANSIT_OLD_TASK_CHANGE_WINDOWING_MODE,
|
||||||
TRANSIT_OLD_TASK_FRAGMENT_OPEN,
|
TRANSIT_OLD_TASK_FRAGMENT_OPEN,
|
||||||
TRANSIT_OLD_TASK_FRAGMENT_CLOSE
|
TRANSIT_OLD_TASK_FRAGMENT_CLOSE,
|
||||||
|
TRANSIT_OLD_TASK_FRAGMENT_CHANGE
|
||||||
})
|
})
|
||||||
@Retention(RetentionPolicy.SOURCE)
|
@Retention(RetentionPolicy.SOURCE)
|
||||||
@interface TransitionOldType {}
|
@interface TransitionOldType {}
|
||||||
|
|||||||
@@ -40,6 +40,7 @@ import static android.view.WindowManager.TRANSIT_OLD_KEYGUARD_UNOCCLUDE;
|
|||||||
import static android.view.WindowManager.TRANSIT_OLD_NONE;
|
import static android.view.WindowManager.TRANSIT_OLD_NONE;
|
||||||
import static android.view.WindowManager.TRANSIT_OLD_TASK_CHANGE_WINDOWING_MODE;
|
import static android.view.WindowManager.TRANSIT_OLD_TASK_CHANGE_WINDOWING_MODE;
|
||||||
import static android.view.WindowManager.TRANSIT_OLD_TASK_CLOSE;
|
import static android.view.WindowManager.TRANSIT_OLD_TASK_CLOSE;
|
||||||
|
import static android.view.WindowManager.TRANSIT_OLD_TASK_FRAGMENT_CHANGE;
|
||||||
import static android.view.WindowManager.TRANSIT_OLD_TASK_FRAGMENT_CLOSE;
|
import static android.view.WindowManager.TRANSIT_OLD_TASK_FRAGMENT_CLOSE;
|
||||||
import static android.view.WindowManager.TRANSIT_OLD_TASK_FRAGMENT_OPEN;
|
import static android.view.WindowManager.TRANSIT_OLD_TASK_FRAGMENT_OPEN;
|
||||||
import static android.view.WindowManager.TRANSIT_OLD_TASK_OPEN;
|
import static android.view.WindowManager.TRANSIT_OLD_TASK_OPEN;
|
||||||
@@ -941,7 +942,7 @@ public class AppTransition implements Dump {
|
|||||||
"applyAnimation NEXT_TRANSIT_TYPE_OPEN_CROSS_PROFILE_APPS: "
|
"applyAnimation NEXT_TRANSIT_TYPE_OPEN_CROSS_PROFILE_APPS: "
|
||||||
+ "anim=%s transit=%s isEntrance=true Callers=%s",
|
+ "anim=%s transit=%s isEntrance=true Callers=%s",
|
||||||
a, appTransitionOldToString(transit), Debug.getCallers(3));
|
a, appTransitionOldToString(transit), Debug.getCallers(3));
|
||||||
} else if (transit == TRANSIT_OLD_TASK_CHANGE_WINDOWING_MODE) {
|
} else if (isChangeTransitOld(transit)) {
|
||||||
// In the absence of a specific adapter, we just want to keep everything stationary.
|
// In the absence of a specific adapter, we just want to keep everything stationary.
|
||||||
a = new AlphaAnimation(1.f, 1.f);
|
a = new AlphaAnimation(1.f, 1.f);
|
||||||
a.setDuration(WindowChangeAnimationSpec.ANIMATION_DURATION);
|
a.setDuration(WindowChangeAnimationSpec.ANIMATION_DURATION);
|
||||||
@@ -1338,6 +1339,9 @@ public class AppTransition implements Dump {
|
|||||||
case TRANSIT_OLD_TASK_FRAGMENT_CLOSE: {
|
case TRANSIT_OLD_TASK_FRAGMENT_CLOSE: {
|
||||||
return "TRANSIT_OLD_TASK_FRAGMENT_CLOSE";
|
return "TRANSIT_OLD_TASK_FRAGMENT_CLOSE";
|
||||||
}
|
}
|
||||||
|
case TRANSIT_OLD_TASK_FRAGMENT_CHANGE: {
|
||||||
|
return "TRANSIT_OLD_TASK_FRAGMENT_CHANGE";
|
||||||
|
}
|
||||||
default: {
|
default: {
|
||||||
return "<UNKNOWN: " + transition + ">";
|
return "<UNKNOWN: " + transition + ">";
|
||||||
}
|
}
|
||||||
@@ -1595,7 +1599,8 @@ public class AppTransition implements Dump {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static boolean isChangeTransitOld(@TransitionOldType int transit) {
|
static boolean isChangeTransitOld(@TransitionOldType int transit) {
|
||||||
return transit == TRANSIT_OLD_TASK_CHANGE_WINDOWING_MODE;
|
return transit == TRANSIT_OLD_TASK_CHANGE_WINDOWING_MODE
|
||||||
|
|| transit == TRANSIT_OLD_TASK_FRAGMENT_CHANGE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static boolean isClosingTransitOld(@TransitionOldType int transit) {
|
static boolean isClosingTransitOld(@TransitionOldType int transit) {
|
||||||
|
|||||||
@@ -39,6 +39,7 @@ import static android.view.WindowManager.TRANSIT_OLD_KEYGUARD_UNOCCLUDE;
|
|||||||
import static android.view.WindowManager.TRANSIT_OLD_NONE;
|
import static android.view.WindowManager.TRANSIT_OLD_NONE;
|
||||||
import static android.view.WindowManager.TRANSIT_OLD_TASK_CHANGE_WINDOWING_MODE;
|
import static android.view.WindowManager.TRANSIT_OLD_TASK_CHANGE_WINDOWING_MODE;
|
||||||
import static android.view.WindowManager.TRANSIT_OLD_TASK_CLOSE;
|
import static android.view.WindowManager.TRANSIT_OLD_TASK_CLOSE;
|
||||||
|
import static android.view.WindowManager.TRANSIT_OLD_TASK_FRAGMENT_CHANGE;
|
||||||
import static android.view.WindowManager.TRANSIT_OLD_TASK_FRAGMENT_CLOSE;
|
import static android.view.WindowManager.TRANSIT_OLD_TASK_FRAGMENT_CLOSE;
|
||||||
import static android.view.WindowManager.TRANSIT_OLD_TASK_FRAGMENT_OPEN;
|
import static android.view.WindowManager.TRANSIT_OLD_TASK_FRAGMENT_OPEN;
|
||||||
import static android.view.WindowManager.TRANSIT_OLD_TASK_OPEN;
|
import static android.view.WindowManager.TRANSIT_OLD_TASK_OPEN;
|
||||||
@@ -204,8 +205,8 @@ public class AppTransitionController {
|
|||||||
mDisplayContent.mOpeningApps);
|
mDisplayContent.mOpeningApps);
|
||||||
|
|
||||||
final @TransitionOldType int transit = getTransitCompatType(
|
final @TransitionOldType int transit = getTransitCompatType(
|
||||||
mDisplayContent.mAppTransition,
|
mDisplayContent.mAppTransition, mDisplayContent.mOpeningApps,
|
||||||
mDisplayContent.mOpeningApps, mDisplayContent.mClosingApps,
|
mDisplayContent.mClosingApps, mDisplayContent.mChangingContainers,
|
||||||
mWallpaperControllerLocked.getWallpaperTarget(), getOldWallpaper(),
|
mWallpaperControllerLocked.getWallpaperTarget(), getOldWallpaper(),
|
||||||
mDisplayContent.mSkipAppTransitionAnimation);
|
mDisplayContent.mSkipAppTransitionAnimation);
|
||||||
mDisplayContent.mSkipAppTransitionAnimation = false;
|
mDisplayContent.mSkipAppTransitionAnimation = false;
|
||||||
@@ -286,6 +287,7 @@ public class AppTransitionController {
|
|||||||
* @param appTransition {@link AppTransition} for managing app transition state.
|
* @param appTransition {@link AppTransition} for managing app transition state.
|
||||||
* @param openingApps {@link ActivityRecord}s which are becoming visible.
|
* @param openingApps {@link ActivityRecord}s which are becoming visible.
|
||||||
* @param closingApps {@link ActivityRecord}s which are becoming invisible.
|
* @param closingApps {@link ActivityRecord}s which are becoming invisible.
|
||||||
|
* @param changingContainers {@link WindowContainer}s which are changed in configuration.
|
||||||
* @param wallpaperTarget If non-null, this is the currently visible window that is associated
|
* @param wallpaperTarget If non-null, this is the currently visible window that is associated
|
||||||
* with the wallpaper.
|
* with the wallpaper.
|
||||||
* @param oldWallpaper The currently visible window that is associated with the wallpaper in
|
* @param oldWallpaper The currently visible window that is associated with the wallpaper in
|
||||||
@@ -294,8 +296,8 @@ public class AppTransitionController {
|
|||||||
*/
|
*/
|
||||||
static @TransitionOldType int getTransitCompatType(AppTransition appTransition,
|
static @TransitionOldType int getTransitCompatType(AppTransition appTransition,
|
||||||
ArraySet<ActivityRecord> openingApps, ArraySet<ActivityRecord> closingApps,
|
ArraySet<ActivityRecord> openingApps, ArraySet<ActivityRecord> closingApps,
|
||||||
@Nullable WindowState wallpaperTarget, @Nullable WindowState oldWallpaper,
|
ArraySet<WindowContainer> changingContainers, @Nullable WindowState wallpaperTarget,
|
||||||
boolean skipAppTransitionAnimation) {
|
@Nullable WindowState oldWallpaper, boolean skipAppTransitionAnimation) {
|
||||||
|
|
||||||
// Determine if closing and opening app token sets are wallpaper targets, in which case
|
// Determine if closing and opening app token sets are wallpaper targets, in which case
|
||||||
// special animations are needed.
|
// special animations are needed.
|
||||||
@@ -328,8 +330,18 @@ public class AppTransitionController {
|
|||||||
|
|
||||||
// Special transitions
|
// Special transitions
|
||||||
// TODO(new-app-transitions): Revisit if those can be rewritten by using flags.
|
// TODO(new-app-transitions): Revisit if those can be rewritten by using flags.
|
||||||
if (appTransition.containsTransitRequest(TRANSIT_CHANGE)) {
|
if (appTransition.containsTransitRequest(TRANSIT_CHANGE) && !changingContainers.isEmpty()) {
|
||||||
|
@TransitContainerType int changingType =
|
||||||
|
getTransitContainerType(changingContainers.valueAt(0));
|
||||||
|
switch (changingType) {
|
||||||
|
case TYPE_TASK:
|
||||||
return TRANSIT_OLD_TASK_CHANGE_WINDOWING_MODE;
|
return TRANSIT_OLD_TASK_CHANGE_WINDOWING_MODE;
|
||||||
|
case TYPE_TASK_FRAGMENT:
|
||||||
|
return TRANSIT_OLD_TASK_FRAGMENT_CHANGE;
|
||||||
|
default:
|
||||||
|
throw new IllegalStateException(
|
||||||
|
"TRANSIT_CHANGE with unrecognized changing type=" + changingType);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if ((flags & TRANSIT_FLAG_APP_CRASHED) != 0) {
|
if ((flags & TRANSIT_FLAG_APP_CRASHED) != 0) {
|
||||||
return TRANSIT_OLD_CRASHING_ACTIVITY_CLOSE;
|
return TRANSIT_OLD_CRASHING_ACTIVITY_CLOSE;
|
||||||
|
|||||||
@@ -2166,16 +2166,6 @@ class Task extends TaskFragment {
|
|||||||
bounds.offset(horizontalDiff, verticalDiff);
|
bounds.offset(horizontalDiff, verticalDiff);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Initializes a change transition. See {@link SurfaceFreezer} for more information.
|
|
||||||
*/
|
|
||||||
private void initializeChangeTransition(Rect startBounds) {
|
|
||||||
mDisplayContent.prepareAppTransition(TRANSIT_CHANGE);
|
|
||||||
mDisplayContent.mChangingContainers.add(this);
|
|
||||||
|
|
||||||
mSurfaceFreezer.freeze(getPendingTransaction(), startBounds);
|
|
||||||
}
|
|
||||||
|
|
||||||
private boolean shouldStartChangeTransition(int prevWinMode, int newWinMode) {
|
private boolean shouldStartChangeTransition(int prevWinMode, int newWinMode) {
|
||||||
if (mWmService.mDisableTransitionAnimation
|
if (mWmService.mDisableTransitionAnimation
|
||||||
|| !isVisible()
|
|| !isVisible()
|
||||||
|
|||||||
@@ -33,6 +33,7 @@ import static android.content.res.Configuration.ORIENTATION_PORTRAIT;
|
|||||||
import static android.content.res.Configuration.ORIENTATION_UNDEFINED;
|
import static android.content.res.Configuration.ORIENTATION_UNDEFINED;
|
||||||
import static android.os.UserHandle.USER_NULL;
|
import static android.os.UserHandle.USER_NULL;
|
||||||
import static android.view.Display.INVALID_DISPLAY;
|
import static android.view.Display.INVALID_DISPLAY;
|
||||||
|
import static android.view.WindowManager.TRANSIT_CHANGE;
|
||||||
import static android.view.WindowManager.TRANSIT_CLOSE;
|
import static android.view.WindowManager.TRANSIT_CLOSE;
|
||||||
import static android.view.WindowManager.TRANSIT_FLAG_OPEN_BEHIND;
|
import static android.view.WindowManager.TRANSIT_FLAG_OPEN_BEHIND;
|
||||||
import static android.view.WindowManager.TRANSIT_NONE;
|
import static android.view.WindowManager.TRANSIT_NONE;
|
||||||
@@ -1987,10 +1988,48 @@ class TaskFragment extends WindowContainer<WindowContainer> {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onConfigurationChanged(Configuration newParentConfig) {
|
public void onConfigurationChanged(Configuration newParentConfig) {
|
||||||
|
// Task will animate differently.
|
||||||
|
if (mTaskFragmentOrganizer != null) {
|
||||||
|
mTmpPrevBounds.set(getBounds());
|
||||||
|
}
|
||||||
|
|
||||||
super.onConfigurationChanged(newParentConfig);
|
super.onConfigurationChanged(newParentConfig);
|
||||||
|
|
||||||
|
if (shouldStartChangeTransition(mTmpPrevBounds)) {
|
||||||
|
initializeChangeTransition(mTmpPrevBounds);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (mTaskFragmentOrganizer != null) {
|
||||||
|
// Update the surface position here instead of in the organizer so that we can make sure
|
||||||
|
// it can be synced with the surface freezer.
|
||||||
|
updateSurfacePosition(getSyncTransaction());
|
||||||
|
}
|
||||||
|
|
||||||
sendTaskFragmentInfoChanged();
|
sendTaskFragmentInfoChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Whether we should prepare a transition for this {@link TaskFragment} bounds change. */
|
||||||
|
private boolean shouldStartChangeTransition(Rect startBounds) {
|
||||||
|
if (mWmService.mDisableTransitionAnimation
|
||||||
|
|| mDisplayContent == null
|
||||||
|
|| mTaskFragmentOrganizer == null
|
||||||
|
|| getSurfaceControl() == null
|
||||||
|
|| !isVisible()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return !startBounds.equals(getBounds());
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Initializes a change transition. See {@link SurfaceFreezer} for more information.
|
||||||
|
*/
|
||||||
|
void initializeChangeTransition(Rect startBounds) {
|
||||||
|
mDisplayContent.prepareAppTransition(TRANSIT_CHANGE);
|
||||||
|
mDisplayContent.mChangingContainers.add(this);
|
||||||
|
mSurfaceFreezer.freeze(getSyncTransaction(), startBounds);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
void setSurfaceControl(SurfaceControl sc) {
|
void setSurfaceControl(SurfaceControl sc) {
|
||||||
super.setSurfaceControl(sc);
|
super.setSurfaceControl(sc);
|
||||||
@@ -2061,6 +2100,11 @@ class TaskFragment extends WindowContainer<WindowContainer> {
|
|||||||
return mTaskFragmentOrganizer;
|
return mTaskFragmentOrganizer;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
boolean isOrganized() {
|
||||||
|
return mTaskFragmentOrganizer != null;
|
||||||
|
}
|
||||||
|
|
||||||
/** Clear {@link #mLastPausedActivity} for all {@link TaskFragment} children */
|
/** Clear {@link #mLastPausedActivity} for all {@link TaskFragment} children */
|
||||||
void clearLastPausedActivity() {
|
void clearLastPausedActivity() {
|
||||||
forAllTaskFragments(taskFragment -> taskFragment.mLastPausedActivity = null);
|
forAllTaskFragments(taskFragment -> taskFragment.mLastPausedActivity = null);
|
||||||
|
|||||||
@@ -48,7 +48,6 @@ import android.view.RemoteAnimationDefinition;
|
|||||||
import android.view.RemoteAnimationTarget;
|
import android.view.RemoteAnimationTarget;
|
||||||
import android.view.WindowManager;
|
import android.view.WindowManager;
|
||||||
|
|
||||||
import androidx.test.filters.FlakyTest;
|
|
||||||
import androidx.test.filters.SmallTest;
|
import androidx.test.filters.SmallTest;
|
||||||
|
|
||||||
import org.junit.Before;
|
import org.junit.Before;
|
||||||
@@ -94,11 +93,10 @@ public class AppTransitionControllerTest extends WindowTestsBase {
|
|||||||
assertEquals(WindowManager.TRANSIT_OLD_UNSET,
|
assertEquals(WindowManager.TRANSIT_OLD_UNSET,
|
||||||
AppTransitionController.getTransitCompatType(mDisplayContent.mAppTransition,
|
AppTransitionController.getTransitCompatType(mDisplayContent.mAppTransition,
|
||||||
mDisplayContent.mOpeningApps, mDisplayContent.mClosingApps,
|
mDisplayContent.mOpeningApps, mDisplayContent.mClosingApps,
|
||||||
null, null, false));
|
mDisplayContent.mChangingContainers, null, null, false));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@FlakyTest(bugId = 131005232)
|
|
||||||
public void testTranslucentOpen() {
|
public void testTranslucentOpen() {
|
||||||
final ActivityRecord behind = createActivityRecord(mDisplayContent,
|
final ActivityRecord behind = createActivityRecord(mDisplayContent,
|
||||||
WINDOWING_MODE_FULLSCREEN, ACTIVITY_TYPE_STANDARD);
|
WINDOWING_MODE_FULLSCREEN, ACTIVITY_TYPE_STANDARD);
|
||||||
@@ -113,11 +111,10 @@ public class AppTransitionControllerTest extends WindowTestsBase {
|
|||||||
assertEquals(WindowManager.TRANSIT_OLD_TRANSLUCENT_ACTIVITY_OPEN,
|
assertEquals(WindowManager.TRANSIT_OLD_TRANSLUCENT_ACTIVITY_OPEN,
|
||||||
AppTransitionController.getTransitCompatType(mDisplayContent.mAppTransition,
|
AppTransitionController.getTransitCompatType(mDisplayContent.mAppTransition,
|
||||||
mDisplayContent.mOpeningApps, mDisplayContent.mClosingApps,
|
mDisplayContent.mOpeningApps, mDisplayContent.mClosingApps,
|
||||||
null, null, false));
|
mDisplayContent.mChangingContainers, null, null, false));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@FlakyTest(bugId = 131005232)
|
|
||||||
public void testTranslucentClose() {
|
public void testTranslucentClose() {
|
||||||
final ActivityRecord behind = createActivityRecord(mDisplayContent,
|
final ActivityRecord behind = createActivityRecord(mDisplayContent,
|
||||||
WINDOWING_MODE_FULLSCREEN, ACTIVITY_TYPE_STANDARD);
|
WINDOWING_MODE_FULLSCREEN, ACTIVITY_TYPE_STANDARD);
|
||||||
@@ -129,11 +126,10 @@ public class AppTransitionControllerTest extends WindowTestsBase {
|
|||||||
assertEquals(WindowManager.TRANSIT_OLD_TRANSLUCENT_ACTIVITY_CLOSE,
|
assertEquals(WindowManager.TRANSIT_OLD_TRANSLUCENT_ACTIVITY_CLOSE,
|
||||||
AppTransitionController.getTransitCompatType(mDisplayContent.mAppTransition,
|
AppTransitionController.getTransitCompatType(mDisplayContent.mAppTransition,
|
||||||
mDisplayContent.mOpeningApps, mDisplayContent.mClosingApps,
|
mDisplayContent.mOpeningApps, mDisplayContent.mClosingApps,
|
||||||
null, null, false));
|
mDisplayContent.mChangingContainers, null, null, false));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@FlakyTest(bugId = 131005232)
|
|
||||||
public void testChangeIsNotOverwritten() {
|
public void testChangeIsNotOverwritten() {
|
||||||
final ActivityRecord behind = createActivityRecord(mDisplayContent,
|
final ActivityRecord behind = createActivityRecord(mDisplayContent,
|
||||||
WINDOWING_MODE_FULLSCREEN, ACTIVITY_TYPE_STANDARD);
|
WINDOWING_MODE_FULLSCREEN, ACTIVITY_TYPE_STANDARD);
|
||||||
@@ -144,14 +140,14 @@ public class AppTransitionControllerTest extends WindowTestsBase {
|
|||||||
mDisplayContent.prepareAppTransition(TRANSIT_CHANGE);
|
mDisplayContent.prepareAppTransition(TRANSIT_CHANGE);
|
||||||
mDisplayContent.mOpeningApps.add(behind);
|
mDisplayContent.mOpeningApps.add(behind);
|
||||||
mDisplayContent.mOpeningApps.add(translucentOpening);
|
mDisplayContent.mOpeningApps.add(translucentOpening);
|
||||||
|
mDisplayContent.mChangingContainers.add(translucentOpening.getTask());
|
||||||
assertEquals(TRANSIT_OLD_TASK_CHANGE_WINDOWING_MODE,
|
assertEquals(TRANSIT_OLD_TASK_CHANGE_WINDOWING_MODE,
|
||||||
AppTransitionController.getTransitCompatType(mDisplayContent.mAppTransition,
|
AppTransitionController.getTransitCompatType(mDisplayContent.mAppTransition,
|
||||||
mDisplayContent.mOpeningApps, mDisplayContent.mClosingApps,
|
mDisplayContent.mOpeningApps, mDisplayContent.mClosingApps,
|
||||||
null, null, false));
|
mDisplayContent.mChangingContainers, null, null, false));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@FlakyTest(bugId = 131005232)
|
|
||||||
public void testTransitWithinTask() {
|
public void testTransitWithinTask() {
|
||||||
final ActivityRecord opening = createActivityRecord(mDisplayContent,
|
final ActivityRecord opening = createActivityRecord(mDisplayContent,
|
||||||
WINDOWING_MODE_FREEFORM, ACTIVITY_TYPE_STANDARD);
|
WINDOWING_MODE_FREEFORM, ACTIVITY_TYPE_STANDARD);
|
||||||
@@ -198,7 +194,7 @@ public class AppTransitionControllerTest extends WindowTestsBase {
|
|||||||
assertEquals(WindowManager.TRANSIT_OLD_WALLPAPER_INTRA_OPEN,
|
assertEquals(WindowManager.TRANSIT_OLD_WALLPAPER_INTRA_OPEN,
|
||||||
AppTransitionController.getTransitCompatType(mDisplayContent.mAppTransition,
|
AppTransitionController.getTransitCompatType(mDisplayContent.mAppTransition,
|
||||||
mDisplayContent.mOpeningApps, mDisplayContent.mClosingApps,
|
mDisplayContent.mOpeningApps, mDisplayContent.mClosingApps,
|
||||||
appWindowClosing, null, false));
|
mDisplayContent.mChangingContainers, appWindowClosing, null, false));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@@ -229,7 +225,7 @@ public class AppTransitionControllerTest extends WindowTestsBase {
|
|||||||
assertEquals(WindowManager.TRANSIT_OLD_WALLPAPER_INTRA_OPEN,
|
assertEquals(WindowManager.TRANSIT_OLD_WALLPAPER_INTRA_OPEN,
|
||||||
AppTransitionController.getTransitCompatType(mDisplayContent.mAppTransition,
|
AppTransitionController.getTransitCompatType(mDisplayContent.mAppTransition,
|
||||||
mDisplayContent.mOpeningApps, mDisplayContent.mClosingApps,
|
mDisplayContent.mOpeningApps, mDisplayContent.mClosingApps,
|
||||||
appWindowClosing, null, false));
|
mDisplayContent.mChangingContainers, appWindowClosing, null, false));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|||||||
@@ -18,11 +18,14 @@ package com.android.server.wm;
|
|||||||
|
|
||||||
import static android.view.WindowManager.LayoutParams.TYPE_APPLICATION_STARTING;
|
import static android.view.WindowManager.LayoutParams.TYPE_APPLICATION_STARTING;
|
||||||
import static android.view.WindowManager.LayoutParams.TYPE_BASE_APPLICATION;
|
import static android.view.WindowManager.LayoutParams.TYPE_BASE_APPLICATION;
|
||||||
|
import static android.view.WindowManager.TRANSIT_CHANGE;
|
||||||
import static android.view.WindowManager.TRANSIT_CLOSE;
|
import static android.view.WindowManager.TRANSIT_CLOSE;
|
||||||
import static android.view.WindowManager.TRANSIT_FLAG_APP_CRASHED;
|
import static android.view.WindowManager.TRANSIT_FLAG_APP_CRASHED;
|
||||||
import static android.view.WindowManager.TRANSIT_KEYGUARD_GOING_AWAY;
|
import static android.view.WindowManager.TRANSIT_KEYGUARD_GOING_AWAY;
|
||||||
import static android.view.WindowManager.TRANSIT_OLD_CRASHING_ACTIVITY_CLOSE;
|
import static android.view.WindowManager.TRANSIT_OLD_CRASHING_ACTIVITY_CLOSE;
|
||||||
import static android.view.WindowManager.TRANSIT_OLD_KEYGUARD_GOING_AWAY;
|
import static android.view.WindowManager.TRANSIT_OLD_KEYGUARD_GOING_AWAY;
|
||||||
|
import static android.view.WindowManager.TRANSIT_OLD_TASK_CHANGE_WINDOWING_MODE;
|
||||||
|
import static android.view.WindowManager.TRANSIT_OLD_TASK_FRAGMENT_CHANGE;
|
||||||
import static android.view.WindowManager.TRANSIT_OLD_TASK_FRAGMENT_CLOSE;
|
import static android.view.WindowManager.TRANSIT_OLD_TASK_FRAGMENT_CLOSE;
|
||||||
import static android.view.WindowManager.TRANSIT_OLD_TASK_FRAGMENT_OPEN;
|
import static android.view.WindowManager.TRANSIT_OLD_TASK_FRAGMENT_OPEN;
|
||||||
import static android.view.WindowManager.TRANSIT_OLD_UNSET;
|
import static android.view.WindowManager.TRANSIT_OLD_UNSET;
|
||||||
@@ -32,6 +35,7 @@ import static androidx.test.platform.app.InstrumentationRegistry.getInstrumentat
|
|||||||
|
|
||||||
import static com.android.dx.mockito.inline.extended.ExtendedMockito.doNothing;
|
import static com.android.dx.mockito.inline.extended.ExtendedMockito.doNothing;
|
||||||
import static com.android.dx.mockito.inline.extended.ExtendedMockito.doReturn;
|
import static com.android.dx.mockito.inline.extended.ExtendedMockito.doReturn;
|
||||||
|
import static com.android.server.wm.WindowContainer.POSITION_TOP;
|
||||||
|
|
||||||
import static org.junit.Assert.assertEquals;
|
import static org.junit.Assert.assertEquals;
|
||||||
import static org.junit.Assert.assertFalse;
|
import static org.junit.Assert.assertFalse;
|
||||||
@@ -39,6 +43,7 @@ import static org.junit.Assert.assertNull;
|
|||||||
import static org.junit.Assert.assertTrue;
|
import static org.junit.Assert.assertTrue;
|
||||||
import static org.mockito.ArgumentMatchers.any;
|
import static org.mockito.ArgumentMatchers.any;
|
||||||
|
|
||||||
|
import android.os.Binder;
|
||||||
import android.os.IBinder;
|
import android.os.IBinder;
|
||||||
import android.os.RemoteException;
|
import android.os.RemoteException;
|
||||||
import android.platform.test.annotations.Presubmit;
|
import android.platform.test.annotations.Presubmit;
|
||||||
@@ -85,8 +90,8 @@ public class AppTransitionTests extends WindowTestsBase {
|
|||||||
assertEquals(TRANSIT_OLD_KEYGUARD_GOING_AWAY,
|
assertEquals(TRANSIT_OLD_KEYGUARD_GOING_AWAY,
|
||||||
AppTransitionController.getTransitCompatType(mDc.mAppTransition,
|
AppTransitionController.getTransitCompatType(mDc.mAppTransition,
|
||||||
mDisplayContent.mOpeningApps, mDisplayContent.mClosingApps,
|
mDisplayContent.mOpeningApps, mDisplayContent.mClosingApps,
|
||||||
null /* wallpaperTarget */, null /* oldWallpaper */,
|
mDisplayContent.mChangingContainers, null /* wallpaperTarget */,
|
||||||
false /*skipAppTransitionAnimation*/));
|
null /* oldWallpaper */, false /*skipAppTransitionAnimation*/));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@@ -100,8 +105,8 @@ public class AppTransitionTests extends WindowTestsBase {
|
|||||||
assertEquals(TRANSIT_OLD_KEYGUARD_GOING_AWAY,
|
assertEquals(TRANSIT_OLD_KEYGUARD_GOING_AWAY,
|
||||||
AppTransitionController.getTransitCompatType(mDc.mAppTransition,
|
AppTransitionController.getTransitCompatType(mDc.mAppTransition,
|
||||||
mDisplayContent.mOpeningApps, mDisplayContent.mClosingApps,
|
mDisplayContent.mOpeningApps, mDisplayContent.mClosingApps,
|
||||||
null /* wallpaperTarget */, null /* oldWallpaper */,
|
mDisplayContent.mChangingContainers, null /* wallpaperTarget */,
|
||||||
false /*skipAppTransitionAnimation*/));
|
null /* oldWallpaper */, false /*skipAppTransitionAnimation*/));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@@ -115,8 +120,8 @@ public class AppTransitionTests extends WindowTestsBase {
|
|||||||
assertEquals(TRANSIT_OLD_CRASHING_ACTIVITY_CLOSE,
|
assertEquals(TRANSIT_OLD_CRASHING_ACTIVITY_CLOSE,
|
||||||
AppTransitionController.getTransitCompatType(mDc.mAppTransition,
|
AppTransitionController.getTransitCompatType(mDc.mAppTransition,
|
||||||
mDisplayContent.mOpeningApps, mDisplayContent.mClosingApps,
|
mDisplayContent.mOpeningApps, mDisplayContent.mClosingApps,
|
||||||
null /* wallpaperTarget */, null /* oldWallpaper */,
|
mDisplayContent.mChangingContainers, null /* wallpaperTarget */,
|
||||||
false /*skipAppTransitionAnimation*/));
|
null /* oldWallpaper */, false /*skipAppTransitionAnimation*/));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@@ -130,8 +135,8 @@ public class AppTransitionTests extends WindowTestsBase {
|
|||||||
assertEquals(TRANSIT_OLD_KEYGUARD_GOING_AWAY,
|
assertEquals(TRANSIT_OLD_KEYGUARD_GOING_AWAY,
|
||||||
AppTransitionController.getTransitCompatType(mDc.mAppTransition,
|
AppTransitionController.getTransitCompatType(mDc.mAppTransition,
|
||||||
mDisplayContent.mOpeningApps, mDisplayContent.mClosingApps,
|
mDisplayContent.mOpeningApps, mDisplayContent.mClosingApps,
|
||||||
null /* wallpaperTarget */, null /* oldWallpaper */,
|
mDisplayContent.mChangingContainers, null /* wallpaperTarget */,
|
||||||
false /*skipAppTransitionAnimation*/));
|
null /* oldWallpaper */, false /*skipAppTransitionAnimation*/));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@@ -145,8 +150,44 @@ public class AppTransitionTests extends WindowTestsBase {
|
|||||||
assertEquals(TRANSIT_OLD_UNSET,
|
assertEquals(TRANSIT_OLD_UNSET,
|
||||||
AppTransitionController.getTransitCompatType(mDc.mAppTransition,
|
AppTransitionController.getTransitCompatType(mDc.mAppTransition,
|
||||||
mDisplayContent.mOpeningApps, mDisplayContent.mClosingApps,
|
mDisplayContent.mOpeningApps, mDisplayContent.mClosingApps,
|
||||||
null /* wallpaperTarget */, null /* oldWallpaper */,
|
mDisplayContent.mChangingContainers, null /* wallpaperTarget */,
|
||||||
true /*skipAppTransitionAnimation*/));
|
null /* oldWallpaper */, true /*skipAppTransitionAnimation*/));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testTaskChangeWindowingMode() {
|
||||||
|
final ActivityRecord activity = createActivityRecord(mDc);
|
||||||
|
|
||||||
|
mDc.prepareAppTransition(TRANSIT_OPEN);
|
||||||
|
mDc.prepareAppTransition(TRANSIT_CHANGE);
|
||||||
|
mDc.mOpeningApps.add(activity); // Make sure TRANSIT_CHANGE has the priority
|
||||||
|
mDc.mChangingContainers.add(activity.getTask());
|
||||||
|
|
||||||
|
assertEquals(TRANSIT_OLD_TASK_CHANGE_WINDOWING_MODE,
|
||||||
|
AppTransitionController.getTransitCompatType(mDc.mAppTransition,
|
||||||
|
mDisplayContent.mOpeningApps, mDisplayContent.mClosingApps,
|
||||||
|
mDisplayContent.mChangingContainers, null /* wallpaperTarget */,
|
||||||
|
null /* oldWallpaper */, false /*skipAppTransitionAnimation*/));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testTaskFragmentChange() {
|
||||||
|
final ActivityRecord activity = createActivityRecord(mDc);
|
||||||
|
final TaskFragment taskFragment = new TaskFragment(mAtm, new Binder(),
|
||||||
|
true /* createdByOrganizer */, true /* isEmbedded */);
|
||||||
|
activity.getTask().addChild(taskFragment, POSITION_TOP);
|
||||||
|
activity.reparent(taskFragment, POSITION_TOP);
|
||||||
|
|
||||||
|
mDc.prepareAppTransition(TRANSIT_OPEN);
|
||||||
|
mDc.prepareAppTransition(TRANSIT_CHANGE);
|
||||||
|
mDc.mOpeningApps.add(activity); // Make sure TRANSIT_CHANGE has the priority
|
||||||
|
mDc.mChangingContainers.add(taskFragment);
|
||||||
|
|
||||||
|
assertEquals(TRANSIT_OLD_TASK_FRAGMENT_CHANGE,
|
||||||
|
AppTransitionController.getTransitCompatType(mDc.mAppTransition,
|
||||||
|
mDisplayContent.mOpeningApps, mDisplayContent.mClosingApps,
|
||||||
|
mDisplayContent.mChangingContainers, null /* wallpaperTarget */,
|
||||||
|
null /* oldWallpaper */, false /*skipAppTransitionAnimation*/));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@@ -160,8 +201,8 @@ public class AppTransitionTests extends WindowTestsBase {
|
|||||||
assertEquals(TRANSIT_OLD_TASK_FRAGMENT_OPEN,
|
assertEquals(TRANSIT_OLD_TASK_FRAGMENT_OPEN,
|
||||||
AppTransitionController.getTransitCompatType(mDisplayContent.mAppTransition,
|
AppTransitionController.getTransitCompatType(mDisplayContent.mAppTransition,
|
||||||
mDisplayContent.mOpeningApps, mDisplayContent.mClosingApps,
|
mDisplayContent.mOpeningApps, mDisplayContent.mClosingApps,
|
||||||
null /* wallpaperTarget */, null /* oldWallpaper */,
|
mDisplayContent.mChangingContainers, null /* wallpaperTarget */,
|
||||||
false /* skipAppTransitionAnimation */));
|
null /* oldWallpaper */, false /* skipAppTransitionAnimation */));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@@ -175,8 +216,8 @@ public class AppTransitionTests extends WindowTestsBase {
|
|||||||
assertEquals(TRANSIT_OLD_TASK_FRAGMENT_OPEN,
|
assertEquals(TRANSIT_OLD_TASK_FRAGMENT_OPEN,
|
||||||
AppTransitionController.getTransitCompatType(mDisplayContent.mAppTransition,
|
AppTransitionController.getTransitCompatType(mDisplayContent.mAppTransition,
|
||||||
mDisplayContent.mOpeningApps, mDisplayContent.mClosingApps,
|
mDisplayContent.mOpeningApps, mDisplayContent.mClosingApps,
|
||||||
null /* wallpaperTarget */, null /* oldWallpaper */,
|
mDisplayContent.mChangingContainers, null /* wallpaperTarget */,
|
||||||
false /* skipAppTransitionAnimation */));
|
null /* oldWallpaper */, false /* skipAppTransitionAnimation */));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@@ -190,8 +231,8 @@ public class AppTransitionTests extends WindowTestsBase {
|
|||||||
assertEquals(TRANSIT_OLD_TASK_FRAGMENT_CLOSE,
|
assertEquals(TRANSIT_OLD_TASK_FRAGMENT_CLOSE,
|
||||||
AppTransitionController.getTransitCompatType(mDisplayContent.mAppTransition,
|
AppTransitionController.getTransitCompatType(mDisplayContent.mAppTransition,
|
||||||
mDisplayContent.mOpeningApps, mDisplayContent.mClosingApps,
|
mDisplayContent.mOpeningApps, mDisplayContent.mClosingApps,
|
||||||
null /* wallpaperTarget */, null /* oldWallpaper */,
|
mDisplayContent.mChangingContainers, null /* wallpaperTarget */,
|
||||||
false /* skipAppTransitionAnimation */));
|
null /* oldWallpaper */, false /* skipAppTransitionAnimation */));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@@ -205,8 +246,8 @@ public class AppTransitionTests extends WindowTestsBase {
|
|||||||
assertEquals(TRANSIT_OLD_TASK_FRAGMENT_CLOSE,
|
assertEquals(TRANSIT_OLD_TASK_FRAGMENT_CLOSE,
|
||||||
AppTransitionController.getTransitCompatType(mDisplayContent.mAppTransition,
|
AppTransitionController.getTransitCompatType(mDisplayContent.mAppTransition,
|
||||||
mDisplayContent.mOpeningApps, mDisplayContent.mClosingApps,
|
mDisplayContent.mOpeningApps, mDisplayContent.mClosingApps,
|
||||||
null /* wallpaperTarget */, null /* oldWallpaper */,
|
mDisplayContent.mChangingContainers, null /* wallpaperTarget */,
|
||||||
false /* skipAppTransitionAnimation */));
|
null /* oldWallpaper */, false /* skipAppTransitionAnimation */));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user