Set default value of A2DP HW offload toggle

When developer options is disabled, A2DP HW offload toggle
will switch to default value, we should decide default value
according to A2DP HW offload is supported of not.

Bug: 63932139
Bug: 79568680
Test: robotests
Change-Id: I3bf941edd3c0e0f70cfba32dc856e3f14fee07fa
This commit is contained in:
Chienyuan
2018-05-23 19:29:58 +08:00
committed by Chienyuan Huang
parent e0e49140d2
commit 48668576e4

View File

@@ -69,8 +69,15 @@ public class BluetoothA2dpHwOffloadPreferenceController extends DeveloperOptions
@Override
protected void onDeveloperOptionsSwitchDisabled() {
super.onDeveloperOptionsSwitchDisabled();
((SwitchPreference) mPreference).setChecked(true);
SystemProperties.set(A2DP_OFFLOAD_DISABLED_PROPERTY, "true");
final boolean offloadSupported =
SystemProperties.getBoolean(A2DP_OFFLOAD_SUPPORTED_PROPERTY, false);
if (offloadSupported) {
((SwitchPreference) mPreference).setChecked(false);
SystemProperties.set(A2DP_OFFLOAD_DISABLED_PROPERTY, "false");
} else {
((SwitchPreference) mPreference).setChecked(true);
SystemProperties.set(A2DP_OFFLOAD_DISABLED_PROPERTY, "true");
}
}
public void onA2dpHwDialogConfirmed() {