Loading libs/WindowManager/Shell/src/com/android/wm/shell/compatui/letterbox/lifecycle/ActivityLetterboxLifecycleEventFactory.kt +26 −15 Original line number Diff line number Diff line Loading @@ -17,7 +17,9 @@ package com.android.wm.shell.compatui.letterbox.lifecycle import android.window.TransitionInfo.Change import com.android.internal.protolog.ProtoLog import com.android.wm.shell.compatui.letterbox.state.LetterboxTaskInfoRepository import com.android.wm.shell.protolog.ShellProtoLogGroup.WM_SHELL_APP_COMPAT /** * [LetterboxLifecycleEventFactory] implementation which creates a [LetterboxLifecycleEvent] from Loading @@ -26,20 +28,26 @@ import com.android.wm.shell.compatui.letterbox.state.LetterboxTaskInfoRepository class ActivityLetterboxLifecycleEventFactory( private val taskRepository: LetterboxTaskInfoRepository ) : LetterboxLifecycleEventFactory { companion object { @JvmStatic private val TAG = "ActivityLetterboxLifecycleEventFactory" } override fun canHandle(change: Change): Boolean = change.activityTransitionInfo != null override fun createLifecycleEvent(change: Change): LetterboxLifecycleEvent { override fun createLifecycleEvent(change: Change): LetterboxLifecycleEvent? { val activityTransitionInfo = change.activityTransitionInfo val taskBounds = change.endAbsBounds val letterboxBoundsTmp = activityTransitionInfo?.appCompatTransitionInfo?.letterboxBounds val taskId = activityTransitionInfo?.taskId ?: -1 taskRepository.find(taskId)?.let { val isLetterboxed = letterboxBoundsTmp != taskBounds // Letterbox bounds are null when the activity is not letterboxed. val letterboxBounds = if (isLetterboxed) letterboxBoundsTmp else null val taskToken = taskRepository.find(taskId)?.containerToken val taskLeash = taskRepository.find(taskId)?.containerLeash val taskToken = it.containerToken val taskLeash = it.containerLeash return LetterboxLifecycleEvent( type = change.asLetterboxLifecycleEventType(), taskId = taskId, Loading @@ -49,4 +57,7 @@ class ActivityLetterboxLifecycleEventFactory( containerToken = taskToken ) } ProtoLog.w(WM_SHELL_APP_COMPAT, "$TAG: Task not found for taskId: $taskId") return null } } Loading
libs/WindowManager/Shell/src/com/android/wm/shell/compatui/letterbox/lifecycle/ActivityLetterboxLifecycleEventFactory.kt +26 −15 Original line number Diff line number Diff line Loading @@ -17,7 +17,9 @@ package com.android.wm.shell.compatui.letterbox.lifecycle import android.window.TransitionInfo.Change import com.android.internal.protolog.ProtoLog import com.android.wm.shell.compatui.letterbox.state.LetterboxTaskInfoRepository import com.android.wm.shell.protolog.ShellProtoLogGroup.WM_SHELL_APP_COMPAT /** * [LetterboxLifecycleEventFactory] implementation which creates a [LetterboxLifecycleEvent] from Loading @@ -26,20 +28,26 @@ import com.android.wm.shell.compatui.letterbox.state.LetterboxTaskInfoRepository class ActivityLetterboxLifecycleEventFactory( private val taskRepository: LetterboxTaskInfoRepository ) : LetterboxLifecycleEventFactory { companion object { @JvmStatic private val TAG = "ActivityLetterboxLifecycleEventFactory" } override fun canHandle(change: Change): Boolean = change.activityTransitionInfo != null override fun createLifecycleEvent(change: Change): LetterboxLifecycleEvent { override fun createLifecycleEvent(change: Change): LetterboxLifecycleEvent? { val activityTransitionInfo = change.activityTransitionInfo val taskBounds = change.endAbsBounds val letterboxBoundsTmp = activityTransitionInfo?.appCompatTransitionInfo?.letterboxBounds val taskId = activityTransitionInfo?.taskId ?: -1 taskRepository.find(taskId)?.let { val isLetterboxed = letterboxBoundsTmp != taskBounds // Letterbox bounds are null when the activity is not letterboxed. val letterboxBounds = if (isLetterboxed) letterboxBoundsTmp else null val taskToken = taskRepository.find(taskId)?.containerToken val taskLeash = taskRepository.find(taskId)?.containerLeash val taskToken = it.containerToken val taskLeash = it.containerLeash return LetterboxLifecycleEvent( type = change.asLetterboxLifecycleEventType(), taskId = taskId, Loading @@ -49,4 +57,7 @@ class ActivityLetterboxLifecycleEventFactory( containerToken = taskToken ) } ProtoLog.w(WM_SHELL_APP_COMPAT, "$TAG: Task not found for taskId: $taskId") return null } }