Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 409a2404 authored by Felix Oghina's avatar Felix Oghina
Browse files

[speech] copy client list to prevent concurrency

Calling removeClient modified the underlying map, resulting in a
ConcurrentModificationException. Copy the list of clients before
iterating through.

Bug: 278168500
Test: cts
Change-Id: I3759e94a45bb5957e4457272d32efed34dc67e21
parent cacb0bf1
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -297,7 +297,8 @@ final class RemoteSpeechRecognitionService extends ServiceConnector.Impl<IRecogn
                    return;
                }

                for (ClientState clientState : mClients.values()) {

                for (ClientState clientState : mClients.values().toArray(new ClientState[0])) {
                    tryRespondWithError(
                            clientState.mDelegatingListener.mRemoteListener,
                            SpeechRecognizer.ERROR_SERVER_DISCONNECTED);