From c79f368dbf712f9e8e33bca0c50866bf61a42cee Mon Sep 17 00:00:00 2001 From: Haijie Hong Date: Mon, 18 Nov 2024 16:55:50 +0800 Subject: [PATCH] Add logging for LE Audio toggle enable/disable BUG: 364201880 Test: local tested Flag: EXEMPT minor change, only add logging Change-Id: I05ea2d0cd85da9879e18ae730fb64beeb4d81dd4 --- .../BluetoothDetailsProfilesController.java | 23 +++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/src/com/android/settings/bluetooth/BluetoothDetailsProfilesController.java b/src/com/android/settings/bluetooth/BluetoothDetailsProfilesController.java index d75e7da3f86..924ba2c7fa7 100644 --- a/src/com/android/settings/bluetooth/BluetoothDetailsProfilesController.java +++ b/src/com/android/settings/bluetooth/BluetoothDetailsProfilesController.java @@ -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 mInvisibleProfiles = Collections.emptySet(); private final AtomicReference> 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());