Loading libs/WindowManager/Shell/src/com/android/wm/shell/desktopmode/DesktopMinimizationTransitionHandler.kt +9 −2 Original line number Diff line number Diff line Loading @@ -21,6 +21,7 @@ import android.app.WindowConfiguration.WINDOWING_MODE_FREEFORM import android.os.Handler import android.os.IBinder import android.view.SurfaceControl.Transaction import android.view.WindowManager.TRANSIT_TO_BACK import android.window.TransitionInfo import android.window.TransitionRequestInfo import android.window.WindowContainerTransaction Loading Loading @@ -61,7 +62,9 @@ class DesktopMinimizationTransitionHandler( finishTransaction: Transaction, finishCallback: Transitions.TransitionFinishCallback, ): Boolean { if (!TransitionUtil.isClosingType(info.type)) return false val shouldAnimate = TransitionUtil.isClosingType(info.type) || info.type == Transitions.TRANSIT_MINIMIZE if (!shouldAnimate) return false val animations = mutableListOf<Animator>() val onAnimFinish: (Animator) -> Unit = { animator -> Loading @@ -75,10 +78,14 @@ class DesktopMinimizationTransitionHandler( } } val checkChangeMode = { change: TransitionInfo.Change -> change.mode == info.type || (info.type == Transitions.TRANSIT_MINIMIZE && change.mode == TRANSIT_TO_BACK) } animations += info.changes .filter { it.mode == info.type && it.taskInfo?.windowingMode == WINDOWING_MODE_FREEFORM checkChangeMode(it) && it.taskInfo?.windowingMode == WINDOWING_MODE_FREEFORM } .mapNotNull { createMinimizeAnimation(it, finishTransaction, onAnimFinish) } if (animations.isEmpty()) return false Loading libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/desktopmode/DesktopMinimizationTransitionHandlerTest.kt +19 −0 Original line number Diff line number Diff line Loading @@ -33,6 +33,7 @@ import com.android.wm.shell.ShellTestCase import com.android.wm.shell.TestRunningTaskInfoBuilder import com.android.wm.shell.common.DisplayController import com.android.wm.shell.common.ShellExecutor import com.android.wm.shell.transition.Transitions import org.junit.Assert.assertFalse import org.junit.Assert.assertNull import org.junit.Assert.assertTrue Loading Loading @@ -154,6 +155,24 @@ class DesktopMinimizationTransitionHandlerTest : ShellTestCase() { assertTrue("Should animate going to back freeform task close transition", animates) } @Test fun startAnimation_minimizeTransitionToBackFreeformTask_returnsTrue() { val animates = handler.startAnimation( transition = mock(), info = createTransitionInfo( type = Transitions.TRANSIT_MINIMIZE, task = createTask(WINDOWING_MODE_FREEFORM), ), startTransaction = mock(), finishTransaction = mock(), finishCallback = {}, ) assertTrue("Should animate going to back freeform task minimize transition", animates) } private fun createTransitionInfo( type: Int = WindowManager.TRANSIT_TO_BACK, changeMode: Int = WindowManager.TRANSIT_TO_BACK, Loading Loading
libs/WindowManager/Shell/src/com/android/wm/shell/desktopmode/DesktopMinimizationTransitionHandler.kt +9 −2 Original line number Diff line number Diff line Loading @@ -21,6 +21,7 @@ import android.app.WindowConfiguration.WINDOWING_MODE_FREEFORM import android.os.Handler import android.os.IBinder import android.view.SurfaceControl.Transaction import android.view.WindowManager.TRANSIT_TO_BACK import android.window.TransitionInfo import android.window.TransitionRequestInfo import android.window.WindowContainerTransaction Loading Loading @@ -61,7 +62,9 @@ class DesktopMinimizationTransitionHandler( finishTransaction: Transaction, finishCallback: Transitions.TransitionFinishCallback, ): Boolean { if (!TransitionUtil.isClosingType(info.type)) return false val shouldAnimate = TransitionUtil.isClosingType(info.type) || info.type == Transitions.TRANSIT_MINIMIZE if (!shouldAnimate) return false val animations = mutableListOf<Animator>() val onAnimFinish: (Animator) -> Unit = { animator -> Loading @@ -75,10 +78,14 @@ class DesktopMinimizationTransitionHandler( } } val checkChangeMode = { change: TransitionInfo.Change -> change.mode == info.type || (info.type == Transitions.TRANSIT_MINIMIZE && change.mode == TRANSIT_TO_BACK) } animations += info.changes .filter { it.mode == info.type && it.taskInfo?.windowingMode == WINDOWING_MODE_FREEFORM checkChangeMode(it) && it.taskInfo?.windowingMode == WINDOWING_MODE_FREEFORM } .mapNotNull { createMinimizeAnimation(it, finishTransaction, onAnimFinish) } if (animations.isEmpty()) return false Loading
libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/desktopmode/DesktopMinimizationTransitionHandlerTest.kt +19 −0 Original line number Diff line number Diff line Loading @@ -33,6 +33,7 @@ import com.android.wm.shell.ShellTestCase import com.android.wm.shell.TestRunningTaskInfoBuilder import com.android.wm.shell.common.DisplayController import com.android.wm.shell.common.ShellExecutor import com.android.wm.shell.transition.Transitions import org.junit.Assert.assertFalse import org.junit.Assert.assertNull import org.junit.Assert.assertTrue Loading Loading @@ -154,6 +155,24 @@ class DesktopMinimizationTransitionHandlerTest : ShellTestCase() { assertTrue("Should animate going to back freeform task close transition", animates) } @Test fun startAnimation_minimizeTransitionToBackFreeformTask_returnsTrue() { val animates = handler.startAnimation( transition = mock(), info = createTransitionInfo( type = Transitions.TRANSIT_MINIMIZE, task = createTask(WINDOWING_MODE_FREEFORM), ), startTransaction = mock(), finishTransaction = mock(), finishCallback = {}, ) assertTrue("Should animate going to back freeform task minimize transition", animates) } private fun createTransitionInfo( type: Int = WindowManager.TRANSIT_TO_BACK, changeMode: Int = WindowManager.TRANSIT_TO_BACK, Loading