Merge "Always enable double tap and pick up gestures"

This commit is contained in:
TreeHugger Robot
2018-08-13 15:04:01 +00:00
committed by Android (Google) Code Review
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_DOUBLE_TAP;
import static android.provider.Settings.Secure.DOZE_DOUBLE_TAP_GESTURE;
import android.annotation.UserIdInt;
import android.content.Context;
@@ -36,7 +36,7 @@ public class DoubleTapScreenPreferenceController extends GesturePreferenceContro
private static final String PREF_KEY_VIDEO = "gesture_double_tap_screen_video";
private final String SECURE_KEY = DOZE_PULSE_ON_DOUBLE_TAP;
private final String SECURE_KEY = DOZE_DOUBLE_TAP_GESTURE;
private AmbientDisplayConfiguration mAmbientConfig;
@UserIdInt
@@ -59,7 +59,7 @@ public class DoubleTapScreenPreferenceController extends GesturePreferenceContro
@VisibleForTesting
static boolean isSuggestionComplete(AmbientDisplayConfiguration config,
SharedPreferences prefs) {
return !config.pulseOnDoubleTapAvailable()
return !config.doubleTapSensorAvailable()
|| prefs.getBoolean(DoubleTapScreenSettings.PREF_KEY_SUGGESTION_COMPLETE, false);
}
@@ -70,11 +70,6 @@ public class DoubleTapScreenPreferenceController extends GesturePreferenceContro
return UNSUPPORTED_ON_DEVICE;
}
// Can't change Double Tap when AOD is enabled.
if (!getAmbientConfig().ambientDisplayAvailable()) {
return DISABLED_DEPENDENT_SETTING;
}
return AVAILABLE;
}
@@ -96,12 +91,7 @@ public class DoubleTapScreenPreferenceController extends GesturePreferenceContro
@Override
public boolean isChecked() {
return getAmbientConfig().pulseOnDoubleTapEnabled(mUserId);
}
@Override
protected boolean canHandleClicks() {
return !getAmbientConfig().alwaysOnEnabled(mUserId);
return getAmbientConfig().doubleTapGestureEnabled(mUserId);
}
private AmbientDisplayConfiguration getAmbientConfig() {

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);