Loading packages/SystemUI/src/com/android/systemui/dagger/SystemUICoreStartableModule.kt +7 −0 Original line number Original line Diff line number Diff line Loading @@ -54,6 +54,7 @@ import com.android.systemui.statusbar.phone.StatusBarHeadsUpChangeListener import com.android.systemui.stylus.StylusUsiPowerStartable import com.android.systemui.stylus.StylusUsiPowerStartable import com.android.systemui.temporarydisplay.chipbar.ChipbarCoordinator import com.android.systemui.temporarydisplay.chipbar.ChipbarCoordinator import com.android.systemui.theme.ThemeOverlayController import com.android.systemui.theme.ThemeOverlayController import com.android.systemui.unfold.DisplaySwitchLatencyTracker import com.android.systemui.usb.StorageNotification import com.android.systemui.usb.StorageNotification import com.android.systemui.util.NotificationChannels import com.android.systemui.util.NotificationChannels import com.android.systemui.util.StartBinderLoggerModule import com.android.systemui.util.StartBinderLoggerModule Loading Loading @@ -141,6 +142,12 @@ abstract class SystemUICoreStartableModule { @ClassKey(LatencyTester::class) @ClassKey(LatencyTester::class) abstract fun bindLatencyTester(sysui: LatencyTester): CoreStartable abstract fun bindLatencyTester(sysui: LatencyTester): CoreStartable /** Inject into DisplaySwitchLatencyTracker. */ @Binds @IntoMap @ClassKey(DisplaySwitchLatencyTracker::class) abstract fun bindDisplaySwitchLatencyTracker(sysui: DisplaySwitchLatencyTracker): CoreStartable /** Inject into NotificationChannels. */ /** Inject into NotificationChannels. */ @Binds @Binds @IntoMap @IntoMap Loading packages/SystemUI/src/com/android/systemui/keyguard/data/repository/KeyguardRepository.kt +2 −2 Original line number Original line Diff line number Diff line Loading @@ -110,7 +110,7 @@ interface KeyguardRepository { val isKeyguardGoingAway: Flow<Boolean> val isKeyguardGoingAway: Flow<Boolean> /** Is the always-on display available to be used? */ /** Is the always-on display available to be used? */ val isAodAvailable: Flow<Boolean> val isAodAvailable: StateFlow<Boolean> fun setAodAvailable(value: Boolean) fun setAodAvailable(value: Boolean) Loading Loading @@ -338,7 +338,7 @@ constructor( .distinctUntilChanged() .distinctUntilChanged() private val _isAodAvailable = MutableStateFlow(false) private val _isAodAvailable = MutableStateFlow(false) override val isAodAvailable: Flow<Boolean> = _isAodAvailable.asStateFlow() override val isAodAvailable: StateFlow<Boolean> = _isAodAvailable.asStateFlow() override fun setAodAvailable(value: Boolean) { override fun setAodAvailable(value: Boolean) { _isAodAvailable.value = value _isAodAvailable.value = value Loading packages/SystemUI/src/com/android/systemui/keyguard/domain/interactor/KeyguardInteractor.kt +1 −1 Original line number Original line Diff line number Diff line Loading @@ -104,7 +104,7 @@ constructor( val dozeTimeTick: Flow<Long> = repository.dozeTimeTick val dozeTimeTick: Flow<Long> = repository.dozeTimeTick /** Whether Always-on Display mode is available. */ /** Whether Always-on Display mode is available. */ val isAodAvailable: Flow<Boolean> = repository.isAodAvailable val isAodAvailable: StateFlow<Boolean> = repository.isAodAvailable /** Doze transition information. */ /** Doze transition information. */ val dozeTransitionModel: Flow<DozeTransitionModel> = repository.dozeTransitionModel val dozeTransitionModel: Flow<DozeTransitionModel> = repository.dozeTransitionModel Loading packages/SystemUI/src/com/android/systemui/power/shared/model/WakeSleepReason.kt +5 −1 Original line number Original line Diff line number Diff line Loading @@ -51,7 +51,10 @@ enum class WakeSleepReason( BIOMETRIC(isTouch = false, PowerManager.WAKE_REASON_BIOMETRIC), BIOMETRIC(isTouch = false, PowerManager.WAKE_REASON_BIOMETRIC), /** Something else happened to wake up or sleep the device. */ /** Something else happened to wake up or sleep the device. */ OTHER(isTouch = false, PowerManager.WAKE_REASON_UNKNOWN); OTHER(isTouch = false, PowerManager.WAKE_REASON_UNKNOWN), /** Device goes to sleep due to folding of a foldable device. */ FOLD(isTouch = false, PowerManager.GO_TO_SLEEP_REASON_DEVICE_FOLD); companion object { companion object { fun fromPowerManagerWakeReason(reason: Int): WakeSleepReason { fun fromPowerManagerWakeReason(reason: Int): WakeSleepReason { Loading @@ -72,6 +75,7 @@ enum class WakeSleepReason( fun fromPowerManagerSleepReason(reason: Int): WakeSleepReason { fun fromPowerManagerSleepReason(reason: Int): WakeSleepReason { return when (reason) { return when (reason) { PowerManager.GO_TO_SLEEP_REASON_POWER_BUTTON -> POWER_BUTTON PowerManager.GO_TO_SLEEP_REASON_POWER_BUTTON -> POWER_BUTTON PowerManager.GO_TO_SLEEP_REASON_DEVICE_FOLD -> FOLD else -> OTHER else -> OTHER } } } } Loading packages/SystemUI/src/com/android/systemui/unfold/DisplaySwitchLatencyLogger.kt 0 → 100644 +55 −0 Original line number Original line Diff line number Diff line /* * Copyright (C) 2023 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.unfold import com.android.systemui.shared.system.SysUiStatsLog class DisplaySwitchLatencyLogger { /** * Based on data present in [displaySwitchLatencyEvent], logs metrics for atom * [DisplaySwitchLatencyTracked] */ fun log(displaySwitchLatencyEvent: DisplaySwitchLatencyTracker.DisplaySwitchLatencyEvent) { with(displaySwitchLatencyEvent) { SysUiStatsLog.write( SysUiStatsLog.DISPLAY_SWITCH_LATENCY_TRACKED, latencyMs, fromFoldableDeviceState, fromState, fromFocusedAppUid, fromPipAppUid, fromVisibleAppsUid.toIntArray(), fromDensityDpi, toState, toFoldableDeviceState, toFocusedAppUid, toPipAppUid, toVisibleAppsUid.toIntArray(), toDensityDpi, notificationCount, externalDisplayCount, throttlingLevel, vskinTemperatureC, hallSensorToFirstHingeAngleChangeMs, hallSensorToDeviceStateChangeMs, onScreenTurningOnToOnDrawnMs, onDrawnToOnScreenTurnedOnMs, ) } } } Loading
packages/SystemUI/src/com/android/systemui/dagger/SystemUICoreStartableModule.kt +7 −0 Original line number Original line Diff line number Diff line Loading @@ -54,6 +54,7 @@ import com.android.systemui.statusbar.phone.StatusBarHeadsUpChangeListener import com.android.systemui.stylus.StylusUsiPowerStartable import com.android.systemui.stylus.StylusUsiPowerStartable import com.android.systemui.temporarydisplay.chipbar.ChipbarCoordinator import com.android.systemui.temporarydisplay.chipbar.ChipbarCoordinator import com.android.systemui.theme.ThemeOverlayController import com.android.systemui.theme.ThemeOverlayController import com.android.systemui.unfold.DisplaySwitchLatencyTracker import com.android.systemui.usb.StorageNotification import com.android.systemui.usb.StorageNotification import com.android.systemui.util.NotificationChannels import com.android.systemui.util.NotificationChannels import com.android.systemui.util.StartBinderLoggerModule import com.android.systemui.util.StartBinderLoggerModule Loading Loading @@ -141,6 +142,12 @@ abstract class SystemUICoreStartableModule { @ClassKey(LatencyTester::class) @ClassKey(LatencyTester::class) abstract fun bindLatencyTester(sysui: LatencyTester): CoreStartable abstract fun bindLatencyTester(sysui: LatencyTester): CoreStartable /** Inject into DisplaySwitchLatencyTracker. */ @Binds @IntoMap @ClassKey(DisplaySwitchLatencyTracker::class) abstract fun bindDisplaySwitchLatencyTracker(sysui: DisplaySwitchLatencyTracker): CoreStartable /** Inject into NotificationChannels. */ /** Inject into NotificationChannels. */ @Binds @Binds @IntoMap @IntoMap Loading
packages/SystemUI/src/com/android/systemui/keyguard/data/repository/KeyguardRepository.kt +2 −2 Original line number Original line Diff line number Diff line Loading @@ -110,7 +110,7 @@ interface KeyguardRepository { val isKeyguardGoingAway: Flow<Boolean> val isKeyguardGoingAway: Flow<Boolean> /** Is the always-on display available to be used? */ /** Is the always-on display available to be used? */ val isAodAvailable: Flow<Boolean> val isAodAvailable: StateFlow<Boolean> fun setAodAvailable(value: Boolean) fun setAodAvailable(value: Boolean) Loading Loading @@ -338,7 +338,7 @@ constructor( .distinctUntilChanged() .distinctUntilChanged() private val _isAodAvailable = MutableStateFlow(false) private val _isAodAvailable = MutableStateFlow(false) override val isAodAvailable: Flow<Boolean> = _isAodAvailable.asStateFlow() override val isAodAvailable: StateFlow<Boolean> = _isAodAvailable.asStateFlow() override fun setAodAvailable(value: Boolean) { override fun setAodAvailable(value: Boolean) { _isAodAvailable.value = value _isAodAvailable.value = value Loading
packages/SystemUI/src/com/android/systemui/keyguard/domain/interactor/KeyguardInteractor.kt +1 −1 Original line number Original line Diff line number Diff line Loading @@ -104,7 +104,7 @@ constructor( val dozeTimeTick: Flow<Long> = repository.dozeTimeTick val dozeTimeTick: Flow<Long> = repository.dozeTimeTick /** Whether Always-on Display mode is available. */ /** Whether Always-on Display mode is available. */ val isAodAvailable: Flow<Boolean> = repository.isAodAvailable val isAodAvailable: StateFlow<Boolean> = repository.isAodAvailable /** Doze transition information. */ /** Doze transition information. */ val dozeTransitionModel: Flow<DozeTransitionModel> = repository.dozeTransitionModel val dozeTransitionModel: Flow<DozeTransitionModel> = repository.dozeTransitionModel Loading
packages/SystemUI/src/com/android/systemui/power/shared/model/WakeSleepReason.kt +5 −1 Original line number Original line Diff line number Diff line Loading @@ -51,7 +51,10 @@ enum class WakeSleepReason( BIOMETRIC(isTouch = false, PowerManager.WAKE_REASON_BIOMETRIC), BIOMETRIC(isTouch = false, PowerManager.WAKE_REASON_BIOMETRIC), /** Something else happened to wake up or sleep the device. */ /** Something else happened to wake up or sleep the device. */ OTHER(isTouch = false, PowerManager.WAKE_REASON_UNKNOWN); OTHER(isTouch = false, PowerManager.WAKE_REASON_UNKNOWN), /** Device goes to sleep due to folding of a foldable device. */ FOLD(isTouch = false, PowerManager.GO_TO_SLEEP_REASON_DEVICE_FOLD); companion object { companion object { fun fromPowerManagerWakeReason(reason: Int): WakeSleepReason { fun fromPowerManagerWakeReason(reason: Int): WakeSleepReason { Loading @@ -72,6 +75,7 @@ enum class WakeSleepReason( fun fromPowerManagerSleepReason(reason: Int): WakeSleepReason { fun fromPowerManagerSleepReason(reason: Int): WakeSleepReason { return when (reason) { return when (reason) { PowerManager.GO_TO_SLEEP_REASON_POWER_BUTTON -> POWER_BUTTON PowerManager.GO_TO_SLEEP_REASON_POWER_BUTTON -> POWER_BUTTON PowerManager.GO_TO_SLEEP_REASON_DEVICE_FOLD -> FOLD else -> OTHER else -> OTHER } } } } Loading
packages/SystemUI/src/com/android/systemui/unfold/DisplaySwitchLatencyLogger.kt 0 → 100644 +55 −0 Original line number Original line Diff line number Diff line /* * Copyright (C) 2023 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.unfold import com.android.systemui.shared.system.SysUiStatsLog class DisplaySwitchLatencyLogger { /** * Based on data present in [displaySwitchLatencyEvent], logs metrics for atom * [DisplaySwitchLatencyTracked] */ fun log(displaySwitchLatencyEvent: DisplaySwitchLatencyTracker.DisplaySwitchLatencyEvent) { with(displaySwitchLatencyEvent) { SysUiStatsLog.write( SysUiStatsLog.DISPLAY_SWITCH_LATENCY_TRACKED, latencyMs, fromFoldableDeviceState, fromState, fromFocusedAppUid, fromPipAppUid, fromVisibleAppsUid.toIntArray(), fromDensityDpi, toState, toFoldableDeviceState, toFocusedAppUid, toPipAppUid, toVisibleAppsUid.toIntArray(), toDensityDpi, notificationCount, externalDisplayCount, throttlingLevel, vskinTemperatureC, hallSensorToFirstHingeAngleChangeMs, hallSensorToDeviceStateChangeMs, onScreenTurningOnToOnDrawnMs, onDrawnToOnScreenTurnedOnMs, ) } } }