Add logging for LE Audio toggle enable/disable

BUG: 364201880
Test: local tested
Flag: EXEMPT minor change, only add logging
Change-Id: I05ea2d0cd85da9879e18ae730fb64beeb4d81dd4
This commit is contained in:
Haijie Hong
2024-11-18 16:55:50 +08:00
parent eb37f169a3
commit c79f368dbf

View File

@@ -18,6 +18,7 @@ package com.android.settings.bluetooth;
import static android.bluetooth.BluetoothDevice.METADATA_MODEL_NAME;
import android.app.settings.SettingsEnums;
import android.bluetooth.BluetoothDevice;
import android.bluetooth.BluetoothProfile;
import android.content.Context;
@@ -83,6 +84,8 @@ public class BluetoothDetailsProfilesController extends BluetoothDetailsControll
private static final boolean LE_AUDIO_TOGGLE_VISIBLE_DEFAULT_VALUE = true;
private static final String LE_AUDIO_TOGGLE_VISIBLE_PROPERTY =
"persist.bluetooth.leaudio.toggle_visible";
private static final String BYPASS_LE_AUDIO_ALLOWLIST_PROPERTY =
"persist.bluetooth.leaudio.bypass_allow_list";
private Set<String> mInvisibleProfiles = Collections.emptySet();
private final AtomicReference<Set<String>> mAdditionalInvisibleProfiles =
@@ -378,6 +381,16 @@ public class BluetoothDetailsProfilesController extends BluetoothDetailsControll
return result;
}
private boolean isCurrentDeviceInOrByPassAllowList() {
if (!SystemProperties.getBoolean(LE_AUDIO_CONNECTION_BY_DEFAULT_PROPERTY, true)) {
return false;
}
return SystemProperties.getBoolean(BYPASS_LE_AUDIO_ALLOWLIST_PROPERTY, false)
|| isModelNameInAllowList(
BluetoothUtils.getStringMetaData(
mCachedDevice.getDevice(), METADATA_MODEL_NAME));
}
/**
* Disable the Le Audio profile for each of the Le Audio devices.
*
@@ -389,6 +402,11 @@ public class BluetoothDetailsProfilesController extends BluetoothDetailsControll
return;
}
mMetricsFeatureProvider.action(
mContext,
SettingsEnums.ACTION_BLUETOOTH_PROFILE_LE_AUDIO_OFF,
isCurrentDeviceInOrByPassAllowList());
LocalBluetoothProfile asha = mProfileManager.getHearingAidProfile();
LocalBluetoothProfile broadcastAssistant =
mProfileManager.getLeAudioBroadcastAssistantProfile();
@@ -427,6 +445,11 @@ public class BluetoothDetailsProfilesController extends BluetoothDetailsControll
return;
}
mMetricsFeatureProvider.action(
mContext,
SettingsEnums.ACTION_BLUETOOTH_PROFILE_LE_AUDIO_ON,
isCurrentDeviceInOrByPassAllowList());
if (!SystemProperties.getBoolean(ENABLE_DUAL_MODE_AUDIO, false)) {
Log.i(TAG, "Disabling classic audio profiles because dual mode is disabled");
disableProfileBeforeUserEnablesLeAudio(mProfileManager.getA2dpProfile());