Loading core/java/android/app/TaskInfo.java +4 −1 Original line number Diff line number Diff line Loading @@ -275,7 +275,10 @@ public class TaskInfo { public int parentTaskId; /** * Whether this task is focused. * Whether this task is focused on the display. This means the task receives input events that * target the display. * CAUTION: This can be true for multiple tasks especially when multiple displays are connected * in the system. * @hide */ public boolean isFocused; Loading packages/SystemUI/src/com/android/systemui/display/data/repository/FocusedDisplayRepository.kt +5 −6 Original line number Diff line number Diff line Loading @@ -19,8 +19,7 @@ package com.android.systemui.display.data.repository import android.annotation.MainThread import android.view.Display.DEFAULT_DISPLAY import com.android.systemui.dagger.SysUISingleton import com.android.systemui.dagger.qualifiers.Application import com.android.systemui.dagger.qualifiers.Main import com.android.systemui.dagger.qualifiers.Background import com.android.systemui.log.LogBuffer import com.android.systemui.log.core.LogLevel import com.android.systemui.log.dagger.FocusedDisplayRepoLog Loading @@ -43,15 +42,15 @@ import kotlinx.coroutines.flow.stateIn class FocusedDisplayRepository @Inject constructor( @Application val scope: CoroutineScope, @Main private val mainExecutor: Executor, @Background val backgroundScope: CoroutineScope, @Background private val backgroundExecutor: Executor, transitions: ShellTransitions, @FocusedDisplayRepoLog logBuffer: LogBuffer, ) { val focusedTask: Flow<Int> = conflatedCallbackFlow { val listener = FocusTransitionListener { displayId -> trySend(displayId) } transitions.setFocusTransitionListener(listener, mainExecutor) transitions.setFocusTransitionListener(listener, backgroundExecutor) awaitClose { transitions.unsetFocusTransitionListener(listener) } } .onEach { Loading @@ -65,5 +64,5 @@ constructor( /** Provides the currently focused display. */ val focusedDisplayId: StateFlow<Int> get() = focusedTask.stateIn(scope, SharingStarted.Eagerly, DEFAULT_DISPLAY) get() = focusedTask.stateIn(backgroundScope, SharingStarted.Eagerly, DEFAULT_DISPLAY) } Loading
core/java/android/app/TaskInfo.java +4 −1 Original line number Diff line number Diff line Loading @@ -275,7 +275,10 @@ public class TaskInfo { public int parentTaskId; /** * Whether this task is focused. * Whether this task is focused on the display. This means the task receives input events that * target the display. * CAUTION: This can be true for multiple tasks especially when multiple displays are connected * in the system. * @hide */ public boolean isFocused; Loading
packages/SystemUI/src/com/android/systemui/display/data/repository/FocusedDisplayRepository.kt +5 −6 Original line number Diff line number Diff line Loading @@ -19,8 +19,7 @@ package com.android.systemui.display.data.repository import android.annotation.MainThread import android.view.Display.DEFAULT_DISPLAY import com.android.systemui.dagger.SysUISingleton import com.android.systemui.dagger.qualifiers.Application import com.android.systemui.dagger.qualifiers.Main import com.android.systemui.dagger.qualifiers.Background import com.android.systemui.log.LogBuffer import com.android.systemui.log.core.LogLevel import com.android.systemui.log.dagger.FocusedDisplayRepoLog Loading @@ -43,15 +42,15 @@ import kotlinx.coroutines.flow.stateIn class FocusedDisplayRepository @Inject constructor( @Application val scope: CoroutineScope, @Main private val mainExecutor: Executor, @Background val backgroundScope: CoroutineScope, @Background private val backgroundExecutor: Executor, transitions: ShellTransitions, @FocusedDisplayRepoLog logBuffer: LogBuffer, ) { val focusedTask: Flow<Int> = conflatedCallbackFlow { val listener = FocusTransitionListener { displayId -> trySend(displayId) } transitions.setFocusTransitionListener(listener, mainExecutor) transitions.setFocusTransitionListener(listener, backgroundExecutor) awaitClose { transitions.unsetFocusTransitionListener(listener) } } .onEach { Loading @@ -65,5 +64,5 @@ constructor( /** Provides the currently focused display. */ val focusedDisplayId: StateFlow<Int> get() = focusedTask.stateIn(scope, SharingStarted.Eagerly, DEFAULT_DISPLAY) get() = focusedTask.stateIn(backgroundScope, SharingStarted.Eagerly, DEFAULT_DISPLAY) }