Generated android wrapper scripts don't work well for WebView |
|||
Issue description
Not sure if //build/android OWNERS have bandwidth to take this, but I thought I would file this in the interest of WebView-team dev productivity.
The Generated Wrapper Scripts [1] are super cool for clank, but I think there's room for improvement when building WebView. I tried them out today, and here's some feedback:
* /bin/system_webview_google_apk install: on N+, this should also set the webview provider
* /bin/system_webview_google_apk argv: I'm pleasantly surprised this uses WebView's CLI file--great!
* /bin/system_webview_google_apk launch: understandably, this fails with "APK does not support launching with URLs." But, a nice default might be to launch WebView shell instead?
* /bin/system_webview_google_apk {logcat,ps,mem-usage}:
- The common issue is that these don't respect WebView's browser process
- For ps/mem-usage, it means we're missing some information
- Logcat filtering strips browser process logs, which essentially requires using the "--verbose" flag
- Bright side: all of these correctly handle OOP renderers on O+
Some of these issues are mitigated by switching to /bin/system_webview_shell_apk instead, but then it has new problems:
* /bin/system_webview_shell_apk install: installs the shell, which is the right thing in this case
* /bin/system_webview_shell_apk argv: doesn't work
* /bin/system_webview_shell_apk launch: this works!
* /bin/system_webview_shell_apk {logcat,ps,mem-usage}: these see the browser process, but not the renderer process
---
It'd be great to have one wrapper which has the best of both (and also sets webview provider). I'm not sure how feasible this is, but I thought I'd share my experience.
[1] https://docs.google.com/presentation/d/1TF7HRo095OcwkV963DHTAhOQ0C6ZSjaM2muYHiI0n1E/edit?usp=sharing
,
Oct 11
Thanks for taking a look! --- In terms of technical questions... > Is there anything in the apk that identifies it as a webview provider? Not really. The logic for where something is a "valid" webview provider is quite complex, and the result (valid or not valid) is only exposed on O+. Technical details are at http://go/clank-webview/webview-providers). > Alternatively, we could just whitelist the list of package IDs that are webviews and set them as providers based on package id. Like I said, this isn't *strictly* correct, but I think it's good enough for the sake of dev productivity. We develop on userdebug nexus/google devices, so we could just assume this list [1] is correct. > Are there any ways via adb to figure out if a process is a webview renderer, and what the "owning" process is? I'll defer to Torne :) --- In terms of policy... I think there's a tradeoff. We can modify the scripts to improve WebView dev productivity and provide a consistent experience for clankers and chromies to work with WebView, but this comes at the cost of carving out special cases. In the past, some of my projects have been affected when non-WebView team members have difficulty working with WebView. Not all the friction is technical (use_signing_keys requires ACL approval), but I thought these scripts might be an opportunity to converge workflows and abstract-away some details (e.g., changing webview provider, WebView flags file). That said, nobody on WebView currently uses these scripts, and don't know if they would do so even if they worked. If you think there's a path forward for providing a clank-like dev experience for WebView (and agree with the value), I'll poll the team for interest. If our team doesn't want to use this, then WontFix might be the best solution. [1] https://cs.corp.google.com/android/vendor/google/google_overlay/static_only/frameworks/base/core/res/res/xml/config_webview_packages.xml
,
Dec 20
|
|||
►
Sign in to add a comment |
|||
Comment 1 by agrieve@chromium.org
, Oct 10We've been trying to keep the generated scripts non-Chrome-specific, in that they work for *any* apks that we build. We could always just add a "webview_mode=true" for some targets though. I'm not sure we'd need to though. For argv not working on system_webview_shell_apk: * Need to set "command_line_flags_file" on the android_apk(). For making it the webview provider: * Is there anything in the apk that identifies it as a webview provider? E.g. we could enable setting it as the provider if we can "sniff" that it's capable. * Alternatively, we could just whitelist the list of package IDs that are webviews and set them as providers based on package id. bin/system_webview_google_apk launch: * I think it makes sense this wouldn't work. We could make this a "webview mode" thing though if you feel strongly. bin/system_webview_shell_apk {logcat,ps,mem-usage} not showing webview renderers: * We should just update all apks to apply these commands to associated webview renderers. * Are there any ways via adb to figure out if a process is a webview renderer, and what the "owning" process is? bin/system_webview_google_apk {logcat,ps,mem-usage} not showing browser process: * I think this makes sense (for the same reason as launch).