From 3461bb46d0769f76c848e50c29fe2ae410046545 Mon Sep 17 00:00:00 2001 From: Matthew Fritze Date: Mon, 21 May 2018 13:12:36 -0700 Subject: [PATCH] Add utility methods to AmbientDisplayConfig The added utility methods are to enable increased granularity in determinining the availability of gesture settings dependant on Always on Display. Bug: 79779562 Test: robotests Change-Id: Ib54a867ca554d44ee4190706805fa8545aec9fa0 --- .../hardware/AmbientDisplayConfiguration.java | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/core/java/com/android/internal/hardware/AmbientDisplayConfiguration.java b/core/java/com/android/internal/hardware/AmbientDisplayConfiguration.java index 1811800c7b692..26fb6b6415e4b 100644 --- a/core/java/com/android/internal/hardware/AmbientDisplayConfiguration.java +++ b/core/java/com/android/internal/hardware/AmbientDisplayConfiguration.java @@ -59,8 +59,11 @@ public class AmbientDisplayConfiguration { } public boolean pulseOnPickupAvailable() { - return mContext.getResources().getBoolean(R.bool.config_dozePulsePickup) - && ambientDisplayAvailable(); + return dozePulsePickupSensorAvailable() && ambientDisplayAvailable(); + } + + public boolean dozePulsePickupSensorAvailable() { + return mContext.getResources().getBoolean(R.bool.config_dozePulsePickup); } public boolean pulseOnPickupCanBeModified(int user) { @@ -73,7 +76,11 @@ public class AmbientDisplayConfiguration { } public boolean pulseOnDoubleTapAvailable() { - return !TextUtils.isEmpty(doubleTapSensorType()) && ambientDisplayAvailable(); + return doubleTapSensorAvailable() && ambientDisplayAvailable(); + } + + public boolean doubleTapSensorAvailable() { + return !TextUtils.isEmpty(doubleTapSensorType()); } public String doubleTapSensorType() { @@ -115,7 +122,7 @@ public class AmbientDisplayConfiguration { return boolSettingDefaultOff(Settings.Secure.ACCESSIBILITY_DISPLAY_INVERSION_ENABLED, user); } - private boolean ambientDisplayAvailable() { + public boolean ambientDisplayAvailable() { return !TextUtils.isEmpty(ambientDisplayComponent()); }