Initialize the Media Player list at start
If the browsable list builder fails to receive any connect callbacks when
connecting to media services, we could be left in a state where the media
player list is uninitialized. This is fixed by always initializing the
media player list at the start of AVRCP.
Change-Id: I15088c1f4e8ffa2ac8a101339c9b47989fc17a5e
Fixes: 36151636
Test: Manually tested connecting AVRCP with AVIC-8100NEX
(cherry picked from commit 11bf73ff614f48a41dc379763bc007f271197b26)
diff --git a/src/com/android/bluetooth/avrcp/Avrcp.java b/src/com/android/bluetooth/avrcp/Avrcp.java
index 58488d7..9112b67 100644
--- a/src/com/android/bluetooth/avrcp/Avrcp.java
+++ b/src/com/android/bluetooth/avrcp/Avrcp.java
@@ -270,14 +270,14 @@
/* initialize BrowseMananger which manages Browse commands and response */
mAvrcpBrowseManager = new AvrcpBrowseManager(mContext, mAvrcpMediaRsp);
+ // Build the media players list
+ buildMediaPlayersList();
+
UserManager manager = UserManager.get(mContext);
if (manager == null || manager.isUserUnlocked()) {
if (DEBUG) Log.d(TAG, "User already unlocked, initializing player lists");
// initialize browsable player list and build media player list
(new BrowsablePlayerListBuilder()).start();
- } else {
- // Still build the media players list even if we can't browse.
- buildMediaPlayersList();
}
}