Google wants to make Android 15 more robust against WebView crashes

Stability is one of the foundations of the user experience. When an app crashes or doesn’t work properly, it can frustrate some users who lose their progress or even some data. However, if a key system component were to crash, countless numbers of applications could become unusable for millions of users. This is exactly what happened in the past with the Android System WebView, a component that many applications rely on to display web content. Fortunately, Google plans to make WebView more crash-resistant in Android 15 — here’s how.



Connected

Here’s everything new we found in Android 15

What we know about Android 15 now that the first developer preview has arrived

For a little background, Android System WebView is essentially a stripped-down version of the Chromium web browser bundled with the Android operating system. Developers can use Android’s WebView API to get a WebView component to display a web page within the bounds of their application. Some applications use WebView to render a single page, while others use it essentially as a mobile wrapper for an entire web page. The impact of crashing a WebView varies by application; this could affect anything from a minor feature like the help page to the entire application failing to launch.


Android_System_WebView_demo

The Android WebView component on an Android device (left, center). Android application using WebView (right).

For example, in 2021 we reported on a wave of mysterious app crashes that affected users of Samsung, Pixel, Motorola, OnePlus and many other smartphone brands. As we reported at the time, the crashes weren’t limited to any particular type of app; apps of all kinds, from many different developers, crashed repeatedly and without warning. Google eventually fixed this issue by sending an update to the WebView component.


Because the WebView component is so critical to the app’s functionality, it is updated through the Google Play Store instead of through an OTA update. This ensures that Google can quickly push out changes to address any bugs found in the WebView component, such as the one that caused the wave of crashes in mid-2021. It also ensures that most Android devices use similar versions of WebView. If Google leaves WebView updates in the hands of OEMs, then it could be weeks or even months before some devices receive critical component updates.

However, as it turns out, Google actually already relies on OEMs to roll out updates to some parts of WebView. While updating to core browser component which Google Play has been dealing with for years, updates to the core framework APIs which applications use to integrate WebView is managed by OEMs. This is because Google currently has no way to directly patch the code for the underlying WebView APIs. Right now it just has to update the code in AOSP and then wait for the OEMs to integrate it into their next release.


Connected

What you need to know about Project Mainline in Android 14 and later

Project Mainline delivers key OS updates via Google Play — here’s how that’s changing

That’s why Google is working on a new Project Mainline module in Android 15 called WebViewBootstrap. Project Mainline is an initiative Google introduced with Android 10 that modularizes OS components so that feature and security updates can be delivered via Google Play instead of regular OTA updates. If you’ve ever seen a Google Play system update pending on your Android device, that’s how Project Mainline modules are updated.

While the public code repository for WebViewBootstrap is currently empty, we have an idea of ​​what Google plans to do with this new module thanks to two sources. According to our sources, Google plans to move a bunch of code related to Android’s WebView API into this new WebViewBootstrap module. This includes the code in the following directories:

  1. frameworks/base/core/java/android/webkit
  2. frameworks/base/services/core/java/com/android/server/webkit
  3. frameworks/base/native/webview


Google wants to move this code to the new WebViewBootstrap module so that it can update the code in emergency situations, such as when WebView cannot start. Our sources tell us that Google only intends to push bug fixes through updates to the WebViewBootstrap module, so there won’t be any new functionality or API changes for developers to worry about. Reportedly, this module will also have some new “resilience” features aimed at automatically detecting and repairing when WebView cannot be started.

Apparently, the plan is to launch this new module with Android 15. However, OEMs may include it in their own builds, at least with the upcoming release. Instead, it seems that Google plans to make it mandatory in the next release, i.e. Android 16. The WebViewBootstrap module didn’t appear in the public Developer Preview 1 release of Android 15, but we’ll be watching to see if it appears in Developer Preview 2.

Source link

Leave a Reply

Your email address will not be published. Required fields are marked *