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

Commit 6b2d00fc authored by Pranav Madapurmath's avatar Pranav Madapurmath
Browse files

Synchronize bluetooth routes map

There was a concurrent modification exception found when iterating across the map which occurred as a result of the map being modified while it was being traversed. Prevent this from happening by synchronizing the map.

Bug: 378169996
Change-Id: I7be8d17d15a0dbdcba625a3943065a19e937eb4b
Flag: EXEMPT bugfix
Test: Manual
parent 173af445
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -57,6 +57,7 @@ import com.android.server.telecom.metrics.ErrorStats;
import com.android.server.telecom.metrics.TelecomMetricsController;

import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.LinkedHashMap;
@@ -371,7 +372,7 @@ public class CallAudioRouteController implements CallAudioRouteAdapter {
    public void initialize() {
        mAvailableRoutes = new HashSet<>();
        mCallSupportedRoutes = new HashSet<>();
        mBluetoothRoutes = new LinkedHashMap<>();
        mBluetoothRoutes = Collections.synchronizedMap(new LinkedHashMap<>());
        mActiveDeviceCache = new HashMap<>();
        mActiveDeviceCache.put(AudioRoute.TYPE_BLUETOOTH_SCO, null);
        mActiveDeviceCache.put(AudioRoute.TYPE_BLUETOOTH_HA, null);