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

Object clone()

Creates and returns a copy of this object.

boolean equals(Object obj)

Indicates whether some other object is "equal to" this one.

void finalize()

Called by the garbage collector on an object when garbage collection determines that there are no more references to the object.

final Class<?> getClass()

Returns the runtime class of this Object.

int hashCode()

Returns a hash code value for the object.

final void notify()

Wakes up a single thread that is waiting on this object's monitor.

final void notifyAll()

Wakes up all threads that are waiting on this object's monitor.

String toString()

Returns a string representation of the object.

final void wait(long timeoutMillis, int nanos)

Causes the current thread to wait until it is awakened, typically by being notified or interrupted, or until a certain amount of real time has elapsed.

final void wait(long timeoutMillis)

Causes the current thread to wait until it is awakened, typically by being notified or interrupted, or until a certain amount of real time has elapsed.

final void wait()

Causes the current thread to wait until it is awakened, typically by being notified or interrupted.

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.