Merge "Add traces for touch events and fix trace naming" into sc-dev

This commit is contained in:
Ilya Matyukhin
2021-06-15 21:07:54 +00:00
committed by Android (Google) Code Review

View File

@@ -378,6 +378,7 @@ public class UdfpsController implements DozeReceiver {
return true; return true;
case MotionEvent.ACTION_DOWN: case MotionEvent.ACTION_DOWN:
case MotionEvent.ACTION_HOVER_ENTER: case MotionEvent.ACTION_HOVER_ENTER:
Trace.beginSection("UdfpsController.onTouch.ACTION_DOWN");
// To simplify the lifecycle of the velocity tracker, make sure it's never null // To simplify the lifecycle of the velocity tracker, make sure it's never null
// after ACTION_DOWN, and always null after ACTION_CANCEL or ACTION_UP. // after ACTION_DOWN, and always null after ACTION_CANCEL or ACTION_UP.
if (mVelocityTracker == null) { if (mVelocityTracker == null) {
@@ -388,8 +389,7 @@ public class UdfpsController implements DozeReceiver {
mVelocityTracker.clear(); mVelocityTracker.clear();
} }
if (isWithinSensorArea(udfpsView, event.getX(), event.getY(), fromUdfpsView)) { if (isWithinSensorArea(udfpsView, event.getX(), event.getY(), fromUdfpsView)) {
Trace.beginAsyncSection( Trace.beginAsyncSection("UdfpsController.e2e.onPointerDown", 0);
"UdfpsController#ACTION_DOWN", 1);
// The pointer that causes ACTION_DOWN is always at index 0. // The pointer that causes ACTION_DOWN is always at index 0.
// We need to persist its ID to track it during ACTION_MOVE that could include // We need to persist its ID to track it during ACTION_MOVE that could include
// data for many other pointers because of multi-touch support. // data for many other pointers because of multi-touch support.
@@ -397,10 +397,12 @@ public class UdfpsController implements DozeReceiver {
mVelocityTracker.addMovement(event); mVelocityTracker.addMovement(event);
handled = true; handled = true;
} }
Trace.endSection();
break; break;
case MotionEvent.ACTION_MOVE: case MotionEvent.ACTION_MOVE:
case MotionEvent.ACTION_HOVER_MOVE: case MotionEvent.ACTION_HOVER_MOVE:
Trace.beginSection("UdfpsController.onTouch.ACTION_MOVE");
final int idx = mActivePointerId == -1 final int idx = mActivePointerId == -1
? event.getPointerId(0) ? event.getPointerId(0)
: event.findPointerIndex(mActivePointerId); : event.findPointerIndex(mActivePointerId);
@@ -466,11 +468,13 @@ public class UdfpsController implements DozeReceiver {
onFingerUp(); onFingerUp();
} }
} }
Trace.endSection();
break; break;
case MotionEvent.ACTION_UP: case MotionEvent.ACTION_UP:
case MotionEvent.ACTION_CANCEL: case MotionEvent.ACTION_CANCEL:
case MotionEvent.ACTION_HOVER_EXIT: case MotionEvent.ACTION_HOVER_EXIT:
Trace.beginSection("UdfpsController.onTouch.ACTION_UP");
mActivePointerId = -1; mActivePointerId = -1;
if (mVelocityTracker != null) { if (mVelocityTracker != null) {
mVelocityTracker.recycle(); mVelocityTracker.recycle();
@@ -479,7 +483,7 @@ public class UdfpsController implements DozeReceiver {
Log.v(TAG, "onTouch | finger up"); Log.v(TAG, "onTouch | finger up");
onFingerUp(); onFingerUp();
mFalsingManager.isFalseTouch(UDFPS_AUTHENTICATION); mFalsingManager.isFalseTouch(UDFPS_AUTHENTICATION);
Trace.endSection();
break; break;
default: default:
@@ -818,12 +822,11 @@ public class UdfpsController implements DozeReceiver {
return; return;
} }
mFingerprintManager.onPointerDown(mSensorProps.sensorId, x, y, minor, major); mFingerprintManager.onPointerDown(mSensorProps.sensorId, x, y, minor, major);
Trace.endAsyncSection( Trace.endAsyncSection("UdfpsController.e2e.onPointerDown", 0);
"UdfpsController#ACTION_DOWN", 1); Trace.beginAsyncSection("UdfpsController.e2e.startIllumination", 0);
Trace.beginAsyncSection("UdfpsController#startIllumination", 1);
mView.startIllumination(() -> { mView.startIllumination(() -> {
mFingerprintManager.onUiReady(mSensorProps.sensorId); mFingerprintManager.onUiReady(mSensorProps.sensorId);
Trace.endAsyncSection("UdfpsController#startIllumination", 1); Trace.endAsyncSection("UdfpsController.e2e.startIllumination", 0);
}); });
} }