Update setIgnoreDisplayTouches when context is updated
Test: atest FingerprintAuthenticationClientTest
Bug: 331656652
Bug: 336110138
Change-Id: I57988525c7f59394e12da033d6af5600d8ca0979
(cherry picked from commit 33fb2017931c5179daf02931cf167d71283aaa98)
Merged-In: I57988525c7f59394e12da033d6af5600d8ca0979
diff --git a/services/core/java/com/android/server/biometrics/sensors/fingerprint/aidl/FingerprintAuthenticationClient.java b/services/core/java/com/android/server/biometrics/sensors/fingerprint/aidl/FingerprintAuthenticationClient.java
index 93d1b6e..e9fac7e 100644
--- a/services/core/java/com/android/server/biometrics/sensors/fingerprint/aidl/FingerprintAuthenticationClient.java
+++ b/services/core/java/com/android/server/biometrics/sensors/fingerprint/aidl/FingerprintAuthenticationClient.java
@@ -407,6 +407,12 @@
if (session.hasContextMethods()) {
try {
session.getSession().onContextChanged(ctx);
+ // TODO(b/317414324): Deprecate setIgnoreDisplayTouches
+ if (ctx.operationState != null && ctx.operationState.getTag()
+ == OperationState.fingerprintOperationState) {
+ session.getSession().setIgnoreDisplayTouches(ctx.operationState
+ .getFingerprintOperationState().isHardwareIgnoringTouches);
+ }
} catch (RemoteException e) {
Slog.e(TAG, "Unable to notify context changed", e);
}
diff --git a/services/tests/servicestests/src/com/android/server/biometrics/sensors/fingerprint/aidl/FingerprintAuthenticationClientTest.java b/services/tests/servicestests/src/com/android/server/biometrics/sensors/fingerprint/aidl/FingerprintAuthenticationClientTest.java
index 7a77392..3a35563 100644
--- a/services/tests/servicestests/src/com/android/server/biometrics/sensors/fingerprint/aidl/FingerprintAuthenticationClientTest.java
+++ b/services/tests/servicestests/src/com/android/server/biometrics/sensors/fingerprint/aidl/FingerprintAuthenticationClientTest.java
@@ -45,6 +45,7 @@
import android.hardware.biometrics.common.AuthenticateReason;
import android.hardware.biometrics.common.ICancellationSignal;
import android.hardware.biometrics.common.OperationContext;
+import android.hardware.biometrics.common.OperationState;
import android.hardware.biometrics.fingerprint.ISession;
import android.hardware.biometrics.fingerprint.PointerContext;
import android.hardware.fingerprint.Fingerprint;
@@ -411,8 +412,8 @@
verify(mBiometricContext).subscribe(mOperationContextCaptor.capture(),
mStartHalConsumerCaptor.capture(), mContextInjector.capture(), any());
- mStartHalConsumerCaptor.getValue().accept(mOperationContextCaptor
- .getValue().toAidlContext());
+ final OperationContextExt operationContext = mOperationContextCaptor.getValue();
+ mStartHalConsumerCaptor.getValue().accept(operationContext.toAidlContext());
final ArgumentCaptor<OperationContext> captor =
ArgumentCaptor.forClass(OperationContext.class);
@@ -420,16 +421,20 @@
OperationContext opContext = captor.getValue();
- assertThat(opContext).isSameInstanceAs(
- mOperationContextCaptor.getValue().toAidlContext());
+ assertThat(opContext).isSameInstanceAs(operationContext.toAidlContext());
+ opContext.operationState = new OperationState();
+ opContext.operationState.setFingerprintOperationState(
+ new OperationState.FingerprintOperationState());
mContextInjector.getValue().accept(opContext);
verify(mHal).onContextChanged(same(opContext));
+ verify(mHal, times(2)).setIgnoreDisplayTouches(
+ opContext.operationState.getFingerprintOperationState().isHardwareIgnoringTouches);
client.stopHalOperation();
- verify(mBiometricContext).unsubscribe(same(mOperationContextCaptor.getValue()));
+ verify(mBiometricContext).unsubscribe(same(operationContext));
}
@Test