Commit Graph

3731 Commits

Author SHA1 Message Date
Martijn Coenen
d7b3a36959 Widen allowed UID range for webview zygote.
The webview zygote is shared for all users on the system, and so unlike
the app zygote, it can't use a single whitelisted UID range. For now,
clamp to the upper bound of the UID range, until we have a better idea.

This is still an improvement from the previous status quo, because it
will prevent setuid/setgid into system users.

Bug: 123597434
Test: builds, webview_zygote running
Change-Id: Ia975826ed5b1f20cabb46f60f5951723b1ba80c9
2019-01-30 12:24:17 +01:00
Torne (Richard Coles)
e032061ddb Use new app preload path for WebView zygote.
In the "common" case where the WebView stub is not being used, have the
WebView zygote use the new APK preload path added for the app zygote,
which avoids duplicating logic from the framework to construct the
classpath. This allows the WebView implementation to use a static shared
library, which was not previously possible.

The old codepath is retained for now to keep the WebView stub working
when it's in use, as it requires the special mechanism to override the
classloader cache key, but this can be removed when we no longer require
the stub.

Bug: 110790153
Test: Manual verification of classloader cache state
Change-Id: Ie49e5810d570bae7bec0341753e6c50d081189b5
2019-01-23 14:25:44 -05:00
Chris Wailes
efce929711 Code cleanup to conform to style guide / linter.
This commit made the following changes to make the code conform to the
Frameworks style guide:
* Re-named variables
* Re-flowed code
* Organized includes

Topic: zygote-prefork
Test: make & flash & launch apps
Bug: 68253328
Change-Id: I9274b32f1f606f29f6eb3a1e5068ca18f607afe7
2019-01-22 16:07:31 -08:00
Toby Sargeant
7980f06690 Merge "[wv] Make WebViewRenderer ctor @SystemApi" 2019-01-22 11:52:02 +00:00
Nate Fischer
b3c20e6ba5 WebView: clean up onReceivedSslError docs am: 9f726cd280
am: f85e6546e6

Change-Id: I05296f1e7c4b400b1111eed312d55741cffd4617
2019-01-18 17:43:02 -08:00
Tobias Sargeant
29a453075a [wv] Make WebViewRenderer ctor @SystemApi
So that it can be subclassed in the WebView glue.

Bug: 111332462
Test: CTS test TBD
Change-Id: Id231420d97e69e1a10b0fdf393950e1b609b4481
2019-01-19 01:23:09 +00:00
Nate Fischer
f85e6546e6 WebView: clean up onReceivedSslError docs
am: 9f726cd280

Change-Id: Id927f42978e86296710995c9d445ac7ce168e265
2019-01-18 17:22:01 -08:00
TreeHugger Robot
b128866274 Merge "Prepare setresuid()/setresgid() seccomp filter in AppZygote." 2019-01-18 22:10:09 +00:00
Nate Fischer
9f726cd280 WebView: clean up onReceivedSslError docs
No change to logic, only docs.

This adds {@link}'s for references to SslErrorHandler methods, improving
readability. This also clarifies this API is only called for recoverable
errors.

Fixes: 123042566
Test: m offline-sdk-docs
Change-Id: I0e94c9903e638e2fce59f35ec76eb5566e7ad875
2019-01-18 13:00:33 -08:00
Martijn Coenen
86f08a5190 Prepare setresuid()/setresgid() seccomp filter in AppZygote.
The application zygote can run untrusted user code; since it also
has the capability to change the uid/gid of the process, we need
to ensure that any changes to the uid and/or gid stay within the
range that we have allocated for this application zygote.

For application zygotes, we install the app_zygote seccomp
filter instead of the regular app filter; the only difference
between this filter and the app one is that it allows
setuid/setgid calls.

To further limit this, pass down the allocated UID range to the
Zygote itself, which in turn installs an additional seccomp
filter that restricts setuid/setgid calls to this range.

The actual calls into seccomp are commented out until the seccomp
changes are merged; to avoid catastrophe, this will leave the
regular app filter for the app_zygote, which is more restrictive
and doesn't allow setuid at all.

Bug: 111434506
Test: atest CtsSeccompHostTestCases passes
Change-Id: I112419629f5ee4774ccbf77e2b1cfa5ddcf77e73
2019-01-18 16:37:09 +01:00
Tobias Sargeant
740b53f0f2 [wv] Add WebView unresponsive renderer APIs.
WebViewRendererClient is a callback class responsible for informing
applications about renderer state changes.

Specifically, these callbacks added as part of this feature are:

onRendererUnresponsive(renderer) - called when the renderer associated
    with a webview does not ack an input event, or a navigation does
    not commit within 5 seconds. The callback will continue to be
    called at 5 second intervals until the renderer is killed or the
    unresponsiveness resolves. |renderer| may be null if webview is
    operating in single process mode.

onRendererResponsive(renderer) - called once when an unresponsive
    renderer becomes responsive again.

This CL also adds the ability to get a webview renderer handle from a
WebView instance, and then terminate that renderer. This allows recovery
from unresponsive renderer situations when webview is in multiprocess
mode and termination is correctly handled via
WebViewClient.onRendererUnresponsive().

Bug: 111332462
Test: CTS test TBD
Change-Id: I0ec026f539a70f412c5567dd87a86a0d851b39ae
2019-01-16 00:25:30 +00:00
Martijn Coenen
7e6fa6727c Initial support for application Zygote.
When an application has requested isolated services to be spawned
from an app zygote, we need to spawn the app zygote itself, and then
ask it to fork an isolated service.

The application zygote currently only creates the class loader, and
doesn't do much else. We keep track of the isolated services that
use the app zygote, and when the last isolated service goes away,
we stop the app zygote itself (after a timeout).

The app zygote itself runs with the app's UID and under the app
seccomp filter. That last one is too restricted, so this currently
only works with SELinux disabled.

Future CLs will add an application callback for preloading.

Test: start multiple isolated services with useAppZygote="true",
      verify app_zygote starts, services start as a child of
      app_zygote. Stopping all services stops app_zygote as well.

Bug: 111434506

Change-Id: I10ee1d4bd148c9298974d434fbc5e5eccbec16cb
2019-01-07 09:10:31 +00:00
TreeHugger Robot
8319a7ee7f Merge "Plumb new functor in native/webview" 2019-01-03 19:15:24 +00:00
Bo Liu
d6668e7c0c Plumb new functor in native/webview
Add plumbing to native/webview for the new functor.
Add a void* data parameter to avoid having to use a thread safe
map for in both the plumbing and in webview.

Test: Compiles and webview runs
Bug: 120997728
Change-Id: I0f9f3acb05688a5afcf95974bc0b3b117f33a8e3
2019-01-03 19:15:18 +00:00
Nate Fischer
d6ca59a508 Merge "WebView: no bars in javadoc" into pi-dev am: 002c637337
am: 23a006b6e2

Change-Id: I8882626eeefce0b2a5e483b8612b45b05ce4faa6
2019-01-02 18:12:03 -08:00
Nate Fischer
23a006b6e2 Merge "WebView: no bars in javadoc" into pi-dev
am: 002c637337

Change-Id: I093585bdc5beaff3f6479b660d9d6d7b5577a5d2
2019-01-02 18:00:02 -08:00
Mathew Inwood
8501ae1763 Merge "Limit access to suspected false positives." am: aeda49d185
am: 152d5a5dcd

Change-Id: I8e10322e69d2d479079df5cf8fec0287c7c117f1
2019-01-02 05:00:54 -08:00
Mathew Inwood
55418eada5 Limit access to suspected false positives.
Members modified herein are suspected to be false positives: i.e. things
that were added to the greylist in P, but subsequent data analysis
suggests that they are not, in fact, used after all.

Add a maxTargetSdk=P to these APIs. This is lower-risk that simply
removing these things from the greylist, as none of out data sources are
perfect nor complete.

For APIs that are not supported yet by annotations, move them to
hiddenapi-greylist-max-p.txt instead which has the same effect.

Exempted-From-Owner-Approval: Automatic changes to the codebase
affecting only @UnsupportedAppUsage annotations, themselves added
without requiring owners approval earlier.

Bug: 115609023
Test: m
Change-Id: Ia937d8c41512e7f1b6e7f67b9104c1878b5cc3a0
Merged-In: I020a9c09672ebcae64c5357abc4993e07e744687
2018-12-28 14:26:35 +00:00
Mathew Inwood
31755f94e1 Limit access to suspected false positives.
Members modified herein are suspected to be false positives: i.e. things
that were added to the greylist in P, but subsequent data analysis
suggests that they are not, in fact, used after all.

Add a maxTargetSdk=P to these APIs. This is lower-risk that simply
removing these things from the greylist, as none of out data sources are
perfect nor complete.

For APIs that are not supported yet by annotations, move them to
hiddenapi-greylist-max-p.txt instead which has the same effect.

Exempted-From-Owner-Approval: Automatic changes to the codebase
affecting only @UnsupportedAppUsage annotations, themselves added
without requiring owners approval earlier.

Bug: 115609023
Test: m
Change-Id: I020a9c09672ebcae64c5357abc4993e07e744687
2018-12-28 11:50:04 +00:00
Nate Fischer
e0938b86ae WebView: no bars in javadoc
No change to logic, only docs change.

The bar/pipe symbols have no meaning in javadoc. We should mark this
with {@code} instead.

Bug: 122046530
Test: None
Change-Id: I594480ea3bf4fec9c87a48275364c7c616a0e3ea
2018-12-26 15:36:35 -08:00
Tobias Sargeant
b58d556772 [wv] Update WebView factory provider class name.
Test: existing CTS tests.
Change-Id: Ib64c0655a605cb38aea1e2db2a45c9a09079c9ae
2018-12-21 15:39:33 +00:00
David Brazdil
9ad1461eb9 Merge "Annotate two non-SDK methods known to be used by apps" am: de441278e7 am: 32d2f8fe46
am: a5083783f7

Change-Id: I59f5f3ea5a0424036e1e715e56d8fa16572358b1
2018-12-20 06:09:41 -08:00
David Brazdil
a5083783f7 Merge "Annotate two non-SDK methods known to be used by apps" am: de441278e7
am: 32d2f8fe46

Change-Id: I0d1a0e85eebb555ca43c2d43e6c28ce96af94122
2018-12-20 05:59:08 -08:00
David Brazdil
ad857d637a Annotate two non-SDK methods known to be used by apps
Exempted-From-Owner-Approval: Mechanical changes to the codebase
which have been approved by Android API council and announced on
android-eng@

Bug: 121237128
Bug: 120783643
Test: m appcompat
Change-Id: Ib7a8bdf3151290aa8a5ca85dc8650612432f0d59
2018-12-20 13:36:21 +00:00
Torne (Richard Coles)
a50a86bbfb Merge "Clarify WebResourceResponse parameter documentation." into pi-dev am: dfcbdef8ab
am: 448eb5fd1b

Change-Id: I215cc7cf98523822adbe2c13e8a2f5891a6f34ec
2018-12-17 09:45:31 -08:00
Torne (Richard Coles)
448eb5fd1b Merge "Clarify WebResourceResponse parameter documentation." into pi-dev
am: dfcbdef8ab

Change-Id: I57fc0e17846ace25c2c90665f32de7a2af121ed8
2018-12-17 09:35:35 -08:00
Torne (Richard Coles)
c848639f08 Clarify WebResourceResponse parameter documentation.
Developers commonly misuse the mimeType and encoding parameters in the
WebResourceResponse constructor as the meaning is different to the
similarly named HTTP headers. Explain more carefully what valid/invalid
inputs look like and mention that this is different to HTTP.

Change-Id: I14d159bc50c89c2215f7de5f4732569e5e246930
Fixes: 64765685
Test: m offline-sdk-docs
2018-12-14 13:00:54 -05:00
Xin Li
15b123ef45 DO NOT MERGE - Merge pie-platform-release (PPRL.181205.001) into master
Bug: 120502534
Change-Id: Idc8bfb6d97a869b76cfb87ca1a494201baf9e8bd
2018-12-11 14:13:44 -08:00
Toby Sargeant
7dee65518e Merge "[webview] Add a force dark WebSetting" 2018-12-06 23:04:51 +00:00
Tobias Sargeant
fec405a35a [webview] Add a force dark WebSetting
Force dark mode is a tristate:

- never invert colours for webview content
- always invert colours
- follow the parent view behaviour

Test: CTS test, after WebView implementation.
Bug: 120599879
Change-Id: Ib11358bc3a3cbc5e55c0ec184084c7d205acf60c
2018-12-06 18:57:32 +00:00
Nate Fischer
7198156c27 Merge "WebView: remove unused Token Binding system APIs" 2018-12-06 03:57:54 +00:00
Nate Fischer
eb667e66eb WebView: remove unused Token Binding system APIs
These APIs never really launched, and the Token Binding protocol is no
longer supported by the chromium team (which means these APIs have been
broken for some time).

This removes most of the TokenBinding API surface, keeping (and
deprecating) just enough to allow us to still compile and run WebView
APKs.

Bug: 119576150
Test: make update-api
Change-Id: Ia5a4258aac5ed21691ea36a428b4aa7195ff21ca
2018-12-04 17:32:12 -08:00
Felipe Leme
bf01eeafa0 Set WebView as important for Content Capture.
Test: echo 'In TreeHugger we trust!'
Bug: 111276913

Change-Id: I28c4691c9b4adb8163eaff15f7e498f637a162ad
2018-11-26 15:54:08 -08:00
Felipe Leme
92ab3857b0 Simplified View.onProvideContentCaptureStructure()
That method was returning a boolean to indicate whether the IntelligenceManager
should be notify, so views with virtual hierarchy could return false.

But now it returns void and always notify, which makes the API easier to
understand and use.

Bug: 117944706

Test: m -j update-api doc-comment-check-docs
Test: atest CtsAutoFillServiceTestCases

Change-Id: I216cacb6edb144239b6eabe56ab177fc2582e1aa
2018-11-16 09:19:37 -08:00
Felipe Leme
1b0e7e816c Implemented WebView.onProvideContentCaptureStructure()
Bug: 117944706
Test: m -j update-api

Change-Id: I2ad56873bae314b7bf66aa123a8ae47eecb7af2e
2018-11-13 16:22:25 -08:00
John Reck
8884cfc13e Merge "Rename & package shuffle" 2018-10-23 20:02:00 +00:00
Nate Fischer
69d7e2e9e1 WebView: fix mistaken wording in API doc
In http://ag/5298658, I said this constant is only used when apps have a
targetSdkVersion (strictly) greater than Q. I actually meant "greater
than or equal to."

This CL changes the wording to "is at least," which is both correct and
concise.

Bug: 117470538
Test: N/A
Change-Id: I8c2e016a7b26ce2ff406c433cc6071eb9d887753
2018-10-18 19:20:26 -07:00
TreeHugger Robot
dc315fd243 Merge "WebView: add new integer for billing threats" 2018-10-18 19:50:08 +00:00
Nate Fischer
f9a235316c WebView: add new integer for billing threats
No change to logic, this adds a new integer constant for Safe Browsing
billing threats.

This also adds ending periods in the docs for existing threat types.

Bug: 117470538
Test: N/A
Change-Id: I5368601efc7d587af1f530b7bf2825f277424082
2018-10-17 20:30:54 -07:00
John Reck
32f140aa67 Rename & package shuffle
Rename DisplayListCanvas -> RecordingCanvas
Move RecordingCanvas to android.graphics
Move RenderNode to android.graphics

Bug: 112709971
Test: make & boot
Change-Id: Iddeb6a89f8923ea81a1f37bbee4e9b1db8ede238
2018-10-04 16:18:12 -07:00
Nate Fischer
1e13fae31c WebView: deprecate accidentally-exposed constructors
This deprecates public-exposed constructors. These constructors were
exposed by accident. These classes shouldn't be instantiated by
applications, but should only be instantiated by WebView.

In some cases, the app should get a singleton instance using
a #getInstance method. In these cases, we document this explicitly in
the deprecation note.

Bug: 110807530
Test: make docs, manually verify docs look good.
Change-Id: Ibe73b3399c9ced0cf4fbb01e1df13564476df252
2018-09-25 19:13:57 -07:00
Nate Fischer
c1de7208ba Merge "WebView: fix TracingController example usage" into pi-dev am: 679e58a8d3
am: fc5c86fda8

Change-Id: Ib44310caef4c52c697307f345dbbf95d30647b0f
2018-09-20 14:02:58 -07:00
Nate Fischer
fc5c86fda8 Merge "WebView: fix TracingController example usage" into pi-dev
am: 679e58a8d3

Change-Id: I72c29fdc11925668a781bbff355fc1c429c2a888
2018-09-20 13:30:49 -07:00
TreeHugger Robot
679e58a8d3 Merge "WebView: fix TracingController example usage" into pi-dev 2018-09-20 18:57:55 +00:00
Nate Fischer
9e39bf1067 WebView: fix TracingController example usage
This fixes a minor mistake in the TracingController class usage. The
example previously used a bare `CATEGORIES_WEB_DEVELOPER` instead of
`TracingConfig.CATEGORIES_WEB_DEVELOPER`.

Bug: 116227333
Test: make docs
Change-Id: I648dd0d5e61666e61adb27303c185013bd80b0ea
2018-09-20 18:17:05 +00:00
Nate Fischer
d75020c65f Merge "WebView: fix SafeBrowsingResponse javadoc bug" into pi-dev am: 62348dad3e
am: 14b2b5f1da

Change-Id: I01e89bf78921bda60ecb100e8d0b45a2c8599688
2018-09-13 15:52:31 -07:00
Nate Fischer
14b2b5f1da Merge "WebView: fix SafeBrowsingResponse javadoc bug" into pi-dev
am: 62348dad3e

Change-Id: Id256658eb343fee58eb4cce2435b03a325d7c3ec
2018-09-13 15:41:35 -07:00
Nate Fischer
211d6159b9 WebView: fix SafeBrowsingResponse javadoc bug
No change to logic, only minor javadoc change.

This fixes javadoc in SafeBrowsingResponse.java. Previously, the first
(and only) sentence did not end in a period (it ended with a quote
character). The Android javadoc parser doesn't handle this well--it
requires a period followed immediately by some whitespace character.

This wasn't a big issue because this was the only sentence. However, if
we ever add a second sentence, both sentences will appear as the
one-line "synopsis doc" for the methods.

See http://go/android-api-guidelines#heading=h.teqny5h9ohqc for details.

Bug: 115441402
Test: make docs
Change-Id: Ic363ed1ecf3d169d598ae85d55297d0a520a6604
2018-09-12 17:26:41 -07:00
TreeHugger Robot
94da778113 Merge "Simplify WebView RELRO creation and handle more cases." 2018-09-12 21:36:36 +00:00
Mathew Inwood
4ef06935d8 Merge "Add @UnsupportedAppUsage annotations" am: 9513a9e215
am: 5e2a54ab19

Change-Id: Iab4a59a3cdc6aa5387b015f749713538ad66c9db
2018-08-20 11:44:32 -07:00