Do not allow Sensors Off to be toggled from the lock screen

When the Sensors Off quick settings tile was originally added, the
primary concern was the tile accidentally being toggled off from
the lock screen. However, if Sensors Off can be toggled on from
the lock screen, this could be enabled on a stolen device to
prevent determining the location of the device. This commit
updates the Sensors Off tile to prevent its state from being
modified at all from the lock screen.

Bug: 282071050
Test: make RunSettingsRoboTests ROBOTEST_FILTER=SensorsOffTest
Test: Manually verified tile couldn't be toggled when device locked
Change-Id: Ib2ea1d92c0b215ebeaf33fb8e4f5e7e297133b82
This commit is contained in:
Michael Groover
2023-05-17 14:31:10 -05:00
parent dbd9841a2f
commit f8b0cdd6ff
2 changed files with 109 additions and 2 deletions

View File

@@ -401,8 +401,8 @@ public abstract class DevelopmentTiles extends TileService {
@Override
public void setIsEnabled(boolean isEnabled) {
// Don't allow sensors to be reenabled from the lock screen.
if (mIsEnabled && mKeyguardManager.isKeyguardLocked()) {
// Don't allow sensors to be toggled from the lock screen.
if (mKeyguardManager.isKeyguardLocked()) {
return;
}
mMetricsFeatureProvider.action(getApplicationContext(), SettingsEnums.QS_SENSOR_PRIVACY,