Always enable double tap and pick up gestures

Both gestures should also work when AOD is on.

Test: make RunSettingsRoboTests ROBOTEST_FILTER=DoubleTapScreenPreferenceControllerTest
Test: make RunSettingsRoboTests ROBOTEST_FILTER=PickupGesturePreferenceControllerTest
Test: manual
Bug: 111414690
Change-Id: I6552b6b6581a942dbc54f5320dda102c2ac62517
This commit is contained in:
Lucas Dupin
2018-08-09 17:05:45 -07:00
parent 06c9bd2cdb
commit 3f773b3be3
5 changed files with 21 additions and 94 deletions

View File

@@ -16,7 +16,7 @@
package com.android.settings.gestures;
import static android.provider.Settings.Secure.DOZE_PULSE_ON_PICK_UP;
import static android.provider.Settings.Secure.DOZE_PICK_UP_GESTURE;
import android.annotation.UserIdInt;
import android.content.Context;
@@ -37,7 +37,7 @@ public class PickupGesturePreferenceController extends GesturePreferenceControll
private static final String PREF_KEY_VIDEO = "gesture_pick_up_video";
private final String mPickUpPrefKey;
private final String SECURE_KEY = DOZE_PULSE_ON_PICK_UP;
private final String SECURE_KEY = DOZE_PICK_UP_GESTURE;
private AmbientDisplayConfiguration mAmbientConfig;
@UserIdInt
@@ -57,21 +57,16 @@ public class PickupGesturePreferenceController extends GesturePreferenceControll
public static boolean isSuggestionComplete(Context context, SharedPreferences prefs) {
AmbientDisplayConfiguration ambientConfig = new AmbientDisplayConfiguration(context);
return prefs.getBoolean(PickupGestureSettings.PREF_KEY_SUGGESTION_COMPLETE, false)
|| !ambientConfig.pulseOnPickupAvailable();
|| !ambientConfig.dozePickupSensorAvailable();
}
@Override
public int getAvailabilityStatus() {
// No hardware support for Pickup Gesture
if (!getAmbientConfig().dozePulsePickupSensorAvailable()) {
if (!getAmbientConfig().dozePickupSensorAvailable()) {
return UNSUPPORTED_ON_DEVICE;
}
// Can't change Pickup Gesture when AOD is enabled.
if (!getAmbientConfig().ambientDisplayAvailable()) {
return DISABLED_DEPENDENT_SETTING;
}
return AVAILABLE;
}
@@ -87,7 +82,7 @@ public class PickupGesturePreferenceController extends GesturePreferenceControll
@Override
public boolean isChecked() {
return getAmbientConfig().pulseOnPickupEnabled(mUserId);
return getAmbientConfig().pickupGestureEnabled(mUserId);
}
@Override
@@ -101,16 +96,6 @@ public class PickupGesturePreferenceController extends GesturePreferenceControll
isChecked ? ON : OFF);
}
@Override
public boolean canHandleClicks() {
return pulseOnPickupCanBeModified();
}
@VisibleForTesting
boolean pulseOnPickupCanBeModified() {
return getAmbientConfig().pulseOnPickupCanBeModified(mUserId);
}
private AmbientDisplayConfiguration getAmbientConfig() {
if (mAmbientConfig == null) {
mAmbientConfig = new AmbientDisplayConfiguration(mContext);