Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 78db757c authored by Emilian Peev's avatar Emilian Peev
Browse files

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
parent 4ac6f1a7
Loading
Loading
Loading
Loading
+3 −6
Original line number Diff line number Diff line
@@ -75,12 +75,9 @@ public class CameraLaserSensorPreferenceController extends DeveloperOptionsPrefe
        ((SwitchPreference) mPreference).setChecked(enabled);
    }

    @Override
    protected void onDeveloperOptionsSwitchDisabled() {
        super.onDeveloperOptionsSwitchDisabled();
        SystemProperties.set(PROPERTY_CAMERA_LASER_SENSOR, Integer.toString(DISABLED));
        ((SwitchPreference) mPreference).setChecked(false);
    }
    // There should be no impact on the current
    // laser sensor settings in case the developer
    // settings switch is turned on or off!

    private boolean isLaserSensorEnabled() {
        final String prop = SystemProperties.get(PROPERTY_CAMERA_LASER_SENSOR,
+0 −12
Original line number Diff line number Diff line
@@ -128,16 +128,4 @@ public class CameraLaserSensorPreferenceControllerTest {
                        CameraLaserSensorPreferenceController.PROPERTY_CAMERA_LASER_SENSOR,
                        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)));
    }
}