Cleaned up side fps logic am: 20987e7f2b

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/20166490

Change-Id: I18cae32d1ec75d1b587e83a2c604c667fc780ac8
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
Joshua McCloskey
2022-10-20 01:44:51 +00:00
committed by Automerger Merge Worker
3 changed files with 51 additions and 5 deletions

View File

@@ -3534,9 +3534,9 @@
config_sidefpsSkipWaitForPowerVendorAcquireMessage -->
<integer name="config_sidefpsSkipWaitForPowerAcquireMessage">6</integer>
<!-- This vendor acquired message that will cause the sidefpsKgPowerPress window to be skipped.
config_sidefpsSkipWaitForPowerOnFingerUp must be true and
config_sidefpsSkipWaitForPowerAcquireMessage must be BIOMETRIC_ACQUIRED_VENDOR == 6. -->
<!-- This vendor acquired message will cause the sidefpsKgPowerPress window to be skipped
when config_sidefpsSkipWaitForPowerAcquireMessage == 6 (VENDOR) and the vendor acquire
message equals this constant -->
<integer name="config_sidefpsSkipWaitForPowerVendorAcquireMessage">2</integer>
<!-- This config is used to force VoiceInteractionService to start on certain low ram devices.

View File

@@ -265,8 +265,7 @@ class FingerprintAuthenticationClient extends AuthenticationClient<AidlSession>
final boolean acquireMessageMatch = acquiredInfo == mSkipWaitForPowerAcquireMessage;
final boolean vendorMessageMatch = vendorCode == mSkipWaitForPowerVendorAcquireMessage;
final boolean ignorePowerPress =
(acquireMessageMatch && !shouldLookForVendor) || (shouldLookForVendor
&& acquireMessageMatch && vendorMessageMatch);
acquireMessageMatch && (!shouldLookForVendor || vendorMessageMatch);
if (ignorePowerPress) {
Slog.d(TAG, "(sideFPS) onFingerUp");

View File

@@ -41,6 +41,7 @@ import android.hardware.biometrics.common.OperationContext;
import android.hardware.biometrics.fingerprint.ISession;
import android.hardware.biometrics.fingerprint.PointerContext;
import android.hardware.fingerprint.Fingerprint;
import android.hardware.fingerprint.FingerprintManager;
import android.hardware.fingerprint.FingerprintSensorPropertiesInternal;
import android.hardware.fingerprint.ISidefpsController;
import android.hardware.fingerprint.IUdfpsOverlayController;
@@ -446,6 +447,52 @@ public class FingerprintAuthenticationClientTest {
verify(mCallback).onClientFinished(any(), eq(true));
}
@Test
public void sideFingerprintSkipsWindowIfVendorMessageMatch() throws Exception {
when(mSensorProps.isAnySidefpsType()).thenReturn(true);
final int vendorAcquireMessage = 1234;
mContext.getOrCreateTestableResources().addOverride(
R.integer.config_sidefpsSkipWaitForPowerAcquireMessage,
FingerprintManager.FINGERPRINT_ACQUIRED_VENDOR);
mContext.getOrCreateTestableResources().addOverride(
R.integer.config_sidefpsSkipWaitForPowerVendorAcquireMessage,
vendorAcquireMessage);
final FingerprintAuthenticationClient client = createClient(1);
client.start(mCallback);
mLooper.dispatchAll();
client.onAuthenticated(new Fingerprint("friendly", 4 /* fingerId */, 5 /* deviceId */),
true /* authenticated */, new ArrayList<>());
client.onAcquired(FingerprintManager.FINGERPRINT_ACQUIRED_VENDOR, vendorAcquireMessage);
mLooper.dispatchAll();
verify(mCallback).onClientFinished(any(), eq(true));
}
@Test
public void sideFingerprintDoesNotSkipWindowOnVendorErrorMismatch() throws Exception {
when(mSensorProps.isAnySidefpsType()).thenReturn(true);
final int vendorAcquireMessage = 1234;
mContext.getOrCreateTestableResources().addOverride(
R.integer.config_sidefpsSkipWaitForPowerAcquireMessage,
FingerprintManager.FINGERPRINT_ACQUIRED_VENDOR);
mContext.getOrCreateTestableResources().addOverride(
R.integer.config_sidefpsSkipWaitForPowerVendorAcquireMessage,
vendorAcquireMessage);
final FingerprintAuthenticationClient client = createClient(1);
client.start(mCallback);
mLooper.dispatchAll();
client.onAuthenticated(new Fingerprint("friendly", 4 /* fingerId */, 5 /* deviceId */),
true /* authenticated */, new ArrayList<>());
client.onAcquired(FingerprintManager.FINGERPRINT_ACQUIRED_VENDOR, 1);
mLooper.dispatchAll();
verify(mCallback, never()).onClientFinished(any(), anyBoolean());
}
@Test
public void sideFingerprintSendsAuthIfFingerUp() throws Exception {
when(mSensorProps.isAnySidefpsType()).thenReturn(true);