Enable/Disable ASHA profile with LE audio toggle
LE audio has more capability and better quality than ASHA has. When LE audio turned on, ASHA should be off to avoid media streaming profile conflict. Bug: 287525854 Change-Id: I3c5c9012c167b920e484b39374fe8174191b094d Test: manual
This commit is contained in:
@@ -323,11 +323,16 @@ public class BluetoothDetailsProfilesController extends BluetoothDetailsControll
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
LocalBluetoothProfile asha = mProfileManager.getHearingAidProfile();
|
||||||
|
|
||||||
for (CachedBluetoothDevice leAudioDevice : mProfileDeviceMap.get(profile.toString())) {
|
for (CachedBluetoothDevice leAudioDevice : mProfileDeviceMap.get(profile.toString())) {
|
||||||
Log.d(TAG,
|
Log.d(TAG,
|
||||||
"device:" + leAudioDevice.getDevice().getAnonymizedAddress()
|
"device:" + leAudioDevice.getDevice().getAnonymizedAddress()
|
||||||
+ "disable LE profile");
|
+ "disable LE profile");
|
||||||
profile.setEnabled(leAudioDevice.getDevice(), false);
|
profile.setEnabled(leAudioDevice.getDevice(), false);
|
||||||
|
if (asha != null) {
|
||||||
|
asha.setEnabled(leAudioDevice.getDevice(), true);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!SystemProperties.getBoolean(ENABLE_DUAL_MODE_AUDIO, false)) {
|
if (!SystemProperties.getBoolean(ENABLE_DUAL_MODE_AUDIO, false)) {
|
||||||
@@ -353,12 +358,16 @@ public class BluetoothDetailsProfilesController extends BluetoothDetailsControll
|
|||||||
disableProfileBeforeUserEnablesLeAudio(mProfileManager.getA2dpProfile());
|
disableProfileBeforeUserEnablesLeAudio(mProfileManager.getA2dpProfile());
|
||||||
disableProfileBeforeUserEnablesLeAudio(mProfileManager.getHeadsetProfile());
|
disableProfileBeforeUserEnablesLeAudio(mProfileManager.getHeadsetProfile());
|
||||||
}
|
}
|
||||||
|
LocalBluetoothProfile asha = mProfileManager.getHearingAidProfile();
|
||||||
|
|
||||||
for (CachedBluetoothDevice leAudioDevice : mProfileDeviceMap.get(profile.toString())) {
|
for (CachedBluetoothDevice leAudioDevice : mProfileDeviceMap.get(profile.toString())) {
|
||||||
Log.d(TAG,
|
Log.d(TAG,
|
||||||
"device:" + leAudioDevice.getDevice().getAnonymizedAddress()
|
"device:" + leAudioDevice.getDevice().getAnonymizedAddress()
|
||||||
+ "enable LE profile");
|
+ "enable LE profile");
|
||||||
profile.setEnabled(leAudioDevice.getDevice(), true);
|
profile.setEnabled(leAudioDevice.getDevice(), true);
|
||||||
|
if (asha != null) {
|
||||||
|
asha.setEnabled(leAudioDevice.getDevice(), false);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -375,6 +384,12 @@ public class BluetoothDetailsProfilesController extends BluetoothDetailsControll
|
|||||||
+ profile.toString() + " profile is disabled. Do nothing.");
|
+ profile.toString() + " profile is disabled. Do nothing.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
if (profile == null) {
|
||||||
|
Log.w(TAG, "profile is null");
|
||||||
|
} else {
|
||||||
|
Log.w(TAG, profile.toString() + " is not in " + mProfileDeviceMap);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -391,6 +406,12 @@ public class BluetoothDetailsProfilesController extends BluetoothDetailsControll
|
|||||||
+ profile.toString() + " profile is enabled. Do nothing.");
|
+ profile.toString() + " profile is enabled. Do nothing.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
if (profile == null) {
|
||||||
|
Log.w(TAG, "profile is null");
|
||||||
|
} else {
|
||||||
|
Log.w(TAG, profile.toString() + " is not in " + mProfileDeviceMap);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user