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:
@@ -21,14 +21,12 @@ 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;
|
||||
|
||||
public class TetheringHardwareAccelPreferenceController extends
|
||||
DeveloperOptionsPreferenceController implements Preference.OnPreferenceChangeListener,
|
||||
PreferenceControllerMixin {
|
||||
public class TetheringHardwareAccelPreferenceController extends DeveloperOptionsPreferenceController
|
||||
implements Preference.OnPreferenceChangeListener, PreferenceControllerMixin {
|
||||
|
||||
private static final String TETHERING_HARDWARE_OFFLOAD = "tethering_hardware_offload";
|
||||
|
||||
@@ -39,8 +37,6 @@ public class TetheringHardwareAccelPreferenceController extends
|
||||
@VisibleForTesting
|
||||
static final int SETTING_VALUE_OFF = 1;
|
||||
|
||||
private SwitchPreference mPreference;
|
||||
|
||||
public TetheringHardwareAccelPreferenceController(Context context) {
|
||||
super(context);
|
||||
}
|
||||
@@ -50,13 +46,6 @@ public class TetheringHardwareAccelPreferenceController extends
|
||||
return TETHERING_HARDWARE_OFFLOAD;
|
||||
}
|
||||
|
||||
@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;
|
||||
@@ -71,19 +60,14 @@ public class TetheringHardwareAccelPreferenceController extends
|
||||
final int tetheringMode = Settings.Global.getInt(
|
||||
mContext.getContentResolver(),
|
||||
Settings.Global.TETHER_OFFLOAD_DISABLED, 0 /* default */);
|
||||
mPreference.setChecked(tetheringMode != SETTING_VALUE_OFF);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDeveloperOptionsSwitchEnabled() {
|
||||
mPreference.setEnabled(true);
|
||||
((SwitchPreference) mPreference).setChecked(tetheringMode != SETTING_VALUE_OFF);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDeveloperOptionsSwitchDisabled() {
|
||||
super.onDeveloperOptionsSwitchDisabled();
|
||||
Settings.Global.putInt(mContext.getContentResolver(),
|
||||
Settings.Global.TETHER_OFFLOAD_DISABLED, SETTING_VALUE_OFF);
|
||||
mPreference.setEnabled(false);
|
||||
mPreference.setChecked(false);
|
||||
((SwitchPreference) mPreference).setChecked(false);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user