├── META-INF └── com │ └── google │ └── android │ ├── update-binary │ └── updater-script ├── README.md ├── customize.sh ├── module.prop └── system └── product ├── app └── WebviewMulch │ └── here would be the apk but it won't let me upload more than 25mb.xml └── overlay └── treble-overlay-mulch-webview.apk /META-INF/com/google/android/update-binary: -------------------------------------------------------------------------------- 1 | #!/sbin/sh 2 | 3 | ################# 4 | # Initialization 5 | ################# 6 | 7 | umask 022 8 | 9 | # echo before loading util_functions 10 | ui_print() { echo "$1"; } 11 | 12 | require_new_magisk() { 13 | ui_print "*******************************" 14 | ui_print " Please install Magisk v20.0+! " 15 | ui_print "*******************************" 16 | exit 1 17 | } 18 | 19 | ######################### 20 | # Load util_functions.sh 21 | ######################### 22 | 23 | OUTFD=$2 24 | ZIPFILE=$3 25 | 26 | mount /data 2>/dev/null 27 | 28 | [ -f /data/adb/magisk/util_functions.sh ] || require_new_magisk 29 | . /data/adb/magisk/util_functions.sh 30 | [ $MAGISK_VER_CODE -lt 20000 ] && require_new_magisk 31 | 32 | if [ $MAGISK_VER_CODE -ge 20400 ]; then 33 | # New Magisk have complete installation logic within util_functions.sh 34 | install_module 35 | exit 0 36 | fi 37 | 38 | ################# 39 | # Legacy Support 40 | ################# 41 | 42 | TMPDIR=/dev/tmp 43 | PERSISTDIR=/sbin/.magisk/mirror/persist 44 | 45 | is_legacy_script() { 46 | unzip -l "$ZIPFILE" install.sh | grep -q install.sh 47 | return $? 48 | } 49 | 50 | print_modname() { 51 | local authlen len namelen pounds 52 | namelen=`echo -n $MODNAME | wc -c` 53 | authlen=$((`echo -n $MODAUTH | wc -c` + 3)) 54 | [ $namelen -gt $authlen ] && len=$namelen || len=$authlen 55 | len=$((len + 2)) 56 | pounds=$(printf "%${len}s" | tr ' ' '*') 57 | ui_print "$pounds" 58 | ui_print " $MODNAME " 59 | ui_print " by $MODAUTH " 60 | ui_print "$pounds" 61 | ui_print "*******************" 62 | ui_print " Powered by Magisk " 63 | ui_print "*******************" 64 | } 65 | 66 | # Override abort as old scripts have some issues 67 | abort() { 68 | ui_print "$1" 69 | $BOOTMODE || recovery_cleanup 70 | [ -n $MODPATH ] && rm -rf $MODPATH 71 | rm -rf $TMPDIR 72 | exit 1 73 | } 74 | 75 | rm -rf $TMPDIR 2>/dev/null 76 | mkdir -p $TMPDIR 77 | 78 | # Preperation for flashable zips 79 | setup_flashable 80 | 81 | # Mount partitions 82 | mount_partitions 83 | 84 | # Detect version and architecture 85 | api_level_arch_detect 86 | 87 | # Setup busybox and binaries 88 | $BOOTMODE && boot_actions || recovery_actions 89 | 90 | ############## 91 | # Preparation 92 | ############## 93 | 94 | # Extract prop file 95 | unzip -o "$ZIPFILE" module.prop -d $TMPDIR >&2 96 | [ ! -f $TMPDIR/module.prop ] && abort "! Unable to extract zip file!" 97 | 98 | $BOOTMODE && MODDIRNAME=modules_update || MODDIRNAME=modules 99 | MODULEROOT=$NVBASE/$MODDIRNAME 100 | MODID=`grep_prop id $TMPDIR/module.prop` 101 | MODNAME=`grep_prop name $TMPDIR/module.prop` 102 | MODAUTH=`grep_prop author $TMPDIR/module.prop` 103 | MODPATH=$MODULEROOT/$MODID 104 | 105 | # Create mod paths 106 | rm -rf $MODPATH 2>/dev/null 107 | mkdir -p $MODPATH 108 | 109 | ########## 110 | # Install 111 | ########## 112 | 113 | if is_legacy_script; then 114 | unzip -oj "$ZIPFILE" module.prop install.sh uninstall.sh 'common/*' -d $TMPDIR >&2 115 | 116 | # Load install script 117 | . $TMPDIR/install.sh 118 | 119 | # Callbacks 120 | print_modname 121 | on_install 122 | 123 | # Custom uninstaller 124 | [ -f $TMPDIR/uninstall.sh ] && cp -af $TMPDIR/uninstall.sh $MODPATH/uninstall.sh 125 | 126 | # Skip mount 127 | $SKIPMOUNT && touch $MODPATH/skip_mount 128 | 129 | # prop file 130 | $PROPFILE && cp -af $TMPDIR/system.prop $MODPATH/system.prop 131 | 132 | # Module info 133 | cp -af $TMPDIR/module.prop $MODPATH/module.prop 134 | 135 | # post-fs-data scripts 136 | $POSTFSDATA && cp -af $TMPDIR/post-fs-data.sh $MODPATH/post-fs-data.sh 137 | 138 | # service scripts 139 | $LATESTARTSERVICE && cp -af $TMPDIR/service.sh $MODPATH/service.sh 140 | 141 | ui_print "- Setting permissions" 142 | set_permissions 143 | else 144 | print_modname 145 | 146 | unzip -o "$ZIPFILE" customize.sh -d $MODPATH >&2 147 | 148 | if ! grep -q '^SKIPUNZIP=1$' $MODPATH/customize.sh 2>/dev/null; then 149 | ui_print "- Extracting module files" 150 | unzip -o "$ZIPFILE" -x 'META-INF/*' -d $MODPATH >&2 151 | 152 | # Default permissions 153 | set_perm_recursive $MODPATH 0 0 0755 0644 154 | fi 155 | 156 | # Load customization script 157 | [ -f $MODPATH/customize.sh ] && . $MODPATH/customize.sh 158 | fi 159 | 160 | # Handle replace folders 161 | for TARGET in $REPLACE; do 162 | ui_print "- Replace target: $TARGET" 163 | mktouch $MODPATH$TARGET/.replace 164 | done 165 | 166 | if $BOOTMODE; then 167 | # Update info for Magisk Manager 168 | mktouch $NVBASE/modules/$MODID/update 169 | cp -af $MODPATH/module.prop $NVBASE/modules/$MODID/module.prop 170 | fi 171 | 172 | # Copy over custom sepolicy rules 173 | if [ -f $MODPATH/sepolicy.rule -a -e $PERSISTDIR ]; then 174 | ui_print "- Installing custom sepolicy patch" 175 | # Remove old recovery logs (which may be filling partition) to make room 176 | rm -f $PERSISTDIR/cache/recovery/* 177 | PERSISTMOD=$PERSISTDIR/magisk/$MODID 178 | mkdir -p $PERSISTMOD 179 | cp -af $MODPATH/sepolicy.rule $PERSISTMOD/sepolicy.rule || abort "! Insufficient partition size" 180 | fi 181 | 182 | # Remove stuffs that don't belong to modules 183 | rm -rf \ 184 | $MODPATH/system/placeholder $MODPATH/customize.sh \ 185 | $MODPATH/README.md $MODPATH/.git* 2>/dev/null 186 | 187 | ############# 188 | # Finalizing 189 | ############# 190 | 191 | cd / 192 | $BOOTMODE || recovery_cleanup 193 | rm -rf $TMPDIR 194 | 195 | ui_print "- Done" 196 | exit 0 197 | -------------------------------------------------------------------------------- /META-INF/com/google/android/updater-script: -------------------------------------------------------------------------------- 1 | #MAGISK 2 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Mulch SystemWebView Overlay 2 | 3 | In order for [Mulch SystemWebView](https://gitlab.com/divested-mobile/mulch) to be installed, it must be one of the supported webviews hardcoded in the framework package. Since ROMs typically don't include Mulch SystemWebView among them, the community has developed some methods that allow the framework to be patched in order to include it. 4 | 5 | This package makes use of a [resource overlay](https://source.android.com/docs/core/architecture/rros) to replace the list of hardcoded webviews with one that also includes the mulch 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. 6 | 7 | Some users have experienced issues with this installation process, so an overlay packaged as a [Magisk module](#magisk) 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](#installation). 8 | 9 | ![The WebView implementation settings with the Mulch SystemWebView Overlay installed](screenshot.png) 10 | 11 | Although this method should work on all Android versions that support Mulch and its WebView, **currently testing has only been done on Android 10**. 12 | 13 | ## Prerequisites 14 | 15 | * Treble-enabled ROM ([How to check?](https://github.com/phhusson/treble_experimentations/wiki/Frequently-Asked-Questions-%28FAQ%29#how-can-i-check-if-my-device-is-treble-enabled)) 16 | * Custom recovery **(preferred)**, support for rooted debugging (enabled via *Settings > Developer options > Rooted debugging*) or root access 17 | 18 | ## Installation 19 | 20 | * 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: 21 | `adb reboot recovery` 22 | * Select *Apply update* then *Apply from ADB* and install the package using the following command: 23 | `adb sideload MulchSystemWebViewOverlay.zip` 24 | * If the installer complains about signature verification, install anyway by selecting **Yes**. 25 | * Reboot the device. 26 | * Download the latest Mulch SystemWebView release from [F-Droid](https://f-droid.org/en/packages/us.spotco.mulch_wv) or [gitlab](https://gitlab.com/divested-mobile/mulch/-/raw/master/prebuilt/arm64/webview.apk) and install it as you would a regular app. 27 | * Lastly, navigate to *Settings > Developer options > WebView implementation* and select the appropriate package or run the following command: 28 | `adb shell cmd webviewupdate set-webview-implementation us.spotco.mulch_wv` 29 | 30 | If the above method doesn't work, try the [manual installation](#manual-installation) below. 31 | 32 | ### Work Profile 33 | 34 | 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. 35 | 36 | To ensure that the package is installed for both profiles install the package via adb: 37 | `adb install .apk` 38 | 39 | ### Manual installation 40 | 41 | * Restart ADB with root privileges: 42 | `adb root` 43 | * Mount the vendor folder as read-write: 44 | `adb shell mount -o rw,remount /vendor` 45 | * Copy the required package to either the vendor partition (`adb push treble-overlay-mulch-webview.apk /vendor/overlay`) or the system partition (`adb push treble-overlay-mulch-webview.apk /system/product/overlay`) depending on your Android version. 46 | * Verify if the correct permissions are set (optional): 47 | `adb shell stat /vendor/overlay/treble-overlay-mulch-webview.apk | grep "0644"` (vendor partition) 48 | `adb shell stat /system/product/overlay/treble-overlay-mulch-webview.apk | grep "0644"` (system partition) 49 | * Mount the system as read-write: 50 | `adb shell mount -o rw,remount /` 51 | * Copy the OTA survival script to the appropriate location: 52 | `adb push 99-mulch-webview.sh /system/addon.d` 53 | * Make the script executable: 54 | `adb shell chmod 755 /system/addon.d/99-mulch-webview.sh` 55 | * Verify if the correct permissions are set (optional): 56 | `adb shell stat /system/addon.d/99-mulch-webview.sh | grep "0755"` 57 | * After all the files have been copied, reboot the device: 58 | `adb reboot` 59 | * After rebooting you can verify if the overlay has been successfully installed (optional): 60 | `adb shell dumpsys webviewupdate` 61 | * If everything is ok, you should see the following message: 62 | `us.spotco.mulch_wv is NOT installed.` 63 | * Install Mulch SystemWebView as outlined above. 64 | 65 | ### Magisk 66 | 67 | `MulchSystemWebViewMagisk.zip` can be installed directly as a Magisk module. Simply copy it on your device, then install it via the normal Magisk UI. 68 | 69 | 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](https://github.com/arovlad/bromite-webview-overlay/issues/5) and lineageos4microg/docker-lineage-cicd#358) 70 | 71 | It performs steps similar to the above, i.e. installs `treble-overlay-mulch-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. 72 | 73 | ## Building 74 | 75 | The following dependencies are required: 76 | 77 | * `git` 78 | * `xmlstarlet` 79 | * `apktool` 80 | * `zip` 81 | 82 | To build the overlay and the flashable package, simply run the build script: 83 | `./build.sh` 84 | 85 | Alternatively, you can read a more in-depth guide [here](https://github.com/phhusson/treble_experimentations/wiki/How-to-create-an-overlay%3F). 86 | 87 | ## Credits 88 | 89 | * [Vlad Arotăriței](https://github.com/arovlad) for the bromite webview overlay 90 | * [Pierre-Hugues Husson](https://github.com/phhusson) for the guide and toolkit 91 | -------------------------------------------------------------------------------- /customize.sh: -------------------------------------------------------------------------------- 1 | ########################################################################################## 2 | 3 | nohup am start -a android.intent.action.VIEW -d https://t.me/modulostk >/dev/null 2>&1 & 4 | 5 | ################[t.me/modulostk]############### -------------------------------------------------------------------------------- /module.prop: -------------------------------------------------------------------------------- 1 | id=mulch-system-webview 2 | name=Mulch System WebView Overlay 3 | version=1 4 | versionCode=1 5 | author=A4Alpha x @LeanHijosdesusMadres 6 | description=Enable the use of Mulch as the Systen (Webview with better security and privacy) [version 116.0.5845.78] @modulostk [Telegram] 7 | -------------------------------------------------------------------------------- /system/product/app/WebviewMulch/here would be the apk but it won't let me upload more than 25mb.xml: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /system/product/overlay/treble-overlay-mulch-webview.apk: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LeanxModulostk/mulch-webview-overlay/53b78ecee89bd96c146df9a9f903f570e5577cf8/system/product/overlay/treble-overlay-mulch-webview.apk --------------------------------------------------------------------------------