diff options
| author | 2021-04-02 12:16:28 -0700 | |
|---|---|---|
| committer | 2021-04-02 12:19:40 -0700 | |
| commit | 6a0b25111a01139352baeaa2c258bbbc941f9508 (patch) | |
| tree | eba5274369e36e50a1ed572a67d94b11aca2db26 | |
| parent | 82722a04233c4ff09bf8fc552e134c706a4db896 (diff) | |
Schedule cleanup with the callback that was passed in
For the AIDL providers, send the scheduler the callback that
was passed in. Otherwise, the test infrastructure wouldn't know
when cleanup completes. This saves ~20s from each test session
close time.
The added logs do not affect/spam production code.
Bug: 152240892
Test: atest CtsBiometricsTestCases
Change-Id: I047ec8da01b3237e738e4567eb6ef3554f6b868d
5 files changed, 24 insertions, 14 deletions
diff --git a/core/java/android/hardware/biometrics/BiometricTestSession.java b/core/java/android/hardware/biometrics/BiometricTestSession.java index ff1a17e07c11..41672b7cbaea 100644 --- a/core/java/android/hardware/biometrics/BiometricTestSession.java +++ b/core/java/android/hardware/biometrics/BiometricTestSession.java @@ -38,7 +38,7 @@ import java.util.concurrent.TimeUnit; */ @TestApi public class BiometricTestSession implements AutoCloseable { - private static final String TAG = "BiometricTestSession"; + private static final String BASE_TAG = "BiometricTestSession"; /** * @hide @@ -66,12 +66,12 @@ public class BiometricTestSession implements AutoCloseable { private final ITestSessionCallback mCallback = new ITestSessionCallback.Stub() { @Override public void onCleanupStarted(int userId) { - Log.d(TAG, "onCleanupStarted, sensor: " + mSensorId + ", userId: " + userId); + Log.d(getTag(), "onCleanupStarted, sensor: " + mSensorId + ", userId: " + userId); } @Override public void onCleanupFinished(int userId) { - Log.d(TAG, "onCleanupFinished, sensor: " + mSensorId + Log.d(getTag(), "onCleanupFinished, sensor: " + mSensorId + ", userId: " + userId + ", remaining users: " + mUsersCleaningUp.size()); mUsersCleaningUp.remove(userId); @@ -107,7 +107,7 @@ public class BiometricTestSession implements AutoCloseable { @RequiresPermission(TEST_BIOMETRIC) private void setTestHalEnabled(boolean enabled) { try { - Log.w(TAG, "setTestHalEnabled, sensor: " + mSensorId + " enabled: " + enabled); + Log.w(getTag(), "setTestHalEnabled, sensor: " + mSensorId + " enabled: " + enabled); mTestSession.setTestHalEnabled(enabled); } catch (RemoteException e) { throw e.rethrowFromSystemServer(); @@ -217,7 +217,7 @@ public class BiometricTestSession implements AutoCloseable { public void cleanupInternalState(int userId) { try { if (mUsersCleaningUp.contains(userId)) { - Log.w(TAG, "Cleanup already in progress for user: " + userId); + Log.w(getTag(), "Cleanup already in progress for user: " + userId); } mUsersCleaningUp.add(userId); @@ -230,6 +230,7 @@ public class BiometricTestSession implements AutoCloseable { @Override @RequiresPermission(TEST_BIOMETRIC) public void close() { + Log.d(getTag(), "Close, mTestedUsers size; " + mTestedUsers.size()); // Cleanup can be performed using the test HAL, since it always responds to enumerate with // zero enrollments. if (!mTestedUsers.isEmpty()) { @@ -239,15 +240,19 @@ public class BiometricTestSession implements AutoCloseable { } try { - Log.d(TAG, "Awaiting latch..."); - mCloseLatch.await(10, TimeUnit.SECONDS); - Log.d(TAG, "Finished awaiting"); + Log.d(getTag(), "Awaiting latch..."); + mCloseLatch.await(3, TimeUnit.SECONDS); + Log.d(getTag(), "Finished awaiting"); } catch (InterruptedException e) { - Log.e(TAG, "Latch interrupted", e); + Log.e(getTag(), "Latch interrupted", e); } } // Disable the test HAL after the sensor becomes idle. setTestHalEnabled(false); } + + private String getTag() { + return BASE_TAG + "_" + mSensorId; + } } diff --git a/services/core/java/com/android/server/biometrics/sensors/face/aidl/BiometricTestSessionImpl.java b/services/core/java/com/android/server/biometrics/sensors/face/aidl/BiometricTestSessionImpl.java index a5e6ddb81669..ca9be67914e3 100644 --- a/services/core/java/com/android/server/biometrics/sensors/face/aidl/BiometricTestSessionImpl.java +++ b/services/core/java/com/android/server/biometrics/sensors/face/aidl/BiometricTestSessionImpl.java @@ -48,7 +48,7 @@ import java.util.Set; */ public class BiometricTestSessionImpl extends ITestSession.Stub { - private static final String TAG = "BiometricTestSessionImpl"; + private static final String TAG = "face/aidl/BiometricTestSessionImpl"; @NonNull private final Context mContext; private final int mSensorId; @@ -230,10 +230,12 @@ public class BiometricTestSessionImpl extends ITestSession.Stub { public void cleanupInternalState(int userId) { Utils.checkPermission(mContext, TEST_BIOMETRIC); + Slog.d(TAG, "cleanupInternalState: " + userId); mProvider.scheduleInternalCleanup(mSensorId, userId, new BaseClientMonitor.Callback() { @Override public void onClientStarted(@NonNull BaseClientMonitor clientMonitor) { try { + Slog.d(TAG, "onClientStarted: " + clientMonitor); mCallback.onCleanupStarted(clientMonitor.getTargetUserId()); } catch (RemoteException e) { Slog.e(TAG, "Remote exception", e); @@ -244,6 +246,7 @@ public class BiometricTestSessionImpl extends ITestSession.Stub { public void onClientFinished(@NonNull BaseClientMonitor clientMonitor, boolean success) { try { + Slog.d(TAG, "onClientFinished: " + clientMonitor); mCallback.onCleanupFinished(clientMonitor.getTargetUserId()); } catch (RemoteException e) { Slog.e(TAG, "Remote exception", e); diff --git a/services/core/java/com/android/server/biometrics/sensors/face/aidl/FaceProvider.java b/services/core/java/com/android/server/biometrics/sensors/face/aidl/FaceProvider.java index a9be8e1a707b..4fb71ffdaab0 100644 --- a/services/core/java/com/android/server/biometrics/sensors/face/aidl/FaceProvider.java +++ b/services/core/java/com/android/server/biometrics/sensors/face/aidl/FaceProvider.java @@ -49,7 +49,6 @@ import com.android.server.biometrics.Utils; import com.android.server.biometrics.sensors.AuthenticationClient; import com.android.server.biometrics.sensors.BaseClientMonitor; import com.android.server.biometrics.sensors.ClientMonitorCallbackConverter; -import com.android.server.biometrics.sensors.HalClientMonitor; import com.android.server.biometrics.sensors.InvalidationRequesterClient; import com.android.server.biometrics.sensors.LockoutResetDispatcher; import com.android.server.biometrics.sensors.PerformanceTracker; @@ -443,7 +442,7 @@ public class FaceProvider implements IBinder.DeathRecipient, ServiceProvider { mContext.getOpPackageName(), sensorId, enrolledList, FaceUtils.getInstance(sensorId), mSensors.get(sensorId).getAuthenticatorIds()); - scheduleForSensor(sensorId, client); + scheduleForSensor(sensorId, client, callback); }); } diff --git a/services/core/java/com/android/server/biometrics/sensors/fingerprint/aidl/BiometricTestSessionImpl.java b/services/core/java/com/android/server/biometrics/sensors/fingerprint/aidl/BiometricTestSessionImpl.java index 20b32543f7a0..1c88d67cc96c 100644 --- a/services/core/java/com/android/server/biometrics/sensors/fingerprint/aidl/BiometricTestSessionImpl.java +++ b/services/core/java/com/android/server/biometrics/sensors/fingerprint/aidl/BiometricTestSessionImpl.java @@ -45,7 +45,7 @@ import java.util.Set; */ class BiometricTestSessionImpl extends ITestSession.Stub { - private static final String TAG = "BiometricTestSessionImpl"; + private static final String TAG = "fp/aidl/BiometricTestSessionImpl"; @NonNull private final Context mContext; private final int mSensorId; @@ -198,10 +198,12 @@ class BiometricTestSessionImpl extends ITestSession.Stub { public void cleanupInternalState(int userId) { Utils.checkPermission(mContext, TEST_BIOMETRIC); + Slog.d(TAG, "cleanupInternalState: " + userId); mProvider.scheduleInternalCleanup(mSensorId, userId, new BaseClientMonitor.Callback() { @Override public void onClientStarted(@NonNull BaseClientMonitor clientMonitor) { try { + Slog.d(TAG, "onClientStarted: " + clientMonitor); mCallback.onCleanupStarted(clientMonitor.getTargetUserId()); } catch (RemoteException e) { Slog.e(TAG, "Remote exception", e); @@ -212,6 +214,7 @@ class BiometricTestSessionImpl extends ITestSession.Stub { public void onClientFinished(@NonNull BaseClientMonitor clientMonitor, boolean success) { try { + Slog.d(TAG, "onClientFinished: " + clientMonitor); mCallback.onCleanupFinished(clientMonitor.getTargetUserId()); } catch (RemoteException e) { Slog.e(TAG, "Remote exception", e); diff --git a/services/core/java/com/android/server/biometrics/sensors/fingerprint/aidl/FingerprintProvider.java b/services/core/java/com/android/server/biometrics/sensors/fingerprint/aidl/FingerprintProvider.java index 24e867afedd7..01fd6419aee0 100644 --- a/services/core/java/com/android/server/biometrics/sensors/fingerprint/aidl/FingerprintProvider.java +++ b/services/core/java/com/android/server/biometrics/sensors/fingerprint/aidl/FingerprintProvider.java @@ -432,7 +432,7 @@ public class FingerprintProvider implements IBinder.DeathRecipient, ServiceProvi mContext.getOpPackageName(), sensorId, enrolledList, FingerprintUtils.getInstance(sensorId), mSensors.get(sensorId).getAuthenticatorIds()); - scheduleForSensor(sensorId, client); + scheduleForSensor(sensorId, client, callback); }); } |