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

Commit 1fcf05bb authored by Weilin Xu's avatar Weilin Xu
Browse files

Move close callback outside ProgramList lock

The callback of on-close listener in program list was moved outside
of the lock in porgram list to avoid the deadlock between
program list and tuner adpater.

Bug: 254505565
Test: atest android.radio.cts.RadioTunerTest
Change-Id: I9c668c63a578ba04b52747e0ef96e9e67cc00b72
parent 2d1f4371
Loading
Loading
Loading
Loading
+6 −1
Original line number Diff line number Diff line
@@ -160,6 +160,7 @@ public final class ProgramList implements AutoCloseable {
     * Disables list updates and releases all resources.
     */
    public void close() {
        OnCloseListener onCompleteListenersCopied = null;
        synchronized (mLock) {
            if (mIsClosed) return;
            mIsClosed = true;
@@ -167,10 +168,14 @@ public final class ProgramList implements AutoCloseable {
            mListCallbacks.clear();
            mOnCompleteListeners.clear();
            if (mOnCloseListener != null) {
                mOnCloseListener.onClose();
                onCompleteListenersCopied = mOnCloseListener;
                mOnCloseListener = null;
            }
        }

        if (onCompleteListenersCopied != null) {
            onCompleteListenersCopied.onClose();
        }
    }

    void apply(Chunk chunk) {