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

@@ -22,7 +22,6 @@ import android.provider.Settings;
import android.support.annotation.VisibleForTesting;
import android.support.v14.preference.SwitchPreference;
import android.support.v7.preference.Preference;
import android.support.v7.preference.PreferenceScreen;
import com.android.settings.core.PreferenceControllerMixin;
import com.android.settingslib.development.DeveloperOptionsPreferenceController;
@@ -34,8 +33,6 @@ public class NotificationChannelWarningsPreferenceController extends
private static final String SHOW_NOTIFICATION_CHANNEL_WARNINGS_KEY =
"show_notification_channel_warnings";
private SwitchPreference mPreference;
@VisibleForTesting
final static int SETTING_VALUE_ON = 1;
@VisibleForTesting
@@ -55,13 +52,6 @@ public class NotificationChannelWarningsPreferenceController extends
return SHOW_NOTIFICATION_CHANNEL_WARNINGS_KEY;
}
@Override
public void displayPreference(PreferenceScreen screen) {
super.displayPreference(screen);
mPreference = (SwitchPreference) screen.findPreference(getPreferenceKey());
}
@Override
public boolean onPreferenceChange(Preference preference, Object newValue) {
final boolean isEnabled = (Boolean) newValue;
@@ -76,20 +66,15 @@ public class NotificationChannelWarningsPreferenceController extends
final int defaultWarningEnabled = isDebuggable() ? DEBUGGING_ENABLED : DEBUGGING_DISABLED;
final int mode = Settings.Global.getInt(mContext.getContentResolver(),
Settings.Global.SHOW_NOTIFICATION_CHANNEL_WARNINGS, defaultWarningEnabled);
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();
Settings.Global.putInt(mContext.getContentResolver(),
Settings.Global.SHOW_NOTIFICATION_CHANNEL_WARNINGS, SETTING_VALUE_OFF);
mPreference.setEnabled(false);
mPreference.setChecked(false);
((SwitchPreference) mPreference).setChecked(false);
}
@VisibleForTesting