Merge "Log custom lockscreen shortcuts" into udc-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
8247263184
@@ -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.data.repository.KeyguardRepositoryModule;
|
||||||
import com.android.systemui.keyguard.domain.interactor.StartKeyguardTransitionModule;
|
import com.android.systemui.keyguard.domain.interactor.StartKeyguardTransitionModule;
|
||||||
import com.android.systemui.keyguard.domain.quickaffordance.KeyguardQuickAffordanceModule;
|
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.navigationbar.NavigationModeController;
|
||||||
import com.android.systemui.settings.UserTracker;
|
import com.android.systemui.settings.UserTracker;
|
||||||
import com.android.systemui.shade.ShadeController;
|
import com.android.systemui.shade.ShadeController;
|
||||||
@@ -64,6 +66,8 @@ import java.util.concurrent.Executor;
|
|||||||
import dagger.Lazy;
|
import dagger.Lazy;
|
||||||
import dagger.Module;
|
import dagger.Module;
|
||||||
import dagger.Provides;
|
import dagger.Provides;
|
||||||
|
import kotlinx.coroutines.CoroutineDispatcher;
|
||||||
|
import kotlinx.coroutines.CoroutineScope;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Dagger Module providing keyguard.
|
* Dagger Module providing keyguard.
|
||||||
@@ -153,4 +157,10 @@ public class KeyguardModule {
|
|||||||
public ViewMediatorCallback providesViewMediatorCallback(KeyguardViewMediator viewMediator) {
|
public ViewMediatorCallback providesViewMediatorCallback(KeyguardViewMediator viewMediator) {
|
||||||
return viewMediator.getViewMediatorCallback();
|
return viewMediator.getViewMediatorCallback();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** */
|
||||||
|
@Provides
|
||||||
|
public KeyguardQuickAffordancesMetricsLogger providesKeyguardQuickAffordancesMetricsLogger() {
|
||||||
|
return new KeyguardQuickAffordancesMetricsLoggerImpl();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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.KeyguardQuickAffordancePickerRepresentation
|
||||||
import com.android.systemui.keyguard.shared.model.KeyguardSlotPickerRepresentation
|
import com.android.systemui.keyguard.shared.model.KeyguardSlotPickerRepresentation
|
||||||
import com.android.systemui.keyguard.shared.quickaffordance.KeyguardQuickAffordancePosition
|
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.plugins.ActivityStarter
|
||||||
import com.android.systemui.settings.UserTracker
|
import com.android.systemui.settings.UserTracker
|
||||||
import com.android.systemui.shared.customization.data.content.CustomizationProviderContract as Contract
|
import com.android.systemui.shared.customization.data.content.CustomizationProviderContract as Contract
|
||||||
@@ -68,6 +69,7 @@ constructor(
|
|||||||
private val featureFlags: FeatureFlags,
|
private val featureFlags: FeatureFlags,
|
||||||
private val repository: Lazy<KeyguardQuickAffordanceRepository>,
|
private val repository: Lazy<KeyguardQuickAffordanceRepository>,
|
||||||
private val launchAnimator: DialogLaunchAnimator,
|
private val launchAnimator: DialogLaunchAnimator,
|
||||||
|
private val logger: KeyguardQuickAffordancesMetricsLogger,
|
||||||
private val devicePolicyManager: DevicePolicyManager,
|
private val devicePolicyManager: DevicePolicyManager,
|
||||||
@Background private val backgroundDispatcher: CoroutineDispatcher,
|
@Background private val backgroundDispatcher: CoroutineDispatcher,
|
||||||
) {
|
) {
|
||||||
@@ -122,10 +124,12 @@ constructor(
|
|||||||
* @param configKey The configuration key corresponding to the [KeyguardQuickAffordanceModel] of
|
* @param configKey The configuration key corresponding to the [KeyguardQuickAffordanceModel] of
|
||||||
* the affordance that was clicked
|
* the affordance that was clicked
|
||||||
* @param expandable An optional [Expandable] for the activity- or dialog-launch animation
|
* @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(
|
fun onQuickAffordanceTriggered(
|
||||||
configKey: String,
|
configKey: String,
|
||||||
expandable: Expandable?,
|
expandable: Expandable?,
|
||||||
|
slotId: String,
|
||||||
) {
|
) {
|
||||||
@Suppress("UNCHECKED_CAST")
|
@Suppress("UNCHECKED_CAST")
|
||||||
val config =
|
val config =
|
||||||
@@ -139,6 +143,7 @@ constructor(
|
|||||||
Log.e(TAG, "Affordance config with key of \"$configKey\" not found!")
|
Log.e(TAG, "Affordance config with key of \"$configKey\" not found!")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
logger.logOnShortcutTriggered(slotId, configKey)
|
||||||
|
|
||||||
when (val result = config.onTriggered(expandable)) {
|
when (val result = config.onTriggered(expandable)) {
|
||||||
is KeyguardQuickAffordanceConfig.OnTriggeredResult.StartActivity ->
|
is KeyguardQuickAffordanceConfig.OnTriggeredResult.StartActivity ->
|
||||||
@@ -191,6 +196,7 @@ constructor(
|
|||||||
affordanceIds = selections,
|
affordanceIds = selections,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
logger.logOnShortcutSelected(slotId, affordanceId)
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,58 @@
|
|||||||
|
/*
|
||||||
|
* 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,
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -502,6 +502,7 @@ object KeyguardBottomAreaViewBinder {
|
|||||||
KeyguardQuickAffordanceViewModel.OnClickedParameters(
|
KeyguardQuickAffordanceViewModel.OnClickedParameters(
|
||||||
configKey = configKey,
|
configKey = configKey,
|
||||||
expandable = Expandable.fromView(view),
|
expandable = Expandable.fromView(view),
|
||||||
|
slotId = viewModel.slotId,
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
@@ -568,6 +569,7 @@ object KeyguardBottomAreaViewBinder {
|
|||||||
KeyguardQuickAffordanceViewModel.OnClickedParameters(
|
KeyguardQuickAffordanceViewModel.OnClickedParameters(
|
||||||
configKey = viewModel.configKey,
|
configKey = viewModel.configKey,
|
||||||
expandable = Expandable.fromView(view),
|
expandable = Expandable.fromView(view),
|
||||||
|
slotId = viewModel.slotId,
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -175,7 +175,8 @@ constructor(
|
|||||||
areQuickAffordancesFullyOpaque,
|
areQuickAffordancesFullyOpaque,
|
||||||
selectedPreviewSlotId,
|
selectedPreviewSlotId,
|
||||||
) { model, animateReveal, isFullyOpaque, selectedPreviewSlotId ->
|
) { model, animateReveal, isFullyOpaque, selectedPreviewSlotId ->
|
||||||
val isSelected = selectedPreviewSlotId == position.toSlotId()
|
val slotId = position.toSlotId()
|
||||||
|
val isSelected = selectedPreviewSlotId == slotId
|
||||||
model.toViewModel(
|
model.toViewModel(
|
||||||
animateReveal = !previewMode.isInPreviewMode && animateReveal,
|
animateReveal = !previewMode.isInPreviewMode && animateReveal,
|
||||||
isClickable = isFullyOpaque && !previewMode.isInPreviewMode,
|
isClickable = isFullyOpaque && !previewMode.isInPreviewMode,
|
||||||
@@ -187,7 +188,8 @@ constructor(
|
|||||||
previewMode.isInPreviewMode &&
|
previewMode.isInPreviewMode &&
|
||||||
previewMode.shouldHighlightSelectedAffordance &&
|
previewMode.shouldHighlightSelectedAffordance &&
|
||||||
!isSelected,
|
!isSelected,
|
||||||
forceInactive = previewMode.isInPreviewMode
|
forceInactive = previewMode.isInPreviewMode,
|
||||||
|
slotId = slotId,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
.distinctUntilChanged()
|
.distinctUntilChanged()
|
||||||
@@ -200,6 +202,7 @@ constructor(
|
|||||||
isSelected: Boolean,
|
isSelected: Boolean,
|
||||||
isDimmed: Boolean,
|
isDimmed: Boolean,
|
||||||
forceInactive: Boolean,
|
forceInactive: Boolean,
|
||||||
|
slotId: String,
|
||||||
): KeyguardQuickAffordanceViewModel {
|
): KeyguardQuickAffordanceViewModel {
|
||||||
return when (this) {
|
return when (this) {
|
||||||
is KeyguardQuickAffordanceModel.Visible ->
|
is KeyguardQuickAffordanceModel.Visible ->
|
||||||
@@ -212,6 +215,7 @@ constructor(
|
|||||||
quickAffordanceInteractor.onQuickAffordanceTriggered(
|
quickAffordanceInteractor.onQuickAffordanceTriggered(
|
||||||
configKey = parameters.configKey,
|
configKey = parameters.configKey,
|
||||||
expandable = parameters.expandable,
|
expandable = parameters.expandable,
|
||||||
|
slotId = parameters.slotId,
|
||||||
)
|
)
|
||||||
},
|
},
|
||||||
isClickable = isClickable,
|
isClickable = isClickable,
|
||||||
@@ -219,8 +223,11 @@ constructor(
|
|||||||
isSelected = isSelected,
|
isSelected = isSelected,
|
||||||
useLongPress = quickAffordanceInteractor.useLongPress,
|
useLongPress = quickAffordanceInteractor.useLongPress,
|
||||||
isDimmed = isDimmed,
|
isDimmed = isDimmed,
|
||||||
|
slotId = slotId,
|
||||||
)
|
)
|
||||||
is KeyguardQuickAffordanceModel.Hidden -> KeyguardQuickAffordanceViewModel()
|
is KeyguardQuickAffordanceModel.Hidden -> KeyguardQuickAffordanceViewModel(
|
||||||
|
slotId = slotId,
|
||||||
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -32,9 +32,11 @@ data class KeyguardQuickAffordanceViewModel(
|
|||||||
val isSelected: Boolean = false,
|
val isSelected: Boolean = false,
|
||||||
val useLongPress: Boolean = false,
|
val useLongPress: Boolean = false,
|
||||||
val isDimmed: Boolean = false,
|
val isDimmed: Boolean = false,
|
||||||
|
val slotId: String,
|
||||||
) {
|
) {
|
||||||
data class OnClickedParameters(
|
data class OnClickedParameters(
|
||||||
val configKey: String,
|
val configKey: String,
|
||||||
val expandable: Expandable?,
|
val expandable: Expandable?,
|
||||||
|
val slotId: String,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -45,6 +45,7 @@ import com.android.systemui.keyguard.data.repository.FakeKeyguardRepository
|
|||||||
import com.android.systemui.keyguard.data.repository.KeyguardQuickAffordanceRepository
|
import com.android.systemui.keyguard.data.repository.KeyguardQuickAffordanceRepository
|
||||||
import com.android.systemui.keyguard.domain.interactor.KeyguardInteractor
|
import com.android.systemui.keyguard.domain.interactor.KeyguardInteractor
|
||||||
import com.android.systemui.keyguard.domain.interactor.KeyguardQuickAffordanceInteractor
|
import com.android.systemui.keyguard.domain.interactor.KeyguardQuickAffordanceInteractor
|
||||||
|
import com.android.systemui.keyguard.shared.quickaffordance.KeyguardQuickAffordancesMetricsLogger
|
||||||
import com.android.systemui.keyguard.ui.preview.KeyguardPreviewRenderer
|
import com.android.systemui.keyguard.ui.preview.KeyguardPreviewRenderer
|
||||||
import com.android.systemui.keyguard.ui.preview.KeyguardPreviewRendererFactory
|
import com.android.systemui.keyguard.ui.preview.KeyguardPreviewRendererFactory
|
||||||
import com.android.systemui.keyguard.ui.preview.KeyguardRemotePreviewManager
|
import com.android.systemui.keyguard.ui.preview.KeyguardRemotePreviewManager
|
||||||
@@ -91,6 +92,7 @@ class CustomizationProviderTest : SysuiTestCase() {
|
|||||||
@Mock private lateinit var launchAnimator: DialogLaunchAnimator
|
@Mock private lateinit var launchAnimator: DialogLaunchAnimator
|
||||||
@Mock private lateinit var commandQueue: CommandQueue
|
@Mock private lateinit var commandQueue: CommandQueue
|
||||||
@Mock private lateinit var devicePolicyManager: DevicePolicyManager
|
@Mock private lateinit var devicePolicyManager: DevicePolicyManager
|
||||||
|
@Mock private lateinit var logger: KeyguardQuickAffordancesMetricsLogger
|
||||||
|
|
||||||
private lateinit var underTest: CustomizationProvider
|
private lateinit var underTest: CustomizationProvider
|
||||||
private lateinit var testScope: TestScope
|
private lateinit var testScope: TestScope
|
||||||
@@ -184,6 +186,7 @@ class CustomizationProviderTest : SysuiTestCase() {
|
|||||||
featureFlags = featureFlags,
|
featureFlags = featureFlags,
|
||||||
repository = { quickAffordanceRepository },
|
repository = { quickAffordanceRepository },
|
||||||
launchAnimator = launchAnimator,
|
launchAnimator = launchAnimator,
|
||||||
|
logger = logger,
|
||||||
devicePolicyManager = devicePolicyManager,
|
devicePolicyManager = devicePolicyManager,
|
||||||
backgroundDispatcher = testDispatcher,
|
backgroundDispatcher = testDispatcher,
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -42,6 +42,7 @@ import com.android.systemui.keyguard.data.repository.FakeKeyguardRepository
|
|||||||
import com.android.systemui.keyguard.data.repository.KeyguardQuickAffordanceRepository
|
import com.android.systemui.keyguard.data.repository.KeyguardQuickAffordanceRepository
|
||||||
import com.android.systemui.keyguard.domain.quickaffordance.FakeKeyguardQuickAffordanceRegistry
|
import com.android.systemui.keyguard.domain.quickaffordance.FakeKeyguardQuickAffordanceRegistry
|
||||||
import com.android.systemui.keyguard.shared.quickaffordance.KeyguardQuickAffordancePosition
|
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.plugins.ActivityStarter
|
||||||
import com.android.systemui.settings.FakeUserTracker
|
import com.android.systemui.settings.FakeUserTracker
|
||||||
import com.android.systemui.settings.UserFileManager
|
import com.android.systemui.settings.UserFileManager
|
||||||
@@ -225,6 +226,7 @@ class KeyguardQuickAffordanceInteractorParameterizedTest : SysuiTestCase() {
|
|||||||
@Mock private lateinit var launchAnimator: DialogLaunchAnimator
|
@Mock private lateinit var launchAnimator: DialogLaunchAnimator
|
||||||
@Mock private lateinit var commandQueue: CommandQueue
|
@Mock private lateinit var commandQueue: CommandQueue
|
||||||
@Mock private lateinit var devicePolicyManager: DevicePolicyManager
|
@Mock private lateinit var devicePolicyManager: DevicePolicyManager
|
||||||
|
@Mock private lateinit var logger: KeyguardQuickAffordancesMetricsLogger
|
||||||
|
|
||||||
private lateinit var underTest: KeyguardQuickAffordanceInteractor
|
private lateinit var underTest: KeyguardQuickAffordanceInteractor
|
||||||
private lateinit var testScope: TestScope
|
private lateinit var testScope: TestScope
|
||||||
@@ -331,6 +333,7 @@ class KeyguardQuickAffordanceInteractorParameterizedTest : SysuiTestCase() {
|
|||||||
featureFlags = featureFlags,
|
featureFlags = featureFlags,
|
||||||
repository = { quickAffordanceRepository },
|
repository = { quickAffordanceRepository },
|
||||||
launchAnimator = launchAnimator,
|
launchAnimator = launchAnimator,
|
||||||
|
logger = logger,
|
||||||
devicePolicyManager = devicePolicyManager,
|
devicePolicyManager = devicePolicyManager,
|
||||||
backgroundDispatcher = testDispatcher,
|
backgroundDispatcher = testDispatcher,
|
||||||
)
|
)
|
||||||
@@ -360,10 +363,11 @@ class KeyguardQuickAffordanceInteractorParameterizedTest : SysuiTestCase() {
|
|||||||
KeyguardQuickAffordanceConfig.OnTriggeredResult.Handled
|
KeyguardQuickAffordanceConfig.OnTriggeredResult.Handled
|
||||||
}
|
}
|
||||||
|
|
||||||
underTest.onQuickAffordanceTriggered(
|
underTest.onQuickAffordanceTriggered(
|
||||||
configKey = BuiltInKeyguardQuickAffordanceKeys.HOME_CONTROLS,
|
configKey = BuiltInKeyguardQuickAffordanceKeys.HOME_CONTROLS,
|
||||||
expandable = expandable,
|
expandable = expandable,
|
||||||
)
|
slotId = "",
|
||||||
|
)
|
||||||
|
|
||||||
if (startActivity) {
|
if (startActivity) {
|
||||||
if (needsToUnlockFirst) {
|
if (needsToUnlockFirst) {
|
||||||
|
|||||||
@@ -45,6 +45,7 @@ import com.android.systemui.keyguard.domain.quickaffordance.FakeKeyguardQuickAff
|
|||||||
import com.android.systemui.keyguard.shared.model.KeyguardQuickAffordancePickerRepresentation
|
import com.android.systemui.keyguard.shared.model.KeyguardQuickAffordancePickerRepresentation
|
||||||
import com.android.systemui.keyguard.shared.quickaffordance.ActivationState
|
import com.android.systemui.keyguard.shared.quickaffordance.ActivationState
|
||||||
import com.android.systemui.keyguard.shared.quickaffordance.KeyguardQuickAffordancePosition
|
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.plugins.ActivityStarter
|
||||||
import com.android.systemui.settings.UserFileManager
|
import com.android.systemui.settings.UserFileManager
|
||||||
import com.android.systemui.settings.UserTracker
|
import com.android.systemui.settings.UserTracker
|
||||||
@@ -80,6 +81,7 @@ class KeyguardQuickAffordanceInteractorTest : SysuiTestCase() {
|
|||||||
@Mock private lateinit var launchAnimator: DialogLaunchAnimator
|
@Mock private lateinit var launchAnimator: DialogLaunchAnimator
|
||||||
@Mock private lateinit var commandQueue: CommandQueue
|
@Mock private lateinit var commandQueue: CommandQueue
|
||||||
@Mock private lateinit var devicePolicyManager: DevicePolicyManager
|
@Mock private lateinit var devicePolicyManager: DevicePolicyManager
|
||||||
|
@Mock private lateinit var logger: KeyguardQuickAffordancesMetricsLogger
|
||||||
|
|
||||||
private lateinit var underTest: KeyguardQuickAffordanceInteractor
|
private lateinit var underTest: KeyguardQuickAffordanceInteractor
|
||||||
|
|
||||||
@@ -186,6 +188,7 @@ class KeyguardQuickAffordanceInteractorTest : SysuiTestCase() {
|
|||||||
featureFlags = featureFlags,
|
featureFlags = featureFlags,
|
||||||
repository = { quickAffordanceRepository },
|
repository = { quickAffordanceRepository },
|
||||||
launchAnimator = launchAnimator,
|
launchAnimator = launchAnimator,
|
||||||
|
logger = logger,
|
||||||
devicePolicyManager = devicePolicyManager,
|
devicePolicyManager = devicePolicyManager,
|
||||||
backgroundDispatcher = testDispatcher,
|
backgroundDispatcher = testDispatcher,
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -45,6 +45,7 @@ import com.android.systemui.keyguard.domain.interactor.KeyguardQuickAffordanceIn
|
|||||||
import com.android.systemui.keyguard.domain.quickaffordance.FakeKeyguardQuickAffordanceRegistry
|
import com.android.systemui.keyguard.domain.quickaffordance.FakeKeyguardQuickAffordanceRegistry
|
||||||
import com.android.systemui.keyguard.shared.quickaffordance.ActivationState
|
import com.android.systemui.keyguard.shared.quickaffordance.ActivationState
|
||||||
import com.android.systemui.keyguard.shared.quickaffordance.KeyguardQuickAffordancePosition
|
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.plugins.ActivityStarter
|
||||||
import com.android.systemui.settings.UserFileManager
|
import com.android.systemui.settings.UserFileManager
|
||||||
import com.android.systemui.settings.UserTracker
|
import com.android.systemui.settings.UserTracker
|
||||||
@@ -89,6 +90,7 @@ class KeyguardBottomAreaViewModelTest : SysuiTestCase() {
|
|||||||
@Mock private lateinit var launchAnimator: DialogLaunchAnimator
|
@Mock private lateinit var launchAnimator: DialogLaunchAnimator
|
||||||
@Mock private lateinit var commandQueue: CommandQueue
|
@Mock private lateinit var commandQueue: CommandQueue
|
||||||
@Mock private lateinit var devicePolicyManager: DevicePolicyManager
|
@Mock private lateinit var devicePolicyManager: DevicePolicyManager
|
||||||
|
@Mock private lateinit var logger: KeyguardQuickAffordancesMetricsLogger
|
||||||
|
|
||||||
private lateinit var underTest: KeyguardBottomAreaViewModel
|
private lateinit var underTest: KeyguardBottomAreaViewModel
|
||||||
|
|
||||||
@@ -208,6 +210,7 @@ class KeyguardBottomAreaViewModelTest : SysuiTestCase() {
|
|||||||
featureFlags = featureFlags,
|
featureFlags = featureFlags,
|
||||||
repository = { quickAffordanceRepository },
|
repository = { quickAffordanceRepository },
|
||||||
launchAnimator = launchAnimator,
|
launchAnimator = launchAnimator,
|
||||||
|
logger = logger,
|
||||||
devicePolicyManager = devicePolicyManager,
|
devicePolicyManager = devicePolicyManager,
|
||||||
backgroundDispatcher = testDispatcher,
|
backgroundDispatcher = testDispatcher,
|
||||||
),
|
),
|
||||||
@@ -230,6 +233,7 @@ class KeyguardBottomAreaViewModelTest : SysuiTestCase() {
|
|||||||
icon = mock(),
|
icon = mock(),
|
||||||
canShowWhileLocked = false,
|
canShowWhileLocked = false,
|
||||||
intent = Intent("action"),
|
intent = Intent("action"),
|
||||||
|
slotId = KeyguardQuickAffordancePosition.BOTTOM_START.toSlotId(),
|
||||||
)
|
)
|
||||||
val configKey =
|
val configKey =
|
||||||
setUpQuickAffordanceModel(
|
setUpQuickAffordanceModel(
|
||||||
@@ -260,6 +264,7 @@ class KeyguardBottomAreaViewModelTest : SysuiTestCase() {
|
|||||||
icon = mock(),
|
icon = mock(),
|
||||||
canShowWhileLocked = false,
|
canShowWhileLocked = false,
|
||||||
intent = Intent("action"),
|
intent = Intent("action"),
|
||||||
|
slotId = KeyguardQuickAffordancePosition.BOTTOM_START.toSlotId(),
|
||||||
)
|
)
|
||||||
val configKey =
|
val configKey =
|
||||||
setUpQuickAffordanceModel(
|
setUpQuickAffordanceModel(
|
||||||
@@ -272,6 +277,7 @@ class KeyguardBottomAreaViewModelTest : SysuiTestCase() {
|
|||||||
testConfig =
|
testConfig =
|
||||||
TestConfig(
|
TestConfig(
|
||||||
isVisible = false,
|
isVisible = false,
|
||||||
|
slotId = KeyguardQuickAffordancePosition.BOTTOM_START.toSlotId(),
|
||||||
),
|
),
|
||||||
configKey = configKey,
|
configKey = configKey,
|
||||||
)
|
)
|
||||||
@@ -299,6 +305,7 @@ class KeyguardBottomAreaViewModelTest : SysuiTestCase() {
|
|||||||
icon = icon,
|
icon = icon,
|
||||||
canShowWhileLocked = false,
|
canShowWhileLocked = false,
|
||||||
intent = Intent("action"),
|
intent = Intent("action"),
|
||||||
|
slotId = KeyguardQuickAffordancePosition.BOTTOM_START.toSlotId(),
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -313,6 +320,7 @@ class KeyguardBottomAreaViewModelTest : SysuiTestCase() {
|
|||||||
canShowWhileLocked = false,
|
canShowWhileLocked = false,
|
||||||
intent = Intent("action"),
|
intent = Intent("action"),
|
||||||
isSelected = true,
|
isSelected = true,
|
||||||
|
slotId = KeyguardQuickAffordancePosition.BOTTOM_START.toSlotId(),
|
||||||
),
|
),
|
||||||
configKey = configKey,
|
configKey = configKey,
|
||||||
)
|
)
|
||||||
@@ -341,6 +349,7 @@ class KeyguardBottomAreaViewModelTest : SysuiTestCase() {
|
|||||||
icon = icon,
|
icon = icon,
|
||||||
canShowWhileLocked = false,
|
canShowWhileLocked = false,
|
||||||
intent = Intent("action"),
|
intent = Intent("action"),
|
||||||
|
slotId = KeyguardQuickAffordancePosition.BOTTOM_START.toSlotId(),
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
val configKey =
|
val configKey =
|
||||||
@@ -354,6 +363,7 @@ class KeyguardBottomAreaViewModelTest : SysuiTestCase() {
|
|||||||
icon = icon,
|
icon = icon,
|
||||||
canShowWhileLocked = false,
|
canShowWhileLocked = false,
|
||||||
intent = Intent("action"),
|
intent = Intent("action"),
|
||||||
|
slotId = KeyguardQuickAffordancePosition.BOTTOM_END.toSlotId(),
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -368,6 +378,7 @@ class KeyguardBottomAreaViewModelTest : SysuiTestCase() {
|
|||||||
canShowWhileLocked = false,
|
canShowWhileLocked = false,
|
||||||
intent = Intent("action"),
|
intent = Intent("action"),
|
||||||
isDimmed = true,
|
isDimmed = true,
|
||||||
|
slotId = KeyguardQuickAffordancePosition.BOTTOM_END.toSlotId(),
|
||||||
),
|
),
|
||||||
configKey = configKey,
|
configKey = configKey,
|
||||||
)
|
)
|
||||||
@@ -387,6 +398,7 @@ class KeyguardBottomAreaViewModelTest : SysuiTestCase() {
|
|||||||
canShowWhileLocked = false,
|
canShowWhileLocked = false,
|
||||||
intent =
|
intent =
|
||||||
null, // This will cause it to tell the system that the click was handled.
|
null, // This will cause it to tell the system that the click was handled.
|
||||||
|
slotId = KeyguardQuickAffordancePosition.BOTTOM_END.toSlotId(),
|
||||||
)
|
)
|
||||||
val configKey =
|
val configKey =
|
||||||
setUpQuickAffordanceModel(
|
setUpQuickAffordanceModel(
|
||||||
@@ -409,6 +421,7 @@ class KeyguardBottomAreaViewModelTest : SysuiTestCase() {
|
|||||||
val config =
|
val config =
|
||||||
TestConfig(
|
TestConfig(
|
||||||
isVisible = false,
|
isVisible = false,
|
||||||
|
slotId = KeyguardQuickAffordancePosition.BOTTOM_START.toSlotId(),
|
||||||
)
|
)
|
||||||
val configKey =
|
val configKey =
|
||||||
setUpQuickAffordanceModel(
|
setUpQuickAffordanceModel(
|
||||||
@@ -434,6 +447,7 @@ class KeyguardBottomAreaViewModelTest : SysuiTestCase() {
|
|||||||
icon = mock(),
|
icon = mock(),
|
||||||
canShowWhileLocked = false,
|
canShowWhileLocked = false,
|
||||||
intent = Intent("action"),
|
intent = Intent("action"),
|
||||||
|
slotId = KeyguardQuickAffordancePosition.BOTTOM_START.toSlotId(),
|
||||||
)
|
)
|
||||||
|
|
||||||
setUpQuickAffordanceModel(
|
setUpQuickAffordanceModel(
|
||||||
@@ -513,6 +527,7 @@ class KeyguardBottomAreaViewModelTest : SysuiTestCase() {
|
|||||||
isClickable = true,
|
isClickable = true,
|
||||||
icon = mock(),
|
icon = mock(),
|
||||||
canShowWhileLocked = true,
|
canShowWhileLocked = true,
|
||||||
|
slotId = KeyguardQuickAffordancePosition.BOTTOM_START.toSlotId(),
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
assertThat(value()).isTrue()
|
assertThat(value()).isTrue()
|
||||||
@@ -524,6 +539,7 @@ class KeyguardBottomAreaViewModelTest : SysuiTestCase() {
|
|||||||
isClickable = true,
|
isClickable = true,
|
||||||
icon = mock(),
|
icon = mock(),
|
||||||
canShowWhileLocked = false,
|
canShowWhileLocked = false,
|
||||||
|
slotId = KeyguardQuickAffordancePosition.BOTTOM_END.toSlotId(),
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
assertThat(value()).isTrue()
|
assertThat(value()).isTrue()
|
||||||
@@ -532,6 +548,7 @@ class KeyguardBottomAreaViewModelTest : SysuiTestCase() {
|
|||||||
testConfig =
|
testConfig =
|
||||||
TestConfig(
|
TestConfig(
|
||||||
isVisible = false,
|
isVisible = false,
|
||||||
|
slotId = KeyguardQuickAffordancePosition.BOTTOM_START.toSlotId(),
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
assertThat(value()).isTrue()
|
assertThat(value()).isTrue()
|
||||||
@@ -540,6 +557,7 @@ class KeyguardBottomAreaViewModelTest : SysuiTestCase() {
|
|||||||
testConfig =
|
testConfig =
|
||||||
TestConfig(
|
TestConfig(
|
||||||
isVisible = false,
|
isVisible = false,
|
||||||
|
slotId = KeyguardQuickAffordancePosition.BOTTOM_END.toSlotId(),
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
assertThat(value()).isFalse()
|
assertThat(value()).isFalse()
|
||||||
@@ -594,6 +612,7 @@ class KeyguardBottomAreaViewModelTest : SysuiTestCase() {
|
|||||||
icon = mock(),
|
icon = mock(),
|
||||||
canShowWhileLocked = false,
|
canShowWhileLocked = false,
|
||||||
intent = Intent("action"),
|
intent = Intent("action"),
|
||||||
|
slotId = KeyguardQuickAffordancePosition.BOTTOM_START.toSlotId(),
|
||||||
)
|
)
|
||||||
val configKey =
|
val configKey =
|
||||||
setUpQuickAffordanceModel(
|
setUpQuickAffordanceModel(
|
||||||
@@ -626,6 +645,7 @@ class KeyguardBottomAreaViewModelTest : SysuiTestCase() {
|
|||||||
icon = mock(),
|
icon = mock(),
|
||||||
canShowWhileLocked = false,
|
canShowWhileLocked = false,
|
||||||
intent = Intent("action"),
|
intent = Intent("action"),
|
||||||
|
slotId = KeyguardQuickAffordancePosition.BOTTOM_START.toSlotId(),
|
||||||
)
|
)
|
||||||
val configKey =
|
val configKey =
|
||||||
setUpQuickAffordanceModel(
|
setUpQuickAffordanceModel(
|
||||||
@@ -656,6 +676,7 @@ class KeyguardBottomAreaViewModelTest : SysuiTestCase() {
|
|||||||
icon = mock(),
|
icon = mock(),
|
||||||
canShowWhileLocked = false,
|
canShowWhileLocked = false,
|
||||||
intent = Intent("action"),
|
intent = Intent("action"),
|
||||||
|
slotId = KeyguardQuickAffordancePosition.BOTTOM_START.toSlotId(),
|
||||||
)
|
)
|
||||||
val configKey =
|
val configKey =
|
||||||
setUpQuickAffordanceModel(
|
setUpQuickAffordanceModel(
|
||||||
@@ -684,6 +705,7 @@ class KeyguardBottomAreaViewModelTest : SysuiTestCase() {
|
|||||||
icon = mock(),
|
icon = mock(),
|
||||||
canShowWhileLocked = false,
|
canShowWhileLocked = false,
|
||||||
intent = Intent("action"),
|
intent = Intent("action"),
|
||||||
|
slotId = KeyguardQuickAffordancePosition.BOTTOM_START.toSlotId(),
|
||||||
)
|
)
|
||||||
val configKey =
|
val configKey =
|
||||||
setUpQuickAffordanceModel(
|
setUpQuickAffordanceModel(
|
||||||
@@ -748,12 +770,14 @@ class KeyguardBottomAreaViewModelTest : SysuiTestCase() {
|
|||||||
assertThat(viewModel.isActivated).isEqualTo(testConfig.isActivated)
|
assertThat(viewModel.isActivated).isEqualTo(testConfig.isActivated)
|
||||||
assertThat(viewModel.isSelected).isEqualTo(testConfig.isSelected)
|
assertThat(viewModel.isSelected).isEqualTo(testConfig.isSelected)
|
||||||
assertThat(viewModel.isDimmed).isEqualTo(testConfig.isDimmed)
|
assertThat(viewModel.isDimmed).isEqualTo(testConfig.isDimmed)
|
||||||
|
assertThat(viewModel.slotId).isEqualTo(testConfig.slotId)
|
||||||
if (testConfig.isVisible) {
|
if (testConfig.isVisible) {
|
||||||
assertThat(viewModel.icon).isEqualTo(testConfig.icon)
|
assertThat(viewModel.icon).isEqualTo(testConfig.icon)
|
||||||
viewModel.onClicked.invoke(
|
viewModel.onClicked.invoke(
|
||||||
KeyguardQuickAffordanceViewModel.OnClickedParameters(
|
KeyguardQuickAffordanceViewModel.OnClickedParameters(
|
||||||
configKey = configKey,
|
configKey = configKey,
|
||||||
expandable = expandable,
|
expandable = expandable,
|
||||||
|
slotId = viewModel.slotId,
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
if (testConfig.intent != null) {
|
if (testConfig.intent != null) {
|
||||||
@@ -775,6 +799,7 @@ class KeyguardBottomAreaViewModelTest : SysuiTestCase() {
|
|||||||
val intent: Intent? = null,
|
val intent: Intent? = null,
|
||||||
val isSelected: Boolean = false,
|
val isSelected: Boolean = false,
|
||||||
val isDimmed: Boolean = false,
|
val isDimmed: Boolean = false,
|
||||||
|
val slotId: String = ""
|
||||||
) {
|
) {
|
||||||
init {
|
init {
|
||||||
check(!isVisible || icon != null) { "Must supply non-null icon if visible!" }
|
check(!isVisible || icon != null) { "Must supply non-null icon if visible!" }
|
||||||
|
|||||||
Reference in New Issue
Block a user