Status: Implemented and tested

Hardware Sensors Subsystem

Android devices feature an array of MEMS (Micro-Electro-Mechanical Systems) silicon sensors: motion accelerators, gyroscopes, magnetometers, ambient light photodiodes, and barometric pressure transducers.

Static Specifications vs. Live Sensor Readings

Sensor inspection distinguishes between static capabilities (vendor name, maximum range, resolution, electrical power in milliamperes) and live readings (XYZ acceleration coordinates, microtesla flux). While some apps keep sensor listeners permanently registered in the background—rapidly depleting device battery—Voodoo queries static characteristics instantly, employing an ephemeral lifecycle test that unregisters listeners immediately after testing.

Wake-Up vs Non-Wake-Up Sensors

Introduced in Android 5.0 (API 21), wake-up sensors (such as significant motion detectors and step counters) can awaken the main application processor from deep sleep. Non-wake-up sensors only deliver events while the CPU is actively awake.

Sensor Reporting Modes

Sensors operate under four distinct reporting modes: Continuous (e.g. accelerometer streaming at fixed intervals), On-Change (e.g. light sensor firing only when lux shifts), One-Shot, and Special Trigger.

How Voodoo Inspects Hardware Sensors

1. Primary Call & API-Level Fallback Chain

Extracted from SensorCollector.kt. Uses SensorManager.getSensorList(Sensor.TYPE_ALL), with segregated helpers for API 21+ wake-up properties:

// Excerpt from com.tool3.hardwareinfo.categories.sensor.SensorCollector.kt
val sensorManager = context.getSystemService(Context.SENSOR_SERVICE) as SensorManager
val sensorList = sensorManager.getSensorList(Sensor.TYPE_ALL)

for (sensor in sensorList) {
    val name = sensor.name
    val vendor = sensor.vendor
    val type = sensor.type
    val maxRange = sensor.maximumRange
    val resolution = sensor.resolution
    val powerMa = sensor.power

    // API 21+ Wake-up and reporting modes
    val isWakeUp = if (Build.VERSION.SDK_INT >= 21) {
        ModernSensorHelper.isWakeUpSensor(sensor)
    } else false
}

2. Permission & Privilege Gate

Sensor enumeration requires zero runtime permissions. Standard motion and environmental sensors are accessible to all applications. Note: On Android 10+ (API 29+), continuous reading of step counters requires the ACTIVITY_RECOGNITION permission.

3. Interpretation & Normalization Logic

  • Type Normalization: Maps integer type constants into descriptive labels via SensorTypeHelper.kt (e.g. TYPE_ACCELEROMETER, TYPE_GYROSCOPE_UNCALIBRATED, TYPE_PRESSURE).
  • Safe Ephemeral Testing: When evaluating live responses, SensorTestManager.kt registers a listener with a strict 2,000ms watchdog timeout and guaranteed unregistration in a finally block.

4. Availability-State Triggers

  • isWakeUpSensor() on Android < 5.0 triggers AvailabilityState.UNSUPPORTED.
  • Physical sensor types absent from the hardware motherboard return AvailabilityState.UNAVAILABLE.

Subsystem Field Inventory

Field ID Display Name Type Primary Source / API Min API
sensor.total_count Total Available Sensors INTEGER SensorManager.getSensorList(TYPE_ALL).size API 3
sensor.wake_up_count Wake-Up Sensor Count INTEGER Sensor.isWakeUpSensor() (API 21+) API 21
sensor.accelerometer Accelerometer Vendor & Model STRING SensorManager.getDefaultSensor(TYPE_ACCELEROMETER) API 3
sensor.gyroscope Gyroscope Vendor & Model STRING SensorManager.getDefaultSensor(TYPE_GYROSCOPE) API 3
sensor.barometer Barometer / Pressure Sensor STRING SensorManager.getDefaultSensor(TYPE_PRESSURE) API 3