Added in API level 31

SensorPrivacyManager

class SensorPrivacyManager
kotlin.Any
   ↳ android.hardware.SensorPrivacyManager

This class provides information about the microphone and camera toggles.

Summary

Nested classes

Sensor constants which are used in SensorPrivacyManager

Constants
static Int

Constant for hardware toggle.

static Int

Constant for software toggle.

Public methods
Boolean

Checks if the given toggle is supported on this device

Boolean
supportsSensorToggle(toggleType: Int, sensor: Int)

Checks if the given toggle is supported on this device

Constants

TOGGLE_TYPE_HARDWARE

Added in API level 33
static val TOGGLE_TYPE_HARDWARE: Int

Constant for hardware toggle.

Value: 2

TOGGLE_TYPE_SOFTWARE

Added in API level 33
static val TOGGLE_TYPE_SOFTWARE: Int

Constant for software toggle.

Value: 1

Public methods

supportsSensorToggle

Added in API level 31
fun supportsSensorToggle(sensor: Int): Boolean

Checks if the given toggle is supported on this device

Parameters
sensor Int: The sensor to check Value is android.hardware.SensorPrivacyManager.Sensors#MICROPHONE, or android.hardware.SensorPrivacyManager.Sensors#CAMERA
Return
Boolean whether the toggle for the sensor is supported on this device.

supportsSensorToggle

Added in API level 33
fun supportsSensorToggle(
    toggleType: Int,
    sensor: Int
): Boolean

Checks if the given toggle is supported on this device

Parameters
sensor Int: The sensor to check Value is android.hardware.SensorPrivacyManager.Sensors#MICROPHONE, or android.hardware.SensorPrivacyManager.Sensors#CAMERA
toggleType Int: Value is android.hardware.SensorPrivacyManager#TOGGLE_TYPE_SOFTWARE, or android.hardware.SensorPrivacyManager#TOGGLE_TYPE_HARDWARE
Return
Boolean whether the toggle for the sensor is supported on this device.