Loading libs/WindowManager/Shell/src/com/android/wm/shell/compatui/letterbox/LetterboxInputController.kt +6 −6 Original line number Diff line number Diff line Loading @@ -52,7 +52,7 @@ class LetterboxInputController @Inject constructor( private val TAG = "LetterboxInputController" } private val inputDetectorMap = mutableMapOf<LetterboxKey, LetterboxInputItems>() private val inputDetectorMap = mutableMapOf<Int, LetterboxInputItems>() override fun createLetterboxSurface( key: LetterboxKey, Loading @@ -60,7 +60,7 @@ class LetterboxInputController @Inject constructor( parentLeash: SurfaceControl, token: WindowContainerToken? ) { inputDetectorMap.runOnItem(key, onMissed = { k, m -> inputDetectorMap.runOnItem(key.taskId, onMissed = { k, m -> val gestureListener = listenerFactory.createReachabilityGestureListener(key.taskId, token) val detector = LetterboxInputDetector( Loading @@ -82,10 +82,10 @@ class LetterboxInputController @Inject constructor( transaction: Transaction ) { with(inputDetectorMap) { runOnItem(key, onFound = { item -> runOnItem(key.taskId, onFound = { item -> item.inputDetector.stop(transaction) }) remove(key) remove(key.taskId) } } Loading @@ -95,7 +95,7 @@ class LetterboxInputController @Inject constructor( visible: Boolean ) { with(inputDetectorMap) { runOnItem(key, onFound = { item -> runOnItem(key.taskId, onFound = { item -> item.inputDetector.updateVisibility(transaction, visible) }) } Loading @@ -107,7 +107,7 @@ class LetterboxInputController @Inject constructor( taskBounds: Rect, activityBounds: Rect ) { inputDetectorMap.runOnItem(key, onFound = { item -> inputDetectorMap.runOnItem(key.taskId, onFound = { item -> item.inputDetector.updateTouchableRegion(transaction, Region(taskBounds)) item.gestureListener.updateActivityBounds(activityBounds) }) Loading libs/WindowManager/Shell/src/com/android/wm/shell/compatui/letterbox/MultiSurfaceLetterboxController.kt +6 −6 Original line number Diff line number Diff line Loading @@ -40,7 +40,7 @@ class MultiSurfaceLetterboxController @Inject constructor( private val TAG = "MultiSurfaceLetterboxController" } private val letterboxMap = mutableMapOf<LetterboxKey, LetterboxSurfaces>() private val letterboxMap = mutableMapOf<Int, LetterboxSurfaces>() override fun createLetterboxSurface( key: LetterboxKey, Loading @@ -56,7 +56,7 @@ class MultiSurfaceLetterboxController @Inject constructor( "MultiSurfaceLetterboxController#createLetterboxSurface" ) } letterboxMap.runOnItem(key, onMissed = { k, m -> letterboxMap.runOnItem(key.taskId, onMissed = { k, m -> m[k] = LetterboxSurfaces( leftSurface = surfaceBuilderFn("Left"), topSurface = surfaceBuilderFn("Top"), Loading @@ -70,12 +70,12 @@ class MultiSurfaceLetterboxController @Inject constructor( key: LetterboxKey, transaction: Transaction ) { letterboxMap.runOnItem(key, onFound = { item -> letterboxMap.runOnItem(key.taskId, onFound = { item -> item.forEach { s -> s.remove(transaction) } }) letterboxMap.remove(key) letterboxMap.remove(key.taskId) } override fun updateLetterboxSurfaceVisibility( Loading @@ -83,7 +83,7 @@ class MultiSurfaceLetterboxController @Inject constructor( transaction: Transaction, visible: Boolean ) { letterboxMap.runOnItem(key, onFound = { item -> letterboxMap.runOnItem(key.taskId, onFound = { item -> item.forEach { s -> s.setVisibility(transaction, visible) } Loading @@ -96,7 +96,7 @@ class MultiSurfaceLetterboxController @Inject constructor( taskBounds: Rect, activityBounds: Rect ) { letterboxMap.runOnItem(key, onFound = { item -> letterboxMap.runOnItem(key.taskId, onFound = { item -> item.updateSurfacesBounds(transaction, taskBounds, activityBounds) }) } Loading libs/WindowManager/Shell/src/com/android/wm/shell/compatui/letterbox/SingleSurfaceLetterboxController.kt +6 −6 Original line number Diff line number Diff line Loading @@ -40,7 +40,7 @@ class SingleSurfaceLetterboxController @Inject constructor( private val TAG = "SingleSurfaceLetterboxController" } private val letterboxMap = mutableMapOf<LetterboxKey, SurfaceControl>() private val letterboxMap = mutableMapOf<Int, SurfaceControl>() /** * Creates a Letterbox Surface for a given displayId/taskId if it doesn't exist. Loading @@ -51,7 +51,7 @@ class SingleSurfaceLetterboxController @Inject constructor( parentLeash: SurfaceControl, token: WindowContainerToken? ) { letterboxMap.runOnItem(key, onMissed = { k, m -> letterboxMap.runOnItem(key.taskId, onMissed = { k, m -> m[k] = letterboxBuilder.createSurface( transaction, parentLeash, Loading @@ -68,12 +68,12 @@ class SingleSurfaceLetterboxController @Inject constructor( key: LetterboxKey, transaction: Transaction ) { letterboxMap.runOnItem(key, onFound = { item -> letterboxMap.runOnItem(key.taskId, onFound = { item -> item.run { transaction.remove(this) } }) letterboxMap.remove(key) letterboxMap.remove(key.taskId) } /** Loading @@ -84,7 +84,7 @@ class SingleSurfaceLetterboxController @Inject constructor( transaction: Transaction, visible: Boolean ) { letterboxMap.runOnItem(key, onFound = { item -> letterboxMap.runOnItem(key.taskId, onFound = { item -> item.run { transaction.setVisibility(this, visible) } Loading @@ -100,7 +100,7 @@ class SingleSurfaceLetterboxController @Inject constructor( taskBounds: Rect, activityBounds: Rect ) { letterboxMap.runOnItem(key, onFound = { item -> letterboxMap.runOnItem(key.taskId, onFound = { item -> item.run { transaction.moveAndCrop(this, taskBounds) } Loading libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/compatui/letterbox/LetterboxControllerRobotTest.kt +3 −0 Original line number Diff line number Diff line Loading @@ -39,6 +39,9 @@ abstract class LetterboxControllerRobotTest { @JvmStatic val TASK_ID = 20 @JvmStatic val ANOTHER_TASK_ID = 10 @JvmStatic private val TOKEN = mock<WindowContainerToken>() } Loading libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/compatui/letterbox/LetterboxInputControllerTest.kt +5 −6 Original line number Diff line number Diff line Loading @@ -28,6 +28,7 @@ import androidx.test.filters.SmallTest import com.android.wm.shell.ShellTestCase import com.android.wm.shell.common.suppliers.InputChannelSupplier import com.android.wm.shell.common.suppliers.WindowSessionSupplier import com.android.wm.shell.compatui.letterbox.LetterboxControllerRobotTest.Companion.ANOTHER_TASK_ID import com.android.wm.shell.compatui.letterbox.LetterboxMatchers.asAnyMode import com.android.wm.shell.compatui.letterbox.events.ReachabilityGestureListener import com.android.wm.shell.compatui.letterbox.events.ReachabilityGestureListenerFactory Loading Loading @@ -79,12 +80,10 @@ class LetterboxInputControllerTest : ShellTestCase() { runTestScenario { r -> r.sendCreateSurfaceRequest() r.sendCreateSurfaceRequest() r.sendCreateSurfaceRequest(displayId = 2) r.sendCreateSurfaceRequest(displayId = 2, taskId = 2) r.sendCreateSurfaceRequest(displayId = 2) r.sendCreateSurfaceRequest(displayId = 2, taskId = 2) r.sendCreateSurfaceRequest(taskId = ANOTHER_TASK_ID) r.sendCreateSurfaceRequest(taskId = ANOTHER_TASK_ID) r.checkInputSurfaceBuilderInvoked(times = 3) r.checkInputSurfaceBuilderInvoked(times = 2) } } Loading @@ -106,7 +105,7 @@ class LetterboxInputControllerTest : ShellTestCase() { runTestScenario { r -> r.sendCreateSurfaceRequest() r.sendUpdateSurfaceVisibilityRequest(visible = true) r.sendUpdateSurfaceVisibilityRequest(visible = true, displayId = 20) r.sendUpdateSurfaceVisibilityRequest(visible = true, taskId = ANOTHER_TASK_ID) r.checkVisibilityUpdated(expectedVisibility = true) } Loading Loading
libs/WindowManager/Shell/src/com/android/wm/shell/compatui/letterbox/LetterboxInputController.kt +6 −6 Original line number Diff line number Diff line Loading @@ -52,7 +52,7 @@ class LetterboxInputController @Inject constructor( private val TAG = "LetterboxInputController" } private val inputDetectorMap = mutableMapOf<LetterboxKey, LetterboxInputItems>() private val inputDetectorMap = mutableMapOf<Int, LetterboxInputItems>() override fun createLetterboxSurface( key: LetterboxKey, Loading @@ -60,7 +60,7 @@ class LetterboxInputController @Inject constructor( parentLeash: SurfaceControl, token: WindowContainerToken? ) { inputDetectorMap.runOnItem(key, onMissed = { k, m -> inputDetectorMap.runOnItem(key.taskId, onMissed = { k, m -> val gestureListener = listenerFactory.createReachabilityGestureListener(key.taskId, token) val detector = LetterboxInputDetector( Loading @@ -82,10 +82,10 @@ class LetterboxInputController @Inject constructor( transaction: Transaction ) { with(inputDetectorMap) { runOnItem(key, onFound = { item -> runOnItem(key.taskId, onFound = { item -> item.inputDetector.stop(transaction) }) remove(key) remove(key.taskId) } } Loading @@ -95,7 +95,7 @@ class LetterboxInputController @Inject constructor( visible: Boolean ) { with(inputDetectorMap) { runOnItem(key, onFound = { item -> runOnItem(key.taskId, onFound = { item -> item.inputDetector.updateVisibility(transaction, visible) }) } Loading @@ -107,7 +107,7 @@ class LetterboxInputController @Inject constructor( taskBounds: Rect, activityBounds: Rect ) { inputDetectorMap.runOnItem(key, onFound = { item -> inputDetectorMap.runOnItem(key.taskId, onFound = { item -> item.inputDetector.updateTouchableRegion(transaction, Region(taskBounds)) item.gestureListener.updateActivityBounds(activityBounds) }) Loading
libs/WindowManager/Shell/src/com/android/wm/shell/compatui/letterbox/MultiSurfaceLetterboxController.kt +6 −6 Original line number Diff line number Diff line Loading @@ -40,7 +40,7 @@ class MultiSurfaceLetterboxController @Inject constructor( private val TAG = "MultiSurfaceLetterboxController" } private val letterboxMap = mutableMapOf<LetterboxKey, LetterboxSurfaces>() private val letterboxMap = mutableMapOf<Int, LetterboxSurfaces>() override fun createLetterboxSurface( key: LetterboxKey, Loading @@ -56,7 +56,7 @@ class MultiSurfaceLetterboxController @Inject constructor( "MultiSurfaceLetterboxController#createLetterboxSurface" ) } letterboxMap.runOnItem(key, onMissed = { k, m -> letterboxMap.runOnItem(key.taskId, onMissed = { k, m -> m[k] = LetterboxSurfaces( leftSurface = surfaceBuilderFn("Left"), topSurface = surfaceBuilderFn("Top"), Loading @@ -70,12 +70,12 @@ class MultiSurfaceLetterboxController @Inject constructor( key: LetterboxKey, transaction: Transaction ) { letterboxMap.runOnItem(key, onFound = { item -> letterboxMap.runOnItem(key.taskId, onFound = { item -> item.forEach { s -> s.remove(transaction) } }) letterboxMap.remove(key) letterboxMap.remove(key.taskId) } override fun updateLetterboxSurfaceVisibility( Loading @@ -83,7 +83,7 @@ class MultiSurfaceLetterboxController @Inject constructor( transaction: Transaction, visible: Boolean ) { letterboxMap.runOnItem(key, onFound = { item -> letterboxMap.runOnItem(key.taskId, onFound = { item -> item.forEach { s -> s.setVisibility(transaction, visible) } Loading @@ -96,7 +96,7 @@ class MultiSurfaceLetterboxController @Inject constructor( taskBounds: Rect, activityBounds: Rect ) { letterboxMap.runOnItem(key, onFound = { item -> letterboxMap.runOnItem(key.taskId, onFound = { item -> item.updateSurfacesBounds(transaction, taskBounds, activityBounds) }) } Loading
libs/WindowManager/Shell/src/com/android/wm/shell/compatui/letterbox/SingleSurfaceLetterboxController.kt +6 −6 Original line number Diff line number Diff line Loading @@ -40,7 +40,7 @@ class SingleSurfaceLetterboxController @Inject constructor( private val TAG = "SingleSurfaceLetterboxController" } private val letterboxMap = mutableMapOf<LetterboxKey, SurfaceControl>() private val letterboxMap = mutableMapOf<Int, SurfaceControl>() /** * Creates a Letterbox Surface for a given displayId/taskId if it doesn't exist. Loading @@ -51,7 +51,7 @@ class SingleSurfaceLetterboxController @Inject constructor( parentLeash: SurfaceControl, token: WindowContainerToken? ) { letterboxMap.runOnItem(key, onMissed = { k, m -> letterboxMap.runOnItem(key.taskId, onMissed = { k, m -> m[k] = letterboxBuilder.createSurface( transaction, parentLeash, Loading @@ -68,12 +68,12 @@ class SingleSurfaceLetterboxController @Inject constructor( key: LetterboxKey, transaction: Transaction ) { letterboxMap.runOnItem(key, onFound = { item -> letterboxMap.runOnItem(key.taskId, onFound = { item -> item.run { transaction.remove(this) } }) letterboxMap.remove(key) letterboxMap.remove(key.taskId) } /** Loading @@ -84,7 +84,7 @@ class SingleSurfaceLetterboxController @Inject constructor( transaction: Transaction, visible: Boolean ) { letterboxMap.runOnItem(key, onFound = { item -> letterboxMap.runOnItem(key.taskId, onFound = { item -> item.run { transaction.setVisibility(this, visible) } Loading @@ -100,7 +100,7 @@ class SingleSurfaceLetterboxController @Inject constructor( taskBounds: Rect, activityBounds: Rect ) { letterboxMap.runOnItem(key, onFound = { item -> letterboxMap.runOnItem(key.taskId, onFound = { item -> item.run { transaction.moveAndCrop(this, taskBounds) } Loading
libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/compatui/letterbox/LetterboxControllerRobotTest.kt +3 −0 Original line number Diff line number Diff line Loading @@ -39,6 +39,9 @@ abstract class LetterboxControllerRobotTest { @JvmStatic val TASK_ID = 20 @JvmStatic val ANOTHER_TASK_ID = 10 @JvmStatic private val TOKEN = mock<WindowContainerToken>() } Loading
libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/compatui/letterbox/LetterboxInputControllerTest.kt +5 −6 Original line number Diff line number Diff line Loading @@ -28,6 +28,7 @@ import androidx.test.filters.SmallTest import com.android.wm.shell.ShellTestCase import com.android.wm.shell.common.suppliers.InputChannelSupplier import com.android.wm.shell.common.suppliers.WindowSessionSupplier import com.android.wm.shell.compatui.letterbox.LetterboxControllerRobotTest.Companion.ANOTHER_TASK_ID import com.android.wm.shell.compatui.letterbox.LetterboxMatchers.asAnyMode import com.android.wm.shell.compatui.letterbox.events.ReachabilityGestureListener import com.android.wm.shell.compatui.letterbox.events.ReachabilityGestureListenerFactory Loading Loading @@ -79,12 +80,10 @@ class LetterboxInputControllerTest : ShellTestCase() { runTestScenario { r -> r.sendCreateSurfaceRequest() r.sendCreateSurfaceRequest() r.sendCreateSurfaceRequest(displayId = 2) r.sendCreateSurfaceRequest(displayId = 2, taskId = 2) r.sendCreateSurfaceRequest(displayId = 2) r.sendCreateSurfaceRequest(displayId = 2, taskId = 2) r.sendCreateSurfaceRequest(taskId = ANOTHER_TASK_ID) r.sendCreateSurfaceRequest(taskId = ANOTHER_TASK_ID) r.checkInputSurfaceBuilderInvoked(times = 3) r.checkInputSurfaceBuilderInvoked(times = 2) } } Loading @@ -106,7 +105,7 @@ class LetterboxInputControllerTest : ShellTestCase() { runTestScenario { r -> r.sendCreateSurfaceRequest() r.sendUpdateSurfaceVisibilityRequest(visible = true) r.sendUpdateSurfaceVisibilityRequest(visible = true, displayId = 20) r.sendUpdateSurfaceVisibilityRequest(visible = true, taskId = ANOTHER_TASK_ID) r.checkVisibilityUpdated(expectedVisibility = true) } Loading