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

@@ -14,14 +14,12 @@
* limitations under the License.
*/
package com.android.settings.development;
import android.content.Context;
import android.os.SystemProperties;
import android.support.v14.preference.SwitchPreference;
import android.support.v7.preference.Preference;
import android.support.v7.preference.PreferenceScreen;
import android.text.TextUtils;
import com.android.internal.annotations.VisibleForTesting;
@@ -29,9 +27,8 @@ import com.android.settings.R;
import com.android.settings.core.PreferenceControllerMixin;
import com.android.settingslib.development.DeveloperOptionsPreferenceController;
public class CameraLaserSensorPreferenceController extends
DeveloperOptionsPreferenceController implements
Preference.OnPreferenceChangeListener, PreferenceControllerMixin {
public class CameraLaserSensorPreferenceController extends DeveloperOptionsPreferenceController
implements Preference.OnPreferenceChangeListener, PreferenceControllerMixin {
private static final String KEY_CAMERA_LASER_SENSOR_SWITCH = "camera_laser_sensor_switch";
@VisibleForTesting
@@ -49,8 +46,6 @@ public class CameraLaserSensorPreferenceController extends
@VisibleForTesting
static final String USER_BUILD = "user";
private SwitchPreference mPreference;
public CameraLaserSensorPreferenceController(Context context) {
super(context);
}
@@ -65,13 +60,6 @@ public class CameraLaserSensorPreferenceController extends
return KEY_CAMERA_LASER_SENSOR_SWITCH;
}
@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;
@@ -83,19 +71,14 @@ public class CameraLaserSensorPreferenceController extends
@Override
public void updateState(Preference preference) {
final boolean enabled = isLaserSensorEnabled();
mPreference.setChecked(enabled);
}
@Override
protected void onDeveloperOptionsSwitchEnabled() {
mPreference.setEnabled(true);
((SwitchPreference) mPreference).setChecked(enabled);
}
@Override
protected void onDeveloperOptionsSwitchDisabled() {
super.onDeveloperOptionsSwitchDisabled();
SystemProperties.set(PROPERTY_CAMERA_LASER_SENSOR, Integer.toString(DISABLED));
mPreference.setChecked(false);
mPreference.setEnabled(false);
((SwitchPreference) mPreference).setChecked(false);
}
private boolean isLaserSensorEnabled() {