No change to logic, only an annotation change.
startSafeBrowsing() should never receive a null Context. This adds
@NonNull to hint to developers not to pass null Contexts.
Test: N/A
Change-Id: I46d863047bf7563ea2a1adf592f3f381be95ca49
This relaxes URLUtil#isFileUrl() to accept a prefix of "file:" instead
of requiring "file://". Chromium treats "file:path" as if the user had
typed "file:///path". An app may incorrectly believe it's safe to load
anything that URLUtil#isFileUrl() rejects, intending to refuse all URLs
which point to the file system.
Bug: 72848579
Test: cts-tradefed run cts -m CtsWebkitTestCases -t android.webkit.cts.URLUtilTest#testIsFileUrl
Change-Id: I7b3bba961523d4bdda6169a0f50fe7f1d1579e38
During boot, WebViewZygote.setMultiprocessEnabled() is called by the
WebView initialization logic. Starting the WebViewZygote here causes a
slowdown in the system_server boot process, so delay launching the
zygote until it is needed.
Previously the webview_zygote was launched by init, and merely
connecting to it in the boot process didn't have significant overhead.
Bug: 73743583
Bug: 63749735
Test: Boot a device, verify that webview_zygote process is not running.
Test: Launch "Third-party licenses" activity from Settings, and it
renders correctly via the WebView.
Change-Id: I1352a5df95e4a793ac64862c439ba2573ddd2d18
Now that the WebView zygote is a child of the system zygote it has the
smae address space layout and can use the existing WebView native
library RELRO file.
Preload the native library using the RELRO file in the zygote, to share
this data with applications which are using WebView. This can save up to
1-2MB of dirty memory, replacing it with clean pages that are shared
with more processes and thus have a smaller impact on PSS.
Bug: 63749735
Test: CtsWebkitTests
Change-Id: I7ce670f5fcddae9e98631e21329840ef3ad52f9a
No change to logic, documentation change only.
This changes "URL" to "host" everywhere in this API documentation.
This API never accepted a list of URLs, it only ever accepted a list of
hosts (e.g. "www.google.com" is ok, "http://www.google.com/" is not).
The original documentation was misleading.
Test: make docs (manually verify)
Change-Id: I3b57a2a160ff00ba8f92b30f6e3b4399e55f2ea0
Pass the library file name to WebViewLibraryLoader.loadNativeLibrary
instead of passing the ApplicationInfo, which was only used to look the
native library file name up. This will allow loadNativeLibrary to be
called from the webview zygote, which doesn't have the ApplicationInfo
available.
Bug: 63749735
Test: CtsWebkitTests
Change-Id: I0bd2de38cd1a0112bbeee6225563d4d0add048e7
This uses the new ZygoteProcess.startChildZygote() method to launch the
webview_zygote, rather than having init start it. This will share more
memory between the app_process and the webview_zygote, reducing the
overall system footprint.
Bug: 63749735
Test: m
Test: Launch "Third-party licenses" activity from Settings, and it
renders correctly via the WebView.
Change-Id: I3e39cd8adb9c099c92ee34640428916d90cb2b8f
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
Merged-In: I5e1409358d935e1c9f325db434bc6d4ef8ead759
Fixes: 65574359
Test: launch anything that uses WebView
(cherry picked from commit 4fd8aa51e4)
Address comments from the API council regarding the WebView Tracing API.
android.webkit.TracingController:
* start() throws IllegalStateException if the system is already tracing
(this is instead of returning false)
* stop uses Executor instead of Handler
* removed stop() (the method w/o arguments)
* renamed stopAndFlush to stop
* use OutputStream instead of a custom callback interface TracingOutputStream
* dropped requirement for UI threading
* updated documentation
android.webkit.TracingFileOutputStream:
* removed the TracingFileOutputStream file completely (functionality
replaced by the existing FileOutputStream)
android.webkit.TracingConfig:
* removed example with CATEGORIES_NONE and “-input,-gpu”.
* customCategories are List<String> instead of String
* updated documentation
* added two more predefined categories: CATEGORIES_ALL,
CATEGORIES_ANDROID_WEBVIEW
* some refactoring, added a Builder class
* ensure that only include category patterns can be specified
* uniform addCategories interface for construction
* predefined category sets are a bitmask now
BUG: 71584598,71584599,63750258
Test: CTS
Change-Id: I615ef5f43d26968329182b09e7c26178f1f85ecc
Update the javadoc for the WebView data directory methods to make it
more clear in what cases these APIs should be used, and what limitations
apply to applications with multiple data directories.
Bug: 63748219
Test: n/a
Change-Id: I98f49c7a75df00aedf2472731b915c3e30e6ba13
Some WebView APIs contain checks ensuring apps only use WebView APIs
from one single thread. The WebView Support Library should perform
similar thread checks. To do so we publish an API to get the WebView
thread, so that the support library knows which thread to check against.
Test: Ran the corresponding CTS tests.
Bug: 38220806
Change-Id: Ibab878e211d9594df6d39f99ce130e28fac7f019
No change to behavior, only docs change.
The docs for setAllow(File|Universal)AccessFromFileUrls were previously
wrong. They implied that:
* Default value is 'false' when SDK_INT > Jellybean
* APIs were added in Jellybean (so they can't be called pre-Jellybean)
* Therefore, setAllow*AccessFromFileUrls(false) is always a NOOP
Actually, WebView examines targetSdk, not SDK_INT. So apps should call
setAllow*AccessFromFileUrls(false) when targeting ICE_CREAM_SANDWICH_MR1
and below.
The docs previously had mixed use of ICE_CREAM_SANDWICH and
ICE_CREAM_SANDWICH_MR1. This corrects the docs to use the right one
(ICE_CREAM_SANDWICH_MR1).
Lastly, this fixes a minor grammar mistake (misplaced comma).
Test: make docs (manually verify)
Change-Id: I206dff54a8c342ae7b47bd40d69d0b01dbad3cc6
The WebView Support Library needs a way to hook into the WebView APK,
this new method returns a classloader that can be used to load internal
WebView classes.
The idea is to have this classloader be provided by the WebView APK
itself, so that the classes accessed from the classloader can be
filtered to avoid apps accidentally adding dependencies on internal
details of the WebView APK.
Test: N/A - cannot add CTS tests until we drop a WebView APK containing
the implementation for this API.
Bug: 38220806
Change-Id: If744a740ff0b1728d2d4674e73697bc6a5e27dde
WebView Safe Browsing will be on by default. While previously it was
opt-in (applications needed to enable via manifest or API), now it is an
opt-out feature.
This CL updates documentation to mention that the feature is on by
default and provides steps for applications to opt-out if necessary.
This also makes the case of "Safe Browsing" consistent across
documentation.
Bug: 69579509
Test: make docs (manually verify)
Change-Id: I77683a684cd79d2e3cd313ddbff8c52fe510b72b
In an earlier release we had to allow disk reads during a part of
WebView initialization, now that this fault is fixed we can remove that
allowance.
Bug: 63324842
Test: Manual: ensure calling new WebView() doesn't cause StrictMode disk
read violation.
Test: run WebViewHostSideStartupTest.testStrictMode()
Change-Id: If7b4ad790c67469806c255427d86e5fd28d19f35
This stops calling findAddress (possibly indirectly via Linkify) from
loading webview native code, resulting in a performance and memory
improvement for those apps that call WebView#findAddress but do not
otherwise use WebView.
Bug: 22362008
Test: Existing WebView CTS test.
Change-Id: I5fcab725ceaf0d6a00e931d3b6cd2f3799d68391
Docs change only, no change to logic.
This CL provides a better loadData() example, using base64 encoding.
This uses the Base64 class already provided by Android to automatically
handle the encoding.
This also changes the percent-encoding docs to:
* Link to the official RFC
* No longer provide examples of characters to encode (one example was
incorrect, '\' is not %27)
Bug: 70555565
Test: make docs (manually verify things look good)
Test: I built a sample app and tested Base64#encodetoString to make sure the flags are correct
Change-Id: If9f810e6b568efdc5d1ad84ac64f2abf3788f40b
We are currently storing WebView package signatures as Strings in
WebViewProviderInfo, represent these as Signatures instead.
Bug: 62429931
Test: start WebView app + run WebViewTest GTS tests + WVUS tests
Change-Id: I910db133cd147b44b4b1c63921308d82db44e5b3
Currently, process start is initiated in ActivityManagerService
holding the main lock and this takes ~40ms to complete. As seen
in some of the issues in previous releases, this is one of the
contributors of the lock contention in system_server. This change
tries to address this issue by moving the process start outside
the locked section.
When a process start is required, instead of doing it synchronously,
this request will be posted on a handler thread. On the handler thread,
this process start request will be completed without holding a lock.
If for some reason, we decide the process is not needed anymore before
it is actually started or being started, then AMS does everything as
usual removing the references to the process from internal state except
actually killing the process which will be handled on the handler
thread.
Bug: 68775202
Test: Ran app startup perf tests using forrest, will update the bug with results.
Test: https://docs.google.com/spreadsheets/d/1cW81guRALZXKsN-WZsKyQiCSY-RgkJ2m_M9IfqIquz8
Test: cts-tradefed run singleCommand cts-dev -m CtsActivityManagerDeviceTestCases
Test: cts-tradefed run singleCommand cts-dev -m CtsWindowManagerDeviceTestCases
Test: cts-tradefed run singleCommand cts-dev -m CtsAppTestCases
Test: cts-tradefed run singleCommand cts-dev -m CtsMultiUserHostTestCases
Test: adb shell am instrument -e package com.android.server.am -w \
com.android.frameworks.servicestests/android.support.test.runner.AndroidJUnitRunner
Test: adb shell am instrument -e class com.android.server.pm.UserManagerTest -w \
com.android.frameworks.servicestests/android.support.test.runner.AndroidJUnitRunner
Test: adb shell am instrument -e package android.content -w \
com.android.frameworks.coretests/android.support.test.runner.AndroidJUnitRunner
Test: cts-tradefed run singleCommand cts-dev -m CtsProviderTestCases
Test: cts-tradefed run singleCommand cts-dev -m CtsContentTestCases -t \
android.content.cts.ContentResolverTest
Test: cts-tradefed run singleCommand cts-dev -m CtsContentTestCases -t \
android.content.cts.ContentProviderTest
Test: cts-tradefed run singleCommand cts-dev -m CtsWebkitTestCases
Test: cts-tradefed run singleCommand cts-dev -m CtsHostsideWebViewTests
Test: cts-tradefed run singleCommand cts-dev -m CtsAssistTestCases
Test: make WebViewLoadingTests && make tradefed-all && tradefed.sh \
run template/local_min --template:map test=WebViewLoadingTests
Test: adb shell setprop wrap.com.google.android.apps.maps \
'"LIBC_DEBUG_MALLOC_OPTIONS=backtrace logwrapper"'
&& adb shell dumpsys meminfo --unreachable <PID_OF_APP>
&& check ppid of <APP> is logwrapper's pid.
Test: cts-tradefed run singleCommand cts-dev -m CtsWrapWrapNoDebugTestCases
Test: cts-tradefed run singleCommand cts-dev -m CtsWrapWrapDebugTestCases
Test: cts-tradefed run singleCommand cts-dev -m CtsWrapNoWrapTestCases
Test: cts-tradefed run singleCommand cts-dev -m CtsWrapWrapDebugMallocDebugTestCases
Test: manual
Change-Id: I1fe7ce48cd5a4aadccaf6b3d6fdb5cad3304f1d3
Add classes/interfaces necessary for the support of tracing API
in WebView.
In particular:
- TracingController: singleton class for starting and stopping
tracing and inspecting tracing status.
- TracingConfig: holds tracing configuration, such as categories
to filter and the tracing mode.
- TracingOutputStream: interface for capturing tracing data.
- TracingFileOutputStream: supporting class for capturing tracing
data to a file.
BUG: 63750258
Test: in progress
Change-Id: I7decd486788766fc8dfa766ae027c02f9d4c6f80
Add WebView.setDataDirectory(String suffix) and WebView.disableWebView()
interfaces. These will enable applications to better control the use of
WebView when running multiple processes, since it's not safe for more
than one process in an app to use the same data directory.
disableWebView is completely implemented in this change;
setDataDirectory will require WebView-side implementation changes to be
functional.
Bug: 63748219
Test: cts android.webkit.cts.WebViewDataDirTest
Change-Id: Ieff225dc99b6b3ca5f223c35f7a854f0c53692df
This change edits the WebView documentation to specify that the mimeType
parameter to loadData and loadDataWithBaseUrl should be a valid mimeType
and the data will be downloaded if it is not.
Test: manual - this only changes documentation
Bug: 70528830
Change-Id: I58ca4655673c6ccfe7547572579ef86a14a259ed
It turns the version code into almost a 64-bit integer, with the
new major part being the upper 32 bits.
The only tricky part about this is the backup manager, since it
stored 32-bit version codes in its backup data sets. This is dealt
with by, when the major version code is not 0, writing MIN_INT as
the version code and following that by the full long version code,
which we can detect when reading. Note that this makes backup sets
containing apps with major version codes incompatible with older
versions of the platform.
Bug: 64459786
Test: Added in Change-Id: Iab8a682b62103babd6c16a56b8dc1e97d7078658
Change-Id: Ibfffe235bbfcf358b3741abd3f7197fdb063d3f3
No change to behavior, only docs changes. No change to wording.
This linkifies ClientCertRequest method names in the docs for
WebViewClient#onReceivedClientCertRequest.
Test: make docs (looks good, no errors)
Change-Id: I1de855e8cdf91b3aace3a188aafaa9ac9f90ed2a
Update testTargetSdkVersionValidity to use the same minimum sdk as the
actual code it's testing.
Bug: 69554263
Test: run com.android.server.webkit.WebViewUpdateServiceTest tests.
Change-Id: Ide04ede774072a10b84a9726bdff536bfef12712
No change to logic, only docs changes.
This is mostly just formatting changes to documentation. Changes fall
into a few categories:
* Linkify ({@link}) or codify ({@code})
* Spelling errors
Test: make docs (looks better)
Change-Id: Ibcd762ab06e51451a53bbce5860cc137bee22ccf
Redirect developers to use the Support Library
versions of Fragments and Loaders to ensure that
they get consistent behavior across versions of
Android and all devices as well as access to
Lifecycle improvements.
Test: Confirmed APIs deprecated in current.txt
BUG: 68381801
Change-Id: I58ec599e557fc93c8547c45ba7c9ced96b0c8616