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

Commit b05891dc authored by Jan Sebechlebsky's avatar Jan Sebechlebsky
Browse files

Fix invalidation of captors and injectors during DAP unregistration.

Also, clear the captors and injectors array in unregistered policy,
so in case it's re-registered again, the arrays don't grow unless
necessary.

Bug: 288086999
Test: atest AudioHostTest AudioServiceHostTest
Change-Id: I9c7cbac530293e2c8f8987897d319bf912b6390e
parent 53787d5f
Loading
Loading
Loading
Loading
+4 −2
Original line number Diff line number Diff line
@@ -865,7 +865,7 @@ public class AudioPolicy {
                for (final WeakReference<AudioTrack> weakTrack : mInjectors) {
                    final AudioTrack track = weakTrack.get();
                    if (track == null) {
                        break;
                        continue;
                    }
                    try {
                        // TODO: add synchronous versions
@@ -876,12 +876,13 @@ public class AudioPolicy {
                        // released by the user of the AudioPolicy
                    }
                }
                mInjectors.clear();
            }
            if (mCaptors != null) {
                for (final WeakReference<AudioRecord> weakRecord : mCaptors) {
                    final AudioRecord record = weakRecord.get();
                    if (record == null) {
                        break;
                        continue;
                    }
                    try {
                        // TODO: if needed: implement an invalidate method
@@ -891,6 +892,7 @@ public class AudioPolicy {
                        // released by the user of the AudioPolicy
                    }
                }
                mCaptors.clear();
            }
        }
    }