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.os.ServiceManager;
import android.support.annotation.VisibleForTesting;
import android.support.v7.preference.ListPreference;
import android.support.v7.preference.Preference;
import android.support.v7.preference.PreferenceScreen;
import android.view.IWindowManager;
import com.android.settings.R;
@@ -43,7 +42,6 @@ public class TransitionAnimationScalePreferenceController extends
private final IWindowManager mWindowManager;
private final String[] mListValues;
private final String[] mListSummaries;
private ListPreference mPreference;
public TransitionAnimationScalePreferenceController(Context context) {
super(context);
@@ -61,13 +59,6 @@ public class TransitionAnimationScalePreferenceController extends
return TRANSITION_ANIMATION_SCALE_KEY;
}
@Override
public void displayPreference(PreferenceScreen screen) {
super.displayPreference(screen);
mPreference = (ListPreference) screen.findPreference(getPreferenceKey());
}
@Override
public boolean onPreferenceChange(Preference preference, Object newValue) {
writeAnimationScaleOption(newValue);
@@ -79,15 +70,10 @@ public class TransitionAnimationScalePreferenceController extends
updateAnimationScaleValue();
}
@Override
protected void onDeveloperOptionsSwitchEnabled() {
mPreference.setEnabled(true);
}
@Override
protected void onDeveloperOptionsSwitchDisabled() {
super.onDeveloperOptionsSwitchDisabled();
writeAnimationScaleOption(null);
mPreference.setEnabled(false);
}
private void writeAnimationScaleOption(Object newValue) {
@@ -112,8 +98,9 @@ public class TransitionAnimationScalePreferenceController extends
break;
}
}
mPreference.setValue(mListValues[index]);
mPreference.setSummary(mListSummaries[index]);
final ListPreference listPreference = (ListPreference) mPreference;
listPreference.setValue(mListValues[index]);
listPreference.setSummary(mListSummaries[index]);
} catch (RemoteException e) {
// intentional no-op
}