Loading core/java/android/hardware/ISensorPrivacyManager.aidl +2 −0 Original line number Diff line number Diff line Loading @@ -50,5 +50,7 @@ interface ISensorPrivacyManager { void suppressToggleSensorPrivacyReminders(int userId, int sensor, IBinder token, boolean suppress); boolean requiresAuthentication(); void showSensorUseDialog(int sensor); } No newline at end of file core/java/android/hardware/SensorPrivacyManager.java +19 −0 Original line number Diff line number Diff line Loading @@ -327,6 +327,8 @@ public final class SensorPrivacyManager { @NonNull private boolean mToggleListenerRegistered = false; private Boolean mRequiresAuthentication = null; /** * Private constructor to ensure only a single instance is created. */ Loading Loading @@ -760,6 +762,23 @@ public final class SensorPrivacyManager { } } /** * @return whether the device is required to be unlocked to change software state. * * @hide */ @RequiresPermission(Manifest.permission.OBSERVE_SENSOR_PRIVACY) public boolean requiresAuthentication() { if (mRequiresAuthentication == null) { try { mRequiresAuthentication = mService.requiresAuthentication(); } catch (RemoteException e) { throw e.rethrowFromSystemServer(); } } return mRequiresAuthentication; } /** * If sensor privacy for the provided sensor is enabled then this call will show the user the * dialog which is shown when an application attempts to use that sensor. If privacy isn't Loading core/res/res/values/config.xml +2 −0 Original line number Diff line number Diff line Loading @@ -5451,6 +5451,8 @@ <bool name="config_supportsHardwareCamToggle">false</bool> <!-- Whether a camera intent is launched when the lens cover is toggled --> <bool name="config_launchCameraOnCameraLensCoverToggle">true</bool> <!-- Whether changing sensor privacy SW setting requires device to be unlocked --> <bool name="config_sensorPrivacyRequiresAuthentication">true</bool> <!-- List containing the allowed install sources for accessibility service. --> <string-array name="config_accessibility_allowed_install_source" translatable="false"/> Loading core/res/res/values/symbols.xml +1 −0 Original line number Diff line number Diff line Loading @@ -4661,6 +4661,7 @@ <java-symbol type="bool" name="config_supportsHardwareMicToggle" /> <java-symbol type="bool" name="config_supportsHardwareCamToggle" /> <java-symbol type="bool" name="config_launchCameraOnCameraLensCoverToggle" /> <java-symbol type="bool" name="config_sensorPrivacyRequiresAuthentication" /> <java-symbol type="dimen" name="starting_surface_icon_size" /> <java-symbol type="dimen" name="starting_surface_default_icon_size" /> Loading packages/SystemUI/src/com/android/systemui/qs/tiles/SensorPrivacyToggleTile.java +7 −7 Original line number Diff line number Diff line Loading @@ -92,15 +92,15 @@ public abstract class SensorPrivacyToggleTile extends QSTileImpl<QSTile.BooleanS @Override protected void handleClick(@Nullable View view) { if (mKeyguard.isMethodSecure() && mKeyguard.isShowing()) { mActivityStarter.postQSRunnableDismissingKeyguard(() -> { mSensorPrivacyController.setSensorBlocked(QS_TILE, getSensorId(), !mSensorPrivacyController.isSensorBlocked(getSensorId())); }); boolean blocked = mSensorPrivacyController.isSensorBlocked(getSensorId()); if (mSensorPrivacyController.requiresAuthentication() && mKeyguard.isMethodSecure() && mKeyguard.isShowing()) { mActivityStarter.postQSRunnableDismissingKeyguard(() -> mSensorPrivacyController.setSensorBlocked(QS_TILE, getSensorId(), !blocked)); return; } mSensorPrivacyController.setSensorBlocked(QS_TILE, getSensorId(), !mSensorPrivacyController.isSensorBlocked(getSensorId())); mSensorPrivacyController.setSensorBlocked(QS_TILE, getSensorId(), !blocked); } @Override Loading Loading
core/java/android/hardware/ISensorPrivacyManager.aidl +2 −0 Original line number Diff line number Diff line Loading @@ -50,5 +50,7 @@ interface ISensorPrivacyManager { void suppressToggleSensorPrivacyReminders(int userId, int sensor, IBinder token, boolean suppress); boolean requiresAuthentication(); void showSensorUseDialog(int sensor); } No newline at end of file
core/java/android/hardware/SensorPrivacyManager.java +19 −0 Original line number Diff line number Diff line Loading @@ -327,6 +327,8 @@ public final class SensorPrivacyManager { @NonNull private boolean mToggleListenerRegistered = false; private Boolean mRequiresAuthentication = null; /** * Private constructor to ensure only a single instance is created. */ Loading Loading @@ -760,6 +762,23 @@ public final class SensorPrivacyManager { } } /** * @return whether the device is required to be unlocked to change software state. * * @hide */ @RequiresPermission(Manifest.permission.OBSERVE_SENSOR_PRIVACY) public boolean requiresAuthentication() { if (mRequiresAuthentication == null) { try { mRequiresAuthentication = mService.requiresAuthentication(); } catch (RemoteException e) { throw e.rethrowFromSystemServer(); } } return mRequiresAuthentication; } /** * If sensor privacy for the provided sensor is enabled then this call will show the user the * dialog which is shown when an application attempts to use that sensor. If privacy isn't Loading
core/res/res/values/config.xml +2 −0 Original line number Diff line number Diff line Loading @@ -5451,6 +5451,8 @@ <bool name="config_supportsHardwareCamToggle">false</bool> <!-- Whether a camera intent is launched when the lens cover is toggled --> <bool name="config_launchCameraOnCameraLensCoverToggle">true</bool> <!-- Whether changing sensor privacy SW setting requires device to be unlocked --> <bool name="config_sensorPrivacyRequiresAuthentication">true</bool> <!-- List containing the allowed install sources for accessibility service. --> <string-array name="config_accessibility_allowed_install_source" translatable="false"/> Loading
core/res/res/values/symbols.xml +1 −0 Original line number Diff line number Diff line Loading @@ -4661,6 +4661,7 @@ <java-symbol type="bool" name="config_supportsHardwareMicToggle" /> <java-symbol type="bool" name="config_supportsHardwareCamToggle" /> <java-symbol type="bool" name="config_launchCameraOnCameraLensCoverToggle" /> <java-symbol type="bool" name="config_sensorPrivacyRequiresAuthentication" /> <java-symbol type="dimen" name="starting_surface_icon_size" /> <java-symbol type="dimen" name="starting_surface_default_icon_size" /> Loading
packages/SystemUI/src/com/android/systemui/qs/tiles/SensorPrivacyToggleTile.java +7 −7 Original line number Diff line number Diff line Loading @@ -92,15 +92,15 @@ public abstract class SensorPrivacyToggleTile extends QSTileImpl<QSTile.BooleanS @Override protected void handleClick(@Nullable View view) { if (mKeyguard.isMethodSecure() && mKeyguard.isShowing()) { mActivityStarter.postQSRunnableDismissingKeyguard(() -> { mSensorPrivacyController.setSensorBlocked(QS_TILE, getSensorId(), !mSensorPrivacyController.isSensorBlocked(getSensorId())); }); boolean blocked = mSensorPrivacyController.isSensorBlocked(getSensorId()); if (mSensorPrivacyController.requiresAuthentication() && mKeyguard.isMethodSecure() && mKeyguard.isShowing()) { mActivityStarter.postQSRunnableDismissingKeyguard(() -> mSensorPrivacyController.setSensorBlocked(QS_TILE, getSensorId(), !blocked)); return; } mSensorPrivacyController.setSensorBlocked(QS_TILE, getSensorId(), !mSensorPrivacyController.isSensorBlocked(getSensorId())); mSensorPrivacyController.setSensorBlocked(QS_TILE, getSensorId(), !blocked); } @Override Loading