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

Commit aded5264 authored by Treehugger Robot's avatar Treehugger Robot Committed by Gerrit Code Review
Browse files

Merge "Prevent modifying mAudioPolicies during iteration"

parents e91ea4eb f85e7786
Loading
Loading
Loading
Loading
+5 −2
Original line number Diff line number Diff line
@@ -1517,6 +1517,7 @@ public class AudioService extends IAudioService.Stub
        }

        synchronized (mAudioPolicies) {
            ArrayList<AudioPolicyProxy> invalidProxies = new ArrayList<>();
            for (AudioPolicyProxy policy : mAudioPolicies.values()) {
                final int status = policy.connectMixes();
                if (status != AudioSystem.SUCCESS) {
@@ -1524,7 +1525,7 @@ public class AudioService extends IAudioService.Stub
                    Log.e(TAG, "onAudioServerDied: error "
                            + AudioSystem.audioSystemErrorToString(status)
                            + " when connecting mixes for policy " + policy.toLogFriendlyString());
                    policy.release();
                    invalidProxies.add(policy);
                } else {
                    final int deviceAffinitiesStatus = policy.setupDeviceAffinities();
                    if (deviceAffinitiesStatus != AudioSystem.SUCCESS) {
@@ -1532,10 +1533,12 @@ public class AudioService extends IAudioService.Stub
                                + AudioSystem.audioSystemErrorToString(deviceAffinitiesStatus)
                                + " when connecting device affinities for policy "
                                + policy.toLogFriendlyString());
                        policy.release();
                        invalidProxies.add(policy);
                    }
                }
            }
            invalidProxies.forEach((policy) -> policy.release());

        }

        // Restore capture policies