Loading packages/SystemUI/src/com/android/systemui/keyguard/dagger/KeyguardModule.java +10 −0 Original line number Diff line number Diff line Loading @@ -46,6 +46,8 @@ import com.android.systemui.keyguard.data.quickaffordance.KeyguardDataQuickAffor import com.android.systemui.keyguard.data.repository.KeyguardRepositoryModule; import com.android.systemui.keyguard.domain.interactor.StartKeyguardTransitionModule; import com.android.systemui.keyguard.domain.quickaffordance.KeyguardQuickAffordanceModule; import com.android.systemui.keyguard.shared.quickaffordance.KeyguardQuickAffordancesMetricsLogger; import com.android.systemui.keyguard.shared.quickaffordance.KeyguardQuickAffordancesMetricsLoggerImpl; import com.android.systemui.navigationbar.NavigationModeController; import com.android.systemui.settings.UserTracker; import com.android.systemui.shade.ShadeController; Loading @@ -64,6 +66,8 @@ import java.util.concurrent.Executor; import dagger.Lazy; import dagger.Module; import dagger.Provides; import kotlinx.coroutines.CoroutineDispatcher; import kotlinx.coroutines.CoroutineScope; /** * Dagger Module providing keyguard. Loading Loading @@ -153,4 +157,10 @@ public class KeyguardModule { public ViewMediatorCallback providesViewMediatorCallback(KeyguardViewMediator viewMediator) { return viewMediator.getViewMediatorCallback(); } /** */ @Provides public KeyguardQuickAffordancesMetricsLogger providesKeyguardQuickAffordancesMetricsLogger() { return new KeyguardQuickAffordancesMetricsLoggerImpl(); } } packages/SystemUI/src/com/android/systemui/keyguard/domain/interactor/KeyguardQuickAffordanceInteractor.kt +6 −0 Original line number Diff line number Diff line Loading @@ -37,6 +37,7 @@ import com.android.systemui.keyguard.shared.model.KeyguardPickerFlag import com.android.systemui.keyguard.shared.model.KeyguardQuickAffordancePickerRepresentation import com.android.systemui.keyguard.shared.model.KeyguardSlotPickerRepresentation import com.android.systemui.keyguard.shared.quickaffordance.KeyguardQuickAffordancePosition import com.android.systemui.keyguard.shared.quickaffordance.KeyguardQuickAffordancesMetricsLogger import com.android.systemui.plugins.ActivityStarter import com.android.systemui.settings.UserTracker import com.android.systemui.shared.customization.data.content.CustomizationProviderContract as Contract Loading Loading @@ -68,6 +69,7 @@ constructor( private val featureFlags: FeatureFlags, private val repository: Lazy<KeyguardQuickAffordanceRepository>, private val launchAnimator: DialogLaunchAnimator, private val logger: KeyguardQuickAffordancesMetricsLogger, private val devicePolicyManager: DevicePolicyManager, @Background private val backgroundDispatcher: CoroutineDispatcher, ) { Loading Loading @@ -122,10 +124,12 @@ constructor( * @param configKey The configuration key corresponding to the [KeyguardQuickAffordanceModel] of * the affordance that was clicked * @param expandable An optional [Expandable] for the activity- or dialog-launch animation * @param slotId The id of the lockscreen slot that the affordance is in */ fun onQuickAffordanceTriggered( configKey: String, expandable: Expandable?, slotId: String, ) { @Suppress("UNCHECKED_CAST") val config = Loading @@ -139,6 +143,7 @@ constructor( Log.e(TAG, "Affordance config with key of \"$configKey\" not found!") return } logger.logOnShortcutTriggered(slotId, configKey) when (val result = config.onTriggered(expandable)) { is KeyguardQuickAffordanceConfig.OnTriggeredResult.StartActivity -> Loading Loading @@ -191,6 +196,7 @@ constructor( affordanceIds = selections, ) logger.logOnShortcutSelected(slotId, affordanceId) return true } Loading packages/SystemUI/src/com/android/systemui/keyguard/shared/quickaffordance/KeyguardQuickAffordancesMetricsLogger.kt 0 → 100644 +58 −0 Original line number 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.keyguard.shared.quickaffordance import com.android.systemui.dagger.SysUISingleton import com.android.systemui.shared.system.SysUiStatsLog interface KeyguardQuickAffordancesMetricsLogger { /** * Logs shortcut Triggered * @param slotId The id of the lockscreen slot that the affordance is in * @param affordanceId The id of the lockscreen affordance */ fun logOnShortcutTriggered(slotId: String, affordanceId: String) /** * Logs shortcut Selected * @param slotId The id of the lockscreen slot that the affordance is in * @param affordanceId The id of the lockscreen affordance */ fun logOnShortcutSelected(slotId: String, affordanceId: String) } @SysUISingleton class KeyguardQuickAffordancesMetricsLoggerImpl : KeyguardQuickAffordancesMetricsLogger { override fun logOnShortcutTriggered(slotId: String, affordanceId: String) { SysUiStatsLog.write( SysUiStatsLog.LOCKSCREEN_SHORTCUT_TRIGGERED, slotId, affordanceId, ) } override fun logOnShortcutSelected(slotId: String, affordanceId: String) { SysUiStatsLog.write( SysUiStatsLog.LOCKSCREEN_SHORTCUT_SELECTED, slotId, affordanceId, ) } } No newline at end of file packages/SystemUI/src/com/android/systemui/keyguard/ui/binder/KeyguardBottomAreaViewBinder.kt +2 −0 Original line number Diff line number Diff line Loading @@ -502,6 +502,7 @@ object KeyguardBottomAreaViewBinder { KeyguardQuickAffordanceViewModel.OnClickedParameters( configKey = configKey, expandable = Expandable.fromView(view), slotId = viewModel.slotId, ) ) } Loading Loading @@ -568,6 +569,7 @@ object KeyguardBottomAreaViewBinder { KeyguardQuickAffordanceViewModel.OnClickedParameters( configKey = viewModel.configKey, expandable = Expandable.fromView(view), slotId = viewModel.slotId, ) ) } Loading packages/SystemUI/src/com/android/systemui/keyguard/ui/viewmodel/KeyguardBottomAreaViewModel.kt +10 −3 Original line number Diff line number Diff line Loading @@ -175,7 +175,8 @@ constructor( areQuickAffordancesFullyOpaque, selectedPreviewSlotId, ) { model, animateReveal, isFullyOpaque, selectedPreviewSlotId -> val isSelected = selectedPreviewSlotId == position.toSlotId() val slotId = position.toSlotId() val isSelected = selectedPreviewSlotId == slotId model.toViewModel( animateReveal = !previewMode.isInPreviewMode && animateReveal, isClickable = isFullyOpaque && !previewMode.isInPreviewMode, Loading @@ -187,7 +188,8 @@ constructor( previewMode.isInPreviewMode && previewMode.shouldHighlightSelectedAffordance && !isSelected, forceInactive = previewMode.isInPreviewMode forceInactive = previewMode.isInPreviewMode, slotId = slotId, ) } .distinctUntilChanged() Loading @@ -200,6 +202,7 @@ constructor( isSelected: Boolean, isDimmed: Boolean, forceInactive: Boolean, slotId: String, ): KeyguardQuickAffordanceViewModel { return when (this) { is KeyguardQuickAffordanceModel.Visible -> Loading @@ -212,6 +215,7 @@ constructor( quickAffordanceInteractor.onQuickAffordanceTriggered( configKey = parameters.configKey, expandable = parameters.expandable, slotId = parameters.slotId, ) }, isClickable = isClickable, Loading @@ -219,8 +223,11 @@ constructor( isSelected = isSelected, useLongPress = quickAffordanceInteractor.useLongPress, isDimmed = isDimmed, slotId = slotId, ) is KeyguardQuickAffordanceModel.Hidden -> KeyguardQuickAffordanceViewModel( slotId = slotId, ) is KeyguardQuickAffordanceModel.Hidden -> KeyguardQuickAffordanceViewModel() } } Loading Loading
packages/SystemUI/src/com/android/systemui/keyguard/dagger/KeyguardModule.java +10 −0 Original line number Diff line number Diff line Loading @@ -46,6 +46,8 @@ import com.android.systemui.keyguard.data.quickaffordance.KeyguardDataQuickAffor import com.android.systemui.keyguard.data.repository.KeyguardRepositoryModule; import com.android.systemui.keyguard.domain.interactor.StartKeyguardTransitionModule; import com.android.systemui.keyguard.domain.quickaffordance.KeyguardQuickAffordanceModule; import com.android.systemui.keyguard.shared.quickaffordance.KeyguardQuickAffordancesMetricsLogger; import com.android.systemui.keyguard.shared.quickaffordance.KeyguardQuickAffordancesMetricsLoggerImpl; import com.android.systemui.navigationbar.NavigationModeController; import com.android.systemui.settings.UserTracker; import com.android.systemui.shade.ShadeController; Loading @@ -64,6 +66,8 @@ import java.util.concurrent.Executor; import dagger.Lazy; import dagger.Module; import dagger.Provides; import kotlinx.coroutines.CoroutineDispatcher; import kotlinx.coroutines.CoroutineScope; /** * Dagger Module providing keyguard. Loading Loading @@ -153,4 +157,10 @@ public class KeyguardModule { public ViewMediatorCallback providesViewMediatorCallback(KeyguardViewMediator viewMediator) { return viewMediator.getViewMediatorCallback(); } /** */ @Provides public KeyguardQuickAffordancesMetricsLogger providesKeyguardQuickAffordancesMetricsLogger() { return new KeyguardQuickAffordancesMetricsLoggerImpl(); } }
packages/SystemUI/src/com/android/systemui/keyguard/domain/interactor/KeyguardQuickAffordanceInteractor.kt +6 −0 Original line number Diff line number Diff line Loading @@ -37,6 +37,7 @@ import com.android.systemui.keyguard.shared.model.KeyguardPickerFlag import com.android.systemui.keyguard.shared.model.KeyguardQuickAffordancePickerRepresentation import com.android.systemui.keyguard.shared.model.KeyguardSlotPickerRepresentation import com.android.systemui.keyguard.shared.quickaffordance.KeyguardQuickAffordancePosition import com.android.systemui.keyguard.shared.quickaffordance.KeyguardQuickAffordancesMetricsLogger import com.android.systemui.plugins.ActivityStarter import com.android.systemui.settings.UserTracker import com.android.systemui.shared.customization.data.content.CustomizationProviderContract as Contract Loading Loading @@ -68,6 +69,7 @@ constructor( private val featureFlags: FeatureFlags, private val repository: Lazy<KeyguardQuickAffordanceRepository>, private val launchAnimator: DialogLaunchAnimator, private val logger: KeyguardQuickAffordancesMetricsLogger, private val devicePolicyManager: DevicePolicyManager, @Background private val backgroundDispatcher: CoroutineDispatcher, ) { Loading Loading @@ -122,10 +124,12 @@ constructor( * @param configKey The configuration key corresponding to the [KeyguardQuickAffordanceModel] of * the affordance that was clicked * @param expandable An optional [Expandable] for the activity- or dialog-launch animation * @param slotId The id of the lockscreen slot that the affordance is in */ fun onQuickAffordanceTriggered( configKey: String, expandable: Expandable?, slotId: String, ) { @Suppress("UNCHECKED_CAST") val config = Loading @@ -139,6 +143,7 @@ constructor( Log.e(TAG, "Affordance config with key of \"$configKey\" not found!") return } logger.logOnShortcutTriggered(slotId, configKey) when (val result = config.onTriggered(expandable)) { is KeyguardQuickAffordanceConfig.OnTriggeredResult.StartActivity -> Loading Loading @@ -191,6 +196,7 @@ constructor( affordanceIds = selections, ) logger.logOnShortcutSelected(slotId, affordanceId) return true } Loading
packages/SystemUI/src/com/android/systemui/keyguard/shared/quickaffordance/KeyguardQuickAffordancesMetricsLogger.kt 0 → 100644 +58 −0 Original line number 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.keyguard.shared.quickaffordance import com.android.systemui.dagger.SysUISingleton import com.android.systemui.shared.system.SysUiStatsLog interface KeyguardQuickAffordancesMetricsLogger { /** * Logs shortcut Triggered * @param slotId The id of the lockscreen slot that the affordance is in * @param affordanceId The id of the lockscreen affordance */ fun logOnShortcutTriggered(slotId: String, affordanceId: String) /** * Logs shortcut Selected * @param slotId The id of the lockscreen slot that the affordance is in * @param affordanceId The id of the lockscreen affordance */ fun logOnShortcutSelected(slotId: String, affordanceId: String) } @SysUISingleton class KeyguardQuickAffordancesMetricsLoggerImpl : KeyguardQuickAffordancesMetricsLogger { override fun logOnShortcutTriggered(slotId: String, affordanceId: String) { SysUiStatsLog.write( SysUiStatsLog.LOCKSCREEN_SHORTCUT_TRIGGERED, slotId, affordanceId, ) } override fun logOnShortcutSelected(slotId: String, affordanceId: String) { SysUiStatsLog.write( SysUiStatsLog.LOCKSCREEN_SHORTCUT_SELECTED, slotId, affordanceId, ) } } No newline at end of file
packages/SystemUI/src/com/android/systemui/keyguard/ui/binder/KeyguardBottomAreaViewBinder.kt +2 −0 Original line number Diff line number Diff line Loading @@ -502,6 +502,7 @@ object KeyguardBottomAreaViewBinder { KeyguardQuickAffordanceViewModel.OnClickedParameters( configKey = configKey, expandable = Expandable.fromView(view), slotId = viewModel.slotId, ) ) } Loading Loading @@ -568,6 +569,7 @@ object KeyguardBottomAreaViewBinder { KeyguardQuickAffordanceViewModel.OnClickedParameters( configKey = viewModel.configKey, expandable = Expandable.fromView(view), slotId = viewModel.slotId, ) ) } Loading
packages/SystemUI/src/com/android/systemui/keyguard/ui/viewmodel/KeyguardBottomAreaViewModel.kt +10 −3 Original line number Diff line number Diff line Loading @@ -175,7 +175,8 @@ constructor( areQuickAffordancesFullyOpaque, selectedPreviewSlotId, ) { model, animateReveal, isFullyOpaque, selectedPreviewSlotId -> val isSelected = selectedPreviewSlotId == position.toSlotId() val slotId = position.toSlotId() val isSelected = selectedPreviewSlotId == slotId model.toViewModel( animateReveal = !previewMode.isInPreviewMode && animateReveal, isClickable = isFullyOpaque && !previewMode.isInPreviewMode, Loading @@ -187,7 +188,8 @@ constructor( previewMode.isInPreviewMode && previewMode.shouldHighlightSelectedAffordance && !isSelected, forceInactive = previewMode.isInPreviewMode forceInactive = previewMode.isInPreviewMode, slotId = slotId, ) } .distinctUntilChanged() Loading @@ -200,6 +202,7 @@ constructor( isSelected: Boolean, isDimmed: Boolean, forceInactive: Boolean, slotId: String, ): KeyguardQuickAffordanceViewModel { return when (this) { is KeyguardQuickAffordanceModel.Visible -> Loading @@ -212,6 +215,7 @@ constructor( quickAffordanceInteractor.onQuickAffordanceTriggered( configKey = parameters.configKey, expandable = parameters.expandable, slotId = parameters.slotId, ) }, isClickable = isClickable, Loading @@ -219,8 +223,11 @@ constructor( isSelected = isSelected, useLongPress = quickAffordanceInteractor.useLongPress, isDimmed = isDimmed, slotId = slotId, ) is KeyguardQuickAffordanceModel.Hidden -> KeyguardQuickAffordanceViewModel( slotId = slotId, ) is KeyguardQuickAffordanceModel.Hidden -> KeyguardQuickAffordanceViewModel() } } Loading