From 5b2ec2a5898fcc684e639a264aa803928e7faec8 Mon Sep 17 00:00:00 2001 From: Joshua Mccloskey Date: Tue, 6 Apr 2021 19:41:36 -0700 Subject: [PATCH] Added perf traces for udfps Test: Verified perf trace showed the added sections Bug: 184592828 Testing 1. Enable sys tracing on developer settings 2. (I also added system server to the tracing) 3. Add the tracing widget 4. Start tracing 5. Enroll fingerprint 6. end tracing 7. Pull trace from /data/local/traces/ 8. Open trace in perfetto Change-Id: Id0b75c9f2dc2805524411bdd749e559f6e38b8bb --- .../android/systemui/biometrics/UdfpsController.java | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/packages/SystemUI/src/com/android/systemui/biometrics/UdfpsController.java b/packages/SystemUI/src/com/android/systemui/biometrics/UdfpsController.java index 7b5d7cb5a5253..f5c58d9ace6e9 100644 --- a/packages/SystemUI/src/com/android/systemui/biometrics/UdfpsController.java +++ b/packages/SystemUI/src/com/android/systemui/biometrics/UdfpsController.java @@ -36,6 +36,7 @@ import android.hardware.fingerprint.IUdfpsOverlayController; import android.hardware.fingerprint.IUdfpsOverlayControllerCallback; import android.os.RemoteException; import android.os.SystemClock; +import android.os.Trace; import android.util.Log; import android.view.Gravity; import android.view.LayoutInflater; @@ -239,6 +240,8 @@ public class UdfpsController implements DozeReceiver, HbmCallback { } // TODO: move isWithinSensorArea to UdfpsController. if (udfpsView.isWithinSensorArea(event.getX(), event.getY())) { + Trace.beginAsyncSection( + "UdfpsController.mOnTouchListener#isWithinSensorArea", 1); // 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 // data for many other pointers because of multi-touch support. @@ -265,6 +268,8 @@ public class UdfpsController implements DozeReceiver, HbmCallback { minor, major, v); final long sinceLastLog = SystemClock.elapsedRealtime() - mTouchLogTime; if (!isFingerDown) { + Trace.endAsyncSection( + "UdfpsController.mOnTouchListener#isWithinSensorArea", 1); onFingerDown((int) x, (int) y, minor, major); Log.v(TAG, "onTouch | finger down: " + touchInfo); mTouchLogTime = SystemClock.elapsedRealtime(); @@ -579,8 +584,11 @@ public class UdfpsController implements DozeReceiver, HbmCallback { Log.w(TAG, "Null view in onFingerDown"); return; } - mView.startIllumination(() -> - mFingerprintManager.onPointerDown(mSensorProps.sensorId, x, y, minor, major)); + Trace.beginAsyncSection("UdfpsController#startIllumination", 1); + mView.startIllumination(() -> { + Trace.endAsyncSection("UdfpsController#startIllumination", 1); + mFingerprintManager.onPointerDown(mSensorProps.sensorId, x, y, minor, major); + }); } // This method can be called from the UI thread.