Commit 9ca63e64 authored by Suzy Li's avatar Suzy Li Committed by Commit Bot

Reland isUVPAA implementation on clank

Currently, clank is using the isUVPAA that gmscore supports, and
the behavior of isUVPAA is intentionally narrowed to return true
only if fingerprint is available. Since gmscore is going to change
the behavior of isUVPAA to return true if fingerprint or screen
lock is available, clank should reland its own isUVPAA implementation
to return true only if fingerprint is available.

This CL is the first of 3 CLs to add isUVPAA implemenration on clank
and remove the flow to call isUVPAA that gmscore supports.

Bug: n/a
Change-Id: I7f0a025b49597fe73e070562bf96921e64c24622
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1739973Reviewed-by: default avatarKen Buchanan <kenrb@chromium.org>
Commit-Queue: Suzy Li <suzyli@google.com>
Cr-Commit-Position: refs/heads/master@{#686226}
parent ca80f582
...@@ -32,7 +32,6 @@ public class AuthenticatorImpl extends HandlerResponseCallback implements Authen ...@@ -32,7 +32,6 @@ public class AuthenticatorImpl extends HandlerResponseCallback implements Authen
private static final String GMSCORE_PACKAGE_NAME = "com.google.android.gms"; private static final String GMSCORE_PACKAGE_NAME = "com.google.android.gms";
private static final int GMSCORE_MIN_VERSION = 12800000; private static final int GMSCORE_MIN_VERSION = 12800000;
private static final int GMSCORE_MIN_VERSION_ISUVPAA = 16200000;
/** Ensures only one request is processed at a time. */ /** Ensures only one request is processed at a time. */
private boolean mIsOperationPending; private boolean mIsOperationPending;
...@@ -98,32 +97,18 @@ public class AuthenticatorImpl extends HandlerResponseCallback implements Authen ...@@ -98,32 +97,18 @@ public class AuthenticatorImpl extends HandlerResponseCallback implements Authen
public void isUserVerifyingPlatformAuthenticatorAvailable( public void isUserVerifyingPlatformAuthenticatorAvailable(
IsUserVerifyingPlatformAuthenticatorAvailableResponse callback) { IsUserVerifyingPlatformAuthenticatorAvailableResponse callback) {
Context context = ChromeActivity.fromWebContents(mWebContents); Context context = ChromeActivity.fromWebContents(mWebContents);
// ChromeActivity could be null. if (context == null
if (context == null) { || PackageUtils.getPackageVersion(context, GMSCORE_PACKAGE_NAME)
< GMSCORE_MIN_VERSION
|| Build.VERSION.SDK_INT < Build.VERSION_CODES.N
|| !ChromeFeatureList.isEnabled(ChromeFeatureList.WEB_AUTH)) {
callback.call(false); callback.call(false);
return; return;
} }
if (!ChromeFeatureList.isEnabled(ChromeFeatureList.WEB_AUTH)) { FingerprintManager fingerprintManager =
callback.call(false); (FingerprintManager) context.getSystemService(Context.FINGERPRINT_SERVICE);
return; callback.call(fingerprintManager != null && fingerprintManager.hasEnrolledFingerprints());
}
if (PackageUtils.getPackageVersion(context, GMSCORE_PACKAGE_NAME)
>= GMSCORE_MIN_VERSION_ISUVPAA) {
mIsUserVerifyingPlatformAuthenticatorAvailableCallback = callback;
Fido2ApiHandler.getInstance().isUserVerifyingPlatformAuthenticatorAvailable(
mRenderFrameHost, this);
} else if (PackageUtils.getPackageVersion(context, GMSCORE_PACKAGE_NAME)
>= GMSCORE_MIN_VERSION
&& Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
FingerprintManager fingerprintManager =
(FingerprintManager) context.getSystemService(Context.FINGERPRINT_SERVICE);
callback.call(
fingerprintManager != null && fingerprintManager.hasEnrolledFingerprints());
} else {
callback.call(false);
}
} }
@Override @Override
...@@ -149,13 +134,6 @@ public class AuthenticatorImpl extends HandlerResponseCallback implements Authen ...@@ -149,13 +134,6 @@ public class AuthenticatorImpl extends HandlerResponseCallback implements Authen
close(); close();
} }
@Override
public void onIsUserVerifyingPlatformAuthenticatorAvailableResponse(boolean isUVPAA) {
assert mIsUserVerifyingPlatformAuthenticatorAvailableCallback != null;
mIsUserVerifyingPlatformAuthenticatorAvailableCallback.call(isUVPAA);
mIsUserVerifyingPlatformAuthenticatorAvailableCallback = null;
}
@Override @Override
public void onError(Integer status) { public void onError(Integer status) {
assert ((mMakeCredentialCallback != null && mGetAssertionCallback == null) assert ((mMakeCredentialCallback != null && mGetAssertionCallback == null)
......
...@@ -61,12 +61,6 @@ public class AuthenticatorTest { ...@@ -61,12 +61,6 @@ public class AuthenticatorTest {
RenderFrameHost frameHost, HandlerResponseCallback callback) { RenderFrameHost frameHost, HandlerResponseCallback callback) {
callback.onError(AuthenticatorStatus.NOT_IMPLEMENTED); callback.onError(AuthenticatorStatus.NOT_IMPLEMENTED);
} }
@Override
protected void isUserVerifyingPlatformAuthenticatorAvailable(
RenderFrameHost frameHost, HandlerResponseCallback callback) {
callback.onIsUserVerifyingPlatformAuthenticatorAvailableResponse(false);
}
} }
/** Waits until the JavaScript code supplies a result. */ /** Waits until the JavaScript code supplies a result. */
...@@ -155,7 +149,6 @@ public class AuthenticatorTest { ...@@ -155,7 +149,6 @@ public class AuthenticatorTest {
@Feature({"WebAuth"}) @Feature({"WebAuth"})
public void testIsUserVerifyingPlatformAuthenticatorAvailable() throws Exception { public void testIsUserVerifyingPlatformAuthenticatorAvailable() throws Exception {
mActivityTestRule.loadUrl(mUrl); mActivityTestRule.loadUrl(mUrl);
Fido2ApiHandler.overrideInstanceForTesting(mMockHandler);
mActivityTestRule.runJavaScriptCodeInCurrentTab( mActivityTestRule.runJavaScriptCodeInCurrentTab(
"doIsUserVerifyingPlatformAuthenticatorAvailable()"); "doIsUserVerifyingPlatformAuthenticatorAvailable()");
Assert.assertEquals("Success", mUpdateWaiter.waitForUpdate()); Assert.assertEquals("Success", mUpdateWaiter.waitForUpdate());
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment