diff options
| author | 2024-03-27 14:44:43 +0000 | |
|---|---|---|
| committer | 2024-03-27 14:44:43 +0000 | |
| commit | 57089e1bd025360ee9be3ca5445fa79113c20476 (patch) | |
| tree | 38661b77a783a06ccdb55312fa76724b78559cac | |
| parent | 9358d9b51c16d84624d6979c9b951686fa894644 (diff) | |
| parent | 833a6e3ee8ab64e5d2fc31295e882d6dcc78ed92 (diff) | |
Merge "Remove Shade expansion FRP check" into main
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<ObservableTransitionState> { 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 5be5ef51bac0..757a6c9e5ac6 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 @@ -619,20 +619,6 @@ class ShadeInteractorImplTest : SysuiTestCase() { } @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 { powerRepository.updateWakefulness( 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<Boolean> = - 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 710cdcd5fcde..b6f653fabdc4 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/CentralSurfacesImpl.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/CentralSurfacesImpl.java @@ -2628,11 +2628,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<DevicePr */ boolean isCurrentUserSetup(); - /** Returns true when Factory Reset Protection is locking the device. */ - boolean isFrpActive(); - /** * Interface to provide calls when the values tracked change */ @@ -73,10 +70,5 @@ public interface DeviceProvisionedController extends CallbackController<DevicePr * Call when some user changes from not provisioned to provisioned */ default void onUserSetupChanged() { } - - /** - * Called when the state of FRP changes. - */ - default void onFrpActiveChanged() {} } } diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/policy/DeviceProvisionedControllerImpl.kt b/packages/SystemUI/src/com/android/systemui/statusbar/policy/DeviceProvisionedControllerImpl.kt index 8b20283749c5..8b63dfe28f08 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/policy/DeviceProvisionedControllerImpl.kt +++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/DeviceProvisionedControllerImpl.kt @@ -36,7 +36,6 @@ import com.android.systemui.dump.DumpManager import com.android.systemui.settings.UserTracker import com.android.systemui.util.settings.GlobalSettings import com.android.systemui.util.settings.SecureSettings -import com.android.systemui.util.wrapper.BuildInfo import java.io.PrintWriter import java.util.concurrent.Executor import java.util.concurrent.atomic.AtomicBoolean @@ -48,7 +47,6 @@ open class DeviceProvisionedControllerImpl @Inject constructor( private val globalSettings: GlobalSettings, private val userTracker: UserTracker, private val dumpManager: DumpManager, - private val buildInfo: BuildInfo, @Background private val backgroundHandler: Handler, @Main private val mainExecutor: Executor ) : DeviceProvisionedController, @@ -62,11 +60,9 @@ open class DeviceProvisionedControllerImpl @Inject constructor( } private val deviceProvisionedUri = globalSettings.getUriFor(Settings.Global.DEVICE_PROVISIONED) - private val frpActiveUri = globalSettings.getUriFor(Settings.Global.SECURE_FRP_MODE) private val userSetupUri = secureSettings.getUriFor(Settings.Secure.USER_SETUP_COMPLETE) private val deviceProvisioned = AtomicBoolean(false) - private val frpActive = AtomicBoolean(false) @GuardedBy("lock") private val userSetupComplete = SparseBooleanArray() @GuardedBy("lock") @@ -93,15 +89,11 @@ open class DeviceProvisionedControllerImpl @Inject constructor( userId: Int ) { val updateDeviceProvisioned = deviceProvisionedUri in uris - val updateFrp = frpActiveUri in uris val updateUser = if (userSetupUri in uris) userId else NO_USERS - updateValues(updateDeviceProvisioned, updateFrp, updateUser) + updateValues(updateDeviceProvisioned, updateUser) if (updateDeviceProvisioned) { onDeviceProvisionedChanged() } - if (updateFrp) { - onFrpActiveChanged() - } if (updateUser != NO_USERS) { onUserSetupChanged() } @@ -111,7 +103,7 @@ open class DeviceProvisionedControllerImpl @Inject constructor( private val userChangedCallback = object : UserTracker.Callback { @WorkerThread override fun onUserChanged(newUser: Int, userContext: Context) { - updateValues(updateDeviceProvisioned = false, updateFrp = false, updateUser = newUser) + updateValues(updateDeviceProvisioned = false, updateUser = newUser) onUserSwitched() } @@ -133,23 +125,18 @@ open class DeviceProvisionedControllerImpl @Inject constructor( updateValues() userTracker.addCallback(userChangedCallback, backgroundExecutor) globalSettings.registerContentObserver(deviceProvisionedUri, observer) - globalSettings.registerContentObserver(frpActiveUri, observer) secureSettings.registerContentObserverForUser(userSetupUri, observer, UserHandle.USER_ALL) } @WorkerThread private fun updateValues( - updateDeviceProvisioned: Boolean = true, - updateFrp: Boolean = true, - updateUser: Int = ALL_USERS + updateDeviceProvisioned: Boolean = true, + updateUser: Int = ALL_USERS ) { if (updateDeviceProvisioned) { deviceProvisioned .set(globalSettings.getInt(Settings.Global.DEVICE_PROVISIONED, 0) != 0) } - if (updateFrp) { - frpActive.set(globalSettings.getInt(Settings.Global.SECURE_FRP_MODE, 0) != 0) - } synchronized(lock) { if (updateUser == ALL_USERS) { val n = userSetupComplete.size() @@ -188,10 +175,6 @@ open class DeviceProvisionedControllerImpl @Inject constructor( return deviceProvisioned.get() } - override fun isFrpActive(): Boolean { - return frpActive.get() && !buildInfo.isDebuggable - } - override fun isUserSetup(user: Int): Boolean { val index = synchronized(lock) { userSetupComplete.indexOfKey(user) @@ -220,12 +203,6 @@ open class DeviceProvisionedControllerImpl @Inject constructor( ) } - override fun onFrpActiveChanged() { - dispatchChange( - DeviceProvisionedController.DeviceProvisionedListener::onFrpActiveChanged - ) - } - override fun onUserSetupChanged() { dispatchChange(DeviceProvisionedController.DeviceProvisionedListener::onUserSetupChanged) } @@ -247,7 +224,6 @@ open class DeviceProvisionedControllerImpl @Inject constructor( override fun dump(pw: PrintWriter, args: Array<out String>) { 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<Boolean> - - /** Whether Factory Reset Protection (FRP) is currently active, locking the device. */ - val isFactoryResetProtectionActive: Flow<Boolean> } @Module @@ -58,16 +55,4 @@ constructor( trySend(deviceProvisionedController.isDeviceProvisioned) awaitClose { deviceProvisionedController.removeCallback(listener) } } - - override val isFactoryResetProtectionActive: Flow<Boolean> = 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<Boolean> = repository.isDeviceProvisioned - - /** Whether Factory Reset Protection (FRP) is currently active, locking the device. */ - val isFactoryResetProtectionActive: Flow<Boolean> = 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, @@ -120,20 +119,6 @@ class NotificationIconContainerAlwaysOnDisplayViewModelTest : SysuiTestCase() { } @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 { powerRepository.updateWakefulness( 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, @@ -127,20 +126,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 { powerRepository.updateWakefulness( 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 ) @@ -99,12 +98,6 @@ class DeviceProvisionedControllerImplTest : SysuiTestCase() { } @Test - fun testFrpNotActiveByDefault() { - init() - assertThat(controller.isFrpActive).isFalse() - } - - @Test fun testNotUserSetupByDefault() { init() assertThat(controller.isUserSetup(START_USER)).isFalse() @@ -119,14 +112,6 @@ class DeviceProvisionedControllerImplTest : SysuiTestCase() { } @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) init() @@ -145,16 +130,6 @@ class DeviceProvisionedControllerImplTest : SysuiTestCase() { } @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,26 +216,10 @@ 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() controller.addCallback(listener) @@ -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<Boolean> = _isDeviceProvisioned - private val _isFactoryResetProtectionActive = MutableStateFlow(false) - override val isFactoryResetProtectionActive: Flow<Boolean> = _isFactoryResetProtectionActive fun setDeviceProvisioned(isProvisioned: Boolean) { _isDeviceProvisioned.value = isProvisioned } - fun setFactoryResetProtectionActive(isActive: Boolean) { - _isFactoryResetProtectionActive.value = isActive - } } @Module |