Don't reregister AoD UDFPS gesture after trigger
Instead, the gesture will re-register on the next AoD transition change (ie: from PULSE => AOD). Test: atest DozeSensorsTest Fixes: 233713099 Change-Id: I7bdd1838385d755a17eefd79e24bf4eb9f72a44c
This commit is contained in:
@@ -183,7 +183,8 @@ public class DozeSensors {
|
|||||||
mSensorManager.getDefaultSensor(Sensor.TYPE_SIGNIFICANT_MOTION),
|
mSensorManager.getDefaultSensor(Sensor.TYPE_SIGNIFICANT_MOTION),
|
||||||
null /* setting */,
|
null /* setting */,
|
||||||
dozeParameters.getPulseOnSigMotion(),
|
dozeParameters.getPulseOnSigMotion(),
|
||||||
DozeLog.PULSE_REASON_SENSOR_SIGMOTION, false /* touchCoords */,
|
DozeLog.PULSE_REASON_SENSOR_SIGMOTION,
|
||||||
|
false /* touchCoords */,
|
||||||
false /* touchscreen */),
|
false /* touchscreen */),
|
||||||
new TriggerSensor(
|
new TriggerSensor(
|
||||||
mSensorManager.getDefaultSensor(Sensor.TYPE_PICK_UP_GESTURE),
|
mSensorManager.getDefaultSensor(Sensor.TYPE_PICK_UP_GESTURE),
|
||||||
@@ -193,7 +194,8 @@ public class DozeSensors {
|
|||||||
DozeLog.REASON_SENSOR_PICKUP, false /* touchCoords */,
|
DozeLog.REASON_SENSOR_PICKUP, false /* touchCoords */,
|
||||||
false /* touchscreen */,
|
false /* touchscreen */,
|
||||||
false /* ignoresSetting */,
|
false /* ignoresSetting */,
|
||||||
false /* requires prox */),
|
false /* requires prox */,
|
||||||
|
true /* immediatelyReRegister */),
|
||||||
new TriggerSensor(
|
new TriggerSensor(
|
||||||
findSensor(config.doubleTapSensorType()),
|
findSensor(config.doubleTapSensorType()),
|
||||||
Settings.Secure.DOZE_DOUBLE_TAP_GESTURE,
|
Settings.Secure.DOZE_DOUBLE_TAP_GESTURE,
|
||||||
@@ -211,6 +213,7 @@ public class DozeSensors {
|
|||||||
true /* touchscreen */,
|
true /* touchscreen */,
|
||||||
false /* ignoresSetting */,
|
false /* ignoresSetting */,
|
||||||
dozeParameters.singleTapUsesProx(mDevicePosture) /* requiresProx */,
|
dozeParameters.singleTapUsesProx(mDevicePosture) /* requiresProx */,
|
||||||
|
true /* immediatelyReRegister */,
|
||||||
mDevicePosture),
|
mDevicePosture),
|
||||||
new TriggerSensor(
|
new TriggerSensor(
|
||||||
findSensor(config.longPressSensorType()),
|
findSensor(config.longPressSensorType()),
|
||||||
@@ -221,7 +224,8 @@ public class DozeSensors {
|
|||||||
true /* reports touch coordinates */,
|
true /* reports touch coordinates */,
|
||||||
true /* touchscreen */,
|
true /* touchscreen */,
|
||||||
false /* ignoresSetting */,
|
false /* ignoresSetting */,
|
||||||
dozeParameters.longPressUsesProx() /* requiresProx */),
|
dozeParameters.longPressUsesProx() /* requiresProx */,
|
||||||
|
true /* immediatelyReRegister */),
|
||||||
new TriggerSensor(
|
new TriggerSensor(
|
||||||
findSensor(config.udfpsLongPressSensorType()),
|
findSensor(config.udfpsLongPressSensorType()),
|
||||||
"doze_pulse_on_auth",
|
"doze_pulse_on_auth",
|
||||||
@@ -231,7 +235,8 @@ public class DozeSensors {
|
|||||||
true /* reports touch coordinates */,
|
true /* reports touch coordinates */,
|
||||||
true /* touchscreen */,
|
true /* touchscreen */,
|
||||||
false /* ignoresSetting */,
|
false /* ignoresSetting */,
|
||||||
dozeParameters.longPressUsesProx()),
|
dozeParameters.longPressUsesProx(),
|
||||||
|
false /* immediatelyReRegister */),
|
||||||
new PluginSensor(
|
new PluginSensor(
|
||||||
new SensorManagerPlugin.Sensor(TYPE_WAKE_DISPLAY),
|
new SensorManagerPlugin.Sensor(TYPE_WAKE_DISPLAY),
|
||||||
Settings.Secure.DOZE_WAKE_DISPLAY_GESTURE,
|
Settings.Secure.DOZE_WAKE_DISPLAY_GESTURE,
|
||||||
@@ -257,7 +262,8 @@ public class DozeSensors {
|
|||||||
false /* requiresTouchCoordinates */,
|
false /* requiresTouchCoordinates */,
|
||||||
false /* requiresTouchscreen */,
|
false /* requiresTouchscreen */,
|
||||||
false /* ignoresSetting */,
|
false /* ignoresSetting */,
|
||||||
false /* requiresProx */),
|
false /* requiresProx */,
|
||||||
|
true /* immediatelyReRegister */),
|
||||||
};
|
};
|
||||||
setProxListening(false); // Don't immediately start listening when we register.
|
setProxListening(false); // Don't immediately start listening when we register.
|
||||||
mProximitySensor.register(
|
mProximitySensor.register(
|
||||||
@@ -493,6 +499,10 @@ public class DozeSensors {
|
|||||||
private final boolean mRequiresTouchscreen;
|
private final boolean mRequiresTouchscreen;
|
||||||
private final boolean mRequiresProx;
|
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 mRequested;
|
||||||
protected boolean mRegistered;
|
protected boolean mRegistered;
|
||||||
protected boolean mDisabled;
|
protected boolean mDisabled;
|
||||||
@@ -516,7 +526,8 @@ public class DozeSensors {
|
|||||||
reportsTouchCoordinates,
|
reportsTouchCoordinates,
|
||||||
requiresTouchscreen,
|
requiresTouchscreen,
|
||||||
false /* ignoresSetting */,
|
false /* ignoresSetting */,
|
||||||
false /* requiresProx */
|
false /* requiresProx */,
|
||||||
|
true /* immediatelyReRegister */
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -529,7 +540,8 @@ public class DozeSensors {
|
|||||||
boolean reportsTouchCoordinates,
|
boolean reportsTouchCoordinates,
|
||||||
boolean requiresTouchscreen,
|
boolean requiresTouchscreen,
|
||||||
boolean ignoresSetting,
|
boolean ignoresSetting,
|
||||||
boolean requiresProx
|
boolean requiresProx,
|
||||||
|
boolean immediatelyReRegister
|
||||||
) {
|
) {
|
||||||
this(
|
this(
|
||||||
new Sensor[]{ sensor },
|
new Sensor[]{ sensor },
|
||||||
@@ -541,6 +553,7 @@ public class DozeSensors {
|
|||||||
requiresTouchscreen,
|
requiresTouchscreen,
|
||||||
ignoresSetting,
|
ignoresSetting,
|
||||||
requiresProx,
|
requiresProx,
|
||||||
|
immediatelyReRegister,
|
||||||
DevicePostureController.DEVICE_POSTURE_UNKNOWN
|
DevicePostureController.DEVICE_POSTURE_UNKNOWN
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -555,6 +568,7 @@ public class DozeSensors {
|
|||||||
boolean requiresTouchscreen,
|
boolean requiresTouchscreen,
|
||||||
boolean ignoresSetting,
|
boolean ignoresSetting,
|
||||||
boolean requiresProx,
|
boolean requiresProx,
|
||||||
|
boolean immediatelyReRegister,
|
||||||
@DevicePostureController.DevicePostureInt int posture
|
@DevicePostureController.DevicePostureInt int posture
|
||||||
) {
|
) {
|
||||||
mSensors = sensors;
|
mSensors = sensors;
|
||||||
@@ -567,6 +581,7 @@ public class DozeSensors {
|
|||||||
mIgnoresSetting = ignoresSetting;
|
mIgnoresSetting = ignoresSetting;
|
||||||
mRequiresProx = requiresProx;
|
mRequiresProx = requiresProx;
|
||||||
mPosture = posture;
|
mPosture = posture;
|
||||||
|
mImmediatelyReRegister = immediatelyReRegister;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -702,8 +717,8 @@ public class DozeSensors {
|
|||||||
screenY = event.values[1];
|
screenY = event.values[1];
|
||||||
}
|
}
|
||||||
mSensorCallback.onSensorPulse(mPulseReason, screenX, screenY, event.values);
|
mSensorCallback.onSensorPulse(mPulseReason, screenX, screenY, event.values);
|
||||||
if (!mRegistered) {
|
if (!mRegistered && mImmediatelyReRegister) {
|
||||||
updateListening(); // reregister, this sensor only fires once
|
updateListening();
|
||||||
}
|
}
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -461,7 +461,8 @@ public class DozeSensorsTest extends SysuiTestCase {
|
|||||||
/* reportsTouchCoordinate*/ false,
|
/* reportsTouchCoordinate*/ false,
|
||||||
/* requiresTouchscreen */ false,
|
/* requiresTouchscreen */ false,
|
||||||
/* ignoresSetting */ false,
|
/* ignoresSetting */ false,
|
||||||
requiresTouchScreen);
|
requiresTouchScreen,
|
||||||
|
/* immediatelyReRegister */ true);
|
||||||
}
|
}
|
||||||
|
|
||||||
public TriggerSensor createDozeSensor(
|
public TriggerSensor createDozeSensor(
|
||||||
@@ -477,7 +478,8 @@ public class DozeSensorsTest extends SysuiTestCase {
|
|||||||
/* reportsTouchCoordinate*/ false,
|
/* reportsTouchCoordinate*/ false,
|
||||||
/* requiresTouchscreen */ false,
|
/* requiresTouchscreen */ false,
|
||||||
/* ignoresSetting */ false,
|
/* ignoresSetting */ false,
|
||||||
/* requiresTouchScreen */false);
|
/* requiresTouchScreen */ false,
|
||||||
|
/* immediatelyReRegister*/ true);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -492,7 +494,8 @@ public class DozeSensorsTest extends SysuiTestCase {
|
|||||||
/* reportsTouchCoordinate*/ false,
|
/* reportsTouchCoordinate*/ false,
|
||||||
/* requiresTouchscreen */ false,
|
/* requiresTouchscreen */ false,
|
||||||
/* ignoresSetting */ true,
|
/* ignoresSetting */ true,
|
||||||
/* requiresProx */false,
|
/* requiresProx */ false,
|
||||||
|
/* immediatelyReRegister */ true,
|
||||||
posture);
|
posture);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user