Change launch change requirement within DesktopAppLaunchAnimatorHelper
Add freeform check and update logs Return early instead of crashing if a launch change is not available Bug: 395495925 Flag: NONE only adding logs, not change of actual code Test: DesktopAppLaunchAnimatorHelperTest Change-Id: I0d51c563a26e7d6020222cb84757e0ea8d561d69
This commit is contained in:
@@ -64,18 +64,13 @@ class DesktopAppLaunchAnimatorHelper(
|
||||
|
||||
fun createAnimators(info: TransitionInfo, finishCallback: (Animator) -> Unit): List<Animator> {
|
||||
val launchChange = getLaunchChange(info)
|
||||
requireNotNull(launchChange) {
|
||||
val changesString =
|
||||
if (launchChange == null) {
|
||||
val tasksInfo =
|
||||
info.changes.joinToString(", ") { change ->
|
||||
"Change: mode=${change.mode}, " +
|
||||
"taskId=${change.taskInfo?.id}, " +
|
||||
"isFreeform=${change.taskInfo?.isFreeform}"
|
||||
"${change.taskInfo?.taskId}:${change.taskInfo?.isFreeform}"
|
||||
}
|
||||
Log.e(
|
||||
TAG,
|
||||
"No launch change found: Transition type=${info.type}, changes=$changesString",
|
||||
)
|
||||
"expected an app launch Change"
|
||||
Log.e(TAG, "No launch change found: Transition info=$info, tasks state=$tasksInfo")
|
||||
return emptyList()
|
||||
}
|
||||
|
||||
val transaction = transactionSupplier.get()
|
||||
@@ -105,10 +100,14 @@ class DesktopAppLaunchAnimatorHelper(
|
||||
}
|
||||
|
||||
private fun getLaunchChange(info: TransitionInfo): Change? =
|
||||
info.changes.firstOrNull { change -> change.mode in LAUNCH_CHANGE_MODES }
|
||||
info.changes.firstOrNull { change ->
|
||||
change.mode in LAUNCH_CHANGE_MODES && change.taskInfo?.isFreeform == true
|
||||
}
|
||||
|
||||
private fun getMinimizeChange(info: TransitionInfo): Change? =
|
||||
info.changes.firstOrNull { change -> change.mode == TRANSIT_TO_BACK }
|
||||
info.changes.firstOrNull { change ->
|
||||
change.mode == TRANSIT_TO_BACK && change.taskInfo?.isFreeform == true
|
||||
}
|
||||
|
||||
private fun getTrampolineCloseChange(info: TransitionInfo): Change? {
|
||||
if (
|
||||
|
||||
@@ -84,6 +84,10 @@ constructor(
|
||||
if (animators.isEmpty()) finishedCallback.run()
|
||||
}
|
||||
animators += animatorHelper.createAnimators(info, animatorFinishedCallback)
|
||||
if (animators.isEmpty()) {
|
||||
finishedCallback.run()
|
||||
return
|
||||
}
|
||||
animators.forEach { it.start() }
|
||||
}
|
||||
|
||||
|
||||
@@ -1574,6 +1574,7 @@ public class TaskbarActivityContext extends BaseTaskbarContext {
|
||||
public boolean canUnminimizeDesktopTask(int taskId) {
|
||||
BubbleTextView.RunningAppState runningAppState =
|
||||
mControllers.taskbarRecentAppsController.getRunningAppState(taskId);
|
||||
Log.d(TAG, "Task id=" + taskId + ", Running app state=" + runningAppState);
|
||||
return runningAppState == RunningAppState.MINIMIZED
|
||||
&& DesktopModeFlags.ENABLE_DESKTOP_APP_LAUNCH_ALTTAB_TRANSITIONS_BUGFIX.isTrue();
|
||||
}
|
||||
|
||||
+15
@@ -92,6 +92,21 @@ class DesktopAppLaunchAnimatorHelperTest {
|
||||
assertLaunchAnimator(actual[0])
|
||||
}
|
||||
|
||||
@Test
|
||||
fun noLaunchTransition_returnsEmptyAnimatorsList() {
|
||||
val pipChange =
|
||||
TransitionInfo.Change(mock(), mock()).apply {
|
||||
mode = WindowManager.TRANSIT_PIP
|
||||
taskInfo = TASK_INFO_FREEFORM
|
||||
}
|
||||
val transitionInfo = TransitionInfo(WindowManager.TRANSIT_NONE, 0)
|
||||
transitionInfo.addChange(pipChange)
|
||||
|
||||
val actual = helper.createAnimators(transitionInfo, finishCallback = {})
|
||||
|
||||
assertThat(actual).hasSize(0)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun minimizeTransition_returnsLaunchAndMinimizeAnimator() {
|
||||
val openChange =
|
||||
|
||||
Reference in New Issue
Block a user