Add LE audio hardware offload development option
Bug: 197296692 Bug: 215492586 Test: make RunSettingsRoboTests ROBOTEST_FILTER=BluetoothLeAudioHwOffloadPreferenceControllerTest Test: make RunSettingsRoboTests ROBOTEST_FILTER=BluetoothA2dpHwOffloadPreferenceControllerTest Change-Id: If1203c50d1d94ac9ed377293b5cb389b7b6f54a1 Merged-In: If1203c50d1d94ac9ed377293b5cb389b7b6f54a1
This commit is contained in:
@@ -16,9 +16,12 @@
|
||||
|
||||
package com.android.settings.development;
|
||||
|
||||
import static com.android.settings.development.BluetoothLeAudioHwOffloadPreferenceController.LE_AUDIO_OFFLOAD_DISABLED_PROPERTY;
|
||||
|
||||
import android.content.Context;
|
||||
import android.os.SystemProperties;
|
||||
|
||||
import androidx.annotation.VisibleForTesting;
|
||||
import androidx.preference.Preference;
|
||||
import androidx.preference.SwitchPreference;
|
||||
|
||||
@@ -34,6 +37,9 @@ public class BluetoothA2dpHwOffloadPreferenceController extends DeveloperOptions
|
||||
static final String A2DP_OFFLOAD_DISABLED_PROPERTY = "persist.bluetooth.a2dp_offload.disabled";
|
||||
static final String A2DP_OFFLOAD_SUPPORTED_PROPERTY = "ro.bluetooth.a2dp_offload.supported";
|
||||
|
||||
@VisibleForTesting
|
||||
boolean mChanged = false;
|
||||
|
||||
public BluetoothA2dpHwOffloadPreferenceController(Context context,
|
||||
DevelopmentSettingsDashboardFragment fragment) {
|
||||
super(context);
|
||||
@@ -47,7 +53,8 @@ public class BluetoothA2dpHwOffloadPreferenceController extends DeveloperOptions
|
||||
|
||||
@Override
|
||||
public boolean onPreferenceChange(Preference preference, Object newValue) {
|
||||
BluetoothA2dpHwOffloadRebootDialog.show(mFragment, this);
|
||||
BluetoothHwOffloadRebootDialog.show(mFragment);
|
||||
mChanged = true;
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -85,10 +92,26 @@ public class BluetoothA2dpHwOffloadPreferenceController extends DeveloperOptions
|
||||
return offloadSupported ? !offloadDisabled : true;
|
||||
}
|
||||
|
||||
public void onA2dpHwDialogConfirmed() {
|
||||
/**
|
||||
* Called when the HwOffloadDialog confirm is clicked.
|
||||
*/
|
||||
public void onHwOffloadDialogConfirmed() {
|
||||
if (!mChanged) {
|
||||
return;
|
||||
}
|
||||
final boolean offloadDisabled =
|
||||
SystemProperties.getBoolean(A2DP_OFFLOAD_DISABLED_PROPERTY, false);
|
||||
SystemProperties.set(A2DP_OFFLOAD_DISABLED_PROPERTY, Boolean.toString(!offloadDisabled));
|
||||
if (offloadDisabled) {
|
||||
SystemProperties.set(LE_AUDIO_OFFLOAD_DISABLED_PROPERTY,
|
||||
Boolean.toString(!offloadDisabled));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when the HwOffloadDialog cancel is clicked.
|
||||
*/
|
||||
public void onHwOffloadDialogCanceled() {
|
||||
mChanged = false;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user