Merge "Check all member devices to determine whether it's LeAudio-only device" into main
This commit is contained in:
@@ -43,7 +43,6 @@ import com.android.settingslib.bluetooth.A2dpProfile;
|
||||
import com.android.settingslib.bluetooth.BluetoothUtils;
|
||||
import com.android.settingslib.bluetooth.CachedBluetoothDevice;
|
||||
import com.android.settingslib.bluetooth.HeadsetProfile;
|
||||
import com.android.settingslib.bluetooth.HearingAidProfile;
|
||||
import com.android.settingslib.bluetooth.LeAudioProfile;
|
||||
import com.android.settingslib.bluetooth.LocalBluetoothManager;
|
||||
import com.android.settingslib.bluetooth.LocalBluetoothProfile;
|
||||
@@ -95,6 +94,7 @@ public class BluetoothDetailsProfilesController extends BluetoothDetailsControll
|
||||
new HashMap<String, List<CachedBluetoothDevice>>();
|
||||
private boolean mIsLeContactSharingEnabled = false;
|
||||
private boolean mIsLeAudioToggleEnabled = false;
|
||||
private boolean mIsLeAudioOnlyDevice = false;
|
||||
|
||||
@VisibleForTesting
|
||||
PreferenceCategory mProfilesContainer;
|
||||
@@ -345,6 +345,11 @@ public class BluetoothDetailsProfilesController extends BluetoothDetailsControll
|
||||
result.remove(mManager.getProfileManager().getA2dpProfile());
|
||||
result.remove(mManager.getProfileManager().getHeadsetProfile());
|
||||
}
|
||||
boolean hearingAidSupported = result.contains(
|
||||
mManager.getProfileManager().getHearingAidProfile());
|
||||
if (leAudioSupported && !classicAudioSupported && !hearingAidSupported) {
|
||||
mIsLeAudioOnlyDevice = true;
|
||||
}
|
||||
Log.d(TAG, "getProfiles:Map:" + mProfileDeviceMap);
|
||||
return result;
|
||||
}
|
||||
@@ -513,19 +518,6 @@ public class BluetoothDetailsProfilesController extends BluetoothDetailsControll
|
||||
refresh();
|
||||
}
|
||||
|
||||
private boolean isLeAudioOnlyDevice() {
|
||||
if (mCachedDevice.getProfiles().stream()
|
||||
.noneMatch(profile -> profile instanceof LeAudioProfile)) {
|
||||
return false;
|
||||
}
|
||||
return mCachedDevice.getProfiles().stream()
|
||||
.noneMatch(
|
||||
profile ->
|
||||
profile instanceof HearingAidProfile
|
||||
|| profile instanceof A2dpProfile
|
||||
|| profile instanceof HeadsetProfile);
|
||||
}
|
||||
|
||||
private void updateLeAudioConfig() {
|
||||
mIsLeContactSharingEnabled = DeviceConfig.getBoolean(DeviceConfig.NAMESPACE_SETTINGS_UI,
|
||||
SettingsUIDeviceConfig.BT_LE_AUDIO_CONTACT_SHARING_ENABLED, true);
|
||||
@@ -534,7 +526,7 @@ public class BluetoothDetailsProfilesController extends BluetoothDetailsControll
|
||||
boolean isLeEnabledByDefault =
|
||||
SystemProperties.getBoolean(LE_AUDIO_CONNECTION_BY_DEFAULT_PROPERTY, true);
|
||||
mIsLeAudioToggleEnabled = isLeAudioToggleVisible || isLeEnabledByDefault;
|
||||
if (Flags.hideLeAudioToggleForLeAudioOnlyDevice() && isLeAudioOnlyDevice()) {
|
||||
if (Flags.hideLeAudioToggleForLeAudioOnlyDevice() && mIsLeAudioOnlyDevice) {
|
||||
mIsLeAudioToggleEnabled = false;
|
||||
Log.d(
|
||||
TAG,
|
||||
|
Reference in New Issue
Block a user