Merge "AVRCP: Remove READ_MEDIA_AUDIO permission" into q-keystone-qcom-dev
diff --git a/src/com/android/bluetooth/a2dp/A2dpService.java b/src/com/android/bluetooth/a2dp/A2dpService.java
index b11ae58..cc2de60 100644
--- a/src/com/android/bluetooth/a2dp/A2dpService.java
+++ b/src/com/android/bluetooth/a2dp/A2dpService.java
@@ -1317,10 +1317,13 @@
         // Inform the Audio Service about the codec configuration change,
         // so the Audio Service can reset accordingly the audio feeding
         // parameters in the Audio HAL to the Bluetooth stack.
+        int rememberedVolume = -1;
         if (isActiveDevice(device) && !sameAudioFeedingParameters) {
+            if (mAvrcp_ext != null)
+                rememberedVolume = mAvrcp_ext.getVolume(device);
             mAudioManager.handleBluetoothA2dpActiveDeviceChange(device,
                     BluetoothProfile.STATE_CONNECTED, BluetoothProfile.A2DP,
-                    true, -1);
+                    true, rememberedVolume);
         }
     }
     void updateTwsChannelMode(int state, BluetoothDevice device) {