Commit Graph

3569 Commits

Author SHA1 Message Date
Gustav Sennton
0e541ef992 Refactor some WebView loading logic into WebViewLibraryLoader.
This is in preparation for a patch which with bigger changes for
WebViewLibraryLoader (including tests).

Bug: 28736099
Test: ensure relro loaded into app process on 32-bit device.
Change-Id: Ic1aef697c1010380d8bce466ee14627d9cdff9e7
2017-10-24 15:07:42 +01:00
TreeHugger Robot
6f2118d763 Merge "[WebView] Only pass one path to relro creation/loading at a time." 2017-10-05 17:07:44 +00:00
Gustav Sennton
ae498f2702 [WebView] Only pass one path to relro creation/loading at a time.
There's no need to send both 32-bit and 64-bit paths to the native side
of the relro-creation/loading logic, we can check which one to send on
the java side instead.

Bug: 28736099
Test: Load WebView app, ensure relro file is loaded into the app
process.

Change-Id: Ia3fb4b3ed686c3e70c26a384aae966bda179d225
2017-10-05 15:49:10 +01:00
Torne (Richard Coles)
29675b2941 Fix NPE in WebView relro creator process.
There's no context available in the relro creator process, resulting in
a NPE and crash when it tries to see if WebView is supported. Skip the
check in this case, because we know it's supported if we ran the relro
creation process at all.

Change-Id: I95e9aad7407b8f73dddf8a8b685d41d2f500736a
Fixes: 67398770
Test: boot, make sure no crash dialog from "android"
2017-10-04 12:40:55 -04:00
Torne (Richard Coles)
ff937ac226 Improve handling of devices without a WebView.
Use the presence of FEATURE_WEBVIEW to determine whether a device is
intended to have a WebView implementation or not, instead of trying to
fall back to NullWebViewFactoryProvider after loading WebView fails.
This removes the need for nullwebview entirely, and eliminates a class
of possible bug where unexpected exceptions during loading cause the
fallback mechanism not to work reliably.

On devices which don't have the feature, don't start
WebViewUpdateService at all. Guard all the places which try to access
the service to return reasonable (empty/null) results when this is the
case, instead of throwing exceptions.

Change-Id: I839adaaf0abee28f4989e3fbc0c49c0732d0ec1c
Bug: 31849211
Fixes: 28529980
Test: on wear and non-wear, cts-tradefed run cts -m CtsWebkitTestCases
2017-10-03 10:40:20 -04:00
Nate Fischer
5cca7bd586 WebView: use proper javadocs
Javadocs need to start with "/**", not "/*". This can unexpectedly
trigger a presubmit failure if someone changes something else in these
methods.

This also fixes an import-order presubmit error.

Bug: 65553544
Test: make -j30 docs (no visible change)
Change-Id: I1bc8ef479e3dc9378e58904d0b317c4775117390
2017-09-26 19:00:41 -07:00
TreeHugger Robot
68945491e0 Merge "WebView: add @Nullable and @NonNull annotations" 2017-09-26 19:44:00 +00:00
Nate Fischer
3442c74d2c WebView: add @Nullable and @NonNull annotations
This adds @Nullable and @NonNull annotations where the docs previously
stated this. This change should be safe, since we already disallowed
null values for the @NonNull parameters via documentation.

I verified that documentation changes for APIs which previously did not
mention null-ness in @param or @return Javadocs (if the API already
mentioned it in these spots, then DroidDoc prefers the hand-written
description).

This also fixes various lint errors.

Bug: 65465498
Test: make update-api and manually verify docs
Change-Id: I4751508d0e72be8ddfc3d6b601db8c307c9df60e
2017-09-21 18:34:43 -07:00
Torne (Richard Coles)
4fd8aa51e4 Consider shared libs when precreating WebView classloader.
The change to handling of the deprecated Apache HTTP library means that
the WebView implementation package might have a non-empty shared library
list. Make sure to fetch shared libraries when querying WebView
implementations, and take them into account when constructing both the
actual classpath to be used to precreate the classloader, and when
deciding what the cache key for the precreated classloader should be.

Change-Id: I5e1409358d935e1c9f325db434bc6d4ef8ead759
Fixes: 65574359
Test: launch anything that uses WebView
2017-09-19 15:21:29 -04:00
Felipe Leme
9f4ff59902 Merge "Minor fixes on WebView.onProvideAutofillVirtualStructure() javadoc." into oc-mr1-dev am: d96b0d1b47
am: 358f7fdff3

Change-Id: I06636c95b5f4e72f2f344b9f9449a5762813b9ca
2017-09-18 17:04:29 +00:00
Felipe Leme
58390fe9ae Minor fixes on WebView.onProvideAutofillVirtualStructure() javadoc.
Test: mmm -j108 frameworks/base/:doc-comment-check-docs
Bug: 65751159

Change-Id: Ie60b1f32e4d9acc675c6e25b7d3e606049b6a3c3
2017-09-15 16:48:41 -07:00
Nate Fischer
270bd52782 Merge "WebView: document Safe Browsing and shouldInterceptRequest" into oc-mr1-dev am: 563cd2d3ca
am: ffbb5666d4

Change-Id: Ida56b201e8a00e0b968736ee29ee40b1d71b87d1
2017-09-14 01:49:06 +00:00
Nate Fischer
a7c7899cf0 Merge "WebView: remove "</p>" tags from docs" 2017-09-14 01:22:53 +00:00
Nate Fischer
b5a9bf41b1 WebView: document Safe Browsing and shouldInterceptRequest
No change to logic, docs only.

This documents shouldInterceptRequest request behavior when Safe
Browsing is enabled, with recommendations for how this can be avoided
depending on the application's needs.

Bug: 65555402
Test: make docs (manually verify links all work)
Change-Id: I055254bfae3a06061402c519e8740ec4d9779e8f
2017-09-11 16:12:24 -07:00
Nate Fischer
f02f846439 WebView: remove "</p>" tags from docs
Docs change only, no change to logic.

This removes closing "</p>" tags from WebView API docs, as per API
guidelines.

This also adds a trailing newline to a <pre> block for consistency.

Other than the modified <pre> block, this has no reader-visible change,
it merely complies with best practices from Android API guidelines.

Bug: 65381884
Test: make docs (and manually compare before/after for differences)
Change-Id: I2f911a43b88a8897d9d1b5c7945360580491883d
2017-09-11 15:16:33 -07:00
Nate Fischer
0a6140d217 WebView: wrap Java literals with {@code}
Docs change only.

This wraps some Java literals (true, false, null) with {@code} blocks,
as per Android API guidelines.

This also addresses other presubmit errors:

 * fix lines that have become too long
 * fix broken import order and unused imports

Bug: 65213517
Test: make docs (and manually verify things look better)
Change-Id: Idc7fe28d40bea7bd1edcad539b75fa9c689b8d46
2017-09-05 13:37:37 -07:00
Nate Fischer
390245b09e Merge "WebView: fix setSafeBrowsingWhitelist table in docs" into oc-mr1-dev am: 0899236129
am: 6ad362b160

Change-Id: I20c3e85ed430cb23660ffbd02a2be39fdb361c59
2017-08-31 04:32:47 +00:00
TreeHugger Robot
433f7c5708 Merge "WebView: fix broken references to #onShowFileChooser" 2017-08-31 02:47:49 +00:00
Nate Fischer
c4f8f89bcc WebView: fix broken references to #onShowFileChooser
WebChromeClient#onShowFileChooser was incorrectly referred to as
"showFileChooser" in two locations. Now these locations use the correct
name and the spot using "<code>" has been fixed to use "{@link}".

This also fixes a grammar error in the docs.

Bug: 65213653
Test: make docs (and manually verify the link works)
Change-Id: I17ba8ac3f76371a8b8a12b998ce4c956b6237119
2017-08-30 15:39:32 -07:00
Nate Fischer
fbebfa9d53 WebView: fix setSafeBrowsingWhitelist table in docs
No change to logic, only docs changes.

The documentation for setSafeBrowsingWhitelist uses a table to describe
whitelist rules. However, this table was previously formatted
incorrectly (it uses <th> elements for each cell, when normal data cells
should use <td> according to Android API guidelines).

This fixes the table to conform to the guidelines, adjusts white space
for consistency, and removes an unnecessary <p> element.

Bug: 65173825
Test: make docs (and manually verify the table looks correct)
Change-Id: I5d7390a44613aaa3acb147a69f8e0ce741e817ed
2017-08-30 21:03:19 +00:00
Nate Fischer
7e4dbe65bc Merge "WebView: require APKs to target OMR1" into oc-mr1-dev am: c233f44a26
am: a97e0833d3

Change-Id: Id9c3e2c7ed292435703bc237974a9cbab6f1c355
2017-08-28 20:01:30 +00:00
Nate Fischer
220d86d142 WebView: require APKs to target OMR1
This disallows WebView/Monochrome APKs targeting O or below to be chosen
as WebView providers.

Bug: 65080651
Test: Open WebView shell with webview from system image, no crash
Test: Install Monochrome compiled for O, it's not in the webview provider list
Change-Id: I79162cedaa801ce227ad4c2eb3cbea9c08704da8
2017-08-28 12:15:56 -07:00
Nate Fischer
02e281a13d WebView: clarify docs for addJavascriptInterface
Docs change only, no change in logic.

We do not support calling #addJavascriptInterface until after JavaScript
is enabled via WebSettings#setJavaScriptEnabled. Calling these methods
in the wrong order is undefined behavior (and we've seen that it's buggy
under certain conditions, e.g. if the DOM includes an <img> element).

This clarifies the point in the docs and code example.

Bug: 64899039
Test: make -j40 docs (everything looks good)
Change-Id: I8ef9eec7f038037e6b898286e4dad8a57ecad472
(cherry picked from commit aaef6827ca)
2017-08-23 17:49:46 +00:00
TreeHugger Robot
e0ebf03ba7 Merge "WebView: clarify docs for addJavascriptInterface" 2017-08-23 15:30:54 +00:00
Nate Fischer
0d2b68bb68 Merge "WebView: rename initSafeBrowsing and remove shutdownSafeBrowsing" into oc-mr1-dev am: b2456e6194
am: 0cd12a83c6

Change-Id: I5c0529021e6bbba15090bfc500bb4610a9a4c0d7
2017-08-22 23:21:15 +00:00
Nate Fischer
aaef6827ca WebView: clarify docs for addJavascriptInterface
Docs change only, no change in logic.

We do not support calling #addJavascriptInterface until after JavaScript
is enabled via WebSettings#setJavaScriptEnabled. Calling these methods
in the wrong order is undefined behavior (and we've seen that it's buggy
under certain conditions, e.g. if the DOM includes an <img> element).

This clarifies the point in the docs and code example.

Bug: 64899039
Test: make -j40 docs (everything looks good)
Change-Id: I8ef9eec7f038037e6b898286e4dad8a57ecad472
2017-08-22 01:06:07 +00:00
Nate Fischer
2b108d8609 WebView: rename initSafeBrowsing and remove shutdownSafeBrowsing
This renames the method as follows:

 * initSafeBrowsing -> startSafeBrowsing

This also updates documentation to fix javadoc references, and to
clarify that Safe Browsing checks are not guaranteed until after
startSafeBrowsing() invokes its callback.

This does not change the method name in WebViewFactoryProvider, because
changing this would break CTS tests (since the WebView APK implements
this under the old name).

This also removes shutdownSafeBrowsing, because we found there was no
good use for this (it's meaningless for AOSP, and we were recommended to
avoid calling the underlying GMSCore API for GoogleWebView). More
significantly, there's no good place for an application to call it from.

Bug: 64331900
Test: make update-api (docs are correct)
Change-Id: Idf2b9390306052f5c5dfb92909fca4cfeec74aef
2017-08-21 18:04:28 -07:00
Felipe Leme
eb6a0c2560 Merge "Merge "Additional documentation about Autofill / WebView security." into oc-dev am: 36cbdef880 am: 7e9f379b50 am: 82e7dfcae8" into oc-mr1-dev-plus-aosp
am: 11435f8153

Change-Id: Id3b356d237d0758180c227c7d452236487eb18aa
2017-08-15 22:42:54 +00:00
Felipe Leme
262966aad1 Merge "Additional documentation about Autofill / WebView security." into oc-dev am: 36cbdef880 am: 7e9f379b50
am: 82e7dfcae8

Change-Id: I47c263e196b9cfa3e664ec6a968eeb2cffcffc58
2017-08-15 22:13:39 +00:00
Felipe Leme
2220049d58 Merge "Additional documentation about Autofill / WebView security." into oc-dev am: 36cbdef880
am: a3c2cee055

Change-Id: Ie107dd462a47009a34ee3768183dfda2e36107c3
2017-08-15 21:48:32 +00:00
Felipe Leme
82e7dfcae8 Merge "Additional documentation about Autofill / WebView security." into oc-dev am: 36cbdef880
am: 7e9f379b50

Change-Id: I1eceb903fed2c46db35c9270769bb0f8cc44150f
2017-08-15 21:42:40 +00:00
Felipe Leme
a3c2cee055 Merge "Additional documentation about Autofill / WebView security." into oc-dev
am: 36cbdef880

Change-Id: Ie198dbbdc7ab4ea1089c7363f1b1d2df333c1d8f
2017-08-15 21:33:01 +00:00
Nate Fischer
cf08be26fa Merge "WebView: switch to OMR1 FactoryProvider" into oc-mr1-dev am: 417944624b
am: c5731e7c85

Change-Id: If5b5fb05f3d22bd3fa9be32aea7336099184f489
2017-08-14 21:53:19 +00:00
Nate Fischer
7b00b32216 WebView: switch to OMR1 FactoryProvider
We now fetch the *ForOMR1 class instead of *ForO, which enables
OMR1-specific code in the WebView APK.

Bug: 63687088
Test: N/A
Change-Id: Ia36a00cd26aff8b87d7aeae859c72cb2fb364d2c
2017-08-14 18:43:28 +00:00
Felipe Leme
303b609eaa Additional documentation about Autofill / WebView security.
Test: ran 'm -j doc-comment-check-docs' and checked resulting HTML

Fixes: 64114048
Fixes: 64337380
Fixes: 64125551

Change-Id: I375bb4712af875251fea4f3e572d92165643409a
2017-08-14 08:49:47 -07:00
Nate Fischer
f332e96c66 Merge "WebView: remove unused DATA_REDUCTION_PROXY_SETTING_CHANGED API" into oc-mr1-dev am: a9732da1f3
am: e1a8030fc9

Change-Id: Ic6af76454398ab9934e635759f7271ad28313e08
2017-08-11 18:10:52 +00:00
Nate Fischer
333398f085 Merge "WebView: add WebView#getSafeBrowsingPrivacyPolicyUrl() API" into oc-mr1-dev am: 070e3c0c7f
am: 56a9c82325

Change-Id: If3247f4b91fc4b8d3dce2d8c77a3976260a69f34
2017-08-11 18:04:45 +00:00
TreeHugger Robot
a9732da1f3 Merge "WebView: remove unused DATA_REDUCTION_PROXY_SETTING_CHANGED API" into oc-mr1-dev 2017-08-11 17:38:11 +00:00
Nate Fischer
3898ac12e4 WebView: add WebView#getSafeBrowsingPrivacyPolicyUrl() API
This adds a dedicated API for fetching a URL for the Safe Browsing
reporting privacy policy.

This URL should be displayed by applications on custom Safe Browsing
interstitials.

Bug: 64077668
Test: make update-api (it compiles and javadocs look good)
Change-Id: I2873260edcaa924e68517c8679079e147b9995f4
2017-08-10 18:33:21 -07:00
Nate Fischer
064b1d5ae0 Merge "WebView: fix SafeBrowsingResponse javadocs" into oc-mr1-dev am: a9fd746ec6
am: f93765fc45

Change-Id: I2c507d1e0746125fa77627d9ea5808224f1c865d
2017-08-09 03:12:24 +00:00
Nate Fischer
bc1da9e2b4 WebView: fix SafeBrowsingResponse javadocs
Docs change only.

This fixes javadoc errors in SafeBrowsingResponse.java:

 * Typo: capital "B" in "onSafeBrowsingHit"
 * Add full package names
 * Add parameter lists to all linked methods

Bug: 64077668
Test: make update-api and check javadocs manually
Change-Id: I5e7b0e59ba865619b252f7e9e431ffac6e1bab1f
2017-08-08 15:43:44 -07:00
Nate Fischer
0c8eab49c8 Merge "WebView: update SafeBrowsing documentation" into oc-mr1-dev am: 2ddac82335
am: 650bae9c45

Change-Id: Ia4a5dc3fd03c2ecf9b7747d255380559e8955607
2017-08-08 21:38:54 +00:00
Nate Fischer
2ddac82335 Merge "WebView: update SafeBrowsing documentation" into oc-mr1-dev 2017-08-08 21:00:59 +00:00
Nate Fischer
07ea436685 WebView: remove unused DATA_REDUCTION_PROXY_SETTING_CHANGED API
This API was unused. We're removing this under recommendation from the
API council.

Bug: 62425491
Test: make -j40 update-api
Change-Id: If869305b46b2dd2c5c4ab269e3544d4e2156ddd7
2017-08-07 12:21:06 -07:00
Jeff Sharkey
1fb3a312e7 Merge "Fix broken javadocs." into oc-mr1-dev am: b79eb54d36
am: 1ad38fe278

Change-Id: I21266d20be036196dbeddb9c4366d641ab1b68a8
2017-08-06 17:00:09 +00:00
Jeff Sharkey
67f9d5070a Fix broken javadocs.
Bug: 64337634
Test: make -j32 doc-comment-check-docs
Change-Id: I20fdd3dcddef09111d35946c41c596c7689effa6
2017-08-06 07:37:08 -06:00
Selim Gurun
b988a6e8c8 Merge "Update documentation for Whitelist API" into oc-mr1-dev am: a30ec5ff4c
am: e8315ab4d7

Change-Id: Id982c9ee88065576bd73ae7ec3e91efea8963fe9
2017-07-31 14:46:30 +00:00
Selim Gurun
a30ec5ff4c Merge "Update documentation for Whitelist API" into oc-mr1-dev 2017-07-31 14:27:52 +00:00
Selim Gurun
89e935904a Update documentation for Whitelist API
Bug: 64144913
Test: compile documentation and visually confirm

Change-Id: Ia19ca9b6cf4f8a0802835d597a30e10c498dbd81
2017-07-28 12:06:42 -07:00
Nate Fischer
471891df02 WebView: update SafeBrowsing documentation
No change in logic, only docs changes:

 * Docs about Safe Browsing feature as a whole.
 * Expand the docs for initSafeBrowsing/shutdownSafeBrowsing

Bug: 63660204
Bug: 62192626
Test: make update-api and manually check javadocs
Change-Id: I6526a0f1ce1327f6eff416c27ded89866587f173
2017-07-27 21:43:59 +00:00