Show reboot dialog when tunring off developer option

The toggle button "Disable Bluetooth A2DP hardware offload" in developer
options need reboot to take effect when value changed. Otherwise, the
A2DP will not work until user reboot the device.

If we want this toggle button change back to default value when turning
off developer options, we need reboot device as well.

This patch will check the property value of A2DP hardware offload. If
turning off developer options will change the value, show a dialog to
force the user to reboot device.

Bug: 80449594
Test: make -j50 RunSettingsRoboTests

Change-Id: Ibace1ff72c1b41bd55444242a74e3f0b49187668
This commit is contained in:
Chienyuan
2018-11-07 16:55:24 +08:00
parent 4c3251ebab
commit eda2987b86
4 changed files with 169 additions and 2 deletions

View File

@@ -66,6 +66,25 @@ public class BluetoothA2dpHwOffloadPreferenceController extends DeveloperOptions
}
}
@Override
protected void onDeveloperOptionsSwitchDisabled() {
super.onDeveloperOptionsSwitchDisabled();
final boolean offloadSupported =
SystemProperties.getBoolean(A2DP_OFFLOAD_SUPPORTED_PROPERTY, false);
if (offloadSupported) {
((SwitchPreference) mPreference).setChecked(false);
SystemProperties.set(A2DP_OFFLOAD_DISABLED_PROPERTY, "false");
}
}
public boolean isDefaultValue() {
final boolean offloadSupported =
SystemProperties.getBoolean(A2DP_OFFLOAD_SUPPORTED_PROPERTY, false);
final boolean offloadDisabled =
SystemProperties.getBoolean(A2DP_OFFLOAD_DISABLED_PROPERTY, false);
return offloadSupported ? !offloadDisabled : true;
}
public void onA2dpHwDialogConfirmed() {
final boolean offloadDisabled =
SystemProperties.getBoolean(A2DP_OFFLOAD_DISABLED_PROPERTY, false);