Merge "AVRCP: Check mMediaSessionManager is not null before handling callback" into qt-qpr1-dev
diff --git a/src/com/android/bluetooth/avrcp/MediaPlayerList.java b/src/com/android/bluetooth/avrcp/MediaPlayerList.java
index 10d99bf..29f4cf9 100644
--- a/src/com/android/bluetooth/avrcp/MediaPlayerList.java
+++ b/src/com/android/bluetooth/avrcp/MediaPlayerList.java
@@ -626,6 +626,12 @@
android.media.session.MediaController controller =
new android.media.session.MediaController(mContext, token);
+ if (mMediaSessionManager == null) {
+ Log.w(TAG, "onAddressedPlayerChanged(Token): Unexpected callback "
+ + "from the MediaSessionManager");
+ return;
+ }
+
if (!mMediaPlayerIds.containsKey(controller.getPackageName())) {
// Since we have a controller, we can try to to recover by adding the
// player and then setting it as active.
@@ -640,6 +646,12 @@
@Override
public void onAddressedPlayerChanged(ComponentName receiver) {
+ if (mMediaSessionManager == null) {
+ Log.w(TAG, "onAddressedPlayerChanged(Component): Unexpected callback "
+ + "from the MediaSessionManager");
+ return;
+ }
+
if (receiver == null) {
return;
}