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 b5d51ce2b9ee3..2e3e71757daa2 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/CentralSurfacesImpl.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/CentralSurfacesImpl.java
@@ -3571,7 +3571,8 @@ public class CentralSurfacesImpl implements CoreStartable, CentralSurfaces {
boolean goingToSleepWithoutAnimation = isGoingToSleep()
&& !mDozeParameters.shouldControlScreenOff();
boolean disabled = (!mDeviceInteractive && !mDozeServiceHost.isPulsing())
- || goingToSleepWithoutAnimation;
+ || goingToSleepWithoutAnimation
+ || mDeviceProvisionedController.isFrpActive();
mNotificationPanelViewController.setTouchAndAnimationDisabled(disabled);
mNotificationIconAreaController.setAnimationsEnabled(!disabled);
}
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 3944c8c77f499..0d09fc184892b 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/policy/DeviceProvisionedController.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/DeviceProvisionedController.java
@@ -21,7 +21,8 @@ import com.android.systemui.statusbar.policy.DeviceProvisionedController.DeviceP
/**
* Controller to cache in process the state of the device provisioning.
*
- * This controller keeps track of the values of device provisioning and user setup complete
+ * This controller keeps track of the values of device provisioning, user setup complete, and
+ * whether Factory Reset Protection is active.
*/
public interface DeviceProvisionedController extends CallbackController {
@@ -49,6 +50,9 @@ 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/tests/src/com/android/systemui/statusbar/phone/CentralSurfacesImplTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/CentralSurfacesImplTest.java
index 5a5b1424758fc..52a93e7e07b3a 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
@@ -1259,6 +1259,15 @@ public class CentralSurfacesImplTest extends SysuiTestCase {
verify(mPowerManagerService, never()).wakeUp(anyLong(), anyInt(), anyString(), anyString());
}
+ @Test
+ public void frpLockedDevice_shadeDisabled() {
+ when(mDeviceProvisionedController.isFrpActive()).thenReturn(true);
+ when(mDozeServiceHost.isPulsing()).thenReturn(true);
+ mCentralSurfaces.updateNotificationPanelTouchState();
+
+ verify(mNotificationPanelViewController).setTouchAndAnimationDisabled(true);
+ }
+
/**
* Configures the appropriate mocks and then calls {@link CentralSurfacesImpl#updateIsKeyguard}
* to reconfigure the keyguard to reflect the requested showing/occluded states.
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 5129f85841654..6980a0b4565e9 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
@@ -89,6 +89,12 @@ class DeviceProvisionedControllerImplTest : SysuiTestCase() {
assertThat(controller.isDeviceProvisioned).isFalse()
}
+ @Test
+ fun testFrpNotActiveByDefault() {
+ init()
+ assertThat(controller.isFrpActive).isFalse()
+ }
+
@Test
fun testNotUserSetupByDefault() {
init()
@@ -103,6 +109,14 @@ class DeviceProvisionedControllerImplTest : SysuiTestCase() {
assertThat(controller.isDeviceProvisioned).isTrue()
}
+ @Test
+ fun testFrpActiveWhenCreated() {
+ settings.putInt(Settings.Secure.SECURE_FRP_MODE, 1)
+ init()
+
+ assertThat(controller.isFrpActive).isTrue()
+ }
+
@Test
fun testUserSetupWhenCreated() {
settings.putIntForUser(Settings.Secure.USER_SETUP_COMPLETE, 1, START_USER)
@@ -121,6 +135,16 @@ class DeviceProvisionedControllerImplTest : SysuiTestCase() {
assertThat(controller.isDeviceProvisioned).isTrue()
}
+ @Test
+ fun testFrpActiveChange() {
+ init()
+
+ settings.putInt(Settings.Secure.SECURE_FRP_MODE, 1)
+ testableLooper.processAllMessages() // background observer
+
+ assertThat(controller.isFrpActive).isTrue()
+ }
+
@Test
fun testUserSetupChange() {
init()
@@ -164,6 +188,7 @@ class DeviceProvisionedControllerImplTest : SysuiTestCase() {
mainExecutor.runAllReady()
verify(listener, never()).onDeviceProvisionedChanged()
+ verify(listener, never()).onFrpActiveChanged()
verify(listener, never()).onUserSetupChanged()
verify(listener, never()).onUserSwitched()
}
@@ -181,6 +206,7 @@ class DeviceProvisionedControllerImplTest : SysuiTestCase() {
verify(listener).onUserSwitched()
verify(listener, never()).onUserSetupChanged()
verify(listener, never()).onDeviceProvisionedChanged()
+ verify(listener, never()).onFrpActiveChanged()
}
@Test
@@ -195,6 +221,7 @@ class DeviceProvisionedControllerImplTest : SysuiTestCase() {
verify(listener, never()).onUserSwitched()
verify(listener).onUserSetupChanged()
verify(listener, never()).onDeviceProvisionedChanged()
+ verify(listener, never()).onFrpActiveChanged()
}
@Test
@@ -208,9 +235,25 @@ 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)
+
+ settings.putInt(Settings.Secure.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()
@@ -220,11 +263,13 @@ class DeviceProvisionedControllerImplTest : SysuiTestCase() {
switchUser(10)
settings.putIntForUser(Settings.Secure.USER_SETUP_COMPLETE, 1, START_USER)
settings.putInt(Settings.Global.DEVICE_PROVISIONED, 1)
+ settings.putInt(Settings.Secure.SECURE_FRP_MODE, 1)
testableLooper.processAllMessages()
mainExecutor.runAllReady()
verify(listener, never()).onDeviceProvisionedChanged()
+ verify(listener, never()).onFrpActiveChanged()
verify(listener, never()).onUserSetupChanged()
verify(listener, never()).onUserSwitched()
}