Developer option off must not affect laser sensor

Turning developer settings to on or off must not
change the current laser sensor preference.

Bug: 140016130
Test: mma ROBOTEST_FILTER=CameraLaserSensorPreferenceControllerTest,
manual using Settings application

Change-Id: Ieb30527e5df97abcb00a6624e1ced93f9198c713
This commit is contained in:
Emilian Peev
2019-09-19 10:47:32 -07:00
parent 4ac6f1a781
commit 78db757cad
2 changed files with 3 additions and 18 deletions

View File

@@ -75,12 +75,9 @@ public class CameraLaserSensorPreferenceController extends DeveloperOptionsPrefe
((SwitchPreference) mPreference).setChecked(enabled); ((SwitchPreference) mPreference).setChecked(enabled);
} }
@Override // There should be no impact on the current
protected void onDeveloperOptionsSwitchDisabled() { // laser sensor settings in case the developer
super.onDeveloperOptionsSwitchDisabled(); // settings switch is turned on or off!
SystemProperties.set(PROPERTY_CAMERA_LASER_SENSOR, Integer.toString(DISABLED));
((SwitchPreference) mPreference).setChecked(false);
}
private boolean isLaserSensorEnabled() { private boolean isLaserSensorEnabled() {
final String prop = SystemProperties.get(PROPERTY_CAMERA_LASER_SENSOR, final String prop = SystemProperties.get(PROPERTY_CAMERA_LASER_SENSOR,

View File

@@ -128,16 +128,4 @@ public class CameraLaserSensorPreferenceControllerTest {
CameraLaserSensorPreferenceController.PROPERTY_CAMERA_LASER_SENSOR, CameraLaserSensorPreferenceController.PROPERTY_CAMERA_LASER_SENSOR,
Integer.toString(CameraLaserSensorPreferenceController.ENABLED))); Integer.toString(CameraLaserSensorPreferenceController.ENABLED)));
} }
@Test
public void onDeveloperOptionsSwitchDisabled_preferenceShouldBeEnabled() {
mController.onDeveloperOptionsSwitchDisabled();
verify(mPreference).setEnabled(false);
verify(mPreference).setChecked(false);
assertThat(Integer.toString(CameraLaserSensorPreferenceController.DISABLED)).isEqualTo(
SystemProperties.get(
CameraLaserSensorPreferenceController.PROPERTY_CAMERA_LASER_SENSOR,
Integer.toString(CameraLaserSensorPreferenceController.ENABLED)));
}
} }