From 6edb515a9fc91e4d29764c2a22a892151e91fcc3 Mon Sep 17 00:00:00 2001 From: Jack He Date: Tue, 9 May 2023 02:44:45 +0000 Subject: [PATCH] Revert "Remove CSIP/VCP enable/disable from Setting" This reverts commit 345889b5e2d1de6f28493492b5db6f1f0b2c51a6. Reason for revert: Accidental merge, should merge together with prebuilt Bug: 280626194 Change-Id: I93f66f22b55eb906f8e079de35f2db00b102c788 --- .../BluetoothDetailsProfilesController.java | 20 +++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/src/com/android/settings/bluetooth/BluetoothDetailsProfilesController.java b/src/com/android/settings/bluetooth/BluetoothDetailsProfilesController.java index 6b58b2c786c..f69cf580d51 100644 --- a/src/com/android/settings/bluetooth/BluetoothDetailsProfilesController.java +++ b/src/com/android/settings/bluetooth/BluetoothDetailsProfilesController.java @@ -320,7 +320,7 @@ public class BluetoothDetailsProfilesController extends BluetoothDetailsControll } /** - * Disable the Le Audio profile for each of the Le Audio devices. + * Disable the Le Audio profile, VCP, and CSIP for each of the Le Audio devices. * * @param profile the LeAudio profile */ @@ -329,12 +329,20 @@ public class BluetoothDetailsProfilesController extends BluetoothDetailsControll Log.e(TAG, "There is no the LE profile or no device in mProfileDeviceMap. Do nothing."); return; } + LocalBluetoothProfile vcp = mProfileManager.getVolumeControlProfile(); + LocalBluetoothProfile csip = mProfileManager.getCsipSetCoordinatorProfile(); for (CachedBluetoothDevice leAudioDevice : mProfileDeviceMap.get(profile.toString())) { Log.d(TAG, "device:" + leAudioDevice.getDevice().getAnonymizedAddress() + "disable LE profile"); profile.setEnabled(leAudioDevice.getDevice(), false); + if (vcp != null) { + vcp.setEnabled(leAudioDevice.getDevice(), false); + } + if (csip != null) { + csip.setEnabled(leAudioDevice.getDevice(), false); + } } if (!SystemProperties.getBoolean(ENABLE_DUAL_MODE_AUDIO, false)) { @@ -345,7 +353,7 @@ public class BluetoothDetailsProfilesController extends BluetoothDetailsControll } /** - * Enable the Le Audio profile for each of the Le Audio devices. + * Enable the Le Audio profile, VCP, and CSIP for each of the Le Audio devices. * * @param profile the LeAudio profile */ @@ -361,11 +369,19 @@ public class BluetoothDetailsProfilesController extends BluetoothDetailsControll disableProfileBeforeUserEnablesLeAudio(mProfileManager.getHeadsetProfile()); } + LocalBluetoothProfile vcp = mProfileManager.getVolumeControlProfile(); + LocalBluetoothProfile csip = mProfileManager.getCsipSetCoordinatorProfile(); for (CachedBluetoothDevice leAudioDevice : mProfileDeviceMap.get(profile.toString())) { Log.d(TAG, "device:" + leAudioDevice.getDevice().getAnonymizedAddress() + "enable LE profile"); profile.setEnabled(leAudioDevice.getDevice(), true); + if (vcp != null) { + vcp.setEnabled(leAudioDevice.getDevice(), true); + } + if (csip != null) { + csip.setEnabled(leAudioDevice.getDevice(), true); + } } }