Loading packages/SystemUI/src/com/android/systemui/dagger/SystemUIModule.java +2 −0 Original line number Diff line number Diff line Loading @@ -111,6 +111,7 @@ import com.android.systemui.startable.Dependencies; import com.android.systemui.statusbar.CommandQueue; import com.android.systemui.statusbar.NotificationLockscreenUserManager; import com.android.systemui.statusbar.NotificationShadeWindowController; import com.android.systemui.statusbar.chips.StatusBarChipsModule; import com.android.systemui.statusbar.connectivity.ConnectivityModule; import com.android.systemui.statusbar.dagger.StatusBarModule; import com.android.systemui.statusbar.disableflags.dagger.DisableFlagsModule; Loading Loading @@ -245,6 +246,7 @@ import javax.inject.Named; SmartspaceModule.class, StatusBarEventsModule.class, StatusBarModule.class, StatusBarChipsModule.class, StatusBarPipelineModule.class, StatusBarPolicyModule.class, StatusBarViewBinderModule.class, Loading packages/SystemUI/src/com/android/systemui/statusbar/chips/StatusBarChipsLog.kt 0 → 100644 +25 −0 Original line number Diff line number Diff line /* * Copyright (C) 2024 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.android.systemui.statusbar.chips import javax.inject.Qualifier /** Logs for events related to the status bar chips. */ @Qualifier @MustBeDocumented @Retention(AnnotationRetention.RUNTIME) annotation class StatusBarChipsLog packages/SystemUI/src/com/android/systemui/statusbar/chips/StatusBarChipsModule.kt 0 → 100644 +35 −0 Original line number Diff line number Diff line /* * Copyright (C) 2024 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.android.systemui.statusbar.chips import com.android.systemui.dagger.SysUISingleton import com.android.systemui.log.LogBuffer import com.android.systemui.log.LogBufferFactory import dagger.Module import dagger.Provides @Module abstract class StatusBarChipsModule { companion object { @Provides @SysUISingleton @StatusBarChipsLog fun provideChipsLogBuffer(factory: LogBufferFactory): LogBuffer { return factory.create("StatusBarChips", 200) } } } packages/SystemUI/src/com/android/systemui/statusbar/chips/call/domain/interactor/CallChipInteractor.kt +22 −1 Original line number Diff line number Diff line Loading @@ -17,15 +17,36 @@ package com.android.systemui.statusbar.chips.call.domain.interactor import com.android.systemui.dagger.SysUISingleton import com.android.systemui.dagger.qualifiers.Application import com.android.systemui.log.LogBuffer import com.android.systemui.log.core.LogLevel import com.android.systemui.statusbar.chips.StatusBarChipsLog import com.android.systemui.statusbar.phone.ongoingcall.data.repository.OngoingCallRepository import com.android.systemui.statusbar.phone.ongoingcall.shared.model.OngoingCallModel import javax.inject.Inject import kotlinx.coroutines.CoroutineScope import kotlinx.coroutines.flow.SharingStarted import kotlinx.coroutines.flow.StateFlow import kotlinx.coroutines.flow.onEach import kotlinx.coroutines.flow.stateIn /** Interactor for the ongoing phone call chip shown in the status bar. */ @SysUISingleton class CallChipInteractor @Inject constructor( @Application private val scope: CoroutineScope, repository: OngoingCallRepository, @StatusBarChipsLog private val logger: LogBuffer, ) { val ongoingCallState = repository.ongoingCallState val ongoingCallState: StateFlow<OngoingCallModel> = repository.ongoingCallState .onEach { logger.log(TAG, LogLevel.INFO, { str1 = it::class.simpleName }, { "State: $str1" }) } .stateIn(scope, SharingStarted.Lazily, OngoingCallModel.NoCall) companion object { private const val TAG = "OngoingCall" } } packages/SystemUI/src/com/android/systemui/statusbar/chips/mediaprojection/domain/interactor/MediaProjectionChipInteractor.kt +21 −1 Original line number Diff line number Diff line Loading @@ -19,8 +19,11 @@ package com.android.systemui.statusbar.chips.mediaprojection.domain.interactor import android.content.pm.PackageManager import com.android.systemui.dagger.SysUISingleton import com.android.systemui.dagger.qualifiers.Application import com.android.systemui.log.LogBuffer import com.android.systemui.log.core.LogLevel import com.android.systemui.mediaprojection.data.model.MediaProjectionState import com.android.systemui.mediaprojection.data.repository.MediaProjectionRepository import com.android.systemui.statusbar.chips.StatusBarChipsLog import com.android.systemui.statusbar.chips.mediaprojection.domain.model.ProjectionChipModel import com.android.systemui.util.Utils import javax.inject.Inject Loading @@ -45,12 +48,16 @@ constructor( @Application private val scope: CoroutineScope, private val mediaProjectionRepository: MediaProjectionRepository, private val packageManager: PackageManager, @StatusBarChipsLog private val logger: LogBuffer, ) { val projection: StateFlow<ProjectionChipModel> = mediaProjectionRepository.mediaProjectionState .map { state -> when (state) { is MediaProjectionState.NotProjecting -> ProjectionChipModel.NotProjecting is MediaProjectionState.NotProjecting -> { logger.log(TAG, LogLevel.INFO, {}, { "State: NotProjecting" }) ProjectionChipModel.NotProjecting } is MediaProjectionState.Projecting -> { val type = if (isProjectionToOtherDevice(state.hostPackage)) { Loading @@ -58,6 +65,15 @@ constructor( } else { ProjectionChipModel.Type.SHARE_TO_APP } logger.log( TAG, LogLevel.INFO, { str1 = type.name str2 = state.hostPackage }, { "State: Projecting(type=$str1 hostPackage=$str2)" } ) ProjectionChipModel.Projecting(type, state) } } Loading @@ -81,4 +97,8 @@ constructor( // marked as going to a different device, even if that isn't always true. See b/321078669. return Utils.isHeadlessRemoteDisplayProvider(packageManager, packageName) } companion object { private const val TAG = "MediaProjection" } } Loading
packages/SystemUI/src/com/android/systemui/dagger/SystemUIModule.java +2 −0 Original line number Diff line number Diff line Loading @@ -111,6 +111,7 @@ import com.android.systemui.startable.Dependencies; import com.android.systemui.statusbar.CommandQueue; import com.android.systemui.statusbar.NotificationLockscreenUserManager; import com.android.systemui.statusbar.NotificationShadeWindowController; import com.android.systemui.statusbar.chips.StatusBarChipsModule; import com.android.systemui.statusbar.connectivity.ConnectivityModule; import com.android.systemui.statusbar.dagger.StatusBarModule; import com.android.systemui.statusbar.disableflags.dagger.DisableFlagsModule; Loading Loading @@ -245,6 +246,7 @@ import javax.inject.Named; SmartspaceModule.class, StatusBarEventsModule.class, StatusBarModule.class, StatusBarChipsModule.class, StatusBarPipelineModule.class, StatusBarPolicyModule.class, StatusBarViewBinderModule.class, Loading
packages/SystemUI/src/com/android/systemui/statusbar/chips/StatusBarChipsLog.kt 0 → 100644 +25 −0 Original line number Diff line number Diff line /* * Copyright (C) 2024 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.android.systemui.statusbar.chips import javax.inject.Qualifier /** Logs for events related to the status bar chips. */ @Qualifier @MustBeDocumented @Retention(AnnotationRetention.RUNTIME) annotation class StatusBarChipsLog
packages/SystemUI/src/com/android/systemui/statusbar/chips/StatusBarChipsModule.kt 0 → 100644 +35 −0 Original line number Diff line number Diff line /* * Copyright (C) 2024 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.android.systemui.statusbar.chips import com.android.systemui.dagger.SysUISingleton import com.android.systemui.log.LogBuffer import com.android.systemui.log.LogBufferFactory import dagger.Module import dagger.Provides @Module abstract class StatusBarChipsModule { companion object { @Provides @SysUISingleton @StatusBarChipsLog fun provideChipsLogBuffer(factory: LogBufferFactory): LogBuffer { return factory.create("StatusBarChips", 200) } } }
packages/SystemUI/src/com/android/systemui/statusbar/chips/call/domain/interactor/CallChipInteractor.kt +22 −1 Original line number Diff line number Diff line Loading @@ -17,15 +17,36 @@ package com.android.systemui.statusbar.chips.call.domain.interactor import com.android.systemui.dagger.SysUISingleton import com.android.systemui.dagger.qualifiers.Application import com.android.systemui.log.LogBuffer import com.android.systemui.log.core.LogLevel import com.android.systemui.statusbar.chips.StatusBarChipsLog import com.android.systemui.statusbar.phone.ongoingcall.data.repository.OngoingCallRepository import com.android.systemui.statusbar.phone.ongoingcall.shared.model.OngoingCallModel import javax.inject.Inject import kotlinx.coroutines.CoroutineScope import kotlinx.coroutines.flow.SharingStarted import kotlinx.coroutines.flow.StateFlow import kotlinx.coroutines.flow.onEach import kotlinx.coroutines.flow.stateIn /** Interactor for the ongoing phone call chip shown in the status bar. */ @SysUISingleton class CallChipInteractor @Inject constructor( @Application private val scope: CoroutineScope, repository: OngoingCallRepository, @StatusBarChipsLog private val logger: LogBuffer, ) { val ongoingCallState = repository.ongoingCallState val ongoingCallState: StateFlow<OngoingCallModel> = repository.ongoingCallState .onEach { logger.log(TAG, LogLevel.INFO, { str1 = it::class.simpleName }, { "State: $str1" }) } .stateIn(scope, SharingStarted.Lazily, OngoingCallModel.NoCall) companion object { private const val TAG = "OngoingCall" } }
packages/SystemUI/src/com/android/systemui/statusbar/chips/mediaprojection/domain/interactor/MediaProjectionChipInteractor.kt +21 −1 Original line number Diff line number Diff line Loading @@ -19,8 +19,11 @@ package com.android.systemui.statusbar.chips.mediaprojection.domain.interactor import android.content.pm.PackageManager import com.android.systemui.dagger.SysUISingleton import com.android.systemui.dagger.qualifiers.Application import com.android.systemui.log.LogBuffer import com.android.systemui.log.core.LogLevel import com.android.systemui.mediaprojection.data.model.MediaProjectionState import com.android.systemui.mediaprojection.data.repository.MediaProjectionRepository import com.android.systemui.statusbar.chips.StatusBarChipsLog import com.android.systemui.statusbar.chips.mediaprojection.domain.model.ProjectionChipModel import com.android.systemui.util.Utils import javax.inject.Inject Loading @@ -45,12 +48,16 @@ constructor( @Application private val scope: CoroutineScope, private val mediaProjectionRepository: MediaProjectionRepository, private val packageManager: PackageManager, @StatusBarChipsLog private val logger: LogBuffer, ) { val projection: StateFlow<ProjectionChipModel> = mediaProjectionRepository.mediaProjectionState .map { state -> when (state) { is MediaProjectionState.NotProjecting -> ProjectionChipModel.NotProjecting is MediaProjectionState.NotProjecting -> { logger.log(TAG, LogLevel.INFO, {}, { "State: NotProjecting" }) ProjectionChipModel.NotProjecting } is MediaProjectionState.Projecting -> { val type = if (isProjectionToOtherDevice(state.hostPackage)) { Loading @@ -58,6 +65,15 @@ constructor( } else { ProjectionChipModel.Type.SHARE_TO_APP } logger.log( TAG, LogLevel.INFO, { str1 = type.name str2 = state.hostPackage }, { "State: Projecting(type=$str1 hostPackage=$str2)" } ) ProjectionChipModel.Projecting(type, state) } } Loading @@ -81,4 +97,8 @@ constructor( // marked as going to a different device, even if that isn't always true. See b/321078669. return Utils.isHeadlessRemoteDisplayProvider(packageManager, packageName) } companion object { private const val TAG = "MediaProjection" } }