From 833a6e3ee8ab64e5d2fc31295e882d6dcc78ed92 Mon Sep 17 00:00:00 2001 From: Justin Weir Date: Thu, 21 Mar 2024 10:17:51 -0400 Subject: Remove Shade expansion FRP check The shade is no longer required to remain collapsed when FRP is active so that check has been removed. Since it was the only FRP check in all of SysUI, the FRP support in DeviceProvisionedController has also been removed. Fixes: 310394043 Test: manual Test: updated and ran affected tests Flag: NONE Change-Id: Ibefa0aea69ecc9477efc42b01e00d16f023ff21f --- .../scene/SceneFrameworkIntegrationTest.kt | 16 -------- .../startable/SceneContainerStartableTest.kt | 11 +----- .../domain/interactor/ShadeInteractorImplTest.kt | 14 ------- .../domain/startable/SceneContainerStartable.kt | 7 +--- .../src/com/android/systemui/shade/ShadeLogger.kt | 12 ++---- .../shade/domain/interactor/ShadeInteractorImpl.kt | 14 ++----- .../statusbar/phone/CentralSurfacesImpl.java | 5 +-- .../policy/DeviceProvisionedController.java | 8 ---- .../policy/DeviceProvisionedControllerImpl.kt | 32 ++------------- .../repository/DeviceProvisioningRepository.kt | 15 ------- .../interactor/DeviceProvisioningInteractor.kt | 3 -- ...ionIconContainerAlwaysOnDisplayViewModelTest.kt | 15 ------- ...ificationIconContainerStatusBarViewModelTest.kt | 15 ------- .../statusbar/phone/CentralSurfacesImplTest.java | 9 ----- .../policy/DeviceProvisionedControllerImplTest.kt | 46 ---------------------- .../DeviceProvisioningRepositoryImplTest.kt | 27 ------------- .../policy/FakeDeviceProvisionedController.kt | 4 -- .../repository/FakeDeviceProvisioningRepository.kt | 5 --- 18 files changed, 15 insertions(+), 243 deletions(-) diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/scene/SceneFrameworkIntegrationTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/scene/SceneFrameworkIntegrationTest.kt index af9abcda73fe..307778bf7e0f 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/scene/SceneFrameworkIntegrationTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/scene/SceneFrameworkIntegrationTest.kt @@ -86,7 +86,6 @@ import com.android.systemui.statusbar.pipeline.mobile.domain.interactor.FakeMobi import com.android.systemui.statusbar.pipeline.mobile.ui.viewmodel.MobileIconsViewModel import com.android.systemui.statusbar.pipeline.mobile.util.FakeMobileMappingsProxy import com.android.systemui.statusbar.pipeline.shared.data.repository.FakeConnectivityRepository -import com.android.systemui.statusbar.policy.data.repository.fakeDeviceProvisioningRepository import com.android.systemui.statusbar.policy.domain.interactor.deviceProvisioningInteractor import com.android.systemui.telephony.data.repository.fakeTelephonyRepository import com.android.systemui.testKosmos @@ -549,21 +548,6 @@ class SceneFrameworkIntegrationTest : SysuiTestCase() { assertCurrentScene(Scenes.Lockscreen) } - @Test - fun deviceProvisioningAndFactoryResetProtection() = - testScope.runTest { - val isVisible by collectLastValue(sceneContainerViewModel.isVisible) - kosmos.fakeDeviceProvisioningRepository.setDeviceProvisioned(false) - kosmos.fakeDeviceProvisioningRepository.setFactoryResetProtectionActive(true) - assertThat(isVisible).isFalse() - - kosmos.fakeDeviceProvisioningRepository.setFactoryResetProtectionActive(false) - assertThat(isVisible).isFalse() - - kosmos.fakeDeviceProvisioningRepository.setDeviceProvisioned(true) - assertThat(isVisible).isTrue() - } - /** * Asserts that the current scene in the view-model matches what's expected. * diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/scene/domain/startable/SceneContainerStartableTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/scene/domain/startable/SceneContainerStartableTest.kt index f018cc189a5e..594543b88b17 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/scene/domain/startable/SceneContainerStartableTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/scene/domain/startable/SceneContainerStartableTest.kt @@ -187,27 +187,20 @@ class SceneContainerStartableTest : SysuiTestCase() { } @Test - fun hydrateVisibility_basedOnDeviceProvisioningAndFactoryResetProtection() = + fun hydrateVisibility_basedOnDeviceProvisioning() = testScope.runTest { val isVisible by collectLastValue(sceneInteractor.isVisible) prepareState( isDeviceUnlocked = true, initialSceneKey = Scenes.Lockscreen, isDeviceProvisioned = false, - isFrpActive = true, ) underTest.start() assertThat(isVisible).isFalse() - kosmos.fakeDeviceProvisioningRepository.setFactoryResetProtectionActive(false) - assertThat(isVisible).isFalse() - kosmos.fakeDeviceProvisioningRepository.setDeviceProvisioned(true) assertThat(isVisible).isTrue() - - kosmos.fakeDeviceProvisioningRepository.setFactoryResetProtectionActive(true) - assertThat(isVisible).isFalse() } @Test @@ -1030,7 +1023,6 @@ class SceneContainerStartableTest : SysuiTestCase() { isLockscreenEnabled: Boolean = true, startsAwake: Boolean = true, isDeviceProvisioned: Boolean = true, - isFrpActive: Boolean = false, ): MutableStateFlow { if (authenticationMethod?.isSecure == true) { assert(isLockscreenEnabled) { @@ -1068,7 +1060,6 @@ class SceneContainerStartableTest : SysuiTestCase() { } kosmos.fakeDeviceProvisioningRepository.setDeviceProvisioned(isDeviceProvisioned) - kosmos.fakeDeviceProvisioningRepository.setFactoryResetProtectionActive(isFrpActive) runCurrent() diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/shade/domain/interactor/ShadeInteractorImplTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/shade/domain/interactor/ShadeInteractorImplTest.kt index 4e82feb3a2c6..eec5c5c0525b 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/shade/domain/interactor/ShadeInteractorImplTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/shade/domain/interactor/ShadeInteractorImplTest.kt @@ -602,20 +602,6 @@ class ShadeInteractorImplTest : SysuiTestCase() { assertThat(actual).isFalse() } - @Test - fun isShadeTouchable_isFalse_whenFrpIsActive() = - testScope.runTest { - deviceProvisioningRepository.setFactoryResetProtectionActive(true) - keyguardTransitionRepository.sendTransitionStep( - TransitionStep( - transitionState = TransitionState.STARTED, - ) - ) - val isShadeTouchable by collectLastValue(underTest.isShadeTouchable) - runCurrent() - assertThat(isShadeTouchable).isFalse() - } - @Test fun isShadeTouchable_isFalse_whenDeviceAsleepAndNotPulsing() = testScope.runTest { diff --git a/packages/SystemUI/src/com/android/systemui/scene/domain/startable/SceneContainerStartable.kt b/packages/SystemUI/src/com/android/systemui/scene/domain/startable/SceneContainerStartable.kt index 32e8f55e68e7..42b41f88e155 100644 --- a/packages/SystemUI/src/com/android/systemui/scene/domain/startable/SceneContainerStartable.kt +++ b/packages/SystemUI/src/com/android/systemui/scene/domain/startable/SceneContainerStartable.kt @@ -126,12 +126,7 @@ constructor( private fun hydrateVisibility() { applicationScope.launch { // TODO(b/296114544): Combine with some global hun state to make it visible! - combine( - deviceProvisioningInteractor.isDeviceProvisioned, - deviceProvisioningInteractor.isFactoryResetProtectionActive, - ) { isDeviceProvisioned, isFrpActive -> - isDeviceProvisioned && !isFrpActive - } + deviceProvisioningInteractor.isDeviceProvisioned .distinctUntilChanged() .flatMapLatest { isAllowedToBeVisible -> if (isAllowedToBeVisible) { diff --git a/packages/SystemUI/src/com/android/systemui/shade/ShadeLogger.kt b/packages/SystemUI/src/com/android/systemui/shade/ShadeLogger.kt index 8d23f5d71681..b5b46f1c1317 100644 --- a/packages/SystemUI/src/com/android/systemui/shade/ShadeLogger.kt +++ b/packages/SystemUI/src/com/android/systemui/shade/ShadeLogger.kt @@ -17,9 +17,9 @@ package com.android.systemui.shade import android.view.MotionEvent -import com.android.systemui.log.dagger.ShadeLog import com.android.systemui.log.LogBuffer import com.android.systemui.log.core.LogLevel +import com.android.systemui.log.dagger.ShadeLog import com.android.systemui.shade.ShadeViewController.Companion.FLING_COLLAPSE import com.android.systemui.shade.ShadeViewController.Companion.FLING_EXPAND import com.android.systemui.shade.ShadeViewController.Companion.FLING_HIDE @@ -304,8 +304,7 @@ class ShadeLogger @Inject constructor(@ShadeLog private val buffer: LogBuffer) { msg: String, forceCancel: Boolean, expand: Boolean, - ) - { + ) { buffer.log( TAG, LogLevel.VERBOSE, @@ -322,8 +321,7 @@ class ShadeLogger @Inject constructor(@ShadeLog private val buffer: LogBuffer) { msg: String, panelClosedOnDown: Boolean, expandFraction: Float, - ) - { + ) { buffer.log( TAG, LogLevel.VERBOSE, @@ -381,7 +379,6 @@ class ShadeLogger @Inject constructor(@ShadeLog private val buffer: LogBuffer) { shouldControlScreenOff: Boolean, deviceInteractive: Boolean, isPulsing: Boolean, - isFrpActive: Boolean, ) { buffer.log( TAG, @@ -392,12 +389,11 @@ class ShadeLogger @Inject constructor(@ShadeLog private val buffer: LogBuffer) { bool3 = shouldControlScreenOff bool4 = deviceInteractive str1 = isPulsing.toString() - str2 = isFrpActive.toString() }, { "CentralSurfaces updateNotificationPanelTouchState set disabled to: $bool1\n" + "isGoingToSleep: $bool2, !shouldControlScreenOff: $bool3," + - "!mDeviceInteractive: $bool4, !isPulsing: $str1, isFrpActive: $str2" + "!mDeviceInteractive: $bool4, !isPulsing: $str1" } ) } diff --git a/packages/SystemUI/src/com/android/systemui/shade/domain/interactor/ShadeInteractorImpl.kt b/packages/SystemUI/src/com/android/systemui/shade/domain/interactor/ShadeInteractorImpl.kt index e619806abc34..7e14e58b4c9c 100644 --- a/packages/SystemUI/src/com/android/systemui/shade/domain/interactor/ShadeInteractorImpl.kt +++ b/packages/SystemUI/src/com/android/systemui/shade/domain/interactor/ShadeInteractorImpl.kt @@ -28,7 +28,6 @@ import com.android.systemui.statusbar.phone.DozeParameters import com.android.systemui.statusbar.policy.data.repository.UserSetupRepository import com.android.systemui.statusbar.policy.domain.interactor.DeviceProvisioningInteractor import com.android.systemui.user.domain.interactor.UserSwitcherInteractor -import com.android.systemui.util.kotlin.combine import javax.inject.Inject import kotlinx.coroutines.CoroutineScope import kotlinx.coroutines.flow.Flow @@ -56,12 +55,8 @@ constructor( private val baseShadeInteractor: BaseShadeInteractor, ) : ShadeInteractor, BaseShadeInteractor by baseShadeInteractor { override val isShadeEnabled: StateFlow = - combine( - deviceProvisioningInteractor.isFactoryResetProtectionActive, - disableFlagsRepository.disableFlags, - ) { isFrpActive, isDisabledByFlags -> - isDisabledByFlags.isShadeEnabled() && !isFrpActive - } + disableFlagsRepository.disableFlags + .map { isDisabledByFlags -> isDisabledByFlags.isShadeEnabled() } .distinctUntilChanged() .stateIn(scope, SharingStarted.Eagerly, initialValue = false) @@ -84,11 +79,8 @@ constructor( powerInteractor.isAsleep, keyguardTransitionInteractor.isInTransitionToStateWhere { it == KeyguardState.AOD }, keyguardRepository.dozeTransitionModel.map { it.to == DozeStateModel.DOZE_PULSING }, - deviceProvisioningInteractor.isFactoryResetProtectionActive, - ) { isAsleep, goingToSleep, isPulsing, isFrpActive -> + ) { isAsleep, goingToSleep, isPulsing -> when { - // Touches are disabled when Factory Reset Protection is active - isFrpActive -> false // If the device is going to sleep, only accept touches if we're still // animating goingToSleep -> dozeParams.shouldControlScreenOff() diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/CentralSurfacesImpl.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/CentralSurfacesImpl.java index f76de04c0c18..4662dd4b7952 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/CentralSurfacesImpl.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/CentralSurfacesImpl.java @@ -2629,11 +2629,10 @@ public class CentralSurfacesImpl implements CoreStartable, CentralSurfaces { boolean goingToSleepWithoutAnimation = isGoingToSleep() && !mDozeParameters.shouldControlScreenOff(); boolean disabled = (!mDeviceInteractive && !mDozeServiceHost.isPulsing()) - || goingToSleepWithoutAnimation - || mDeviceProvisionedController.isFrpActive(); + || goingToSleepWithoutAnimation; mShadeLogger.logUpdateNotificationPanelTouchState(disabled, isGoingToSleep(), !mDozeParameters.shouldControlScreenOff(), !mDeviceInteractive, - !mDozeServiceHost.isPulsing(), mDeviceProvisionedController.isFrpActive()); + !mDozeServiceHost.isPulsing()); mShadeSurface.setTouchAndAnimationDisabled(disabled); if (!NotificationIconContainerRefactor.isEnabled()) { diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/policy/DeviceProvisionedController.java b/packages/SystemUI/src/com/android/systemui/statusbar/policy/DeviceProvisionedController.java index 0d09fc184892..e432158c8cbb 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/policy/DeviceProvisionedController.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/DeviceProvisionedController.java @@ -50,9 +50,6 @@ public interface DeviceProvisionedController extends CallbackController) { pw.println("Device provisioned: ${deviceProvisioned.get()}") - pw.println("Factory Reset Protection active: ${frpActive.get()}") synchronized(lock) { pw.println("User setup complete: $userSetupComplete") pw.println("Listeners: $listeners") diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/policy/data/repository/DeviceProvisioningRepository.kt b/packages/SystemUI/src/com/android/systemui/statusbar/policy/data/repository/DeviceProvisioningRepository.kt index 1160d657ba88..483855409b91 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/policy/data/repository/DeviceProvisioningRepository.kt +++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/data/repository/DeviceProvisioningRepository.kt @@ -31,9 +31,6 @@ interface DeviceProvisioningRepository { * @see android.provider.Settings.Global.DEVICE_PROVISIONED */ val isDeviceProvisioned: Flow - - /** Whether Factory Reset Protection (FRP) is currently active, locking the device. */ - val isFactoryResetProtectionActive: Flow } @Module @@ -58,16 +55,4 @@ constructor( trySend(deviceProvisionedController.isDeviceProvisioned) awaitClose { deviceProvisionedController.removeCallback(listener) } } - - override val isFactoryResetProtectionActive: Flow = conflatedCallbackFlow { - val listener = - object : DeviceProvisionedController.DeviceProvisionedListener { - override fun onFrpActiveChanged() { - trySend(deviceProvisionedController.isFrpActive) - } - } - deviceProvisionedController.addCallback(listener) - trySend(deviceProvisionedController.isFrpActive) - awaitClose { deviceProvisionedController.removeCallback(listener) } - } } diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/policy/domain/interactor/DeviceProvisioningInteractor.kt b/packages/SystemUI/src/com/android/systemui/statusbar/policy/domain/interactor/DeviceProvisioningInteractor.kt index 32cf86d8e390..66ed092fcce1 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/policy/domain/interactor/DeviceProvisioningInteractor.kt +++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/domain/interactor/DeviceProvisioningInteractor.kt @@ -34,7 +34,4 @@ constructor( * @see android.provider.Settings.Global.DEVICE_PROVISIONED */ val isDeviceProvisioned: Flow = repository.isDeviceProvisioned - - /** Whether Factory Reset Protection (FRP) is currently active, locking the device. */ - val isFactoryResetProtectionActive: Flow = repository.isFactoryResetProtectionActive } diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/icon/ui/viewmodel/NotificationIconContainerAlwaysOnDisplayViewModelTest.kt b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/icon/ui/viewmodel/NotificationIconContainerAlwaysOnDisplayViewModelTest.kt index 24195fe0640c..4eb7daa1eac7 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/icon/ui/viewmodel/NotificationIconContainerAlwaysOnDisplayViewModelTest.kt +++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/icon/ui/viewmodel/NotificationIconContainerAlwaysOnDisplayViewModelTest.kt @@ -109,7 +109,6 @@ class NotificationIconContainerAlwaysOnDisplayViewModelTest : SysuiTestCase() { testComponent.apply { keyguardRepository.setKeyguardShowing(true) keyguardRepository.setKeyguardOccluded(false) - deviceProvisioningRepository.setFactoryResetProtectionActive(false) powerRepository.updateWakefulness( rawState = WakefulnessState.AWAKE, lastWakeReason = WakeSleepReason.OTHER, @@ -119,20 +118,6 @@ class NotificationIconContainerAlwaysOnDisplayViewModelTest : SysuiTestCase() { mSetFlagsRule.enableFlags(FLAG_NEW_AOD_TRANSITION) } - @Test - fun animationsEnabled_isFalse_whenFrpIsActive() = - testComponent.runTest { - deviceProvisioningRepository.setFactoryResetProtectionActive(true) - keyguardTransitionRepository.sendTransitionStep( - TransitionStep( - transitionState = TransitionState.STARTED, - ) - ) - val animationsEnabled by collectLastValue(underTest.areContainerChangesAnimated) - runCurrent() - assertThat(animationsEnabled).isFalse() - } - @Test fun animationsEnabled_isFalse_whenDeviceAsleepAndNotPulsing() = testComponent.runTest { diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/icon/ui/viewmodel/NotificationIconContainerStatusBarViewModelTest.kt b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/icon/ui/viewmodel/NotificationIconContainerStatusBarViewModelTest.kt index c40401fe4d59..35b84939b05d 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/icon/ui/viewmodel/NotificationIconContainerStatusBarViewModelTest.kt +++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/icon/ui/viewmodel/NotificationIconContainerStatusBarViewModelTest.kt @@ -117,7 +117,6 @@ class NotificationIconContainerStatusBarViewModelTest : SysuiTestCase() { fun setup() { testComponent.apply { keyguardRepository.setKeyguardShowing(false) - deviceProvisioningRepository.setFactoryResetProtectionActive(false) powerRepository.updateWakefulness( rawState = WakefulnessState.AWAKE, lastWakeReason = WakeSleepReason.OTHER, @@ -126,20 +125,6 @@ class NotificationIconContainerStatusBarViewModelTest : SysuiTestCase() { } } - @Test - fun animationsEnabled_isFalse_whenFrpIsActive() = - testComponent.runTest { - deviceProvisioningRepository.setFactoryResetProtectionActive(true) - keyguardTransitionRepository.sendTransitionStep( - TransitionStep( - transitionState = TransitionState.STARTED, - ) - ) - val animationsEnabled by collectLastValue(underTest.animationsEnabled) - runCurrent() - assertThat(animationsEnabled).isFalse() - } - @Test fun animationsEnabled_isFalse_whenDeviceAsleepAndNotPulsing() = testComponent.runTest { diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/CentralSurfacesImplTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/CentralSurfacesImplTest.java index dd534748db83..ed29665c6e16 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/CentralSurfacesImplTest.java +++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/CentralSurfacesImplTest.java @@ -1035,15 +1035,6 @@ public class CentralSurfacesImplTest extends SysuiTestCase { verify(mStatusBarStateController).setState(SHADE); } - @Test - public void frpLockedDevice_shadeDisabled() { - when(mDeviceProvisionedController.isFrpActive()).thenReturn(true); - when(mDozeServiceHost.isPulsing()).thenReturn(true); - mCentralSurfaces.updateNotificationPanelTouchState(); - - verify(mNotificationPanelViewController).setTouchAndAnimationDisabled(true); - } - /** Regression test for b/298355063 */ @Test public void fingerprintManagerNull_noNPE() { diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/DeviceProvisionedControllerImplTest.kt b/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/DeviceProvisionedControllerImplTest.kt index 361fa5b169d9..31bd57e777d1 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/DeviceProvisionedControllerImplTest.kt +++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/DeviceProvisionedControllerImplTest.kt @@ -86,7 +86,6 @@ class DeviceProvisionedControllerImplTest : SysuiTestCase() { globalSettings, userTracker, dumpManager, - buildInfo, Handler(testableLooper.looper), mainExecutor ) @@ -98,12 +97,6 @@ class DeviceProvisionedControllerImplTest : SysuiTestCase() { assertThat(controller.isDeviceProvisioned).isFalse() } - @Test - fun testFrpNotActiveByDefault() { - init() - assertThat(controller.isFrpActive).isFalse() - } - @Test fun testNotUserSetupByDefault() { init() @@ -118,14 +111,6 @@ class DeviceProvisionedControllerImplTest : SysuiTestCase() { assertThat(controller.isDeviceProvisioned).isTrue() } - @Test - fun testFrpActiveWhenCreated() { - globalSettings.putInt(Settings.Global.SECURE_FRP_MODE, 1) - init() - - assertThat(controller.isFrpActive).isTrue() - } - @Test fun testUserSetupWhenCreated() { secureSettings.putIntForUser(Settings.Secure.USER_SETUP_COMPLETE, 1, START_USER) @@ -144,16 +129,6 @@ class DeviceProvisionedControllerImplTest : SysuiTestCase() { assertThat(controller.isDeviceProvisioned).isTrue() } - @Test - fun testFrpActiveChange() { - init() - - globalSettings.putInt(Settings.Global.SECURE_FRP_MODE, 1) - testableLooper.processAllMessages() // background observer - - assertThat(controller.isFrpActive).isTrue() - } - @Test fun testUserSetupChange() { init() @@ -197,7 +172,6 @@ class DeviceProvisionedControllerImplTest : SysuiTestCase() { mainExecutor.runAllReady() verify(listener, never()).onDeviceProvisionedChanged() - verify(listener, never()).onFrpActiveChanged() verify(listener, never()).onUserSetupChanged() verify(listener, never()).onUserSwitched() } @@ -215,7 +189,6 @@ class DeviceProvisionedControllerImplTest : SysuiTestCase() { verify(listener).onUserSwitched() verify(listener, never()).onUserSetupChanged() verify(listener, never()).onDeviceProvisionedChanged() - verify(listener, never()).onFrpActiveChanged() } @Test @@ -230,7 +203,6 @@ class DeviceProvisionedControllerImplTest : SysuiTestCase() { verify(listener, never()).onUserSwitched() verify(listener).onUserSetupChanged() verify(listener, never()).onDeviceProvisionedChanged() - verify(listener, never()).onFrpActiveChanged() } @Test @@ -244,25 +216,9 @@ class DeviceProvisionedControllerImplTest : SysuiTestCase() { verify(listener, never()).onUserSwitched() verify(listener, never()).onUserSetupChanged() - verify(listener, never()).onFrpActiveChanged() verify(listener).onDeviceProvisionedChanged() } - @Test - fun testListenerCalledOnFrpActiveChanged() { - init() - controller.addCallback(listener) - - globalSettings.putInt(Settings.Global.SECURE_FRP_MODE, 1) - testableLooper.processAllMessages() - mainExecutor.runAllReady() - - verify(listener, never()).onUserSwitched() - verify(listener, never()).onUserSetupChanged() - verify(listener, never()).onDeviceProvisionedChanged() - verify(listener).onFrpActiveChanged() - } - @Test fun testRemoveListener() { init() @@ -272,13 +228,11 @@ class DeviceProvisionedControllerImplTest : SysuiTestCase() { switchUser(10) secureSettings.putIntForUser(Settings.Secure.USER_SETUP_COMPLETE, 1, START_USER) globalSettings.putInt(Settings.Global.DEVICE_PROVISIONED, 1) - globalSettings.putInt(Settings.Global.SECURE_FRP_MODE, 1) testableLooper.processAllMessages() mainExecutor.runAllReady() verify(listener, never()).onDeviceProvisionedChanged() - verify(listener, never()).onFrpActiveChanged() verify(listener, never()).onUserSetupChanged() verify(listener, never()).onUserSwitched() } diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/data/repository/DeviceProvisioningRepositoryImplTest.kt b/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/data/repository/DeviceProvisioningRepositoryImplTest.kt index 12694ae998c1..21ed3841c70b 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/data/repository/DeviceProvisioningRepositoryImplTest.kt +++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/data/repository/DeviceProvisioningRepositoryImplTest.kt @@ -78,31 +78,4 @@ class DeviceProvisioningRepositoryImplTest : SysuiTestCase() { .onDeviceProvisionedChanged() assertThat(deviceProvisioned).isFalse() } - - @Test - fun isFrpActive_reflectsCurrentControllerState() = runTest { - whenever(deviceProvisionedController.isFrpActive).thenReturn(true) - val frpActive by collectLastValue(underTest.isFactoryResetProtectionActive) - assertThat(frpActive).isTrue() - } - - @Test - fun isFrpActive_updatesWhenControllerStateChanges_toTrue() = runTest { - val frpActive by collectLastValue(underTest.isFactoryResetProtectionActive) - runCurrent() - whenever(deviceProvisionedController.isFrpActive).thenReturn(true) - withArgCaptor { verify(deviceProvisionedController).addCallback(capture()) } - .onFrpActiveChanged() - assertThat(frpActive).isTrue() - } - - @Test - fun isFrpActive_updatesWhenControllerStateChanges_toFalse() = runTest { - val frpActive by collectLastValue(underTest.isFactoryResetProtectionActive) - runCurrent() - whenever(deviceProvisionedController.isFrpActive).thenReturn(false) - withArgCaptor { verify(deviceProvisionedController).addCallback(capture()) } - .onFrpActiveChanged() - assertThat(frpActive).isFalse() - } } diff --git a/packages/SystemUI/tests/utils/src/com/android/systemui/statusbar/policy/FakeDeviceProvisionedController.kt b/packages/SystemUI/tests/utils/src/com/android/systemui/statusbar/policy/FakeDeviceProvisionedController.kt index ebcabf82c166..91b29560930e 100644 --- a/packages/SystemUI/tests/utils/src/com/android/systemui/statusbar/policy/FakeDeviceProvisionedController.kt +++ b/packages/SystemUI/tests/utils/src/com/android/systemui/statusbar/policy/FakeDeviceProvisionedController.kt @@ -30,10 +30,6 @@ class FakeDeviceProvisionedController : DeviceProvisionedController { return currentUser in usersSetup } - override fun isFrpActive(): Boolean { - TODO("Not yet implemented") - } - fun setCurrentUser(userId: Int) { currentUser = userId callbacks.toSet().forEach { it.onUserSwitched() } diff --git a/packages/SystemUI/tests/utils/src/com/android/systemui/statusbar/policy/data/repository/FakeDeviceProvisioningRepository.kt b/packages/SystemUI/tests/utils/src/com/android/systemui/statusbar/policy/data/repository/FakeDeviceProvisioningRepository.kt index fc6a800e186c..9247e889f8f9 100644 --- a/packages/SystemUI/tests/utils/src/com/android/systemui/statusbar/policy/data/repository/FakeDeviceProvisioningRepository.kt +++ b/packages/SystemUI/tests/utils/src/com/android/systemui/statusbar/policy/data/repository/FakeDeviceProvisioningRepository.kt @@ -26,14 +26,9 @@ import kotlinx.coroutines.flow.MutableStateFlow class FakeDeviceProvisioningRepository @Inject constructor() : DeviceProvisioningRepository { private val _isDeviceProvisioned = MutableStateFlow(true) override val isDeviceProvisioned: Flow = _isDeviceProvisioned - private val _isFactoryResetProtectionActive = MutableStateFlow(false) - override val isFactoryResetProtectionActive: Flow = _isFactoryResetProtectionActive fun setDeviceProvisioned(isProvisioned: Boolean) { _isDeviceProvisioned.value = isProvisioned } - fun setFactoryResetProtectionActive(isActive: Boolean) { - _isFactoryResetProtectionActive.value = isActive - } } @Module -- cgit v1.2.3-59-g8ed1b