Merge "Enable/Disable ASHA profile with LE audio toggle"

This commit is contained in:
Yuyang Huang
2023-06-30 18:16:28 +00:00
committed by Android (Google) Code Review

View File

@@ -319,11 +319,16 @@ public class BluetoothDetailsProfilesController extends BluetoothDetailsControll
return;
}
LocalBluetoothProfile asha = mProfileManager.getHearingAidProfile();
for (CachedBluetoothDevice leAudioDevice : mProfileDeviceMap.get(profile.toString())) {
Log.d(TAG,
"device:" + leAudioDevice.getDevice().getAnonymizedAddress()
+ "disable LE profile");
profile.setEnabled(leAudioDevice.getDevice(), false);
if (asha != null) {
asha.setEnabled(leAudioDevice.getDevice(), true);
}
}
if (!SystemProperties.getBoolean(ENABLE_DUAL_MODE_AUDIO, false)) {
@@ -349,12 +354,16 @@ public class BluetoothDetailsProfilesController extends BluetoothDetailsControll
disableProfileBeforeUserEnablesLeAudio(mProfileManager.getA2dpProfile());
disableProfileBeforeUserEnablesLeAudio(mProfileManager.getHeadsetProfile());
}
LocalBluetoothProfile asha = mProfileManager.getHearingAidProfile();
for (CachedBluetoothDevice leAudioDevice : mProfileDeviceMap.get(profile.toString())) {
Log.d(TAG,
"device:" + leAudioDevice.getDevice().getAnonymizedAddress()
+ "enable LE profile");
profile.setEnabled(leAudioDevice.getDevice(), true);
if (asha != null) {
asha.setEnabled(leAudioDevice.getDevice(), false);
}
}
}
@@ -371,6 +380,12 @@ public class BluetoothDetailsProfilesController extends BluetoothDetailsControll
+ 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);
}
}
}
@@ -387,6 +402,12 @@ public class BluetoothDetailsProfilesController extends BluetoothDetailsControll
+ 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);
}
}
}