TWS_AVRCP: Check volume level before sending to both TWS+ pair
-Send volume to both pair during SHO only if the remote volume
is not equal to local volume.
-Check if mCurrentDevice is not null before setting volume
Change-Id: Iedebbbfd72355e26998cd64732691f67ced6a163
diff --git a/packages_apps_bluetooth_ext/src/avrcp/Avrcp_ext.java b/packages_apps_bluetooth_ext/src/avrcp/Avrcp_ext.java
index a4cf61a..a57da3f 100644
--- a/packages_apps_bluetooth_ext/src/avrcp/Avrcp_ext.java
+++ b/packages_apps_bluetooth_ext/src/avrcp/Avrcp_ext.java
@@ -809,7 +809,8 @@
vol = convertToAvrcpVolume(vol);
Log.d(TAG,"vol = " + vol + "rem vol = " + deviceFeatures[deviceIndex].mRemoteVolume);
if(vol != deviceFeatures[deviceIndex].mRemoteVolume &&
- deviceFeatures[deviceIndex].isAbsoluteVolumeSupportingDevice)
+ deviceFeatures[deviceIndex].isAbsoluteVolumeSupportingDevice &&
+ deviceFeatures[deviceIndex].mCurrentDevice != null) {
setVolumeNative(vol , getByteAddress(deviceFeatures[deviceIndex].mCurrentDevice));
if (deviceFeatures[deviceIndex].mCurrentDevice.isTwsPlusDevice()) {
AdapterService adapterService = AdapterService.getAdapterService();
@@ -822,6 +823,7 @@
setVolumeNative(vol, getByteAddress(peer_device));
}
}
+ }
}
//mLastLocalVolume = -1;
break;