Remove unnecessary onDeveloperOptionsSwitchEnabled/Disabled override.

- default implementation has been added in the super class to handle
enabling/disabling the preference when the master developer options
switch it turned on/off. Removing all subclass that originally
implemented the methods that only contains the default behavior.

Bug: 73955632
Test: make RunSettingsRoboTests
Change-Id: I13c372c2ab498a5786b40cdc1ad3b5f3424abb5a
This commit is contained in:
Doris Ling
2018-03-01 10:33:14 -08:00
parent 46d6ecc2b1
commit 4fbf04cd10
131 changed files with 489 additions and 1699 deletions

View File

@@ -39,7 +39,6 @@ public class KeepActivitiesPreferenceController extends DeveloperOptionsPreferen
static final int SETTING_VALUE_OFF = 0;
private IActivityManager mActivityManager;
private SwitchPreference mPreference;
public KeepActivitiesPreferenceController(Context context) {
super(context);
@@ -54,7 +53,6 @@ public class KeepActivitiesPreferenceController extends DeveloperOptionsPreferen
public void displayPreference(PreferenceScreen screen) {
super.displayPreference(screen);
mPreference = (SwitchPreference) screen.findPreference(getPreferenceKey());
mActivityManager = getActivityManager();
}
@@ -69,19 +67,14 @@ public class KeepActivitiesPreferenceController extends DeveloperOptionsPreferen
public void updateState(Preference preference) {
final int mode = Settings.Global.getInt(mContext.getContentResolver(),
Settings.Global.ALWAYS_FINISH_ACTIVITIES, SETTING_VALUE_OFF);
mPreference.setChecked(mode != SETTING_VALUE_OFF);
}
@Override
protected void onDeveloperOptionsSwitchEnabled() {
mPreference.setEnabled(true);
((SwitchPreference) mPreference).setChecked(mode != SETTING_VALUE_OFF);
}
@Override
protected void onDeveloperOptionsSwitchDisabled() {
super.onDeveloperOptionsSwitchDisabled();
writeImmediatelyDestroyActivitiesOptions(false);
mPreference.setEnabled(false);
mPreference.setChecked(false);
((SwitchPreference) mPreference).setChecked(false);
}
private void writeImmediatelyDestroyActivitiesOptions(boolean isEnabled) {