fix(android): head gestures don't answer or decline calls - #821
Open
Jeremy0538 wants to merge 1 commit into
Open
Jeremy0538 wants to merge 1 commit into
Jeremy0538 wants to merge 1 commit into
Conversation
While a call is ringing the AirPods send head tracking at ~5 Hz instead of ~25 Hz. At that rate consecutive samples fall on opposite sides of a nod, so the 3-sample moving average cancels the motion and no peak ever passes peakThreshold: calls could not be answered or declined by nodding or shaking. Feed raw values to peak detection when samples arrive more than 100 ms apart; fast data is smoothed as before. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Nodding or shaking the head works on the head gestures test screen, but not on a real incoming call: the detector runs for the whole ring and never reports "yes" or "no".
While a call is ringing, the AirPods send head-tracking data at about 5 Hz (one sample every ~200 ms) instead of about 25 Hz. At that rate consecutive samples land on opposite sides of a nod.
applySmoothing()averages the last three, which cancels the motion out, so no value ever passespeakThreshold(400) and no extremes are counted.Fix
GestureDetector.processHeadOrientation(): when samples arrive more than 100 ms apart, feed the raw values to peak detection instead of the 3-sample average. Fast data (the test screen, ~25 Hz) is smoothed exactly as before.Evidence
With temporary logging of the raw values and the extreme counts:
v=37, 19, 12, 22, 115, 283, 316, 267, 177, 20, -178), then"Yes" Gesture Detected (confidence: 0.8, extremes: 4/4).v=419, -927, 461, 486, -1290, 639), withextremes v=0+0for the whole ring and no detection.Tested on a Samsung Galaxy S26 Ultra running One UI 9 / Android 17 (unrooted, FOSS debug build) with AirPods Pro (A3064). Not tested on other devices or AirPods models.
Side note, not changed here: these AirPods sent no head-tracking data at all with
use_alternate_head_tracking_packetson (the default since #176). They only started after it was turned off.These changes were written with AI assistance (Claude Code) and debugged against logcat captures from the device above.
🤖 Generated with Claude Code