-
@Serializable() public final class MotionConfiguration
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public classMotionConfiguration.Companion
-
Field Summary
Fields Modifier and Type Field Description private final IntegerrateReducerNprivate final Booleanenabledprivate final DoublesamplingHzprivate final Map<String, Boolean>fieldsprivate final BooleanuseRateReducerprivate final DoublerateReducerOutputHzprivate final BooleanuseWakeupSensorsprivate final LongmaxReportLatencyMs
-
Method Summary
Modifier and Type Method Description final IntegergetRateReducerN()final BooleangetEnabled()final DoublegetSamplingHz()Sensor collection rate (Hz). final Map<String, Boolean>getFields()Single per-stream on/off map. final BooleangetUseRateReducer()Server controls whether decimation is active. final DoublegetRateReducerOutputHz()Target output rate (Hz) for the rate reducer when useRateReducer == true.final BooleangetUseWakeupSensors()Register the continuous IMU sensors (accel/gyro/mag) as their WAKE-UP variants so the hardware FIFO delivers through AP suspend (AOSP: "No events shall be lost"). final LonggetMaxReportLatencyMs()Hardware FIFO batch window (ms) for the wake-up IMU sensors ( maxReportLatencyUs).-
-
Method Detail
-
getRateReducerN
final Integer getRateReducerN()
-
getEnabled
final Boolean getEnabled()
-
getSamplingHz
final Double getSamplingHz()
Sensor collection rate (Hz). Accepts the canonical key
collectionRateHz, the previous canonicalcollect, and the legacyhzfor parity with iOS; also accepts the existing Android keysamplingHz. Tried in priority order by kotlinx.serialization (Json must haveuseAlternativeNames).
-
getFields
final Map<String, Boolean> getFields()
Single per-stream on/off map. Each key matches the wire-format stream name 1:1 —
accel,gyroscope,magneticField,rotationVector,gameRotationVector,gravity,proximity,stepCounter,pressure, etc. — so the config map and the JSONdata.<stream>object align directly. The map decides whether the underlyingSensor.TYPE_*listener is registered at all —MotionFieldPolicy.want<Sensor>returns true when the stream's key is true (or missing). When false, the listener never starts and the dedicated stream stays silent.Each sensor emits its own stream at its own native cadence (with its own
sensorTimestamp); there is no fused / interpolated row, so streams are all-or-nothing (no per-axis suppression).Omitted / null means "every stream enabled" (backward compatible). Only an explicit
falsedisables a stream. AcceptscollectedFieldsas an alias so older server responses keep working unchanged through the rename.
-
getUseRateReducer
final Boolean getUseRateReducer()
Server controls whether decimation is active. Mirrors iOS
MotionConfiguration.useRateReducer. Defaults to false so older server builds keep the legacy "no rate reducer" behavior.
-
getRateReducerOutputHz
final Double getRateReducerOutputHz()
Target output rate (Hz) for the rate reducer when
useRateReducer == true. Null falls back tosamplingHz(no reduction).
-
getUseWakeupSensors
final Boolean getUseWakeupSensors()
Register the continuous IMU sensors (accel/gyro/mag) as their WAKE-UP variants so the hardware FIFO delivers through AP suspend (AOSP: "No events shall be lost"). Falls back to the non-wake-up sensor automatically when a device has no wake-up variant.
-
getMaxReportLatencyMs
final Long getMaxReportLatencyMs()
Hardware FIFO batch window (ms) for the wake-up IMU sensors (
maxReportLatencyUs). Larger = fewer AP wakeups/interrupts; realized batch = min(this, FIFO-fill time).Default is 0 (unbatched, per-event delivery). Batching delivers events in bursts and stamps
wallClockTimestampat flush time, which surfaces as random multi-second gaps in the wall-clock stream even thoughsensorTimestampstays continuous. Unbatched delivery removes that artifact and is effectively free while a continuous wake lock is held (MiscConfiguration.holdWakeLock = true, the default: the AP is already awake).COUPLING: in the Play-compliant mode (MiscConfiguration.holdWakeLock = false) a value of 0 forces an AP wakeup per sample. Those fleets should set a non-zero window (Google recommends ≥30s once no continuous wake lock is held) so the FIFO carries continuity through AP suspend.
-
-
-
-