New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 755922 link

Starred by 1 user

Issue metadata

Status: Fixed
Owner:
Last visit > 30 days ago
Closed: Oct 2017
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Android
Pri: 3
Type: Bug



Sign in to add a comment

Fix WebView compilation warnings

Project Member Reported by gsennton@chromium.org, Aug 16 2017

Issue description

I get the followign warnings when compiling WebView:

../../android_webview/java/src/org/chromium/android_webview/AwZoomControls.java:12: warning: [deprecation] ZoomButtonsController in android.widget has been deprecated
import android.widget.ZoomButtonsController;
                     ^
../../android_webview/java/src/org/chromium/android_webview/AwZoomControls.java:18: warning: [deprecation] ZoomButtonsController in android.widget has been deprecated
    private ZoomButtonsController mZoomButtonsController;
            ^
../../android_webview/java/src/org/chromium/android_webview/AwZoomControls.java:25: warning: [deprecation] ZoomButtonsController in android.widget has been deprecated
        ZoomButtonsController zoomController = getZoomController();
        ^
../../android_webview/java/src/org/chromium/android_webview/AwZoomControls.java:32: warning: [deprecation] ZoomButtonsController in android.widget has been deprecated
        ZoomButtonsController zoomController = getZoomController();
        ^
../../android_webview/java/src/org/chromium/android_webview/AwZoomControls.java:39: warning: [deprecation] ZoomButtonsController in android.widget has been deprecated
        ZoomButtonsController zoomController = getZoomController();
        ^
../../android_webview/java/src/org/chromium/android_webview/AwZoomControls.java:61: warning: [deprecation] ZoomButtonsController in android.widget has been deprecated
    private ZoomButtonsController getZoomController() {
            ^
../../android_webview/java/src/org/chromium/android_webview/AwZoomControls.java:64: warning: [deprecation] ZoomButtonsController in android.widget has been deprecated
            mZoomButtonsController = new ZoomButtonsController(
                                         ^
../../android_webview/java/src/org/chromium/android_webview/AwZoomControls.java:79: warning: [deprecation] ZoomButtonsController in android.widget has been deprecated
    private class ZoomListener implements ZoomButtonsController.OnZoomListener {
                                          ^
../../android_webview/java/src/org/chromium/android_webview/AwSafeBrowsingConfigHelper.java:40: warning: [unchecked] unchecked call to getDeclaredMethod(String,Class<?>...) as a member of the raw type Class
            Method getUserOptInPreference = awSafeBrowsingApiHelperClass.getDeclaredMethod(


ZoomButtonsController is deprecated:
"@deprecated This functionality and UI is better handled with custom views and layouts
 * rather than a dedicated zoom-control widget"

We should either suppress that deprecation warning, or fix it.



Regarding AwSafeBrowsingConfigHelper I'm not sure why we don't provide an API for AwSafeBrowsingApiHandler in the public chromium code, and then implement that in the internal clank code (I guess it might be difficult to find a good spot during WebView startup to instantiate AwSafeBrowsingApiHandler) . Nate, why are we using reflection here instead of an interface + implementation class? 
 
Cc: -ntfschr@chromium.org
Owner: ntfschr@chromium.org
Status: Assigned (was: Unconfirmed)
Oh thanks. Yeah, I'll handle the warning.

We keep the ApiHandler internal like that because that's how clank structured it. No good reason for it (and we've received some questions on chromium-dev I think about this). Obviously, the GMS part is still internal, however the overall logic can be upstreamed.

I've been meaning to refactor these classes in issue 748687. Upstreaming is probably a good idea, I may take PlatformServiceBridge as inspiration.

Comment 2 by boliu@chromium.org, Aug 16 2017

upstreaming for O is happening real soon now, probably wait for that first

> We should either suppress that deprecation warning, or fix it.

We still have to implement deprecated things, so need to suppress them. I think I tried suppressing once long ago, and for some reason, the annotation didn't make the warning go away, so I just gave up
Cc: boliu@chromium.org
That particular Safe Browsing class is unrelated to O, so I'll suppress the warning now.

The other warnings aren't mine, so someone can feel free to take this from me. Bo, it looks like that class is internal code--why do we need to use deprecated classes if it's not for an API?

Comment 4 by boliu@chromium.org, Aug 17 2017

it's implementing a deprecated feature
Project Member

Comment 5 by bugdroid1@chromium.org, Aug 17 2017

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/e2d22cf660126d4290da10eb8fd8f6fa60eb0d0c

commit e2d22cf660126d4290da10eb8fd8f6fa60eb0d0c
Author: Nate Fischer <ntfschr@chromium.org>
Date: Thu Aug 17 05:04:14 2017

AW: suppress compile warning

This suppresses a compile warning for an unchecked reflection call on
AwSafeBrowsingApiHandler. The class will always have the method to fetch
user opt-in preference, so it's safe to ignore the warning.

Bug:  755922 
Test: ninja system_webview_google_apk system_webview_apk monochrome_apk
Change-Id: If14900d9bdc42bbb01d4e9f65a0e19f9f0678d12
Reviewed-on: https://chromium-review.googlesource.com/618304
Reviewed-by: Bo <boliu@chromium.org>
Commit-Queue: Nate Fischer <ntfschr@chromium.org>
Cr-Commit-Position: refs/heads/master@{#495079}
[modify] https://crrev.com/e2d22cf660126d4290da10eb8fd8f6fa60eb0d0c/android_webview/java/src/org/chromium/android_webview/AwSafeBrowsingConfigHelper.java

Cc: paulmiller@chromium.org
The remaining work is to suppress warnings on ZoomButtonsController. This is mostly mechanical, so I'll pass this off as a 1st bug for a noogler. If someone wants this fixed sooner, I can land the patch.
Cc: -paulmiller@chromium.org ntfschr@chromium.org
Owner: paulmiller@chromium.org
Assign back if you don't want this for a noogler bug.

---

For whoever takes this up next, you'll need to look up how to suppress warnings for deprecated classes (to suppress the warning from the import statement).
I found more deprecation warnings in the glue layer, which should be resolved the same way:

---

../../android_webview/glue/java/src/com/android/webview/chromium/WebIconDatabaseAdapter.java:8: warning: [deprecation] WebIconDatabase in android.webkit has been deprecated
import android.webkit.WebIconDatabase;
                     ^
../../android_webview/glue/java/src/com/android/webview/chromium/WebIconDatabaseAdapter.java:9: warning: [deprecation] WebIconDatabase in android.webkit has been deprecated
import android.webkit.WebIconDatabase.IconListener;
                     ^
../../android_webview/glue/java/src/com/android/webview/chromium/WebIconDatabaseAdapter.java:9: warning: [deprecation] WebIconDatabase in android.webkit has been deprecated
import android.webkit.WebIconDatabase.IconListener;
                     ^
../../android_webview/glue/java/src/com/android/webview/chromium/WebIconDatabaseAdapter.java:9: warning: [deprecation] IconListener in WebIconDatabase has been deprecated
import android.webkit.WebIconDatabase.IconListener;
Cc: paulmiller@chromium.org
Owner: jamwalla@chromium.org
Passing to jamwalla@

See examples for how to suppress deprecation warnings:
https://cs.chromium.org/search/?q="@SuppressWarnings(%5C"deprecation%5C")"+lang:java
Project Member

Comment 10 by bugdroid1@chromium.org, Sep 25 2017

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/3b09d5a1ec7d5ee8685e8b3fedc5d259d23bd634

commit 3b09d5a1ec7d5ee8685e8b3fedc5d259d23bd634
Author: James Wallace-Lee <jamwalla@chromium.org>
Date: Mon Sep 25 22:40:59 2017

WebView: suppress deprecation warnings

supress deprecation warnings on ZoomButtonsController and
WebIconDatabase

BUG= 755922 

Change-Id: I7b0f6769127b45245652afcd53615d2f2fcde985
Reviewed-on: https://chromium-review.googlesource.com/682997
Reviewed-by: Paul Miller <paulmiller@chromium.org>
Reviewed-by: Bo <boliu@chromium.org>
Commit-Queue: James Wallace-Lee <jamwalla@chromium.org>
Cr-Commit-Position: refs/heads/master@{#504192}
[modify] https://crrev.com/3b09d5a1ec7d5ee8685e8b3fedc5d259d23bd634/android_webview/glue/java/src/com/android/webview/chromium/WebIconDatabaseAdapter.java
[modify] https://crrev.com/3b09d5a1ec7d5ee8685e8b3fedc5d259d23bd634/android_webview/java/src/org/chromium/android_webview/AwZoomControls.java

Is there remaining work for this bug?
Status: Fixed (was: Assigned)

Sign in to add a comment