Code Monkey home page Code Monkey logo

bromite-webview-overlay's Introduction

Bromite SystemWebView Overlay

As the Bromite project seems to be dormant and using an outdated WebView introduces several security issues, the new version also provides a way to install Mulch SystemWebView. The name of the package will remain the same.

In order for Bromite SystemWebView to be installed, it must be one of the supported webviews hardcoded in the framework package. Since ROMs typically don't include Bromite SystemWebView among them, the community has developed some methods that allow the framework to be patched in order to include it.

This package makes use of a resource overlay to replace the list of hardcoded webviews with one that also includes the Bromite WebView. This method is more straightforward and elegant, as it does not require a rooted device nor the tedious process of installing Magisk modules or patching the system framework itself manually — if anything breaks the package can simply be removed. Moreover, the WebView itself does not need to be installed as a system app and has no potential risk of breaking SafetyNet — e.g. you can install it directly from F-Droid.

Some users have experienced issues with this installation process, so an overlay packaged as a Magisk module is also provided. It is included for convenience only, and undergoes less frequent testing as the main developer does not endorse Magisk. The officially-endorsed and tested installation method still remains installing via recovery.

The WebView implementation settings with the Bromite SystemWebView Overlay installed

Although this method should work on all Android versions that support Bromite and its WebView, currently testing has only been done on LineageOS 19.1 for MicroG based on Android 12.1.

Prerequisites

  • Custom recovery (preferred), support for rooted debugging (enabled via Settings > Developer options > Rooted debugging) or root access

Installation

  • Reboot device into recovery mode, either from the power menu, via a device-specific key combination or by typing the following command if the device has USB debugging enabled: adb reboot recovery
  • Select Apply update then Apply from ADB and install the package using the following command: adb sideload BromiteSystemWebViewOverlay.zip
  • If the installer complains about signature verification, install anyway by selecting Yes.
  • Reboot the device.
  • Download the latest Bromite SystemWebView release and install it as you would a regular app.
  • Lastly, navigate to Settings > Developer options > WebView implementation and select the appropriate package or run the following command: adb shell cmd webviewupdate set-webview-implementation org.bromite.webview

If the above method doesn't work, try the manual installation below.

Mulch SystemWebView

For installing Mulch SystemWebView instead of Bromite SystemWebView, simply follow the steps above while downloading the latest Mulch SystemWebView release. The WebView can then be updated from F-Droid by adding this repository.

Please be aware that by using Mulch SystemWebView you will be running some proprietary/non-free code (according to the website of the developer).

Work Profile

Be aware that if you have a work profile enabled you also need to install the package from the work profile a second time (usually via de Work Files app), otherwise work apps that rely on the WebView component will refuse to work or crash altogether.

To ensure that the package is installed for both profiles install the package via adb: adb install <package-name>.apk

Manual installation

  • Restart ADB with root privileges: adb root
  • Mount the vendor folder as read-write: adb shell mount -o rw,remount /vendor
  • Copy the required package to either the vendor partition (adb push treble-overlay-bromite-webview.apk /vendor/overlay) or the system partition (adb push treble-overlay-bromite-webview.apk /system/product/overlay) depending on your Android version.
  • Verify if the correct permissions are set (optional): adb shell stat /vendor/overlay/treble-overlay-bromite-webview.apk | grep "0644" (vendor partition) adb shell stat /system/product/overlay/treble-overlay-bromite-webview.apk | grep "0644" (system partition)
  • Mount the system as read-write: adb shell mount -o rw,remount /
  • Copy the OTA survival script to the appropriate location: adb push 39-bromite-webview.sh /system/addon.d
  • Make the script executable: adb shell chmod 755 /system/addon.d/39-bromite-webview.sh
  • Verify if the correct permissions are set (optional): adb shell stat /system/addon.d/39-bromite-webview.sh | grep "0755"
  • After all the files have been copied, reboot the device: adb reboot
  • After rebooting you can verify if the overlay has been successfully installed (optional): adb shell dumpsys webviewupdate
  • If everything is ok, you should see the following message: org.bromite.webview is NOT installed.
  • Install Bromite SystemWebView as outlined above.

Magisk

BromiteSystemWebViewMagisk.zip can be installed directly as a Magisk module. Simply copy it on your device, then install it via the normal Magisk UI.

Its main use case is for when you have Magisk already installed, where it works around an issue where some ROMs — in particular MicroG ROMs — do not have enough reserved partition space to install addons. This makes the previous installation options fail, sometimes in non-obvious ways. (Details in #5 and lineageos4microg/docker-lineage-cicd#358)

It performs steps similar to the above, i.e. installs treble-overlay-bromite-webview.apk into /vendor/overlay, but as a Magisk module. The overlay is performed dynamically by Magisk at boot time, instead of directly modifying the vendor partition (until the next system update overwrites these changes). The OTA survival script is therefore not needed, as Magisk modules are not overwritten by system updates.

Building

The following dependencies are required:

  • git
  • xmlstarlet
  • apktool
  • zip
  • java

To build the overlay and the flashable package, simply run the build script: ./build.sh

Alternatively, you can read a more in-depth guide here.

Credits

bromite-webview-overlay's People

Contributors

arovlad avatar infinity0 avatar loknplay avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

bromite-webview-overlay's Issues

Bromite-webview-overlay does not support Android 11

Hi, as requested making an issue. I have installed bromite-webview-overlay on crDroid 7.23(Android 11) via recovery, but it did not enable the overlay.

It doesn't show up in the list of overlays in developer options, in the output of aapt d xmltree /system/framework/framework-res.apk res/xml/config_webview_packages.xml, in the output of dumpsys webviewupdate | grep org.bromite.webview, or, as requested, the output of cmd overlay list - in fact, this one does not seem to list any of the webviews at all.

I have attached the recovery log of when I flashed the zip below.

recovery_BromiteSystemWebViewOverlay.zip_2022-12-10-02-44-06.log

I can't get it to work.

I have a OnePlus 6T with LineageOS 19.1 for MicroG and I install the zip file in recovery and say yes to install on the phone.

I reboot my device and downloade Bromite webviewer and it says "update" and not install when I open the apk.

The phone has factory setting (Apart from adding the developer settings and giving usb debugging and root debugging access).

I have also installed it for work profils. But when i get in to settings to changet the webview its still only has chromium.

When i use adb to change the webview i get this respons

"Failed to switch to org.bromite.webview, the WebView implementation is now provided by com.android.webview."

I have no idea of what I'm doing wrong. The phone is also compatible with treble.

Not work on Android 7.1.2

I have a Samsung Galaxy Tab A6 (2016) SM-T280 with Lineage OS 14.1 installed. When i tried to install with TWRP fail with error 1.
With the magisk module it flash correctly but after reboot, the system enter in bootloop.
Some advice, alternative or solution?
PD: The ROM was abandoned but it´s the only ROM for this device.

Zip error

Device Xiaomi Redmi 4x.
Using Custom Rom VoltageOs 2.2 based on A-13.

My device supports treble as shown by TrebleInfo app.
Flashed via orangeFox recovery.
Screenshot_2023-02-08-12-29-18
Screenshot_20230208-131224_Voltage_Home
Screenshot_20230208-131227_Voltage_Home

Install script uses wrong device path for A/B device, silently succeeds

Device: OnePlus 8T (KB2003), LineageOS 19.1 with MicroG, same LineageOS recovery.

getprop ro.treble.enabled shows true.

Androidacy/WebviewManager-Module does work for me.


Firstly you want to set -e at the top of your install script, so it actually fails if one of the steps fails.

Then to my actual problem: these lines don't work:

mount -o rw /dev/block/by-name/system /picodroid_system
mount -o rw /dev/block/by-name/vendor /picodroid_vendor

On my system, they should instead be:

mount -o rw /dev/block/mapper/system_a /picodroid_system
mount -o rw /dev/block/mapper/vendor_a /picodroid_vendor

You'd also need to write logic to detect what the active slot is (either A or B). On my recovery ROM at least, {system_b,vendor_b} doesn't exist when the active slot is A. I have no idea if this holds true in the general case.

Then there is a further problem, which is that cp creates empty files on both /system and /vendor for me, showing no error message nor failure exit code. This is the case even if I boot into my normal system, mount read-write, and try it. It is possible to create files in those paths, but not to put content in those empty files. I haven't figured out how to fix this yet...

Manual install instructions did not work (rw error) - LineageOS 20

Phone : beyond1lte
OS    : LineageOS
Build : 20-20230915-NIGHTLY-beyond1lte

I couldn't sideload the zip (the error wasn't descriptive sorry) so I tried to manually install it following the instructions in the readme.

When trying to push the apk it would error as it couldn't write the file. Here's the commands I used.

> adb root
> adb shell mount -o rw,remount /vendor
> adb push treble-overlay-bromite-webview.apk /vendor/overlay/
treble-overlay-bromite-webview.ap...18.3 MB/s (16815 bytes in 0.000s)
adb: error: failed to copy 'treble-overlay-bromite-webview.apk' to '/vendor/overlay/treble-overlay-bromite-webview.apk': remote couldn't create file: Read-only file system

I came across this as a possible solution using adb disable-verity and it worked:

> adb disable-verity
> adb reboot
> adb root
> adb remount
> adb push treble-overlay-bromite-webview.apk /vendor/overlay/
treble-overlay-bromite-webview.ap...74.7 MB/s (16815 bytes in 0.000s)

# and the rest of the tutorial...

and I managed to follow the rest of the install instructions with no problem. I now have Mulch System WebView working.

I don't know if the tutorial itself is broken, I could have just done something wrong or my phone just didn't want to cooperate. But figured I'd write an issue as the install-guide didn't work for me.

Thanks for the project btw :)

"resource overlay [..] does not require rooted device" is misleading wording

As discussed in #8 I think the current wording is misleading, because:

  1. it confuses the issue of how the overlay works to enable Bromite, vs the issue of how to install the overlay
  2. "rooted device" is ambiguous and might make a user think root access is not used at all during the installation process, or that the overlay doesn't effectively have system/root privileges as it modifies a vital part of the system. Both of these beliefs are incorrect.

In #8 I suggested amending the current sentence to simply say:

This method is more straightforward and elegant, as it does not require the
tedious process of patching the system framework itself manually.

This addresses (1) by only talking about how the overlay works, after it is installed. Then I suggested to elaborate the installation process in a separate paragraph, addressing (2):

Our officially-endorsed and tested way for installing this overlay is [via
recovery](#installation), which allows you to avoid rooting your main system
e.g. with Magisk. (You still need to unlock your bootloader, and install a
custom ROM that allows addons to be installed via recovery, which provides
temporary root access to the addon installation script.)

Granted, this is quite long and could be shortened, e.g. to something like:

Our official well-tested method for installing this overlay is [via
recovery](#installation), which allows you to avoid rooting your main system,
by providing temporary root access to our addon installation script only during
recovery.

BTW, the existing popular Androidacy module in fact uses an overlay itself. The problem is that it does a lot of other unnecessary things during installation such as download Bromite from the internet, with no well-defined update process for it, which is why I did #8 as an alternative. The point is, whether or not something "requires Magisk" or "requires a rooted device" is an aspect of the installation process, not of the overlay itself.

Works on one out of two devices

Android 7 tablet: Installed (as Magisk module), installed Mulch System WebView. Works perfectly.

Android 10 phone: Installed (as Magisk module), installed Mulch System WebView. Mulch System Webview does not show up as an option in "WebView implementation." I had Bromite System WebView installed, and it DID show up, but I uninstalled it in preference to Mulch due to the length of time since the last Bromite release.

Any idea why Mulch doesn't show up?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.