├── .gitignore ├── .gitattributes ├── META-INF └── com │ └── google │ └── android │ ├── updater-script │ └── update-binary ├── system └── placeholder ├── change.log ├── update.json ├── module.prop ├── service.sh ├── LICENSE ├── README_ZH.md └── README.md /.gitignore: -------------------------------------------------------------------------------- 1 | *.zip -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | * text=auto eol=lf 2 | -------------------------------------------------------------------------------- /META-INF/com/google/android/updater-script: -------------------------------------------------------------------------------- 1 | #MAGISK 2 | -------------------------------------------------------------------------------- /system/placeholder: -------------------------------------------------------------------------------- 1 | REMOVE THIS WHEN YOU ALREADY FILL THIS FOLDER 2 | -------------------------------------------------------------------------------- /change.log: -------------------------------------------------------------------------------- 1 | # v1.4 2 | 1. Processing other shared libraries 3 | 4 | # v1.3 5 | 1. Use a method that doesn't require root privileges instead 6 | 7 | # v1.2 8 | 1. Support for (beta|dev|canary) versions 9 | 10 | # v1.1 11 | 1. Update for Magisk 24 -------------------------------------------------------------------------------- /update.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": "v1.5", 3 | "versionCode": 20240809, 4 | "zipUrl": "https://github.com/entr0pia/trichromelibrary-squoosh/releases/latest/download/trichromelibrary-squoosh.zip", 5 | "changelog": "https://raw.githubusercontent.com/entr0pia/trichromelibrary-squoosh/master/change.log" 6 | } -------------------------------------------------------------------------------- /module.prop: -------------------------------------------------------------------------------- 1 | id=trichromelibrary-squoosh 2 | name=TrichromeLibrary Squoosh 3 | version=v1.5 4 | versionCode=20240809 5 | author=entr0pia@GitHub 6 | description=Remove the outdated TrichromeLibrary after reboot | 重启后移除过时的 TrichromeLibrary 7 | minMagisk=20400 8 | updateJson=https://raw.githubusercontent.com/entr0pia/trichromelibrary-squoosh/master/update.json 9 | -------------------------------------------------------------------------------- /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.4+! " 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 20400 ] && require_new_magisk 31 | 32 | install_module 33 | exit 0 34 | -------------------------------------------------------------------------------- /service.sh: -------------------------------------------------------------------------------- 1 | #!/system/bin/sh 2 | # Do NOT assume where your module will be located. 3 | # ALWAYS use $MODDIR if you need to know where this script 4 | # and module is placed. 5 | # This will make sure your module will still work 6 | # if Magisk change its mount point in the future 7 | MODDIR=${0%/*} 8 | 9 | # This script will be executed in late_start service mode 10 | function squoosh_libs() { 11 | for lib in $1; do 12 | echo "Removing $lib" 13 | pm uninstall $lib 14 | done 15 | echo "If you see any failure messages, just ignore them, because the TrichromeLibrary is being used." 16 | } 17 | 18 | 19 | if [ "$(whoami)" != "shell" ]; then 20 | sleep 19 21 | fi 22 | 23 | webview_stat=$(dumpsys webviewupdate) 24 | current_ver=$(echo "$webview_stat" | grep 'Current WebView package' | grep -oE '[0-9\.]{2,}') 25 | current_code=$(echo "$webview_stat" | grep "$current_ver" | grep -oE '[0-9]{9}') 26 | 27 | tri_libs=$(dumpsys -t 1 package | grep -E 'name.*version:[0-9]*' | sed "s/[ ]version:/_/g; s/name://g; /$current_code/d") 28 | squoosh_libs "$tri_libs" | tee "/data/local/tmp/trichromelibrary-squoosh.log" 29 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2021 entr0pia (风沐白) 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy 4 | of this software and associated documentation files (the "Software"), to deal 5 | in the Software without restriction, including without limitation the rights 6 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | copies of the Software, and to permit persons to whom the Software is 8 | furnished to do so, subject to the following conditions: 9 | 10 | The above copyright notice and this permission notice shall be included in all 11 | copies or substantial portions of the Software. 12 | 13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 19 | SOFTWARE. -------------------------------------------------------------------------------- /README_ZH.md: -------------------------------------------------------------------------------- 1 | # TrichromeLibrary-Squoosh 2 | 3 | [English](https://github.com/entr0pia/trichromelibrary-squoosh#readme) | [中文](https://github.com/entr0pia/trichromelibrary-squoosh/blob/master/README_ZH.md) 4 | 5 | 移除过时的 TrichromeLibrary. **需要 root 权限** 6 | 7 | ## 描述 8 | 9 | 众所周知, Google 使用 TrichromeLibrary 在 Android Q+ 设备上的 Chrome 和 Webview 中共享相同的代码, 以节省设备空间. Play 商店在安装和升级 Chrome 和 Webview 时会自动安装相应的 TrichromeLibrary 版本, **但是, 旧版本不会自动卸载**, 这占用了大量的存储空间. 10 | 11 | 已知可以通过 ```pm uninstall com.google.android.trichromelibrary_$version``` 命令卸载对应版本的 TrichromeLibrary, 所以获取到 TrichromeLibrary 的版本号就可以手动卸载了. 不幸的是, Android 在共享库管理方面做得很差. TrichromeLibrary 不能像普通应用程序一样显示在应用程序列表中 (因为它是共享库), 也不能用 ```adb shell pm list libraries``` 查询设备上已安装的库版本. 12 | 13 | 感谢 issue#1,*TrichromeLibrary-Squoosh* 现在使用不需要 root 权限的方法。 `dumpsys package|grep name:c` 命令只需要 shell 权限即可运行,并能获得 TrichromeLibrary 的版本。 14 | 15 | > **旧方法:**
由于每个 Android App 都会在 ```/data/app``` 下面拥有一个自己的目录, 而且 TrichromeLibrary 的文件夹名还会追加版本号, 如下图. 所以我们可以查找关键字, 然后从结果中提取版本号. 不过, 访问 ```/data/app``` 需要 root 权限. 16 | ![TrichromeLibrary 目录](https://tvax2.sinaimg.cn/large/007uv4aMgy1h0k41g844cj30rs0eqgsx.jpg) 17 | 18 | ## 使用方法 19 | 20 | 1. 就是一个普通的 Magisk 模块. 从 [release](https://github.com/entr0pia/trichromelibrary-squoosh/releases/latest) 页面下载并安装. 脚本会在每次系统重启后自动地检查是否有多余的Trichromelibrary并将其移除. 21 | 2. 如果你没有 Magisk, 在电脑上连接 `adb shell`, 运行以下命令: 22 | ```shell 23 | sh -c "$(curl -sLf https://cdn.jsdelivr.net/gh/entr0pia/trichromelibrary-squoosh@master/service.sh)" 24 | ``` 25 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # TrichromeLibrary-Squoosh 2 | 3 | [English](https://github.com/entr0pia/trichromelibrary-squoosh#readme) | [中文](https://github.com/entr0pia/trichromelibrary-squoosh/blob/master/README_ZH.md) 4 | 5 | Remove the outdated TrichromeLibrary. 6 | 7 | ## Description 8 | 9 | As we know, Google uses TrichromeLibrary to share the same code in Chrome and Webview on Android Q+ devices to save space on the device. The Play Store will automatically install the corresponding TrichromeLibrary version when installing and upgrading Chrome and Webview, **but will not uninstall the old version**, which takes up a lot of storage space. 10 | 11 | It is known that the corresponding version of TrichromeLibrary can be uninstalled through the command ```pm uninstall com.google.android.trichromelibrary_$version```, so you can manually uninstall the version number of TrichromeLibrary. Unfortunately, Android does a poor job of shared library management. TrichromeLibrary cannot be displayed in the application list like a normal application (because it is a shared library), nor can use `adb shell pm list libraries` to query installed libraries version on the device. 12 | 13 | Thanks to issue#1, *TrichromeLibrary-Squoosh* now uses a method that does not require root privileges. The command `dumpsys package|grep name:c` only needs shell privileges to run, and can get the version of TrichromeLibrary. 14 | 15 | 16 | > **Old method:**
Since each Android application will have its own directory under ```/data/app```, as shown in the figure below, and the folder name of TrichromeLibrary will also append the version number, so we can search for keywords, and then extract the version number from the results. However, root access is required to access ```/data/app```. 17 | ![TrichromeLibrary dirs](https://tvax2.sinaimg.cn/large/007uv4aMgy1h0k41g844cj30rs0eqgsx.jpg) 18 | 19 | ## Usage 20 | 21 | 1. Just like a normal Magisk module. Download it from the [release](https://github.com/entr0pia/trichromelibrary-squoosh/releases/latest) page, and install it. The script will automatically check for excess Trichromelibrary and remove it after each system reboot. 22 | 2. If you don't have a Magisk, run the follow commands on PC in `adb shell`: 23 | ```shell 24 | sh -c "$(curl -sLf https://raw.githubusercontent.com/entr0pia/trichromelibrary-squoosh/master/service.sh)" 25 | ``` 26 | --------------------------------------------------------------------------------