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

Commit 1b202c9a authored by Treehugger Robot's avatar Treehugger Robot Committed by Automerger Merge Worker
Browse files

Merge "Prevent modifying mAudioPolicies during iteration" am: aded5264 am: 439bed36

parents 7998d64f 439bed36
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