Webview fix/comment on suppressions |
||||||
Issue descriptionhttps://crrev.com/c/857694 introduced a couple suppressions for webview code as lint was updated: These new suppressions should be removed, the errors examined, and comments added if they still make sense. android_webview/glue/java/src/com/android/webview/chromium/WebViewContentsClientAdapter.java } @SuppressLint({"NewApi", "Override"}) @Override public void onSafeBrowsingHit(AwWebResourceRequest request, int threatType, final Callback<AwSafeBrowsingResponse> callback) { android_webview/java/src/org/chromium/android_webview/AwWebContentsDelegateAdapter.java private static class GetDisplayNameTask extends AsyncTask<Void, Void, String[]> { final int mProcessId; final int mRenderId; final int mModeFlags; final String[] mFilePaths; @SuppressLint("StaticFieldLeak") final Context mContext;
,
Jan 22 2018
Here is a list: http://tools.android.com/tips/lint-checks My usual method of attack is removing the suppression, build, and you'll see the errors explicitly.
,
Jan 22 2018
I can't seem to find a way to remove @SuppressLint({"Override"}). Lint complains I'm overriding methods that don't show up until API 27, yet I've already specified this method only runs on 27 (I added @TargetApi(OMR1) locally). Is this a lint bug, or am I missing something?
```
../SRC_ROOT1/android_webview/glue/java/src/com/android/webview/chromium/WebViewContentsClientAdapter.java:673 This method is not overriding anything with the current build target, but will in API level 27 (current target is 26): null#backToSafety: Override [warning]
public void backToSafety(boolean report) {
~~~~~~~~~~~~
```
---
I'll take this issue for onSafeBrowisngHit and give this back to the queue when I'm done.
,
Jan 22 2018
tangent.. why aren't we targeting 27 yet?
,
Jan 22 2018
The webview APK does target 27..
,
Jan 24 2018
The following revision refers to this bug: https://chromium.googlesource.com/chromium/src.git/+/63515bcdb8cea586f8149883456dcff068420670 commit 63515bcdb8cea586f8149883456dcff068420670 Author: Nate Fischer <ntfschr@chromium.org> Date: Wed Jan 24 07:57:50 2018 AW: cleanup onSafeBrowsingHit lint issues No change to logic. This CL resolves the NewApi lint error by specifying @TargetApi for onSafeBrowsingHit. This also adds a comment to document this method as being added in O_MR1 (following the pattern for onRenderProcessGone. Unrelated to the lint issue, this also wraps onSafeBrowsingHit with TraceEvents and puts TraceEvent.end() in a "finally" block. This is for consistency with the rest of the WebViewContentsClientAdapter methods. This leaves @SuppressLint("{Override}") because it's necessary to override the SafeBrowsingResponse methods. Lint complains that these methods are added in 27, despite using @TargetApi(27). This appears to be a lint bug. Lastly, this sets 'android_manifest_for_lint' for the glue layer (to point to system_webview_apk's AndroidManifest.xml). This produces new lint warnings for existing errors, so this CL also addresses those issues and includes miscellaneous cleanups to the related methods. Bug: 804422 Test: ninja system_webview_google_apk (no compile errors) Change-Id: I18d3582150805c0c1d4b62560a32ec0be5bd7f26 Reviewed-on: https://chromium-review.googlesource.com/879564 Commit-Queue: Nate Fischer <ntfschr@chromium.org> Reviewed-by: Bo <boliu@chromium.org> Reviewed-by: Richard Coles <torne@chromium.org> Cr-Commit-Position: refs/heads/master@{#531476} [modify] https://crrev.com/63515bcdb8cea586f8149883456dcff068420670/android_webview/BUILD.gn [modify] https://crrev.com/63515bcdb8cea586f8149883456dcff068420670/android_webview/glue/BUILD.gn [modify] https://crrev.com/63515bcdb8cea586f8149883456dcff068420670/android_webview/glue/glue.gni [modify] https://crrev.com/63515bcdb8cea586f8149883456dcff068420670/android_webview/glue/java/src/com/android/webview/chromium/ServiceWorkerControllerAdapter.java [modify] https://crrev.com/63515bcdb8cea586f8149883456dcff068420670/android_webview/glue/java/src/com/android/webview/chromium/ServiceWorkerSettingsAdapter.java [modify] https://crrev.com/63515bcdb8cea586f8149883456dcff068420670/android_webview/glue/java/src/com/android/webview/chromium/WebViewChromium.java [modify] https://crrev.com/63515bcdb8cea586f8149883456dcff068420670/android_webview/glue/java/src/com/android/webview/chromium/WebViewChromiumFactoryProvider.java [modify] https://crrev.com/63515bcdb8cea586f8149883456dcff068420670/android_webview/glue/java/src/com/android/webview/chromium/WebViewContentsClientAdapter.java [add] https://crrev.com/63515bcdb8cea586f8149883456dcff068420670/android_webview/variables.gni
,
Jan 25 2018
onSafeBrowsingHit is done, passing this back to the queue for "StaticFieldLeak".
,
Jan 29 2018
The StaticFieldLeak warning seems like an actual bug - AFAICT the context we are storing is the context passed to WebView (e.g. an activity context), not the app context - so that context should probably not be stored in some task that is running on a background thread for who knows how long.. (but on the other hand that task won't stick around forever).
,
Jan 30 2018
Maybe we can use a weak reference instead?
,
Jan 30 2018
it's just a warning, it's ok to keep it a strong reference as long as the task doesn't do anything that's super long
,
Feb 28 2018
,
Feb 28 2018
I agree with comment #10. I opened a CL to add an explanatory comment, I'll close this bug after.
,
Mar 1 2018
The following revision refers to this bug: https://chromium.googlesource.com/chromium/src.git/+/928bb07887f68a509c53713e748207ca13270dd3 commit 928bb07887f68a509c53713e748207ca13270dd3 Author: Nate Fischer <ntfschr@chromium.org> Date: Thu Mar 01 01:44:05 2018 AW: comment to explain StaticFieldLeak warning No change to behavior, this only adds a comment. This adds a comment explaining why we're going to ignore the StaticFieldLeak lint warning. There is no real leak because the task doesn't run for a long time. Bug: 804422 Test: N/A Change-Id: I5a70a04a4eb5eed748f20a2396ea8dad3b86770c Reviewed-on: https://chromium-review.googlesource.com/942029 Reviewed-by: Richard Coles <torne@chromium.org> Commit-Queue: Nate Fischer <ntfschr@chromium.org> Cr-Commit-Position: refs/heads/master@{#539975} [modify] https://crrev.com/928bb07887f68a509c53713e748207ca13270dd3/android_webview/java/src/org/chromium/android_webview/AwWebContentsDelegateAdapter.java
,
Mar 1 2018
,
Aug 24
Bulk edit: marking stale 'fixed' bugs as 'verified' since they don't need verification at this point. |
||||||
►
Sign in to add a comment |
||||||
Comment 1 by ntfschr@chromium.org
, Jan 22 2018