Loading libs/WindowManager/Shell/src/com/android/wm/shell/compatui/letterbox/LetterboxControllerStrategy.kt +9 −0 Original line number Diff line number Diff line Loading @@ -37,6 +37,9 @@ class LetterboxControllerStrategy @Inject constructor( @Volatile private var currentMode: LetterboxMode = SINGLE_SURFACE @Volatile private var supportsInputSurface: Boolean = false fun configureLetterboxMode(event: LetterboxLifecycleEvent) { // Decides whether to use a single surface or multiple surfaces for the letterbox. // The primary trade-off is memory usage versus rendering performance. Loading @@ -51,10 +54,16 @@ class LetterboxControllerStrategy @Inject constructor( letterboxConfiguration.isLetterboxActivityCornersRounded() -> SINGLE_SURFACE else -> MULTIPLE_SURFACES } supportsInputSurface = event.supportsInput } /** * @return The specific mode to use for implementing letterboxing for the given [request]. */ fun getLetterboxImplementationMode(): LetterboxMode = currentMode /** * Tells if the input surface should be created or not. This enabled reachability. */ fun shouldSupportInputSurface(): Boolean = supportsInputSurface } libs/WindowManager/Shell/src/com/android/wm/shell/compatui/letterbox/MixedLetterboxController.kt +6 −2 Original line number Diff line number Diff line Loading @@ -33,7 +33,7 @@ class MixedLetterboxController @Inject constructor( private val singleSurfaceController: SingleSurfaceLetterboxController, private val multipleSurfaceController: MultiSurfaceLetterboxController, private val controllerStrategy: LetterboxControllerStrategy, private val inputController: LetterboxInputController private val inputController: LetterboxInputController, ) : LetterboxController by singleSurfaceController.append(multipleSurfaceController) .append(inputController) { Loading @@ -59,6 +59,10 @@ class MixedLetterboxController @Inject constructor( ) } } if (controllerStrategy.shouldSupportInputSurface()) { inputController.createLetterboxSurface(key, transaction, parentLeash, token) } else { inputController.destroyLetterboxSurface(key, transaction) } } } libs/WindowManager/Shell/src/com/android/wm/shell/compatui/letterbox/lifecycle/ActivityLetterboxLifecycleEventFactory.kt +5 −2 Original line number Diff line number Diff line Loading @@ -19,6 +19,7 @@ package com.android.wm.shell.compatui.letterbox.lifecycle import android.graphics.Rect import android.window.TransitionInfo.Change import com.android.internal.protolog.ProtoLog import com.android.wm.shell.compatui.letterbox.config.LetterboxDependenciesHelper import com.android.wm.shell.compatui.letterbox.state.LetterboxTaskInfoRepository import com.android.wm.shell.protolog.ShellProtoLogGroup.WM_SHELL_APP_COMPAT Loading @@ -27,7 +28,8 @@ import com.android.wm.shell.protolog.ShellProtoLogGroup.WM_SHELL_APP_COMPAT * a [TransitionInfo.Change] using a [ActivityTransitionInfo] when present. */ class ActivityLetterboxLifecycleEventFactory( private val taskRepository: LetterboxTaskInfoRepository private val taskRepository: LetterboxTaskInfoRepository, private val letterboxDependenciesHelper: LetterboxDependenciesHelper ) : LetterboxLifecycleEventFactory { companion object { Loading Loading @@ -65,7 +67,8 @@ class ActivityLetterboxLifecycleEventFactory( letterboxBounds = letterboxBounds, taskLeash = taskItem.containerLeash, containerToken = taskItem.containerToken, isTranslucent = change.isTranslucent() isTranslucent = change.isTranslucent(), supportsInput = letterboxDependenciesHelper.shouldSupportInputSurface(change) ) } ProtoLog.w(WM_SHELL_APP_COMPAT, "$TAG: Task not found for taskId: $taskId") Loading libs/WindowManager/Shell/src/com/android/wm/shell/compatui/letterbox/lifecycle/LetterboxLifecycleEvent.kt +2 −1 Original line number Diff line number Diff line Loading @@ -46,7 +46,8 @@ data class LetterboxLifecycleEvent( val containerToken: WindowContainerToken? = null, val taskLeash: SurfaceControl? = null, val isBubble: Boolean = false, val isTranslucent: Boolean = false val isTranslucent: Boolean = false, val supportsInput: Boolean = true ) /** Loading libs/WindowManager/Shell/src/com/android/wm/shell/compatui/letterbox/lifecycle/TaskInfoLetterboxLifecycleEventFactory.kt +6 −2 Original line number Diff line number Diff line Loading @@ -18,12 +18,15 @@ package com.android.wm.shell.compatui.letterbox.lifecycle import android.graphics.Rect import android.window.TransitionInfo.Change import com.android.wm.shell.compatui.letterbox.config.LetterboxDependenciesHelper /** * [LetterboxLifecycleEventFactory] implementation which creates a [LetterboxLifecycleEvent] from * a [TransitionInfo.Change] using a [TaskInfo] when present. */ class TaskInfoLetterboxLifecycleEventFactory : LetterboxLifecycleEventFactory { class TaskInfoLetterboxLifecycleEventFactory( private val letterboxDependenciesHelper: LetterboxDependenciesHelper ) : LetterboxLifecycleEventFactory { override fun canHandle(change: Change): Boolean = change.taskInfo != null override fun createLifecycleEvent(change: Change): LetterboxLifecycleEvent? { Loading Loading @@ -51,7 +54,8 @@ class TaskInfoLetterboxLifecycleEventFactory : LetterboxLifecycleEventFactory { containerToken = ti.token, taskLeash = change.leash, isBubble = ti.isAppBubble, isTranslucent = change.isTranslucent() isTranslucent = change.isTranslucent(), supportsInput = letterboxDependenciesHelper.shouldSupportInputSurface(change) ) } return null Loading Loading
libs/WindowManager/Shell/src/com/android/wm/shell/compatui/letterbox/LetterboxControllerStrategy.kt +9 −0 Original line number Diff line number Diff line Loading @@ -37,6 +37,9 @@ class LetterboxControllerStrategy @Inject constructor( @Volatile private var currentMode: LetterboxMode = SINGLE_SURFACE @Volatile private var supportsInputSurface: Boolean = false fun configureLetterboxMode(event: LetterboxLifecycleEvent) { // Decides whether to use a single surface or multiple surfaces for the letterbox. // The primary trade-off is memory usage versus rendering performance. Loading @@ -51,10 +54,16 @@ class LetterboxControllerStrategy @Inject constructor( letterboxConfiguration.isLetterboxActivityCornersRounded() -> SINGLE_SURFACE else -> MULTIPLE_SURFACES } supportsInputSurface = event.supportsInput } /** * @return The specific mode to use for implementing letterboxing for the given [request]. */ fun getLetterboxImplementationMode(): LetterboxMode = currentMode /** * Tells if the input surface should be created or not. This enabled reachability. */ fun shouldSupportInputSurface(): Boolean = supportsInputSurface }
libs/WindowManager/Shell/src/com/android/wm/shell/compatui/letterbox/MixedLetterboxController.kt +6 −2 Original line number Diff line number Diff line Loading @@ -33,7 +33,7 @@ class MixedLetterboxController @Inject constructor( private val singleSurfaceController: SingleSurfaceLetterboxController, private val multipleSurfaceController: MultiSurfaceLetterboxController, private val controllerStrategy: LetterboxControllerStrategy, private val inputController: LetterboxInputController private val inputController: LetterboxInputController, ) : LetterboxController by singleSurfaceController.append(multipleSurfaceController) .append(inputController) { Loading @@ -59,6 +59,10 @@ class MixedLetterboxController @Inject constructor( ) } } if (controllerStrategy.shouldSupportInputSurface()) { inputController.createLetterboxSurface(key, transaction, parentLeash, token) } else { inputController.destroyLetterboxSurface(key, transaction) } } }
libs/WindowManager/Shell/src/com/android/wm/shell/compatui/letterbox/lifecycle/ActivityLetterboxLifecycleEventFactory.kt +5 −2 Original line number Diff line number Diff line Loading @@ -19,6 +19,7 @@ package com.android.wm.shell.compatui.letterbox.lifecycle import android.graphics.Rect import android.window.TransitionInfo.Change import com.android.internal.protolog.ProtoLog import com.android.wm.shell.compatui.letterbox.config.LetterboxDependenciesHelper import com.android.wm.shell.compatui.letterbox.state.LetterboxTaskInfoRepository import com.android.wm.shell.protolog.ShellProtoLogGroup.WM_SHELL_APP_COMPAT Loading @@ -27,7 +28,8 @@ import com.android.wm.shell.protolog.ShellProtoLogGroup.WM_SHELL_APP_COMPAT * a [TransitionInfo.Change] using a [ActivityTransitionInfo] when present. */ class ActivityLetterboxLifecycleEventFactory( private val taskRepository: LetterboxTaskInfoRepository private val taskRepository: LetterboxTaskInfoRepository, private val letterboxDependenciesHelper: LetterboxDependenciesHelper ) : LetterboxLifecycleEventFactory { companion object { Loading Loading @@ -65,7 +67,8 @@ class ActivityLetterboxLifecycleEventFactory( letterboxBounds = letterboxBounds, taskLeash = taskItem.containerLeash, containerToken = taskItem.containerToken, isTranslucent = change.isTranslucent() isTranslucent = change.isTranslucent(), supportsInput = letterboxDependenciesHelper.shouldSupportInputSurface(change) ) } ProtoLog.w(WM_SHELL_APP_COMPAT, "$TAG: Task not found for taskId: $taskId") Loading
libs/WindowManager/Shell/src/com/android/wm/shell/compatui/letterbox/lifecycle/LetterboxLifecycleEvent.kt +2 −1 Original line number Diff line number Diff line Loading @@ -46,7 +46,8 @@ data class LetterboxLifecycleEvent( val containerToken: WindowContainerToken? = null, val taskLeash: SurfaceControl? = null, val isBubble: Boolean = false, val isTranslucent: Boolean = false val isTranslucent: Boolean = false, val supportsInput: Boolean = true ) /** Loading
libs/WindowManager/Shell/src/com/android/wm/shell/compatui/letterbox/lifecycle/TaskInfoLetterboxLifecycleEventFactory.kt +6 −2 Original line number Diff line number Diff line Loading @@ -18,12 +18,15 @@ package com.android.wm.shell.compatui.letterbox.lifecycle import android.graphics.Rect import android.window.TransitionInfo.Change import com.android.wm.shell.compatui.letterbox.config.LetterboxDependenciesHelper /** * [LetterboxLifecycleEventFactory] implementation which creates a [LetterboxLifecycleEvent] from * a [TransitionInfo.Change] using a [TaskInfo] when present. */ class TaskInfoLetterboxLifecycleEventFactory : LetterboxLifecycleEventFactory { class TaskInfoLetterboxLifecycleEventFactory( private val letterboxDependenciesHelper: LetterboxDependenciesHelper ) : LetterboxLifecycleEventFactory { override fun canHandle(change: Change): Boolean = change.taskInfo != null override fun createLifecycleEvent(change: Change): LetterboxLifecycleEvent? { Loading Loading @@ -51,7 +54,8 @@ class TaskInfoLetterboxLifecycleEventFactory : LetterboxLifecycleEventFactory { containerToken = ti.token, taskLeash = change.leash, isBubble = ti.isAppBubble, isTranslucent = change.isTranslucent() isTranslucent = change.isTranslucent(), supportsInput = letterboxDependenciesHelper.shouldSupportInputSurface(change) ) } return null Loading