Skip to content
Commit 749650c2 authored by Atneya Nair's avatar Atneya Nair
Browse files

Add recognition session tokens

A recognition event can race with a start/stop/start in quick
succession. Attributing the event to the incorrect startReco leads to
state mismatch between lower/upper layers.

- Associate each startRecognition with an IBinder token at the STModule
  layer
- Invalidate the token field on downwards stop calls, and drop callbacks
  when no session is active
- Add the token as a field to framework recognition event, so async
  clients can drop stale events
- Additionally, add protection against a startRecognition while the lock
  is dropped in stopRecognition
- Call new startReco version in STService, and drop callbacks for stale
  sessions
- Drop wtf on stale callback in the HAL enforcer, since we handle it
  gracefully at a higher layer

Bug: 236826280
Fixes: 275080257
Test: SoundTriggerManagerTest#
    testStartTriggerStopRecognitionRace_doesNotFail
Test: CtsVoiceInteractionTestCases
Test: FrameworksVoiceInteractionTests
Test: Smoke tests
Change-Id: I8a613b5f6821636e545309c09e6dfbb67626ea2b
parent 70b1371b
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment