Commit 7f66f445 authored by Suzy Li's avatar Suzy Li Committed by Commit Bot

Revert "Reland isUVPAA implementation on clank"

This reverts commit 9ca63e64.

Reason for revert: Clank should use the GmsCore implementation of isUVPAA, see crbug.com/1017587

Original change's description:
> 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/+/1739973
> Reviewed-by: Ken Buchanan <kenrb@chromium.org>
> Commit-Queue: Suzy Li <suzyli@google.com>
> Cr-Commit-Position: refs/heads/master@{#686226}

TBR=kenrb@chromium.org,suzyli@google.com

# Not skipping CQ checks because original CL landed > 1 day ago.

Bug: 1017587
Change-Id: Ib31b0fe0999de859f4e47642e1568ac813c47949
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1881378Reviewed-by: default avatarMartin Kreichgauer <martinkr@google.com>
Reviewed-by: default avatarKen Buchanan <kenrb@chromium.org>
Commit-Queue: Suzy Li <suzyli@google.com>
Cr-Commit-Position: refs/heads/master@{#709577}
parent 9d93a2ed
......@@ -32,6 +32,7 @@ public class AuthenticatorImpl extends HandlerResponseCallback implements Authen
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_ISUVPAA = 16200000;
/** Ensures only one request is processed at a time. */
private boolean mIsOperationPending;
......@@ -97,18 +98,32 @@ public class AuthenticatorImpl extends HandlerResponseCallback implements Authen
public void isUserVerifyingPlatformAuthenticatorAvailable(
IsUserVerifyingPlatformAuthenticatorAvailableResponse callback) {
Context context = ChromeActivity.fromWebContents(mWebContents);
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)) {
// ChromeActivity could be null.
if (context == null) {
callback.call(false);
return;
}
FingerprintManager fingerprintManager =
(FingerprintManager) context.getSystemService(Context.FINGERPRINT_SERVICE);
callback.call(fingerprintManager != null && fingerprintManager.hasEnrolledFingerprints());
if (!ChromeFeatureList.isEnabled(ChromeFeatureList.WEB_AUTH)) {
callback.call(false);
return;
}
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
......@@ -134,6 +149,13 @@ public class AuthenticatorImpl extends HandlerResponseCallback implements Authen
close();
}
@Override
public void onIsUserVerifyingPlatformAuthenticatorAvailableResponse(boolean isUVPAA) {
assert mIsUserVerifyingPlatformAuthenticatorAvailableCallback != null;
mIsUserVerifyingPlatformAuthenticatorAvailableCallback.call(isUVPAA);
mIsUserVerifyingPlatformAuthenticatorAvailableCallback = null;
}
@Override
public void onError(Integer status) {
assert ((mMakeCredentialCallback != null && mGetAssertionCallback == null)
......
......@@ -62,6 +62,12 @@ public class AuthenticatorTest {
RenderFrameHost frameHost, HandlerResponseCallback callback) {
callback.onError(AuthenticatorStatus.NOT_IMPLEMENTED);
}
@Override
protected void isUserVerifyingPlatformAuthenticatorAvailable(
RenderFrameHost frameHost, HandlerResponseCallback callback) {
callback.onIsUserVerifyingPlatformAuthenticatorAvailableResponse(false);
}
}
/** Waits until the JavaScript code supplies a result. */
......@@ -153,6 +159,7 @@ public class AuthenticatorTest {
@Feature({"WebAuth"})
public void testIsUserVerifyingPlatformAuthenticatorAvailable() throws Exception {
mActivityTestRule.loadUrl(mUrl);
Fido2ApiHandler.overrideInstanceForTesting(mMockHandler);
mActivityTestRule.runJavaScriptCodeInCurrentTab(
"doIsUserVerifyingPlatformAuthenticatorAvailable()");
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