aboutsummaryrefslogtreecommitdiff
path: root/doze/src
diff options
context:
space:
mode:
authorMichael W <baddaemon87@gmail.com>2017-01-03 02:22:40 +0100
committerdavidevinavil <davidevinavil@gmail.com>2017-01-21 18:33:27 +0100
commit17792cc39924a3fd5307cd6771eb869f0f165ca9 (patch)
treeb9a3e8a42e2c02e40c469a36d2df23c9d8d36ebc /doze/src
parent718fc81cff4180ca5436f138439a080b87817be1 (diff)
z2_plus: Doze: Set different timings for wave and pocket detection
* One second is a little bit short for pocket Change-Id: Id27bba6f01a3a4d54ae9096fae87505f38ee5062
Diffstat (limited to 'doze/src')
-rw-r--r--doze/src/com/cyanogenmod/settings/doze/ProximitySensor.java10
1 files changed, 7 insertions, 3 deletions
diff --git a/doze/src/com/cyanogenmod/settings/doze/ProximitySensor.java b/doze/src/com/cyanogenmod/settings/doze/ProximitySensor.java
index eb33027..31fe15d 100644
--- a/doze/src/com/cyanogenmod/settings/doze/ProximitySensor.java
+++ b/doze/src/com/cyanogenmod/settings/doze/ProximitySensor.java
@@ -29,7 +29,11 @@ public class ProximitySensor implements SensorEventListener {
private static final boolean DEBUG = false;
private static final String TAG = "ProximitySensor";
- private static final int POCKET_DELTA_NS = 1000 * 1000 * 1000;
+ // Maximum time for the hand to cover the sensor: 1s
+ private static final int HANDWAVE_MAX_DELTA_NS = 1000 * 1000 * 1000;
+
+ // Minimum time until the device is considered to have been in the pocket: 2s
+ private static final int POCKET_MIN_DELTA_NS = 2000 * 1000 * 1000;
private SensorManager mSensorManager;
private Sensor mSensor;
@@ -63,9 +67,9 @@ public class ProximitySensor implements SensorEventListener {
if (Utils.handwaveGestureEnabled(mContext) && Utils.pocketGestureEnabled(mContext)) {
return true;
} else if (Utils.handwaveGestureEnabled(mContext)) {
- return delta < POCKET_DELTA_NS;
+ return delta < HANDWAVE_MAX_DELTA_NS;
} else if (Utils.pocketGestureEnabled(mContext)) {
- return delta >= POCKET_DELTA_NS;
+ return delta >= POCKET_MIN_DELTA_NS;
}
return false;
}