Skip to content

perf(voice): run raise to talk motion only while the sensor is covered - #231

Open
Tarquinen wants to merge 2 commits into
devfrom
raise-to-talk-motion
Open

Tarquinen wants to merge 2 commits into
devfrom
raise-to-talk-motion

Conversation

@Tarquinen

@Tarquinen Tarquinen commented Nov 20, 2026 •

Copy link
Copy Markdown
Member

Raise to Talk kept the gravity sensor running at 10 Hz the whole time a session screen was open with the setting on. Now it runs only from the moment the proximity sensor is covered until the raise is decided, and while the phone is at the ear. Posture is read from the first samples, 100 ms after the cover (or from the first sample to arrive, if the sensor starts slower), and again when the dwell ends. Ports iOS #313 (7393e966).

Verified with the full scripts/check.sh. The four ported IdleVoiceSensorsTests and the late-first-sample test fail without the change. On the emulator with faked sensors, dumpsys sensorservice shows only proximity while idle, gravity switching on with a cover and back off after the dwell when the phone lies flat, and an upright cover still raises.

Not tried on a real phone. How quickly a sensor delivers its first sample after starting depends on the device, and on phones without a gravity sensor the accelerometer fallback reads its first samples unfiltered.

Raise to Talk kept the gravity sensor on at 10 Hz for as long as the session
screen listened, though posture only matters once proximity is covered. Now
motion starts with the cover and stops once the raise is decided (a brief
cover, a refused raise, a flat phone) or the phone leaves the ear. The posture
as it's covered is read from motion's first samples, 100 ms in, and checked
again when the 600 ms dwell ends; a sample from before motion started is never
read. Ports iOS #313 (7393e966).

Verified: scripts/check.sh (full, on the Android VM); four ported
IdleVoiceSensorsTests fail on the old detector and pass now. On the emulator
with faked sensors (adb emu sensor set), dumpsys sensorservice shows only
proximity while idle, gravity on right after a cover, off again after the
dwell when flat, and an upright cover raises. Not checked on a real phone.
When the motion sensor starts cold, its first sample can land after the
100 ms posture check, which then had nothing to read and let the cover
through; a phone covered flat that turned upright within the dwell could
start a call that dev, with motion always warm, refused. Now a cover with no
sample at 100 ms takes its posture from the first sample that arrives.
The parity row now says the proximity refcount cases don't apply on Android
and the cover warming nudge is deferred.

Verified: scripts/check.sh (full, on the Android VM); the new
aFirstSampleLyingFlatAfterTheEarlyCheckIsNoRaise fails with the check
disabled and passes with it.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant