Loading core/api/test-current.txt +12 −0 Original line number Diff line number Diff line Loading @@ -730,6 +730,18 @@ package android.graphics.drawable { } package android.hardware { public final class SensorPrivacyManager { method public boolean isIndividualSensorPrivacyEnabled(int); method @RequiresPermission(android.Manifest.permission.MANAGE_SENSOR_PRIVACY) public void setIndividualSensorPrivacy(int, boolean); method @RequiresPermission(android.Manifest.permission.MANAGE_SENSOR_PRIVACY) public void setIndividualSensorPrivacyForProfileGroup(int, boolean); field public static final int INDIVIDUAL_SENSOR_CAMERA = 2; // 0x2 field public static final int INDIVIDUAL_SENSOR_MICROPHONE = 1; // 0x1 } } package android.hardware.biometrics { public class BiometricManager { Loading core/java/android/hardware/SensorPrivacyManager.java +31 −2 Original line number Diff line number Diff line Loading @@ -20,6 +20,7 @@ import android.annotation.IntDef; import android.annotation.NonNull; import android.annotation.RequiresPermission; import android.annotation.SystemService; import android.annotation.TestApi; import android.content.Context; import android.os.IBinder; import android.os.RemoteException; Loading @@ -40,14 +41,19 @@ import java.lang.annotation.RetentionPolicy; * * @hide */ @TestApi @SystemService(Context.SENSOR_PRIVACY_SERVICE) public final class SensorPrivacyManager { /** Microphone */ /** Microphone * @hide */ @TestApi public static final int INDIVIDUAL_SENSOR_MICROPHONE = SensorPrivacyIndividualEnabledSensorProto.MICROPHONE; /** Camera */ /** Camera * @hide */ @TestApi public static final int INDIVIDUAL_SENSOR_CAMERA = SensorPrivacyIndividualEnabledSensorProto.CAMERA; Loading @@ -66,6 +72,8 @@ public final class SensorPrivacyManager { * A class implementing this interface can register with the {@link * android.hardware.SensorPrivacyManager} to receive notification when the sensor privacy * state changes. * * @hide */ public interface OnSensorPrivacyChangedListener { /** Loading Loading @@ -101,6 +109,8 @@ public final class SensorPrivacyManager { /** * Returns the single instance of the SensorPrivacyManager. * * @hide */ public static SensorPrivacyManager getInstance(Context context) { synchronized (sInstanceLock) { Loading @@ -121,6 +131,8 @@ public final class SensorPrivacyManager { * Sets sensor privacy to the specified state. * * @param enable the state to which sensor privacy should be set. * * @hide */ @RequiresPermission(android.Manifest.permission.MANAGE_SENSOR_PRIVACY) public void setSensorPrivacy(boolean enable) { Loading @@ -137,6 +149,8 @@ public final class SensorPrivacyManager { * * @param listener the OnSensorPrivacyChangedListener to be notified when the state of sensor * privacy changes. * * @hide */ public void addSensorPrivacyListener(final OnSensorPrivacyChangedListener listener) { synchronized (mListeners) { Loading Loading @@ -166,6 +180,8 @@ public final class SensorPrivacyManager { * @param sensor the sensor to listen to changes to * @param listener the OnSensorPrivacyChangedListener to be notified when the state of sensor * privacy changes. * * @hide */ public void addSensorPrivacyListener(@IndividualSensor int sensor, final OnSensorPrivacyChangedListener listener) { Loading Loading @@ -196,6 +212,8 @@ public final class SensorPrivacyManager { * * @param listener the OnSensorPrivacyChangedListener to be unregistered from notifications when * sensor privacy changes. * * @hide */ public void removeSensorPrivacyListener(OnSensorPrivacyChangedListener listener) { synchronized (mListeners) { Loading @@ -215,6 +233,8 @@ public final class SensorPrivacyManager { * Returns whether sensor privacy is currently enabled. * * @return true if sensor privacy is currently enabled, false otherwise. * * @hide */ public boolean isSensorPrivacyEnabled() { try { Loading @@ -228,7 +248,10 @@ public final class SensorPrivacyManager { * Returns whether sensor privacy is currently enabled for a specific sensor. * * @return true if sensor privacy is currently enabled, false otherwise. * * @hide */ @TestApi public boolean isIndividualSensorPrivacyEnabled(@IndividualSensor int sensor) { try { return mService.isIndividualSensorPrivacyEnabled(mContext.getUserId(), sensor); Loading @@ -242,7 +265,10 @@ public final class SensorPrivacyManager { * * @param sensor the sensor which to change the state for * @param enable the state to which sensor privacy should be set. * * @hide */ @TestApi @RequiresPermission(android.Manifest.permission.MANAGE_SENSOR_PRIVACY) public void setIndividualSensorPrivacy(@IndividualSensor int sensor, boolean enable) { Loading @@ -259,7 +285,10 @@ public final class SensorPrivacyManager { * * @param sensor the sensor which to change the state for * @param enable the state to which sensor privacy should be set. * * @hide */ @TestApi @RequiresPermission(android.Manifest.permission.MANAGE_SENSOR_PRIVACY) public void setIndividualSensorPrivacyForProfileGroup(@IndividualSensor int sensor, boolean enable) { Loading packages/Shell/AndroidManifest.xml +3 −0 Original line number Diff line number Diff line Loading @@ -383,6 +383,9 @@ <!-- Permission required for CTS tests to enable/disable rate limiting toasts. --> <uses-permission android:name="android.permission.MANAGE_TOAST_RATE_LIMITING" /> <!-- Permission required for CTS to test sensor privacy behavior --> <uses-permission android:name="android.permission.MANAGE_SENSOR_PRIVACY" /> <application android:label="@string/app_label" android:theme="@android:style/Theme.DeviceDefault.DayNight" android:defaultToDeviceProtectedStorage="true" Loading Loading
core/api/test-current.txt +12 −0 Original line number Diff line number Diff line Loading @@ -730,6 +730,18 @@ package android.graphics.drawable { } package android.hardware { public final class SensorPrivacyManager { method public boolean isIndividualSensorPrivacyEnabled(int); method @RequiresPermission(android.Manifest.permission.MANAGE_SENSOR_PRIVACY) public void setIndividualSensorPrivacy(int, boolean); method @RequiresPermission(android.Manifest.permission.MANAGE_SENSOR_PRIVACY) public void setIndividualSensorPrivacyForProfileGroup(int, boolean); field public static final int INDIVIDUAL_SENSOR_CAMERA = 2; // 0x2 field public static final int INDIVIDUAL_SENSOR_MICROPHONE = 1; // 0x1 } } package android.hardware.biometrics { public class BiometricManager { Loading
core/java/android/hardware/SensorPrivacyManager.java +31 −2 Original line number Diff line number Diff line Loading @@ -20,6 +20,7 @@ import android.annotation.IntDef; import android.annotation.NonNull; import android.annotation.RequiresPermission; import android.annotation.SystemService; import android.annotation.TestApi; import android.content.Context; import android.os.IBinder; import android.os.RemoteException; Loading @@ -40,14 +41,19 @@ import java.lang.annotation.RetentionPolicy; * * @hide */ @TestApi @SystemService(Context.SENSOR_PRIVACY_SERVICE) public final class SensorPrivacyManager { /** Microphone */ /** Microphone * @hide */ @TestApi public static final int INDIVIDUAL_SENSOR_MICROPHONE = SensorPrivacyIndividualEnabledSensorProto.MICROPHONE; /** Camera */ /** Camera * @hide */ @TestApi public static final int INDIVIDUAL_SENSOR_CAMERA = SensorPrivacyIndividualEnabledSensorProto.CAMERA; Loading @@ -66,6 +72,8 @@ public final class SensorPrivacyManager { * A class implementing this interface can register with the {@link * android.hardware.SensorPrivacyManager} to receive notification when the sensor privacy * state changes. * * @hide */ public interface OnSensorPrivacyChangedListener { /** Loading Loading @@ -101,6 +109,8 @@ public final class SensorPrivacyManager { /** * Returns the single instance of the SensorPrivacyManager. * * @hide */ public static SensorPrivacyManager getInstance(Context context) { synchronized (sInstanceLock) { Loading @@ -121,6 +131,8 @@ public final class SensorPrivacyManager { * Sets sensor privacy to the specified state. * * @param enable the state to which sensor privacy should be set. * * @hide */ @RequiresPermission(android.Manifest.permission.MANAGE_SENSOR_PRIVACY) public void setSensorPrivacy(boolean enable) { Loading @@ -137,6 +149,8 @@ public final class SensorPrivacyManager { * * @param listener the OnSensorPrivacyChangedListener to be notified when the state of sensor * privacy changes. * * @hide */ public void addSensorPrivacyListener(final OnSensorPrivacyChangedListener listener) { synchronized (mListeners) { Loading Loading @@ -166,6 +180,8 @@ public final class SensorPrivacyManager { * @param sensor the sensor to listen to changes to * @param listener the OnSensorPrivacyChangedListener to be notified when the state of sensor * privacy changes. * * @hide */ public void addSensorPrivacyListener(@IndividualSensor int sensor, final OnSensorPrivacyChangedListener listener) { Loading Loading @@ -196,6 +212,8 @@ public final class SensorPrivacyManager { * * @param listener the OnSensorPrivacyChangedListener to be unregistered from notifications when * sensor privacy changes. * * @hide */ public void removeSensorPrivacyListener(OnSensorPrivacyChangedListener listener) { synchronized (mListeners) { Loading @@ -215,6 +233,8 @@ public final class SensorPrivacyManager { * Returns whether sensor privacy is currently enabled. * * @return true if sensor privacy is currently enabled, false otherwise. * * @hide */ public boolean isSensorPrivacyEnabled() { try { Loading @@ -228,7 +248,10 @@ public final class SensorPrivacyManager { * Returns whether sensor privacy is currently enabled for a specific sensor. * * @return true if sensor privacy is currently enabled, false otherwise. * * @hide */ @TestApi public boolean isIndividualSensorPrivacyEnabled(@IndividualSensor int sensor) { try { return mService.isIndividualSensorPrivacyEnabled(mContext.getUserId(), sensor); Loading @@ -242,7 +265,10 @@ public final class SensorPrivacyManager { * * @param sensor the sensor which to change the state for * @param enable the state to which sensor privacy should be set. * * @hide */ @TestApi @RequiresPermission(android.Manifest.permission.MANAGE_SENSOR_PRIVACY) public void setIndividualSensorPrivacy(@IndividualSensor int sensor, boolean enable) { Loading @@ -259,7 +285,10 @@ public final class SensorPrivacyManager { * * @param sensor the sensor which to change the state for * @param enable the state to which sensor privacy should be set. * * @hide */ @TestApi @RequiresPermission(android.Manifest.permission.MANAGE_SENSOR_PRIVACY) public void setIndividualSensorPrivacyForProfileGroup(@IndividualSensor int sensor, boolean enable) { Loading
packages/Shell/AndroidManifest.xml +3 −0 Original line number Diff line number Diff line Loading @@ -383,6 +383,9 @@ <!-- Permission required for CTS tests to enable/disable rate limiting toasts. --> <uses-permission android:name="android.permission.MANAGE_TOAST_RATE_LIMITING" /> <!-- Permission required for CTS to test sensor privacy behavior --> <uses-permission android:name="android.permission.MANAGE_SENSOR_PRIVACY" /> <application android:label="@string/app_label" android:theme="@android:style/Theme.DeviceDefault.DayNight" android:defaultToDeviceProtectedStorage="true" Loading