SensorPrivacyManager


public final class SensorPrivacyManager
extends Object

java.lang.Object
   ↳ android.hardware.SensorPrivacyManager


This class provides information about the microphone and camera toggles.

Summary

Nested classes

class SensorPrivacyManager.Sensors

Sensor constants which are used in SensorPrivacyManager 

Constants

int TOGGLE_TYPE_HARDWARE

Constant for hardware toggle.

int TOGGLE_TYPE_SOFTWARE

Constant for software toggle.

Public methods

boolean supportsSensorToggle(int sensor)

Checks if the given toggle is supported on this device

boolean supportsSensorToggle(int toggleType, int sensor)

Checks if the given toggle is supported on this device

Inherited methods

Constants

TOGGLE_TYPE_HARDWARE

Added in API level 33
public static final int TOGGLE_TYPE_HARDWARE

Constant for hardware toggle.

Constant Value: 2 (0x00000002)

TOGGLE_TYPE_SOFTWARE

Added in API level 33
public static final int TOGGLE_TYPE_SOFTWARE

Constant for software toggle.

Constant Value: 1 (0x00000001)

Public methods

supportsSensorToggle

Added in API level 31
public boolean supportsSensorToggle (int sensor)

Checks if the given toggle is supported on this device

Parameters
sensor int: The sensor to check Value is SensorPrivacyManager.Sensors.MICROPHONE, or SensorPrivacyManager.Sensors.CAMERA

Returns
boolean whether the toggle for the sensor is supported on this device.

supportsSensorToggle

Added in API level 33
public boolean supportsSensorToggle (int toggleType, 
                int sensor)

Checks if the given toggle is supported on this device

Parameters
toggleType int: Value is TOGGLE_TYPE_SOFTWARE, or TOGGLE_TYPE_HARDWARE

sensor int: The sensor to check Value is SensorPrivacyManager.Sensors.MICROPHONE, or SensorPrivacyManager.Sensors.CAMERA

Returns
boolean whether the toggle for the sensor is supported on this device.