[Audiosharing] Use LE audio profile as fallback to get group id.
For non-CSIP LE audio device, use LE audio profile to get group id. Also, did some refinement in this change. 1. Add more log 2. Use context#getMainExecutor instead, since postOnMainThread is deprecated. Test: manual Bug: 305620450 Bug: 319723439 Change-Id: I8056b2e7b6ab37915a518ad2290a0a7fb7671c18
This commit is contained in:
@@ -77,11 +77,12 @@ public class AudioSharingDeviceVolumeGroupController extends AudioSharingBasePre
|
||||
CachedBluetoothDevice cachedDevice =
|
||||
mLocalBtManager.getCachedDeviceManager().findDevice(device);
|
||||
if (cachedDevice == null) return;
|
||||
mValueMap.put(cachedDevice.getGroupId(), volume);
|
||||
int groupId = AudioSharingUtils.getGroupId(cachedDevice);
|
||||
mValueMap.put(groupId, volume);
|
||||
for (AudioSharingDeviceVolumePreference preference : mVolumePreferences) {
|
||||
if (preference.getCachedDevice() != null
|
||||
&& preference.getCachedDevice().getGroupId()
|
||||
== cachedDevice.getGroupId()) {
|
||||
&& AudioSharingUtils.getGroupId(preference.getCachedDevice())
|
||||
== groupId) {
|
||||
// If the callback return invalid volume, try to
|
||||
// get the volume from AudioManager.STREAM_MUSIC
|
||||
int finalVolume = getAudioVolumeIfNeeded(volume);
|
||||
@@ -270,7 +271,7 @@ public class AudioSharingDeviceVolumeGroupController extends AudioSharingBasePre
|
||||
if (volumePref.getProgress() > 0) return;
|
||||
CachedBluetoothDevice device = volumePref.getCachedDevice();
|
||||
if (device == null) return;
|
||||
int volume = mValueMap.getOrDefault(device.getGroupId(), -1);
|
||||
int volume = mValueMap.getOrDefault(AudioSharingUtils.getGroupId(device), -1);
|
||||
// If the volume is invalid, try to get the volume from AudioManager.STREAM_MUSIC
|
||||
int finalVolume = getAudioVolumeIfNeeded(volume);
|
||||
Log.d(
|
||||
|
||||
Reference in New Issue
Block a user