Bluetooth: Enable AVDTP Delay reports by default.

Bug: 32755225
Test: See that delay reports are enabled when connecting to device
Change-Id: Icba9be6fc8ba455d37df39d283e36129f6acb536
(cherry picked from commit a8cf0b9371)
This commit is contained in:
Ajay Panicker
2018-03-07 15:55:02 -08:00
parent 7208905cb9
commit ff6a90994f
4 changed files with 30 additions and 28 deletions

View File

@@ -28,11 +28,11 @@ import com.android.settingslib.development.DeveloperOptionsPreferenceController;
public class BluetoothDelayReportsPreferenceController extends DeveloperOptionsPreferenceController
implements Preference.OnPreferenceChangeListener, PreferenceControllerMixin {
private static final String BLUETOOTH_ENABLE_AVDTP_DELAY_REPORT_KEY =
"bluetooth_enable_avdtp_delay_reports";
private static final String BLUETOOTH_DISABLE_AVDTP_DELAY_REPORT_KEY =
"bluetooth_disable_avdtp_delay_reports";
@VisibleForTesting
static final String BLUETOOTH_ENABLE_AVDTP_DELAY_REPORTS_PROPERTY =
"persist.bluetooth.enabledelayreports";
static final String BLUETOOTH_DISABLE_AVDTP_DELAY_REPORTS_PROPERTY =
"persist.bluetooth.disabledelayreports";
public BluetoothDelayReportsPreferenceController(Context context) {
super(context);
@@ -40,22 +40,22 @@ public class BluetoothDelayReportsPreferenceController extends DeveloperOptionsP
@Override
public String getPreferenceKey() {
return BLUETOOTH_ENABLE_AVDTP_DELAY_REPORT_KEY;
return BLUETOOTH_DISABLE_AVDTP_DELAY_REPORT_KEY;
}
@Override
public boolean onPreferenceChange(Preference preference, Object newValue) {
final boolean isEnabled = (Boolean) newValue;
SystemProperties.set(BLUETOOTH_ENABLE_AVDTP_DELAY_REPORTS_PROPERTY,
isEnabled ? "true" : "false");
final boolean isDisabled = (Boolean) newValue;
SystemProperties.set(BLUETOOTH_DISABLE_AVDTP_DELAY_REPORTS_PROPERTY,
isDisabled ? "true" : "false");
return true;
}
@Override
public void updateState(Preference preference) {
final boolean isEnabled = SystemProperties.getBoolean(
BLUETOOTH_ENABLE_AVDTP_DELAY_REPORTS_PROPERTY, false /* default */);
((SwitchPreference) mPreference).setChecked(isEnabled);
final boolean isDisabled = SystemProperties.getBoolean(
BLUETOOTH_DISABLE_AVDTP_DELAY_REPORTS_PROPERTY, false /* default */);
((SwitchPreference) mPreference).setChecked(isDisabled);
}
@Override
@@ -63,7 +63,7 @@ public class BluetoothDelayReportsPreferenceController extends DeveloperOptionsP
super.onDeveloperOptionsSwitchDisabled();
// the default setting for this preference is the disabled state
((SwitchPreference) mPreference).setChecked(false);
SystemProperties.set(BLUETOOTH_ENABLE_AVDTP_DELAY_REPORTS_PROPERTY, "false");
SystemProperties.set(BLUETOOTH_DISABLE_AVDTP_DELAY_REPORTS_PROPERTY, "false");
}
}