Profile
interface Profile
A Profile represents one browsing session for WebView.
You can have multiple profiles and each profile holds its own set of data. The creation and deletion of the Profile is being managed by ProfileStore.
Summary
Constants |
|
|---|---|
const String! |
DEFAULT_PROFILE_NAME = "Default"Represents the name of the default profile which can't be deleted. |
Public functions |
|
|---|---|
Unit |
@RequiresFeature(name = WebViewFeature.CUSTOM_REQUEST_HEADERS, enforcement = "androidx.webkit.WebViewFeature#isFeatureSupported")Add a header for outgoing requests that match the given origin rules. |
Unit |
@RequiresFeature(name = WebViewFeature.ADD_QUIC_HINTS_V1, enforcement = "androidx.webkit.WebViewFeature#isFeatureSupported")This function is deprecated. This method is being renamed to |
Unit |
@RequiresFeature(name = WebViewFeature.CUSTOM_REQUEST_HEADERS, enforcement = "androidx.webkit.WebViewFeature#isFeatureSupported")Remove any currently set headers from being applied to network requests. |
Unit |
@RequiresFeature(name = WebViewFeature.CUSTOM_REQUEST_HEADERS, enforcement = "androidx.webkit.WebViewFeature#isFeatureSupported")Removes the specified headers from the set of headers attached to requests. |
Unit |
@RequiresFeature(name = WebViewFeature.CUSTOM_REQUEST_HEADERS, enforcement = "androidx.webkit.WebViewFeature#isFeatureSupported")Removes the specified header from the set of headers attached to requests. |
Unit |
@RequiresFeature(name = WebViewFeature.SET_MAX_PRERENDERS_V1, enforcement = "androidx.webkit.WebViewFeature#isFeatureSupported")Resets the max prerenders for the current profile session to system default. |
Unit |
@RequiresFeature(name = WebViewFeature.ENQUEUE_PRECONNECT, enforcement = "androidx.webkit.WebViewFeature#isFeatureSupported")Enqueue a network preconnect to occur once WebView has started up. |
CookieManager |
@AnyThreadReturns the profile's cookie manager. |
(Mutable)Set<String!> |
@RequiresFeature(name = WebViewFeature.CROSS_ORIGIN_ISOLATED_ALLOWLIST, enforcement = "androidx.webkit.WebViewFeature#isFeatureSupported")Get the current allowlist of origins, with explicitly written ports, for cross-origin isolated APIs. |
(Mutable)Set<CustomHeader!> |
@RequiresFeature(name = WebViewFeature.CUSTOM_REQUEST_HEADERS, enforcement = "androidx.webkit.WebViewFeature#isFeatureSupported")Returns all custom headers set with |
(Mutable)Set<CustomHeader!> |
@RequiresFeature(name = WebViewFeature.CUSTOM_REQUEST_HEADERS, enforcement = "androidx.webkit.WebViewFeature#isFeatureSupported")Returns all custom headers set with |
(Mutable)Set<CustomHeader!> |
@RequiresFeature(name = WebViewFeature.CUSTOM_REQUEST_HEADERS, enforcement = "androidx.webkit.WebViewFeature#isFeatureSupported")Returns all custom headers set with |
GeolocationPermissions |
@AnyThreadReturns the geolocation permissions of the profile. |
HttpCache |
@RequiresFeature(name = WebViewFeature.HTTP_CACHE_MANAGER, enforcement = "androidx.webkit.WebViewFeature#isFeatureSupported") |
Int |
@RequiresFeature(name = WebViewFeature.SET_MAX_PRERENDERS_V1, enforcement = "androidx.webkit.WebViewFeature#isFeatureSupported")Returns maximum prerenders for the current profile session. |
String |
@AnyThreadReturns the name of this Profile. |
ServiceWorkerController |
@AnyThreadReturns the service worker controller of the profile. |
WebStorage |
@AnyThreadReturns the profile's web storage. |
Boolean |
@RequiresFeature(name = WebViewFeature.CUSTOM_REQUEST_HEADERS, enforcement = "androidx.webkit.WebViewFeature#isFeatureSupported")Returns true if the profile has a value set for the given header name. |
Unit |
@RequiresFeature(name = WebViewFeature.PRECONNECT, enforcement = "androidx.webkit.WebViewFeature#isFeatureSupported")Preconnect to the given origin to speed up future network requests. |
Unit |
@RequiresFeature(name = WebViewFeature.ADD_QUIC_HINTS_V1, enforcement = "androidx.webkit.WebViewFeature#isFeatureSupported")Advises that the given origins support the QUIC protocol and that WebView should use that to connect to them. |
Unit |
@RequiresFeature(name = WebViewFeature.PROFILE_URL_PREFETCH, enforcement = "androidx.webkit.WebViewFeature#isFeatureSupported")This function is deprecated. Use |
Unit |
@RequiresFeature(name = WebViewFeature.PROFILE_URL_PREFETCH, enforcement = "androidx.webkit.WebViewFeature#isFeatureSupported")This function is deprecated. Use |
Unit |
@RequiresFeature(name = WebViewFeature.CROSS_ORIGIN_ISOLATED_ALLOWLIST, enforcement = "androidx.webkit.WebViewFeature#isFeatureSupported")Set the list of origin patterns where Cross Origin Isolated APIs should be accessible. |
Unit |
@RequiresFeature(name = WebViewFeature.SET_MAX_PRERENDERS_V1, enforcement = "androidx.webkit.WebViewFeature#isFeatureSupported")Sets the max prerenders for the current profile session. |
Unit |
@RequiresFeature(name = WebViewFeature.SPECULATIVE_LOADING_CONFIG, enforcement = "androidx.webkit.WebViewFeature#isFeatureSupported")This function is deprecated. use |
Unit |
@RequiresFeature(name = WebViewFeature.WARM_UP_RENDERER_PROCESS, enforcement = "androidx.webkit.WebViewFeature#isFeatureSupported")Initiates warm-up of the renderer process associated with this Profile. |
Constants
DEFAULT_PROFILE_NAME
const val DEFAULT_PROFILE_NAME = "Default": String!
Represents the name of the default profile which can't be deleted.
Public functions
addCustomHeader
@RequiresFeature(name = WebViewFeature.CUSTOM_REQUEST_HEADERS, enforcement = "androidx.webkit.WebViewFeature#isFeatureSupported")
@UiThread
fun addCustomHeader(header: CustomHeader): Unit
Add a header for outgoing requests that match the given origin rules.
It applies to all requests that are initiated after this method is called, including prefetch requests and requests sent from service workers. It does not apply the header to WebSocket requests.
Headers added through this API will be present in the set returned by getRequestHeaders provided in shouldInterceptRequest.
If this method is called multiple times with headers that have the same name and value, then the sets of origin rules will be merged into a single set.
If multiple headers with the same name but different values match a request, then all the values will be sent in a comma-separated list of values following the guidance for repeated header fields. This does not take into account whether such merging is safe.
Headers are considered the same if their name matches case-insensitive and their value matches case-sensitive. This follows RFC 9110, which states that "field names are case insensitive". This API will use the casing of the first custom header encountered.
| Parameters | |
|---|---|
header: CustomHeader |
The header to add. |
| Throws | |
|---|---|
java.lang.UnsupportedOperationException |
if the |
@RequiresFeature(name = WebViewFeature.ADD_QUIC_HINTS_V1, enforcement = "androidx.webkit.WebViewFeature#isFeatureSupported")
@UiThread
@Profile.ExperimentalAddQuicHints
funaddQuicHints(urls: (Mutable)Set<String>): Unit
Advises that the given origins support the QUIC protocol and that WebView should use that to connect to them.
By default, when connecting to a new server, WebView attempts both a HTTP3 (QUIC) and HTTP2 connection, choosing the one that responds faster. This can lead to cases where HTTP2 responds faster, even though HTTP3 is supported and would result in a faster overall load. Calling this API tells WebView to prefer HTTP3 connections for these origins.
Note: addQuicHints operates on origins, but for convenience full URLs can be provided. A full URL (such as https://www.example.com/index.html) will be treated as its origin (https://www.example.com).
This method can be called multiple times and the result is additive - QUIC hints are applied to all of the origins provided to all calls. Providing the same origin multiple times has no further effect.
| Parameters | |
|---|---|
urls: (Mutable)Set<String> |
A set of urls representing origins that support the QUIC protocol. |
| Throws | |
|---|---|
java.lang.UnsupportedOperationException |
if the |
clearAllCustomHeaders
@RequiresFeature(name = WebViewFeature.CUSTOM_REQUEST_HEADERS, enforcement = "androidx.webkit.WebViewFeature#isFeatureSupported")
@UiThread
fun clearAllCustomHeaders(): Unit
Remove any currently set headers from being applied to network requests.
| Throws | |
|---|---|
java.lang.UnsupportedOperationException |
if the |
| See also | |
|---|---|
addCustomHeader |
clearCustomHeader
@RequiresFeature(name = WebViewFeature.CUSTOM_REQUEST_HEADERS, enforcement = "androidx.webkit.WebViewFeature#isFeatureSupported")
@UiThread
fun clearCustomHeader(headerName: String): Unit
Removes the specified headers from the set of headers attached to requests. This will remove all configured headers that match headerName.
It is safe to call this method even if headerName has not previously been set via addCustomHeader.
This method is case insensitive.
| Parameters | |
|---|---|
headerName: String |
Header to remove. |
| Throws | |
|---|---|
java.lang.UnsupportedOperationException |
if the |
| See also | |
|---|---|
addCustomHeader |
clearCustomHeader
@RequiresFeature(name = WebViewFeature.CUSTOM_REQUEST_HEADERS, enforcement = "androidx.webkit.WebViewFeature#isFeatureSupported")
@UiThread
fun clearCustomHeader(headerName: String, headerValue: String): Unit
Removes the specified header from the set of headers attached to requests.
It is safe to call this method even if (headerName, headerValue) has not previously been set via addCustomHeader.
This method is case insensitive for name but case-sensitive for value.
| Throws | |
|---|---|
java.lang.UnsupportedOperationException |
if the |
| See also | |
|---|---|
addCustomHeader |
clearMaxPrerenders
@RequiresFeature(name = WebViewFeature.SET_MAX_PRERENDERS_V1, enforcement = "androidx.webkit.WebViewFeature#isFeatureSupported")
@UiThread
@Profile.ExperimentalUrlPrefetch
fun clearMaxPrerenders(): Unit
Resets the max prerenders for the current profile session to system default. This configuration will be applied to any prerender requests made after they are set; they will not be applied to in-flight requests.
This configuration will be applied to WebViews that are associated with this Profile.
| Throws | |
|---|---|
java.lang.UnsupportedOperationException |
if the |
enqueuePreconnect
@RequiresFeature(name = WebViewFeature.ENQUEUE_PRECONNECT, enforcement = "androidx.webkit.WebViewFeature#isFeatureSupported")
@UiThread
@Profile.ExperimentalPreconnect
fun enqueuePreconnect(url: String): Unit
Enqueue a network preconnect to occur once WebView has started up.
This method acts like preconnect but doesn't trigger WebView start up. Instead, it enqueues that action for when WebView start up occurs. If the WebView has already started, this method acts exactly like preconnect
| Parameters | |
|---|---|
url: String |
A url containing the origin to open a connection to. |
| Throws | |
|---|---|
java.lang.UnsupportedOperationException |
if the |
| See also | |
|---|---|
preconnect |
getCookieManager
@AnyThread
@RequiresFeature(name = WebViewFeature.MULTI_PROFILE, enforcement = "androidx.webkit.WebViewFeature#isFeatureSupported")
fun getCookieManager(): CookieManager
Returns the profile's cookie manager.
Can be called from any thread.
| Throws | |
|---|---|
java.lang.IllegalStateException |
if the profile has been deleted by |
java.lang.UnsupportedOperationException |
if the |
getCrossOriginIsolatedAllowlist
@RequiresFeature(name = WebViewFeature.CROSS_ORIGIN_ISOLATED_ALLOWLIST, enforcement = "androidx.webkit.WebViewFeature#isFeatureSupported")
@UiThread
fun getCrossOriginIsolatedAllowlist(): (Mutable)Set<String!>
Get the current allowlist of origins, with explicitly written ports, for cross-origin isolated APIs.
If setting the origin rule https://example.com, this method will return the same origin rule as https://example.com:443).
| Throws | |
|---|---|
java.lang.UnsupportedOperationException |
if the |
getCustomHeaders
@RequiresFeature(name = WebViewFeature.CUSTOM_REQUEST_HEADERS, enforcement = "androidx.webkit.WebViewFeature#isFeatureSupported")
@UiThread
fun getCustomHeaders(): (Mutable)Set<CustomHeader!>
Returns all custom headers set with addCustomHeader.
| Throws | |
|---|---|
java.lang.UnsupportedOperationException |
if the |
getCustomHeaders
@RequiresFeature(name = WebViewFeature.CUSTOM_REQUEST_HEADERS, enforcement = "androidx.webkit.WebViewFeature#isFeatureSupported")
@UiThread
fun getCustomHeaders(name: String): (Mutable)Set<CustomHeader!>
Returns all custom headers set with addCustomHeader which have the specified name.
This method is case insensitive.
| Parameters | |
|---|---|
name: String |
Name of headers to get. Case sensitive. |
| Throws | |
|---|---|
java.lang.UnsupportedOperationException |
if the |
getCustomHeaders
@RequiresFeature(name = WebViewFeature.CUSTOM_REQUEST_HEADERS, enforcement = "androidx.webkit.WebViewFeature#isFeatureSupported")
@UiThread
fun getCustomHeaders(name: String, value: String): (Mutable)Set<CustomHeader!>
Returns all custom headers set with addCustomHeader which have the specified name and value.
This method is case insensitive for name but case-sensitive for value.
| Parameters | |
|---|---|
name: String |
Name of headers to get. Case sensitive. |
value: String |
Value of headers to get. Case sensitive. |
| Throws | |
|---|---|
java.lang.UnsupportedOperationException |
if the |
getGeolocationPermissions
@AnyThread
@RequiresFeature(name = WebViewFeature.MULTI_PROFILE, enforcement = "androidx.webkit.WebViewFeature#isFeatureSupported")
fun getGeolocationPermissions(): GeolocationPermissions
Returns the geolocation permissions of the profile.
Can be called from any thread.
| Throws | |
|---|---|
java.lang.IllegalStateException |
if the profile has been deleted by |
java.lang.UnsupportedOperationException |
if the |
getHttpCache
@RequiresFeature(name = WebViewFeature.HTTP_CACHE_MANAGER, enforcement = "androidx.webkit.WebViewFeature#isFeatureSupported")
@UiThread
fun getHttpCache(): HttpCache
Returns the HttpCache associated with this Profile.
| Throws | |
|---|---|
java.lang.UnsupportedOperationException |
if the |
getMaxPrerenders
@RequiresFeature(name = WebViewFeature.SET_MAX_PRERENDERS_V1, enforcement = "androidx.webkit.WebViewFeature#isFeatureSupported")
@UiThread
@Profile.ExperimentalUrlPrefetch
fun getMaxPrerenders(): Int
Returns maximum prerenders for the current profile session.
| Throws | |
|---|---|
java.lang.UnsupportedOperationException |
if the |
getName
@AnyThread
@RequiresFeature(name = WebViewFeature.MULTI_PROFILE, enforcement = "androidx.webkit.WebViewFeature#isFeatureSupported")
fun getName(): String
Returns the name of this Profile.
| Returns | |
|---|---|
String |
the name of this Profile which was used to create the Profile from ProfileStore create methods. |
| Throws | |
|---|---|
java.lang.UnsupportedOperationException |
if the |
getServiceWorkerController
@AnyThread
@RequiresFeature(name = WebViewFeature.MULTI_PROFILE, enforcement = "androidx.webkit.WebViewFeature#isFeatureSupported")
fun getServiceWorkerController(): ServiceWorkerController
Returns the service worker controller of the profile.
Can be called from any thread.
| Throws | |
|---|---|
java.lang.IllegalStateException |
if the profile has been deleted by |
java.lang.UnsupportedOperationException |
if the |
getWebStorage
@AnyThread
@RequiresFeature(name = WebViewFeature.MULTI_PROFILE, enforcement = "androidx.webkit.WebViewFeature#isFeatureSupported")
fun getWebStorage(): WebStorage
Returns the profile's web storage.
Can be called from any thread.
| Throws | |
|---|---|
java.lang.IllegalStateException |
if the profile has been deleted by |
java.lang.UnsupportedOperationException |
if the |
hasCustomHeader
@RequiresFeature(name = WebViewFeature.CUSTOM_REQUEST_HEADERS, enforcement = "androidx.webkit.WebViewFeature#isFeatureSupported")
@UiThread
fun hasCustomHeader(headerName: String): Boolean
Returns true if the profile has a value set for the given header name.
This method is case insensitive.
| Parameters | |
|---|---|
headerName: String |
| Returns | |
|---|---|
Boolean |
|
| Throws | |
|---|---|
java.lang.UnsupportedOperationException |
if the |
| See also | |
|---|---|
addCustomHeader |
preconnect
@RequiresFeature(name = WebViewFeature.PRECONNECT, enforcement = "androidx.webkit.WebViewFeature#isFeatureSupported")
@UiThread
@Profile.ExperimentalPreconnect
fun preconnect(url: String): Unit
Preconnect to the given origin to speed up future network requests.
Opens a connection to the provided origin, performing DNS lookup and TCP/TLS handshakes. This can speed up future loads to the origin which could use the open connection. The connection will remain open (and can be reused by future loads) until it times out (roughly 30s).
The main benefit of this API is to preconnect to origins that haven't yet been visited by a WebView - it provides no further performance benefit to origins that have already been loaded.
Note: Preconnect operates on origins, but for convenience full URLs can be provided. A call with a full URL (such as https://www.example.com/index.html) will be treated as a call to the origin (https://www.example.com).
Multiple origins can be connected to by calling this API multiple times.
See: HTML Preconnect Specification
| Parameters | |
|---|---|
url: String |
A url containing the origin to open a connection to. |
| Throws | |
|---|---|
java.lang.UnsupportedOperationException |
if the |
preferQuicFor
@RequiresFeature(name = WebViewFeature.ADD_QUIC_HINTS_V1, enforcement = "androidx.webkit.WebViewFeature#isFeatureSupported")
@UiThread
@Profile.ExperimentalAddQuicHints
fun preferQuicFor(urls: (Mutable)Set<String>): Unit
Advises that the given origins support the QUIC protocol and that WebView should use that to connect to them.
By default, when connecting to a new server, WebView attempts both a HTTP3 (QUIC) and HTTP2 connection, choosing the one that responds faster. This can lead to cases where HTTP2 responds faster, even though HTTP3 is supported and would result in a faster overall load. Calling this API tells WebView to prefer HTTP3 connections for these origins.
Note: preferQuicFor operates on origins, but for convenience full URLs can be provided. A full URL (such as https://www.example.com/index.html) will be treated as its origin (https://www.example.com).
This method can be called multiple times and the result is additive - QUIC hints are applied to all of the origins provided to all calls. Providing the same origin multiple times has no further effect.
| Parameters | |
|---|---|
urls: (Mutable)Set<String> |
A set of urls representing origins that support the QUIC protocol. |
| Throws | |
|---|---|
java.lang.UnsupportedOperationException |
if the |
@RequiresFeature(name = WebViewFeature.PROFILE_URL_PREFETCH, enforcement = "androidx.webkit.WebViewFeature#isFeatureSupported")
@AnyThread
@Profile.ExperimentalUrlPrefetch
funprefetchUrlAsync(
url: String,
cancellationSignal: CancellationSignal?,
callbackExecutor: Executor?,
outcomeReceiver: WebViewOutcomeReceiver<Void?, PrefetchException!>
): Unit
Starts a URL prefetch request.
All WebViews associated with this Profile will use a URL request matching algorithm during execution of all variants of loadUrl for determining if there was already a prefetch request executed for the provided URL. This includes prefetches that are "in progress". If a prefetch is matched, WebView will leverage that for handling the URL, otherwise the URL will be handled normally (i.e. through a network request).
Applications will still be responsible for calling loadUrl to display web contents in a WebView.
NOTE: Additional headers passed to loadUrl are not considered in the matching algorithm for determining whether or not to serve a prefetched response to a navigation.
For max latency saving benefits, it is recommended to call this method as early as possible (i.e. before any WebView associated with this profile is created).
Only supports HTTPS scheme.
| Parameters | |
|---|---|
url: String |
the url associated with the prefetch request. |
cancellationSignal: CancellationSignal? |
will make the best effort to cancel an in-flight prefetch request, However cancellation is not guaranteed. |
callbackExecutor: Executor? |
the executor to resolve the callback with. If |
outcomeReceiver: WebViewOutcomeReceiver<Void?, PrefetchException!> |
callbacks for reporting result back to application. |
| Throws | |
|---|---|
java.lang.IllegalArgumentException |
if the url or callback is null. |
java.lang.UnsupportedOperationException |
if the |
@RequiresFeature(name = WebViewFeature.PROFILE_URL_PREFETCH, enforcement = "androidx.webkit.WebViewFeature#isFeatureSupported")
@AnyThread
@Profile.ExperimentalUrlPrefetch
funprefetchUrlAsync(
url: String,
cancellationSignal: CancellationSignal?,
callbackExecutor: Executor?,
speculativeLoadingParameters: SpeculativeLoadingParameters,
outcomeReceiver: WebViewOutcomeReceiver<Void?, PrefetchException!>
): Unit
Starts a URL prefetch request.
All WebViews associated with this Profile will use a URL request matching algorithm during execution of all variants of loadUrl for determining if there was already a prefetch request executed for the provided URL. This includes prefetches that are "in progress". If a prefetch is matched, WebView will leverage that for handling the URL, otherwise the URL will be handled normally (i.e. through a network request).
Applications will still be responsible for calling loadUrl to display web contents in a WebView.
NOTE: Additional headers passed to loadUrl are not considered in the matching algorithm for determining whether or not to serve a prefetched response to a navigation.
For max latency saving benefits, it is recommended to call this method as early as possible (i.e. before any WebView associated with this profile is created).
Only supports HTTPS scheme.
| Parameters | |
|---|---|
url: String |
the url associated with the prefetch request. |
cancellationSignal: CancellationSignal? |
will make the best effort to cancel an in-flight prefetch request, However cancellation is not guaranteed. |
callbackExecutor: Executor? |
the executor to resolve the callback with. If |
speculativeLoadingParameters: SpeculativeLoadingParameters |
parameters to customize the prefetch request. |
outcomeReceiver: WebViewOutcomeReceiver<Void?, PrefetchException!> |
callbacks for reporting result back to application. |
| Throws | |
|---|---|
java.lang.IllegalArgumentException |
if the url or callback is null. |
java.lang.UnsupportedOperationException |
if the |
setCrossOriginIsolatedAllowlist
@RequiresFeature(name = WebViewFeature.CROSS_ORIGIN_ISOLATED_ALLOWLIST, enforcement = "androidx.webkit.WebViewFeature#isFeatureSupported")
@UiThread
fun setCrossOriginIsolatedAllowlist(
allowedOriginRules: (Mutable)Set<String!>
): Unit
Set the list of origin patterns where Cross Origin Isolated APIs should be accessible.
This API allows you to set an allowlist of origins where potentially risky APIs will be enabled, provided the loaded page has the correct Document-Isolation-Policy response header.
WebView does not enable this feature by default because WebView does not support renderer process isolation. By calling this API, you acknowledge that it is OK to relax this security guarantee and allow pages to use cross-origin-isolated APIs, for example SharedArrayBuffer even if they are running in a shared renderer process. For this reason, you should only use this API with origins you trust.
You should also avoid using the wildcard matcher ("*") in the originPatterns for the same reason.
This method will affect pages that are already loaded.
| Parameters | |
|---|---|
allowedOriginRules: (Mutable)Set<String!> |
A set of origin patterns where cross-origin-isolated APIs should be available. Avoid using the wildcard matcher. See the documentation for |
| Throws | |
|---|---|
java.lang.IllegalArgumentException |
if one or more of the patterns cannot be parsed. |
java.lang.UnsupportedOperationException |
if the |
setMaxPrerenders
@RequiresFeature(name = WebViewFeature.SET_MAX_PRERENDERS_V1, enforcement = "androidx.webkit.WebViewFeature#isFeatureSupported")
@UiThread
@Profile.ExperimentalUrlPrefetch
fun setMaxPrerenders(maxPrerenders: @IntRange(from = 1) Int): Unit
Sets the max prerenders for the current profile session. These configurations will be applied to any prerender requests made after they are set; they will not be applied to in-flight requests.
These configurations will be applied to WebViews that are associated with this Profile.
| Throws | |
|---|---|
java.lang.UnsupportedOperationException |
if the |
@RequiresFeature(name = WebViewFeature.SPECULATIVE_LOADING_CONFIG, enforcement = "androidx.webkit.WebViewFeature#isFeatureSupported")
@UiThread
@Profile.ExperimentalUrlPrefetch
funsetSpeculativeLoadingConfig(
speculativeLoadingConfig: SpeculativeLoadingConfig
): Unit
Sets the SpeculativeLoadingConfig for the current profile session. These configurations will be applied to any Prefetch requests made after they are set; they will not be applied to in-flight requests.
These configurations will be applied to any prefetch requests initiated by a prerender request. This applies specifically to WebViews that are associated with this Profile.
| Parameters | |
|---|---|
speculativeLoadingConfig: SpeculativeLoadingConfig |
the config to set for this profile session. |
| Throws | |
|---|---|
java.lang.UnsupportedOperationException |
if the |
warmUpRendererProcess
@RequiresFeature(name = WebViewFeature.WARM_UP_RENDERER_PROCESS, enforcement = "androidx.webkit.WebViewFeature#isFeatureSupported")
@UiThread
@Profile.ExperimentalWarmUpRendererProcess
fun warmUpRendererProcess(): Unit
Initiates warm-up of the renderer process associated with this Profile.
If no renderer currently exists for the profile, this will kick off the process of starting one in the background. This call does not block or guarantee that the renderer will be fully started by the time it returns.
This can be used to reduce perceived latency when a renderer is needed shortly after.
| Throws | |
|---|---|
java.lang.UnsupportedOperationException |
if the |