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,14 +22,12 @@ import android.os.SystemProperties;
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;
public class BluetoothInbandRingingPreferenceController extends
DeveloperOptionsPreferenceController implements Preference.OnPreferenceChangeListener,
PreferenceControllerMixin {
public class BluetoothInbandRingingPreferenceController extends DeveloperOptionsPreferenceController
implements Preference.OnPreferenceChangeListener, PreferenceControllerMixin {
private static final String BLUETOOTH_DISABLE_INBAND_RINGING_KEY =
"bluetooth_disable_inband_ringing";
@@ -37,8 +35,6 @@ public class BluetoothInbandRingingPreferenceController extends
static final String BLUETOOTH_DISABLE_INBAND_RINGING_PROPERTY =
"persist.bluetooth.disableinbandringing";
private SwitchPreference mPreference;
public BluetoothInbandRingingPreferenceController(Context context) {
super(context);
}
@@ -53,13 +49,6 @@ public class BluetoothInbandRingingPreferenceController extends
return BLUETOOTH_DISABLE_INBAND_RINGING_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 isChecked = (Boolean) newValue;
@@ -72,18 +61,13 @@ public class BluetoothInbandRingingPreferenceController extends
public void updateState(Preference preference) {
final boolean isEnabled = SystemProperties.getBoolean(
BLUETOOTH_DISABLE_INBAND_RINGING_PROPERTY, false /* default */);
mPreference.setChecked(isEnabled);
}
@Override
protected void onDeveloperOptionsSwitchEnabled() {
mPreference.setEnabled(true);
((SwitchPreference) mPreference).setChecked(isEnabled);
}
@Override
protected void onDeveloperOptionsSwitchDisabled() {
mPreference.setEnabled(false);
mPreference.setChecked(false);
super.onDeveloperOptionsSwitchDisabled();
((SwitchPreference) mPreference).setChecked(false);
SystemProperties.set(BLUETOOTH_DISABLE_INBAND_RINGING_PROPERTY, "false");
}