OSDN Git Service

Disable "double tap to check" when "always on"
authorLucas Dupin <dupin@google.com>
Sun, 11 Feb 2018 02:18:19 +0000 (18:18 -0800)
committerLucas Dupin <dupin@google.com>
Mon, 12 Feb 2018 23:28:59 +0000 (15:28 -0800)
"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

src/com/android/settings/display/AmbientDisplaySettings.java
src/com/android/settings/gestures/DoubleTapScreenPreferenceController.java
tests/robotests/src/com/android/settings/gestures/DoubleTapScreenPreferenceControllerTest.java

index 187325c..3cac078 100644 (file)
@@ -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
index 5412f36..aa08e6f 100644 (file)
@@ -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
index 8f06c40..74e1e5d 100644 (file)
@@ -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();
+    }
 }