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

Commit 8e490b40 authored by Lucas Dupin's avatar Lucas Dupin
Browse files

Disable "double tap to check" when "always on"

"Double tap to check" has no effect when AOD is enabled.
Double tapping will take you to the lock screen anyway.

Test: manual
Test: make RunSettingsRoboTests ROBOTEST_FILTER=DoubleTapScreenPreferenceControllerTest
Change-Id: Ia97b7ecb00a9d83b867959d83642d476841e2f13
Fixes: 73096311
parent d4c1d5ee
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -79,7 +79,7 @@ public class AmbientDisplaySettings extends DashboardFragment {
    protected List<AbstractPreferenceController> getPreferenceControllers(Context context) {
        return buildPreferenceControllers(context, getLifecycle(),
                new AmbientDisplayConfiguration(context), mMetricsFeatureProvider,
                () -> { updatePreferenceStates(); });
                this::updatePreferenceStates);
    }

    @Override
+5 −0
Original line number Diff line number Diff line
@@ -102,4 +102,9 @@ public class DoubleTapScreenPreferenceController extends GesturePreferenceContro
        return new InlineSwitchPayload(SECURE_KEY, ResultPayload.SettingsSource.SECURE,
                ON /* onValue */, intent, isAvailable(), ON /* defaultValue */);
    }

    @Override
    protected boolean canHandleClicks() {
        return !mAmbientConfig.alwaysOnEnabled(mUserId);
    }
}
 No newline at end of file
+12 −0
Original line number Diff line number Diff line
@@ -161,4 +161,16 @@ public class DoubleTapScreenPreferenceControllerTest {
        assertThat(DoubleTapScreenPreferenceController.isSuggestionComplete(
                mAmbientDisplayConfiguration, prefs)).isTrue();
    }

    @Test
    public void canHandleClicks_falseWhenAlwaysOnEnabled() {
        when(mAmbientDisplayConfiguration.alwaysOnEnabled(anyInt())).thenReturn(true);
        assertThat(mController.canHandleClicks()).isFalse();
    }

    @Test
    public void canHandleClicks_trueWhenAlwaysOnDisabled() {
        when(mAmbientDisplayConfiguration.alwaysOnEnabled(anyInt())).thenReturn(false);
        assertThat(mController.canHandleClicks()).isTrue();
    }
}