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

@@ -221,7 +221,16 @@ public class DevelopmentSettingsDashboardFragment extends RestrictedDashboardFra
if (isChecked) {
EnableDevelopmentSettingWarningDialog.show(this /* host */);
} else {
disableDeveloperOptions();
final BluetoothA2dpHwOffloadPreferenceController controller =
getDevelopmentOptionsController(
BluetoothA2dpHwOffloadPreferenceController.class);
// If A2DP hardware offload isn't default value, we must reboot after disable
// developer options. Show a dialog for the user to confirm.
if (controller == null || controller.isDefaultValue()) {
disableDeveloperOptions();
} else {
DisableDevSettingsDialogFragment.show(this /* host */);
}
}
}
}
@@ -380,6 +389,15 @@ public class DevelopmentSettingsDashboardFragment extends RestrictedDashboardFra
mSwitchBar.setChecked(false);
}
void onDisableDevelopmentOptionsConfirmed() {
disableDeveloperOptions();
}
void onDisableDevelopmentOptionsRejected() {
// Reset the toggle
mSwitchBar.setChecked(true);
}
private static List<AbstractPreferenceController> buildPreferenceControllers(Context context,
Activity activity, Lifecycle lifecycle, DevelopmentSettingsDashboardFragment fragment,
BluetoothA2dpConfigStore bluetoothA2dpConfigStore) {