Revert "Remove media players if their backing session dissappears"

This reverts commit b510b281485962877792dbcc2e71fe576e6fd2d7.

Reason for revert: Bluetooth crash
Bug: 129235323

Change-Id: I0c770d1b164a7f2f676a33109805be396fbf0c15
(cherry picked from commit 14c52c4ae36682d321154bb7a3c122df3ab6aef0)
diff --git a/src/com/android/bluetooth/avrcp/MediaPlayerList.java b/src/com/android/bluetooth/avrcp/MediaPlayerList.java
index 31113da..10d99bf 100644
--- a/src/com/android/bluetooth/avrcp/MediaPlayerList.java
+++ b/src/com/android/bluetooth/avrcp/MediaPlayerList.java
@@ -459,7 +459,6 @@
         if (playerId == mActivePlayerId && playerId != NO_ACTIVE_PLAYER) {
             getActivePlayer().unregisterCallback();
             mActivePlayerId = NO_ACTIVE_PLAYER;
-            sendMediaUpdate(new MediaData(Util.empty_data(), null, null));
         }
 
         final MediaPlayerWrapper wrapper = mMediaPlayers.get(playerId);
@@ -537,35 +536,28 @@
             new MediaSessionManager.OnActiveSessionsChangedListener() {
         @Override
         public void onActiveSessionsChanged(
-                List<android.media.session.MediaController> controllers) {
+                List<android.media.session.MediaController> newControllers) {
             synchronized (MediaPlayerList.this) {
                 Log.v(TAG, "onActiveSessionsChanged: number of controllers: "
-                        + controllers.size());
-                if (controllers.size() == 0) return;
+                        + newControllers.size());
+                if (newControllers.size() == 0) return;
 
                 // Apps are allowed to have multiple MediaControllers. If an app does have
-                // multiple controllers then controllers contains them in highest
+                // multiple controllers then newControllers contains them in highest
                 // priority order. Since we only want to keep the highest priority one,
                 // we keep track of which controllers we updated and skip over ones
                 // we've already looked at.
                 HashSet<String> addedPackages = new HashSet<String>();
 
-                for (int i = 0; i < controllers.size(); i++) {
+                for (int i = 0; i < newControllers.size(); i++) {
                     Log.d(TAG, "onActiveSessionsChanged: controller: "
-                            + controllers.get(i).getPackageName());
-                    if (addedPackages.contains(controllers.get(i).getPackageName())) {
+                            + newControllers.get(i).getPackageName());
+                    if (addedPackages.contains(newControllers.get(i).getPackageName())) {
                         continue;
                     }
 
-                    addedPackages.add(controllers.get(i).getPackageName());
-                    addMediaPlayer(controllers.get(i));
-                }
-
-                // Remove all players that weren't added.
-                for (String packageName : mMediaPlayerIds.keySet()) {
-                    if (!addedPackages.contains(packageName)) {
-                        removeMediaPlayer(mMediaPlayerIds.get(packageName));
-                    }
+                    addedPackages.add(newControllers.get(i).getPackageName());
+                    addMediaPlayer(newControllers.get(i));
                 }
             }
         }