Skip to content
Commit b09de473 authored by Andrea Ambu's avatar Andrea Ambu
Browse files

speech: Fix RemoteSpeechReco race condition

stopListening schedules a Runnable referring to mDelegatingListener.
mDelegatingListener can be set to null before the Runnable runs, causing
NullPointerException when it does run.

This CL defines a local alias for the current mDelegatingListener reference,
and uses this new alias in the Runnable closure.

After this CL, even if mDelegatingListener changes between stopListening
and run(), run() will always use the DelegatingListener
mDelegatingListener was pointing to at schedule-time rather than
run-time.

Bug: 193046622
Test: atest CtsVoiceRecognitionTestCases
Change-Id: I98b4fabf074873ce17e4046e243fe22f9e541f91
(cherry picked from commit a3312942)
parent be851a2a
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