aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael W <baddaemon87@gmail.com>2017-01-03 02:22:40 +0100
committerMister Oyster <oysterized@gmail.com>2017-10-21 15:10:59 +0200
commit5f480054b3552406198557948a1ef97ae189a1a1 (patch)
treea17cc7a7a9a29d29b9e8dc8ec2533266858d07ee
parent616ff9adad830e50783e6c1b12292efa8ab0eba8 (diff)
doze: Set different timings for wave and pocket detection
* One second is a little bit short for pocket Change-Id: Id27bba6f01a3a4d54ae9096fae87505f38ee5062
-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;
}