Merge "Pass major/minor FP info through to AuthController"
This commit is contained in:
@@ -42,6 +42,7 @@ import android.os.Handler;
|
||||
import android.os.Looper;
|
||||
import android.os.RemoteException;
|
||||
import android.util.Log;
|
||||
import android.view.MotionEvent;
|
||||
import android.view.WindowManager;
|
||||
|
||||
import com.android.internal.R;
|
||||
@@ -247,12 +248,14 @@ public class AuthController extends SystemUI implements CommandQueue.Callbacks,
|
||||
*
|
||||
* @param screenX X position of long press
|
||||
* @param screenY Y position of long press
|
||||
* @param major length of the major axis. See {@link MotionEvent#AXIS_TOOL_MAJOR}.
|
||||
* @param minor length of the minor axis. See {@link MotionEvent#AXIS_TOOL_MINOR}.
|
||||
*/
|
||||
public void onAodInterrupt(int screenX, int screenY) {
|
||||
public void onAodInterrupt(int screenX, int screenY, float major, float minor) {
|
||||
if (mUdfpsController == null) {
|
||||
return;
|
||||
}
|
||||
mUdfpsController.onAodInterrupt(screenX, screenY);
|
||||
mUdfpsController.onAodInterrupt(screenX, screenY, major, minor);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -337,7 +337,7 @@ class UdfpsController implements DozeReceiver {
|
||||
* This is intented to be called in response to a sensor that triggers an AOD interrupt for the
|
||||
* fingerprint sensor.
|
||||
*/
|
||||
void onAodInterrupt(int screenX, int screenY) {
|
||||
void onAodInterrupt(int screenX, int screenY, float major, float minor) {
|
||||
if (mIsAodInterruptActive) {
|
||||
return;
|
||||
}
|
||||
@@ -348,7 +348,7 @@ class UdfpsController implements DozeReceiver {
|
||||
mCancelAodTimeoutAction = mFgExecutor.executeDelayed(this::onCancelAodInterrupt,
|
||||
AOD_INTERRUPT_TIMEOUT_MILLIS);
|
||||
// using a hard-coded value for major and minor until it is available from the sensor
|
||||
onFingerDown(screenX, screenY, 13.0f, 13.0f);
|
||||
onFingerDown(screenX, screenY, minor, major);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -131,7 +131,10 @@ public class DozeTriggers implements DozeMachine.Part {
|
||||
DOZING_UPDATE_SENSOR_WAKE_LOCKSCREEN(440),
|
||||
|
||||
@UiEvent(doc = "Dozing updated because sensor was tapped.")
|
||||
DOZING_UPDATE_SENSOR_TAP(441);
|
||||
DOZING_UPDATE_SENSOR_TAP(441),
|
||||
|
||||
@UiEvent(doc = "Dozing updated because on display auth was triggered from AOD.")
|
||||
DOZING_UPDATE_AUTH_TRIGGERED(442);
|
||||
|
||||
private final int mId;
|
||||
|
||||
@@ -155,6 +158,7 @@ public class DozeTriggers implements DozeMachine.Part {
|
||||
case 7: return DOZING_UPDATE_SENSOR_WAKEUP;
|
||||
case 8: return DOZING_UPDATE_SENSOR_WAKE_LOCKSCREEN;
|
||||
case 9: return DOZING_UPDATE_SENSOR_TAP;
|
||||
case 10: return DOZING_UPDATE_AUTH_TRIGGERED;
|
||||
default: return null;
|
||||
}
|
||||
}
|
||||
@@ -289,7 +293,8 @@ public class DozeTriggers implements DozeMachine.Part {
|
||||
requestPulse(DozeLog.REASON_SENSOR_UDFPS_LONG_PRESS, true, null);
|
||||
// Since the gesture won't be received by the UDFPS view, manually inject an
|
||||
// event.
|
||||
mAuthController.onAodInterrupt((int) screenX, (int) screenY);
|
||||
mAuthController.onAodInterrupt((int) screenX, (int) screenY,
|
||||
rawValues[2] /* major */, rawValues[3] /* minor */);
|
||||
} else {
|
||||
mDozeHost.extendPulse(pulseReason);
|
||||
}
|
||||
|
||||
@@ -494,8 +494,9 @@ public class AuthControllerTest extends SysuiTestCase {
|
||||
@Test
|
||||
public void testOnAodInterrupt() {
|
||||
final int pos = 10;
|
||||
mAuthController.onAodInterrupt(pos, pos);
|
||||
verify(mUdfpsController).onAodInterrupt(eq(pos), eq(pos));
|
||||
final float majorMinor = 5f;
|
||||
mAuthController.onAodInterrupt(pos, pos, majorMinor, majorMinor);
|
||||
verify(mUdfpsController).onAodInterrupt(eq(pos), eq(pos), eq(majorMinor), eq(majorMinor));
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
@@ -234,10 +234,10 @@ public class UdfpsControllerTest extends SysuiTestCase {
|
||||
mOverlayController.showUdfpsOverlay(TEST_UDFPS_SENSOR_ID);
|
||||
mFgExecutor.runAllReady();
|
||||
// WHEN fingerprint is requested because of AOD interrupt
|
||||
mUdfpsController.onAodInterrupt(0, 0);
|
||||
mUdfpsController.onAodInterrupt(0, 0, 2f, 3f);
|
||||
// THEN the event is passed to the FingerprintManager
|
||||
verify(mFingerprintManager).onPointerDown(eq(mUdfpsController.mSensorProps.sensorId), eq(0),
|
||||
eq(0), anyFloat(), anyFloat());
|
||||
eq(0), eq(3f) /* minor */, eq(2f) /* major */);
|
||||
// AND the scrim and dot is shown
|
||||
verify(mUdfpsView).showScrimAndDot();
|
||||
}
|
||||
@@ -247,7 +247,7 @@ public class UdfpsControllerTest extends SysuiTestCase {
|
||||
// GIVEN AOD interrupt
|
||||
mOverlayController.showUdfpsOverlay(TEST_UDFPS_SENSOR_ID);
|
||||
mFgExecutor.runAllReady();
|
||||
mUdfpsController.onAodInterrupt(0, 0);
|
||||
mUdfpsController.onAodInterrupt(0, 0, 0f, 0f);
|
||||
// WHEN it is cancelled
|
||||
mUdfpsController.onCancelAodInterrupt();
|
||||
// THEN the scrim and dot is hidden
|
||||
@@ -259,7 +259,7 @@ public class UdfpsControllerTest extends SysuiTestCase {
|
||||
// GIVEN AOD interrupt
|
||||
mOverlayController.showUdfpsOverlay(TEST_UDFPS_SENSOR_ID);
|
||||
mFgExecutor.runAllReady();
|
||||
mUdfpsController.onAodInterrupt(0, 0);
|
||||
mUdfpsController.onAodInterrupt(0, 0, 0f, 0f);
|
||||
// WHEN it times out
|
||||
mFgExecutor.advanceClockToNext();
|
||||
mFgExecutor.runAllReady();
|
||||
|
||||
@@ -194,10 +194,13 @@ public class DozeTriggersTest extends SysuiTestCase {
|
||||
public void testOnSensor_Fingerprint() {
|
||||
final int screenX = 100;
|
||||
final int screenY = 100;
|
||||
final float minor = 2f;
|
||||
final float major = 3f;
|
||||
final int reason = DozeLog.REASON_SENSOR_UDFPS_LONG_PRESS;
|
||||
mTriggers.onSensor(reason, screenX, screenY, null);
|
||||
float[] rawValues = new float[]{screenX, screenY, minor, major};
|
||||
mTriggers.onSensor(reason, screenX, screenY, rawValues);
|
||||
verify(mHost).extendPulse(reason);
|
||||
verify(mAuthController).onAodInterrupt(eq(screenX), eq(screenY));
|
||||
verify(mAuthController).onAodInterrupt(eq(screenX), eq(screenY), eq(minor), eq(major));
|
||||
}
|
||||
|
||||
private void waitForSensorManager() {
|
||||
|
||||
Reference in New Issue
Block a user