SystemUI: doze: add config for double tap sensors that need a proximity check
Change-Id: Id7df987f0e9db4e5e2328534764ded397b6ac48d
diff --git a/packages/SystemUI/res/values/lineage_config.xml b/packages/SystemUI/res/values/lineage_config.xml
new file mode 100644
index 0000000..5a2da7801
--- /dev/null
+++ b/packages/SystemUI/res/values/lineage_config.xml
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ Copyright (C) 2018-2022 The LineageOS Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<resources>
+ <!-- Doze: does the double tap sensor need a proximity check? -->
+ <bool name="doze_double_tap_proximity_check">false</bool>
+</resources>
diff --git a/packages/SystemUI/src/com/android/systemui/doze/DozeSensors.java b/packages/SystemUI/src/com/android/systemui/doze/DozeSensors.java
index a418927..863685b 100644
--- a/packages/SystemUI/src/com/android/systemui/doze/DozeSensors.java
+++ b/packages/SystemUI/src/com/android/systemui/doze/DozeSensors.java
@@ -211,7 +211,8 @@
true /* configured */,
DozeLog.REASON_SENSOR_DOUBLE_TAP,
dozeParameters.doubleTapReportsTouchCoordinates(),
- true /* touchscreen */
+ true /* touchscreen */,
+ !dozeParameters.doubleTapNeedsProximityCheck() /* performsProxCheck */
),
new TriggerSensor(
findSensors(config.tapSensorTypeMapping()),
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/DozeParameters.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/DozeParameters.java
index 218a114..29afb4b 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/DozeParameters.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/DozeParameters.java
@@ -395,6 +395,10 @@
return 2 * getPulseVisibleDuration();
}
+ public boolean doubleTapNeedsProximityCheck() {
+ return mResources.getBoolean(R.bool.doze_double_tap_proximity_check);
+ }
+
public boolean doubleTapReportsTouchCoordinates() {
return mResources.getBoolean(R.bool.doze_double_tap_reports_touch_coordinates);
}