android: OS-level mic mute on stem press during calls + independent head gesture toggles#580
Open
ntsour wants to merge 1 commit intokavishdevar:mainfrom
Open
android: OS-level mic mute on stem press during calls + independent head gesture toggles#580ntsour wants to merge 1 commit intokavishdevar:mainfrom
ntsour wants to merge 1 commit intokavishdevar:mainfrom
Conversation
Replace the single "Head Gestures" master toggle with two independent feature
toggles in the Head Tracking screen:
* Answer/decline incoming calls (nod = answer, shake = decline)
* Mute/unmute during a call (shake = mute, nod = unmute)
The two behaviors operate in different call phases (ringing vs. active) and
never overlap, so they are exposed as separate prefs (head_gestures_answer_call
and head_gestures_mute_call) rather than a single switch.
Additional gesture-related polish:
* Stem-press toggleMicMute now plays the same confirm_yes/confirm_no tones
used for head gestures (audible mute/unmute feedback over the AirPods).
* New MUTE_CALL StemAction so a stem press can be mapped to mute toggling.
* Periodic 15-second low-volume "still muted" reminder while the mic is muted
during a call, cancelled automatically on unmute or call end.
* Active-call gesture loop now mutes/unmutes directionally (shake mutes, nod
unmutes) instead of toggling, fixing the case where the gesture detector
re-fires the same direction during a missed restart.
* Restart bug fix in GestureDetector: callback is now invoked AFTER
stopDetection() so a callback that re-arms detection doesn't hit
isRunning=true and silently no-op.
* Removed per-movement "blip" sounds on every head turn; only the final
confirmation tone is played.
* Stale-state fix in testHeadGestures(): force a stop before re-arming so
isRunning=true left over from a previous test no longer breaks the next.
* Threshold tuning for the gesture detector to reduce accidental triggers.
0343554 to
ac5079b
Compare
6 tasks
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.
Two related changes to call audio control, both landing in the same service refactor.
1. OS-level mic mute on stem press during a call
the problem
Previously, pressing the AirPods stem during a call only triggered whatever the Bluetooth stack or the app natively did. The OS microphone was never actually muted —
AudioManager.setMicrophoneMute()was never called from the stem press path.what changed
StemAction.MUTE_CALLenum value;setupStemActions()forces the firmware to report the stem press event during a call (the mute press type is read fromCALL_MANAGEMENT_CONFIGso double-press devices are handled correctly)toggleMicMute()callsAudioManager.setMicrophoneMute()and updates the notificationGestureFeedback.playConfirmation()handleCallStemPressalso intercepts the end-call press (the opposite of the mute press) and routes it throughrejectCall(). This works for both telephony (TelecomManager.endCall) and VoIP (HEADSETHOOK fallback for Teams/Zoom/Meet)2. Independent head gesture toggles for calls
the problem
head_gestureswas a single boolean that controlled all gesture behaviour. There was no way to use gestures to mute/unmute during an active call without also enabling nod/shake to answer/decline incoming calls.what changed
head_gesturespref replaced by two independent booleans:head_gestures_answer_callandhead_gestures_mute_callhead_gestures_answer_callhead_gestures_mute_callAudioManager.MODE_IN_COMMUNICATION) also trigger the mute gesture loop, not just telephony callswhat this does NOT change