A2dp: For codec configuration change update stored volume to audio

Due to race condtion between active device change and codec
config change volume -1 updated to audio from codec upadte path
which start streaming with current stream volume. Actual volume
upadte is ignored.
Now updating current stored active device volume to start streaming
with last stored volume.

CRs-Fixed: 2522213
Change-Id: I75bdf050f4d773e54fc5ee9da3044276746c2b3a
diff --git a/src/com/android/bluetooth/a2dp/A2dpService.java b/src/com/android/bluetooth/a2dp/A2dpService.java
index 8104526..37e549f 100644
--- a/src/com/android/bluetooth/a2dp/A2dpService.java
+++ b/src/com/android/bluetooth/a2dp/A2dpService.java
@@ -1329,10 +1329,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) {