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

Commit 0639b8a5 authored by Jack He's avatar Jack He
Browse files

AVRCP: Fix deadlock between Avrcp.this and mMediaPlayerInfoList

* addMediaPlayerInfo (acquires mMediaPlayerInfoList)
  -> updateCurrentController (acquires Avrcp.this)
* onSessionDestroyed (acquires Avrcp.this)
  -> removeMediaController (acquires mMediaPlayerInfoList)
* Above is a deadlock that causes ANR
* This CL moves updateCurrentController call out of the critical section
  in addMediaPlayerInfo to resolve this deadlock situation

Bug: 63458678
Test: make, test connecting to Avrcp devices
Change-Id: Iaae2d1bc005a181b950d4306d0773332f6c1afef
parent c0d85be6
Loading
Loading
Loading
Loading
+4 −5
Original line number Diff line number Diff line
@@ -1843,12 +1843,11 @@ public final class Avrcp {
                mAvailablePlayerViewChanged = true;
            }
            mMediaPlayerInfoList.put(updateId, info);
            if (DEBUG)
                Log.d(TAG, (updated ? "update #" : "add #") + updateId + ":" + info.toString());
        }
        if (DEBUG) Log.d(TAG, (updated ? "update #" : "add #") + updateId + ":" + info.toString());
        if (currentRemoved || updateId == mCurrAddrPlayerID) {
            updateCurrentController(updateId, mCurrBrowsePlayerID);
        }
        }
        return updated;
    }