Commit Graph

3487 Commits

Author SHA1 Message Date
Jeff Sharkey
f383c24749 Unbreak even more APK 26 apps running on "O" preview/beta builds.
Bug: 38391358
Test: builds
Change-Id: Ic48f9cb53da3ed8241e5d40d3096304ee4dfebd2
2017-05-17 17:53:38 -06:00
Andrew Solovay
51142577ab docs: Changing "http" to "https" in Javadoc examples
Several of the Javadoc comments had code snippets that used "http"
web addresses (e.g. "http://example.com"). Our style heavily
recommends using https whenever possible; in addition, this caused
the generated Javadoc files to fail presubmit checks when we try
to migrate them to Piper (see, e.g., http://cl/155212684)

In addition, one code snipped used (as an example) a link to
http://slashdot.org/ ; we really shouldn't be using links to real
websited (that we don't control) unless we absolutely have to.

I changed all the examples to "https://example.com/" ; I've verified
that that's a valid URL (they've got a good certificate).

Generated the doc and staged it to:
go/dac-stage/reference/android/webkit/WebView.html

Test: make ds-docs
Bug: 37996959
Change-Id: Id8e44930b107b94022376a260892ed867ba281fc
2017-05-05 17:09:46 -07:00
Tima Vaisburd
5544f6c63b Hide onMovedToDisplay for WebView
Bug: 37724053
Test: Not needed
Change-Id: Ic6decc3be65e6b16f8fb42149f3e0798e855d4b7
2017-04-27 14:24:24 -07:00
Tima Vaisburd
2240ea6448 Hide getTextClassifier and setTextClassifier for WebView
Bug: 37724053
Test: Not needed, these methods have not been implemented.
Change-Id: I43c97cb13e80eeb13d53123a22230d5934b8a60d
2017-04-26 21:59:12 -07:00
Gustav Sennton
3202c10207 Merge "Explicitly wait for the WebView Zygote." into oc-dev 2017-04-25 16:05:58 +00:00
Gustav Sennton
833813cecc Explicitly wait for the WebView Zygote.
There is a time-window during which the WebViewZygote service has
started, but can't be connected to. To avoid crashing during this
time-window we add a retry-loop in this CL to explicitly initiate a
connection to the Zygote.

Bug: 36687066
Test: gts-tradefed run gts --module GtsWebViewHostTestCases
Change-Id: Ia58a3342cd4e149621ba6b4aaf926e7b53c06d8f
2017-04-24 16:08:39 +01:00
Abodunrinwa Toki
3f3354e087 Undeprecate WebView.findAddress
Reverts I772961bd20bff4817a060f14a843abeceb55ac92
Until we bring back TextClassifier.getLinks
See I275a9d055ef0ab68f3ca339c37ee939257c4bd54

Test: none
Bug: 22362008
Bug: 37565246
Change-Id: I2948f22cf4c3462491f47376af48624697703969
2017-04-24 14:41:14 +00:00
Selim Gurun
9858e5372a Deprecate findAddress() method
FindAddress method only ever worked on US addresses and being a part
of WebView API, it required the users that did not use WebView otherwise
to pay a heavy penalty. Further, it was also used by Linkify.

The new way to find addresses is using TextClassifier.

Bug: 22362008
Test: WebView.findAddress.

Change-Id: I772961bd20bff4817a060f14a843abeceb55ac92
2017-04-11 11:18:49 -07:00
Selim Gurun
ec0a1f2599 Add an API to enable disable safebrowsing in WebView
WebView safebrowsing can be opted in using a manifest value. However,
we also need to control individual WebViews.

Bug:37158813
Test: See change I71e813bccc2fab73d100384661128c7311dd396c

Change-Id: I647dc304787d6406691b5cbadf1c9a4f13ac5604
2017-04-07 18:46:18 -07:00
Tima Vaisburd
134752b471 Added onMovedToDisplay method to WebView
Delegate the action to WebViewProvider, by default it is no-op.

Bug: 36006397
Test: There is no implementation yet to test.
Change-Id: Ib5101d3669a92ae81cfb34cc5db607c374712a3d
2017-04-06 15:50:05 -07:00
Selim Gurun
13e5b0bb97 Disable WebView autocomplete feature.
Platform is now providing autofill feature. Disable WebView's simple
form data save feature for platform O and above.

Test: Removing the functionality and the test
Bug: 36869838

Change-Id: If6b9fc12edbe4146fca99d9c6ef8fde36d61f852
2017-04-04 10:19:28 -07:00
TreeHugger Robot
4d558930c8 Merge "Created an HtmlInfo object on ViewStructure." into oc-dev 2017-04-01 02:34:03 +00:00
TreeHugger Robot
c7f474668e Merge "Override View.autofill() method and call into ViewDelegate" into oc-dev 2017-03-31 02:57:38 +00:00
Philip P. Moltmann
81192b40de Rename autoFillHint to autoFillHints.
Fixes: 35364993
Test: cts-tradefed run cts-dev -m CtsAutoFillServiceTestCases
Change-Id: I65a4c2c65563e7bbd60c4e99c8800b0b11af2300
(cherry picked from commit feb3299ed5)
2017-03-30 23:45:33 +00:00
Tao Bai
a5717331d1 Override View.autofill() method and call into ViewDelegate
BUG: 36787841

Test: this just forwards api call.
Change-Id: Ie2c9675e5a7ee2ed2a7997d1270cf388571a855b
2017-03-30 15:02:53 -07:00
Felipe Leme
25bf787ffb Created an HtmlInfo object on ViewStructure.
The ViewStructure typically represents a View, but it it can also be a virtual
view; in particular, WebView uses virtual views to represent HTML elements.

Although most of the properties of the HTML element maps to properties of
Android Views, some properties (such as 'name' and 'id' on <INPUT> fields)
don't, and those are crucial for autofilling web pages.

Rather than trying to artificially map these properties, it's better to create
a generic representation, for the following reasons:

1. Web standards move in a different velocity than Android APIs
2. Android APIs cannot be changed easily. Deprecated APIs continue to work,
   and new added APIs don't work in older versions
3. The data used for autofill is opaque to the Framework - it's only relevant
   to the node producers (like WebView) and consumers (Autofill services).

Also removed the setIdEntry() that was used for the same purpose.

Fixes: 36696757
Bug: 36718508
Test: VirtualContainerActivityTest with new checks pass

Change-Id: Ia626bd1f640b0b5861e81a5915504b95029874c9
2017-03-30 14:24:05 -07:00
Tima Vaisburd
cf49a23b3c TextClassifier: add API to WebView
Delegate the actions to WebViewProvider, by default they are no-ops.

Bug: 34780392
Test: Existing tests should be enough
Change-Id: Iefb1045b44a6e8cee5d1cc2c9b194b392d33f36d
2017-03-28 14:24:16 -07:00
Torne (Richard Coles)
0452670374 Support loading a stub WebView using a donor package.
Support loading a WebView package which specifies the name of a "donor"
that provides missing files. This allows a preinstalled stub WebView to
function by loading its code and assets from the preinstalled Monochrome
implementation, as long as the versions are close enough that the
manifest contents are compatible, which should be fine since
preinstalled versions will match.

To do this, we replace the stub's code paths in AppplicationInfo with
the donor's, so that all Java and native code and resources are loaded
from the donor APK at runtime instead of from the (mostly empty) stub.

To get the ClassLoader with the modified path cached as if it was the
regular path, we introduce a new "cacheKey" parameter in
ApplicationLoaders.

Bug: 21643067
Test: build "new" stub WebView upstream in chromium and test loading
Change-Id: I08cc9122b1c9def3e1206974f3e0e8973cca3419
2017-03-28 16:21:10 +00:00
Gustav Sennton
f05f99b910 Post WebView Zygote connection code to a background thread.
Currently, the act of waiting for the WebView Zygote to start running,
and then connecting to it is run in a blocking way from
WebViewZygote.onWebViewProviderChanged(). This causes us to block large
parts of WebViewUpdateService for a long time whenever we change WebView
provider.
This CL moves the blocking code onto a background thread to unblock
WebViewUpdateService.

Bug: 35025131
Test: Ensure changing WebView provider from the WebView Implementation
Developer Setting is quick/responsive.
Test: Turn off WebView multi-process and ensure the WebView Zygote
Service is NOT started.
Test: Turn on WebView multi-process and ensure the WebView Zygote
Service is started.

Change-Id: I0b378a471491d40cbf027568ca317d6c080da4b2
2017-03-24 12:36:12 +00:00
TreeHugger Robot
709ff779e6 Merge "Improved WebView -> ViewStructure mapping for Autofill." 2017-03-21 19:49:43 +00:00
Felipe Leme
1a1e4687e4 Improved WebView -> ViewStructure mapping for Autofill.
Added setIdEntry() on ViewStructure and documented how WebView can map HTML
tags and attributes into ViewStructure.

Test: VirtualContainerActivityTest pass
Test: m update-api
Bug: 36056207

Change-Id: Idaee9612d2c1b1adac99f354c8f87137ee9ef877
2017-03-20 17:54:33 -07:00
Robert Sesek
450b55bbd9 Do not allow WebView instantiation from privileged processes.
Test: Patched in CL on bug, got UnsupportedOperationException
Bug: 36077109
Change-Id: I01dba02407dd7b1ea1ce22f0023f8882e1e96dae
2017-03-16 18:18:13 -04:00
TreeHugger Robot
642028fccd Merge "Replaced auto-fill by autofill to keep it consistent with API style." 2017-03-10 07:05:41 +00:00
Nate Fischer
f7683a6f17 Merge "Add WebView Safe Browsing error code" 2017-03-09 22:14:31 +00:00
Felipe Leme
640f30a776 Replaced auto-fill by autofill to keep it consistent with API style.
This change will affects 2 types of apps: autofill service implementations
and apps that use autofill APIs.

Since just the former is known to be used at the moment, we're not trying
to keep backward compatibility with the latter.

Bug: 35956626
Test: CtsAutoFillServiceTestCases pass
Test: android.provider.SettingsBackupTest pass

Change-Id: Ia720083508716deae9e887f9faa7ae7c5a82f471
2017-03-09 08:14:49 -08:00
Felipe Leme
d04a697ede Optimize ViewStructure for autofill by removing irrelevant nodes.
Test: CtsAutoFillServiceTestCases (with new tests) pass
Fixes: 35840787

Change-Id: Iaa2c1907c8383b4a820fd7204e67fa2d276ad2b8
2017-03-08 13:31:38 -08:00
Gustav Sennton
4cbfe71bba Update WebView.getCurrentWebViewPackage documentation.
Explain when a WebView implementation change can occur, and what happens
when it occurs.

Bug: 35764852
Test: None (java-doc change).
Change-Id: I2d2bcccc2f16bc911636373bb47c64d846f15b2d
2017-03-07 14:33:13 +00:00
Nate Fischer
3c7c937060 Add WebView Safe Browsing error code
This adds a Safe Browsing specific network error code for WebView. This
will be returned when we cancel page load because the end user has
clicked "Back to safety" on an interstitial page, the WebView is too
small to display a readable interstitial page, or other similar cases.

When this is used due to an unsafe subresource, the error passed to
WebViewClient#OnReceivedError() will be associated with that specific
resource, not the main frame.

Bug: 36007752
Test: N/A
Change-Id: I8b149a9d6e4ed113de0dd8ee051a2934af477128
2017-03-06 18:25:07 -08:00
Dimitry Ivanov
638d810099 Add isBundled argument to LoadedApk.makePaths call
There is a disconnect between the way webview created
classloader and the way makePaths decides if paths are
intended for bundled app.

This change moves decision making out of makePaths method
which allows WebViewZygote to pass correct argument and
have makePath omit java.library.path for libPaths

Bug: http://b/35426785
Test: manual
Change-Id: Iab5a18c0091d0193dafa750498eb00f378411ba0
2017-02-22 23:52:01 -08:00
Gustav Sennton
f9295bcc24 Merge "Make sure we cannot use packages targeting pre-O as WebView packages." 2017-02-02 14:34:04 +00:00
Gustav Sennton
564c2fd5db Make sure we cannot use packages targeting pre-O as WebView packages.
Using a WebView package targeting a release before O as WebView provider
on O will cause crashes (because of incompatibility issues), this CL
makes us interpret a package targeting a pre-O release as being invalid
on O.

Also remove the code that lets us fall back to loading the old
WebViewChromiumFactoryProvider (pre-O) class.

Bug: 34773740
Bug: 34180497
Test: Ensure WebView provider with targetSdkVersion="O" shows up in the
WebView Implementation Dev Setting, ensure targetSdkVersion=25 doesn't
show up.
Test: Add WVUS unit test to ensure a packages with targetSdkVersion < 26
are considered invalid, and > 26 are valid. Run WVUS unit tests.

Change-Id: I4d80d46019e2522bc3fc6068712d28eedb31fcce
2017-02-01 13:59:26 +00:00
Tao Bai
dd264f69ed WebView: Revise the behavior of crash handle API
To make backward compatible, kills application when render process
is killed by system.

Bug: 30824898
Test: No test, this is document revision.
Change-Id: I12862ee9ed1986ec274fe627782542e8d8414856
2017-01-31 11:02:08 -08:00
Richard Coles
2536cc6872 Merge "Expose isMultiProcessEnabled via WebViewDelegate." 2017-01-23 21:23:45 +00:00
TreeHugger Robot
eeb4e1d219 Merge "Change WebView fallback mechanism to consider all users' package states." 2017-01-23 20:20:15 +00:00
Torne (Richard Coles)
b26428b3c2 Expose isMultiProcessEnabled via WebViewDelegate.
Allow the WebView implementation to call isMultiProcessEnabled via the
delegate, so that it doesn't have to fetch and interpret the value of
the system setting itself.

Bug: 21643067
Test: manual (requires modifications to chromium to call)
Change-Id: I1ef2b7ea0054c606965040e02034c938d5e6464c
2017-01-23 15:09:55 +00:00
Gustav Sennton
364e160290 Change WebView fallback mechanism to consider all users' package states.
MultiProcess WebView will use a Service to start a separate process (the
renderer process). This Service can only be started if the WebView
package is enabled for the current user. To ensure that the current
WebView package is usable by all users on a single device we now only
use a WebView package as WebView implementation if that package is
enabled and installed for all user on the device. This also means that
the WebView-fallback mechanism will trigger when disabling the primary
WebView package for any user (not just the system user).

Also add multi-user unit tests to cover this new change.

Bug: 32894152
Test: run unit tests in WebViewUpdateServiceTest
Test: ensure the standalone WebView package becomes enabled (for all
device users) when disabling Chrome for a secondary user.
Test: load WebView (both using Monochrome, and using the standalone
WebView).

Change-Id: Iad3fc48aa50273062c2f29ae48a343c2dea38116
2017-01-23 09:30:11 +00:00
Tobias Sargeant
d10e4af098 WebView: Add the definition of the renderer importance API.
The renderer importance API is used to specify how important
out-of-process WebView renderer services are for the purposes of OOM
killing and scheduling with respect to the binding application.

This allows an application to - for example - specify that renderers can
be killed while the application is not in the foreground, thus cleaning
up additional resources.

Bug: 30824898
Test: Tests await Chromium change.
Change-Id: I6dca3d427d6cdb5cb7e0be6f7fb8ece64bd24af9
2017-01-22 18:59:12 +00:00
TreeHugger Robot
9ecde44945 Merge "Handle multiprocess flag in WebView update service." 2017-01-18 15:19:43 +00:00
Torne (Richard Coles)
1a4c4e3539 Handle multiprocess flag in WebView update service.
Instead of letting DevelopmentSettings manage the setting directly and
observing the changes from WebViewUpdateService, have the update service
manage the setting and just expose IPCs for the settings app to use to
get/set the setting. This means we can set a more flexible policy for
whether multiprocess is enabled by default and change it without
touching the settings code, though for now this CL does not change the
behaviour and is just a refactoring.

Bug: 21643067
Test: Toggle multiprocess WebView in developer settings
Change-Id: I3057c09d99f5f6f472a5195a8e14e9164ea5733a
2017-01-12 14:23:17 +00:00
Tao Bai
fe0c0e05be Merge "Load WebViewChromiumFactoryProviderForO" 2017-01-11 19:01:25 +00:00
Felipe Leme
6d553874be YAMAFFR - Yet Another Major AutoFill Framework Refactoring
- Explicitly split View methods into Assist and AutoFill methods, rather
  than use an overloaded method that takes flags.
- Simarly, renamed ASSIST_FLAG_SANITIZED_TEXT and
  ASSIST_FLAG_NON_SANITIZED_TEXT flags to
  AUTO_FILL_FLAG_TYPE_FILL and AUTO_FILL_FLAG_TYPE_SAVE respectively.
- Created a AutoFillUI class to host the auto-fill bar and other UI
  affordances.
- Moved the temporary notifications to AutoFillUI (eventually that
  class will host the real UI).
- Moved FillData to android.app.view.autofill package.
- Split IAutoFillCallback in 2 (IAutoFillAppCallback and
  IAutoFillServerCallback, residing at the app and system_server
  respectively), so service cannot fill the app directly (which lets
  the framework control the UI).
- Moved assist's IResultReceiver to AutoFillServiceImpl so
  system_server can act as a mediator between the AutoFillService
  implementation and the app being auto-filled.
- Replaced FillData and FillableInputFields by a bunch of new objects:
  - FillResponse contains a group of Datasets, each representing
  different values
    that can be used to auto-fill an activity (for example, different
    user accounts), optional id of fields the service is interested
    to save, and an optional bundle for service-side extras.
  - Dataset contains a name, Fields, and an optional bundle for
    service-side extras.
  - Fields contain an AutoFillId (parcelable) and a value (Bundle)
- Changed the temporary notifications to emulate the new workflow:
  - Initial notification requests the auto-fill data but do not
    auto-fill.
  - Once service calls back, a new notification is shown with the
    results.
  - Then if the user selects a dataset, the activity is auto-filled
    with it.
  - It also shows a notification to emulate what can be saved.
- Created an VirtualViewDelegate for views that uses a virtual
  hierarchy for assist data.
- Added new methods on ViewStructure to add children with virtual ids.
- Added 2 methods on View to support auto-fill:
  - autoFill(Bundle) to auto-fill the view.
  - getAutoFillType() to return how the view can be auto-filled.
- AutoFillType defines the input fields that support auto-fill:
  - Text fields (like EditText)
  - Toggle fields (like CheckBox)
  - Lists (like RadioGroup)
- AutoFillType can also have a sub-type representing its semantic (for
  now only text fields have it, and it's the same as getInputType()).
- etc :-)

Bug: 31001899
Test: manual verification
Change-Id: I2dd2fdedcb3ecd1e4403f9c32fa644cb914e186f
2017-01-10 12:50:47 -08:00
Tao Bai
755eded053 Load WebViewChromiumFactoryProviderForO
BUG: 34180497
Test: change the name of class to load.

Change-Id: I586e83242d380b1def88de605a4e9dee375c87b2
2017-01-10 11:07:18 -08:00
Robert Sesek
c99a9e0a45 Merge "Synchronize access to WebViewZygote." am: fd6f631de5 am: c8111e07d0 am: 2c3818158a
am: 8be4cfc638

Change-Id: I31e7f0e75173e79e42ec9ce8703e7fd40f39c31a
2017-01-05 09:50:05 +00:00
Robert Sesek
8be4cfc638 Merge "Synchronize access to WebViewZygote." am: fd6f631de5 am: c8111e07d0
am: 2c3818158a

Change-Id: Ib6afc79a3905a68fa92d5ff9389752724a77d305
2017-01-05 09:43:53 +00:00
Tao Bai
2bb0099b0a Merge "WebView: Add the definition of crash API." 2017-01-04 18:08:28 +00:00
Robert Sesek
89cc5205b3 Synchronize access to WebViewZygote.
The onWebViewProviderChanged callback can be entered from a binder thread,
rather than the system_server main thread. This could lead to races when
managing the webview_zygote.

Test: m
Test: Turn on Multiprocess WebView, install a new WebView provider, then
      instantiate a new WebView. The new WebView should load (note that
      this is racy so may require multiple attempts to test).

Bug: 21643067
Change-Id: I28512906c38e073d4e3d39a2f2b30dcbb50c85ff
2017-01-03 19:31:44 -05:00
Tao Bai
c53fae1001 WebView: Add the definition of crash API.
Bug: 30824898
Test: There is no test yet, this patch just add the defintion of API,
 and make it easy to work on chromium side.

Change-Id: I7fdaf894f18cc8bad8e84465e4a0390b22f8bba8
2016-12-16 10:33:37 -08:00
Felipe Leme
1ca634a544 AutoFill Framework refactoring.
The AutoFill Framework uses the same AssitStructure provided by the Assist API
and so far it was using the same methods as well, both internally and externally
(public API).

Sharing that internal code internally is fine, but the public APIs must distinguish between the 2 cases so they can fill the assist structures accordingly (although the initial implementation still shares the same logic).

This CL also splits the original 'auto-fill' request in 2 types of requests,
which are set by View flags:

- ASSIST_FLAG_SANITIZED_TEXT
- ASSIST_FLAG_NON_SANITIZED_TEXT

It also added new methods and callbacks to handle save requests.

Bug: 31001899
Test: manual verification

Change-Id:  I4eb09099dc19a43cb7e053e64d939aed3704b410
2016-12-12 18:22:45 -08:00
Robert Sesek
e4ddf44967 Merge "Add new hostingType for startProcessLocked() that selects using the WebViewZygote." am: eda1af611f am: bbcd9d26b1 am: 5806963539
am: 5c44250176

Change-Id: Ia1a819697d7144073f824a98dd8a315eb60c779b
2016-12-02 17:43:56 +00:00
Robert Sesek
5c44250176 Merge "Add new hostingType for startProcessLocked() that selects using the WebViewZygote." am: eda1af611f am: bbcd9d26b1
am: 5806963539

Change-Id: Ic0e53ed482fb27dfab2bb8de52bfe8947beae866
2016-12-02 17:36:21 +00:00