Commit f05f8299 authored by Nate Fischer's avatar Nate Fischer Committed by Commit Bot

AW: add metric for support library client

No change to logic.

This adds an UMA metric to see if the WebViewClient is a
WebViewClientCompat or not. This will only ever be boolean (at least for
the foreseeable future), so this should be safe to keep as a boolean
histogram for now.

R=changwan@chromium.org, isherman@chromium.org

Bug: 901581
Test: N/A (not feasible to test metrics right now)
Change-Id: I9e6ba219d4f5f26f1fec947ef9974549490e2258
Reviewed-on: https://chromium-review.googlesource.com/c/1318748
Commit-Queue: Nate Fischer <ntfschr@chromium.org>
Reviewed-by: default avatarChangwan Ryu <changwan@chromium.org>
Reviewed-by: default avatarIlya Sherman <isherman@chromium.org>
Cr-Commit-Position: refs/heads/master@{#605888}
parent eba51657
...@@ -14,6 +14,7 @@ import org.chromium.android_webview.AwContentsClient.AwWebResourceError; ...@@ -14,6 +14,7 @@ import org.chromium.android_webview.AwContentsClient.AwWebResourceError;
import org.chromium.android_webview.AwSafeBrowsingResponse; import org.chromium.android_webview.AwSafeBrowsingResponse;
import org.chromium.android_webview.ScopedSysTraceEvent; import org.chromium.android_webview.ScopedSysTraceEvent;
import org.chromium.base.Callback; import org.chromium.base.Callback;
import org.chromium.base.metrics.RecordHistogram;
import org.chromium.support_lib_boundary.SafeBrowsingResponseBoundaryInterface; import org.chromium.support_lib_boundary.SafeBrowsingResponseBoundaryInterface;
import org.chromium.support_lib_boundary.WebResourceErrorBoundaryInterface; import org.chromium.support_lib_boundary.WebResourceErrorBoundaryInterface;
import org.chromium.support_lib_boundary.WebViewClientBoundaryInterface; import org.chromium.support_lib_boundary.WebViewClientBoundaryInterface;
...@@ -30,6 +31,9 @@ public class SupportLibWebViewContentsClientAdapter { ...@@ -30,6 +31,9 @@ public class SupportLibWebViewContentsClientAdapter {
private static final String WEBVIEW_CLIENT_COMPAT_NAME = "androidx.webkit.WebViewClientCompat"; private static final String WEBVIEW_CLIENT_COMPAT_NAME = "androidx.webkit.WebViewClientCompat";
private static final String[] EMPTY_FEATURE_LIST = new String[0]; private static final String[] EMPTY_FEATURE_LIST = new String[0];
private static final String COMPAT_CLIENT_HISTOGRAM =
"Android.WebView.SupportLibrary.ClientIsCompat";
// If {@code null}, this indicates the WebViewClient is not a WebViewClientCompat. Otherwise, // If {@code null}, this indicates the WebViewClient is not a WebViewClientCompat. Otherwise,
// this is a Proxy for the WebViewClientCompat. // this is a Proxy for the WebViewClientCompat.
@Nullable @Nullable
...@@ -47,6 +51,13 @@ public class SupportLibWebViewContentsClientAdapter { ...@@ -47,6 +51,13 @@ public class SupportLibWebViewContentsClientAdapter {
mWebViewClientSupportedFeatures = mWebViewClient == null mWebViewClientSupportedFeatures = mWebViewClient == null
? EMPTY_FEATURE_LIST ? EMPTY_FEATURE_LIST
: mWebViewClient.getSupportedFeatures(); : mWebViewClient.getSupportedFeatures();
// We ignore the case where the client is set to null, since this is often done by
// WebView's internal logic (such as during destroy()), and would otherwise skew data.
if (possiblyCompatClient != null) {
RecordHistogram.recordBooleanHistogram(
COMPAT_CLIENT_HISTOGRAM, mWebViewClient != null);
}
} }
} }
......
...@@ -53076,6 +53076,11 @@ Full version information for the fingerprint enum values: ...@@ -53076,6 +53076,11 @@ Full version information for the fingerprint enum values:
<int value="1" label="Revoked ephemeral permission"/> <int value="1" label="Revoked ephemeral permission"/>
</enum> </enum>
<enum name="WebViewClientTypeEnum">
<int value="0" label="Regular WebViewClient"/>
<int value="1" label="WebViewClientCompat (via AndroidX)"/>
</enum>
<enum name="WelcomeSignInPromptOutcome"> <enum name="WelcomeSignInPromptOutcome">
<int value="0" label="User navigated away from page"/> <int value="0" label="User navigated away from page"/>
<int value="1" label="User clicked the No Thanks button"/> <int value="1" label="User clicked the No Thanks button"/>
...@@ -2737,6 +2737,18 @@ uploading your change for review. ...@@ -2737,6 +2737,18 @@ uploading your change for review.
</summary> </summary>
</histogram> </histogram>
<histogram name="Android.WebView.SupportLibrary.ClientIsCompat"
enum="WebViewClientTypeEnum" expires_after="2019-05-05">
<owner>ntfschr@chromium.org</owner>
<owner>changwan@chromium.org</owner>
<summary>
Records whether the WebViewClient provided by the app is an instance of
WebViewClientCompat (and therefore exposes AndroidX callbacks). This is
recorded each time the app sets a new WebViewClient via
WebView#setWebViewClient().
</summary>
</histogram>
<histogram name="Android.WebView.TargetSdkVersion" enum="AndroidApiLevel"> <histogram name="Android.WebView.TargetSdkVersion" enum="AndroidApiLevel">
<owner>changwan@chromium.org</owner> <owner>changwan@chromium.org</owner>
<summary> <summary>
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