Merge "Camera lift settings are now default-on."

This commit is contained in:
Daniel Sheng
2017-06-06 23:26:05 +00:00
committed by Android (Google) Code Review
2 changed files with 11 additions and 1 deletions

View File

@@ -61,7 +61,8 @@ public class CameraLiftTriggerPreferenceController extends GesturePreferenceCont
@Override @Override
protected boolean isSwitchPrefEnabled() { protected boolean isSwitchPrefEnabled() {
final int triggerEnabled = Settings.Secure.getInt(mContext.getContentResolver(), final int triggerEnabled = Settings.Secure.getInt(mContext.getContentResolver(),
Settings.Secure.CAMERA_LIFT_TRIGGER_ENABLED, 0); Settings.Secure.CAMERA_LIFT_TRIGGER_ENABLED,
Settings.Secure.CAMERA_LIFT_TRIGGER_ENABLED_DEFAULT);
return triggerEnabled == 1; return triggerEnabled == 1;
} }
} }

View File

@@ -74,6 +74,15 @@ public class CameraLiftTriggerPreferenceControllerTest {
assertThat(mController.isAvailable()).isFalse(); assertThat(mController.isAvailable()).isFalse();
} }
@Test
public void testSwitchEnabled_defaultConfig_shouldReturnTrue() {
final Context context = RuntimeEnvironment.application;
mController = new CameraLiftTriggerPreferenceController(context, null,
KEY_CAMERA_LIFT_TRIGGER);
assertThat(mController.isSwitchPrefEnabled()).isTrue();
}
@Test @Test
public void testSwitchEnabled_configIsNotSet_shouldReturnFalse() { public void testSwitchEnabled_configIsNotSet_shouldReturnFalse() {
// Set the setting to be enabled. // Set the setting to be enabled.