summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--packages/SystemUI/src/com/android/systemui/doze/DozeSensors.java33
-rw-r--r--packages/SystemUI/tests/src/com/android/systemui/doze/DozeSensorsTest.java9
2 files changed, 30 insertions, 12 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/doze/DozeSensors.java b/packages/SystemUI/src/com/android/systemui/doze/DozeSensors.java
index c8720e409883..da6c163b1eea 100644
--- a/packages/SystemUI/src/com/android/systemui/doze/DozeSensors.java
+++ b/packages/SystemUI/src/com/android/systemui/doze/DozeSensors.java
@@ -183,7 +183,8 @@ public class DozeSensors {
mSensorManager.getDefaultSensor(Sensor.TYPE_SIGNIFICANT_MOTION),
null /* setting */,
dozeParameters.getPulseOnSigMotion(),
- DozeLog.PULSE_REASON_SENSOR_SIGMOTION, false /* touchCoords */,
+ DozeLog.PULSE_REASON_SENSOR_SIGMOTION,
+ false /* touchCoords */,
false /* touchscreen */),
new TriggerSensor(
mSensorManager.getDefaultSensor(Sensor.TYPE_PICK_UP_GESTURE),
@@ -193,7 +194,8 @@ public class DozeSensors {
DozeLog.REASON_SENSOR_PICKUP, false /* touchCoords */,
false /* touchscreen */,
false /* ignoresSetting */,
- false /* requires prox */),
+ false /* requires prox */,
+ true /* immediatelyReRegister */),
new TriggerSensor(
findSensor(config.doubleTapSensorType()),
Settings.Secure.DOZE_DOUBLE_TAP_GESTURE,
@@ -211,6 +213,7 @@ public class DozeSensors {
true /* touchscreen */,
false /* ignoresSetting */,
dozeParameters.singleTapUsesProx(mDevicePosture) /* requiresProx */,
+ true /* immediatelyReRegister */,
mDevicePosture),
new TriggerSensor(
findSensor(config.longPressSensorType()),
@@ -221,7 +224,8 @@ public class DozeSensors {
true /* reports touch coordinates */,
true /* touchscreen */,
false /* ignoresSetting */,
- dozeParameters.longPressUsesProx() /* requiresProx */),
+ dozeParameters.longPressUsesProx() /* requiresProx */,
+ true /* immediatelyReRegister */),
new TriggerSensor(
findSensor(config.udfpsLongPressSensorType()),
"doze_pulse_on_auth",
@@ -231,7 +235,8 @@ public class DozeSensors {
true /* reports touch coordinates */,
true /* touchscreen */,
false /* ignoresSetting */,
- dozeParameters.longPressUsesProx()),
+ dozeParameters.longPressUsesProx(),
+ false /* immediatelyReRegister */),
new PluginSensor(
new SensorManagerPlugin.Sensor(TYPE_WAKE_DISPLAY),
Settings.Secure.DOZE_WAKE_DISPLAY_GESTURE,
@@ -257,7 +262,8 @@ public class DozeSensors {
false /* requiresTouchCoordinates */,
false /* requiresTouchscreen */,
false /* ignoresSetting */,
- false /* requiresProx */),
+ false /* requiresProx */,
+ true /* immediatelyReRegister */),
};
setProxListening(false); // Don't immediately start listening when we register.
mProximitySensor.register(
@@ -493,6 +499,10 @@ public class DozeSensors {
private final boolean mRequiresTouchscreen;
private final boolean mRequiresProx;
+ // Whether to immediately re-register this sensor after the sensor is triggered.
+ // If false, the sensor registration will be updated on the next AOD state transition.
+ private final boolean mImmediatelyReRegister;
+
protected boolean mRequested;
protected boolean mRegistered;
protected boolean mDisabled;
@@ -516,7 +526,8 @@ public class DozeSensors {
reportsTouchCoordinates,
requiresTouchscreen,
false /* ignoresSetting */,
- false /* requiresProx */
+ false /* requiresProx */,
+ true /* immediatelyReRegister */
);
}
@@ -529,7 +540,8 @@ public class DozeSensors {
boolean reportsTouchCoordinates,
boolean requiresTouchscreen,
boolean ignoresSetting,
- boolean requiresProx
+ boolean requiresProx,
+ boolean immediatelyReRegister
) {
this(
new Sensor[]{ sensor },
@@ -541,6 +553,7 @@ public class DozeSensors {
requiresTouchscreen,
ignoresSetting,
requiresProx,
+ immediatelyReRegister,
DevicePostureController.DEVICE_POSTURE_UNKNOWN
);
}
@@ -555,6 +568,7 @@ public class DozeSensors {
boolean requiresTouchscreen,
boolean ignoresSetting,
boolean requiresProx,
+ boolean immediatelyReRegister,
@DevicePostureController.DevicePostureInt int posture
) {
mSensors = sensors;
@@ -567,6 +581,7 @@ public class DozeSensors {
mIgnoresSetting = ignoresSetting;
mRequiresProx = requiresProx;
mPosture = posture;
+ mImmediatelyReRegister = immediatelyReRegister;
}
/**
@@ -702,8 +717,8 @@ public class DozeSensors {
screenY = event.values[1];
}
mSensorCallback.onSensorPulse(mPulseReason, screenX, screenY, event.values);
- if (!mRegistered) {
- updateListening(); // reregister, this sensor only fires once
+ if (!mRegistered && mImmediatelyReRegister) {
+ updateListening();
}
}));
}
diff --git a/packages/SystemUI/tests/src/com/android/systemui/doze/DozeSensorsTest.java b/packages/SystemUI/tests/src/com/android/systemui/doze/DozeSensorsTest.java
index 0a1e45c2b28f..9ffc5a57cef6 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/doze/DozeSensorsTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/doze/DozeSensorsTest.java
@@ -461,7 +461,8 @@ public class DozeSensorsTest extends SysuiTestCase {
/* reportsTouchCoordinate*/ false,
/* requiresTouchscreen */ false,
/* ignoresSetting */ false,
- requiresTouchScreen);
+ requiresTouchScreen,
+ /* immediatelyReRegister */ true);
}
public TriggerSensor createDozeSensor(
@@ -477,7 +478,8 @@ public class DozeSensorsTest extends SysuiTestCase {
/* reportsTouchCoordinate*/ false,
/* requiresTouchscreen */ false,
/* ignoresSetting */ false,
- /* requiresTouchScreen */false);
+ /* requiresTouchScreen */ false,
+ /* immediatelyReRegister*/ true);
}
/**
@@ -492,7 +494,8 @@ public class DozeSensorsTest extends SysuiTestCase {
/* reportsTouchCoordinate*/ false,
/* requiresTouchscreen */ false,
/* ignoresSetting */ true,
- /* requiresProx */false,
+ /* requiresProx */ false,
+ /* immediatelyReRegister */ true,
posture);
}