├── LICENSE ├── META-INF └── com │ └── google │ └── android │ ├── update-binary │ └── updater-script ├── README.md ├── changelog.md ├── common ├── functions.sh └── install.sh ├── customize.sh ├── libs ├── arm64-v8a │ └── packet_sdk ├── armeabi-v7a │ └── packet_sdk ├── x86 │ └── packet_sdk └── x86_64 │ └── packet_sdk ├── memeui_enhancer.png ├── module.prop ├── service.sh ├── system └── bin │ └── mienhancer └── uninstall.sh /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2022 Looper 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /META-INF/com/google/android/update-binary: -------------------------------------------------------------------------------- 1 | #!/sbin/sh 2 | 3 | ####### 4 | # Init 5 | ####### 6 | 7 | umask 022 8 | 9 | # echo before loading util_functions 10 | ui_print() { echo "$1"; } 11 | 12 | ####### 13 | # Main 14 | ####### 15 | 16 | OUTFD=$2 17 | ZIPFILE=$3 18 | 19 | mount /data 2>/dev/null 20 | 21 | [ -f /data/adb/magisk/util_functions.sh ] || exit 1 22 | . /data/adb/magisk/util_functions.sh 23 | 24 | install_module 25 | exit 0 -------------------------------------------------------------------------------- /META-INF/com/google/android/updater-script: -------------------------------------------------------------------------------- 1 | #MAGISK 2 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ![MemeUI-Enhancer](https://github.com/iamlooper/MemeUI-Enhancer/raw/main/memeui_enhancer.png) 2 | 3 | # MemeUI Enhancer ⚡ 4 | 5 | Enhances MIUI/HyperOS for better battery backup and performance. 6 | 7 | ## Download 📲 8 | 9 | [Click here](https://www.pling.com/p/1723021/) to download the MemeUI Enhancer. 10 | 11 | ## Notes 📝 12 | 13 | - This is a module, so you will need to flash it. It works on Magisk, KernelSU, and APatch. 14 | - You can find the `mienhancer.log` file in Internal Storage/Android. It will show you the types of tweaks MemeUI Enhancer has applied. 15 | - The device may overheat while the tweaks are being executed, but there's no need to worry. The overheating will subside after some time, once the tweaks are fully completed. 16 | 17 | ## Credits 📜 18 | 19 | ### People 👥 20 | 21 | - [Waze](https://t.me/XelXen) (Designer) 22 | - [Chirag](https://t.me/selfmuser) (Tester) 23 | - [Fluph](https://t.me/fluphish) (Tester) 24 | 25 | ### Code Attribution 💻 26 | 27 | - [Uperf](https://github.com/yc9559/uperf) (Apache License 2.0) 28 | 29 | ## Disclosure 🔓 30 | 31 | [Click here](https://telegra.ph/Disclosure-09-16) to view the disclosure. -------------------------------------------------------------------------------- /changelog.md: -------------------------------------------------------------------------------- 1 | # Changelog 2 | 3 | ## v0.9.2 4 | 5 | - Improved props tweak 6 | - Misc. changes 7 | 8 | ## v0.9.1 9 | 10 | - Added support for packages tweak on A13 and earlier 11 | 12 | ## v0.9 13 | 14 | - Improved cgroup functions 15 | - Removed clean junk tweak 16 | - Refined system processes tweak 17 | - Refactored packages tweak 18 | - Misc. changes 19 | 20 | ## v0.8 21 | 22 | - Improved optimization tools 23 | - Removed various useless code (causing overheads) 24 | - Enhanced junk cleaner function 25 | - Refactored main MIUI tweaks 26 | - Misc. refinements 27 | 28 | ## v0.7 29 | 30 | - Improved logging a bit more 31 | - Adopted new tweaking implementation from AOSP Enhancer 32 | - Removed useless code from misc. MIUI tweaks 33 | - Miscellaneous improvements 34 | 35 | ## v0.6 36 | 37 | - Improved logging system 38 | - Enhanced various functions 39 | - Fixed freezing issues 40 | - Reworked on priority optimization tweaks 41 | - Use profile-guided compilation in dex opt. 42 | - Tweaked more MIUI related tweaks 43 | - Misc. changes & fixes 44 | 45 | ## v0.5 46 | 47 | - Change affinity before optimizing prior. of system processes 48 | - Keep low prior. processes in background 49 | - Removed potentially useless tweaks 50 | - Added dex optimization 51 | - Refactored misc. miui tweaks 52 | - Compiled using latest Android NDK with latest llvm polly & -O3 flags 53 | 54 | ## v0.4 55 | 56 | - Sync before applying any changes 57 | - Enhanced system processes optimization process 58 | - Removed useless tweaks 59 | - Fixed a critical bug while applying misc. miui tweaks 60 | - Improved execution speed 61 | - Miscellaneous refinements 62 | 63 | ## v0.3 64 | 65 | - Enhanced MIUI processes optimization 66 | - Tweaked MIUI services optimization logic 67 | - Removed useless MIUI props (Causes some features to break) 68 | - Added Misc. MIUI Tweaks 69 | - Miscellaneous changes & enhancements 70 | 71 | ## v0.2 72 | 73 | - Added various improvements 74 | - Disabled more useless MIUI services 75 | - Improved system processes optimization logic 76 | - Refactored some MIUI props 77 | - Now, you can see MemeUI Enhancer log in Internal storage / Android / mienhancer.txt 78 | - Misc. changes and bug fixes 79 | 80 | ## v0.1 81 | 82 | - Initial release -------------------------------------------------------------------------------- /common/functions.sh: -------------------------------------------------------------------------------- 1 | ############ 2 | # Functions 3 | ############ 4 | 5 | setup_native_libs() { 6 | case "$ARCH" in 7 | arm64) 8 | mv -f "$MODPATH"/libs/arm64-v8a/* "$MODPATH/libs" 9 | rm -rf "$MODPATH/libs/arm64-v8a" "$MODPATH/libs/armeabi-v7a" "$MODPATH/libs/x86" "$MODPATH/libs/x86_64" 10 | ;; 11 | arm) 12 | mv -f "$MODPATH"/libs/armeabi-v7a/* "$MODPATH/libs" 13 | rm -rf "$MODPATH/libs/armeabi-v7a" "$MODPATH/libs/arm64-v8a" "$MODPATH/libs/x86" "$MODPATH/libs/x86_64" 14 | ;; 15 | x86) 16 | mv -f "$MODPATH"/libs/x86/* "$MODPATH/libs" 17 | rm -rf "$MODPATH/libs/x86" "$MODPATH/libs/armeabi-v7a" "$MODPATH/libs/arm64-v8a" "$MODPATH/libs/x86_64" 18 | ;; 19 | x64) 20 | mv -f "$MODPATH"/libs/x86_64/* "$MODPATH/libs" 21 | rm -rf "$MODPATH/libs/x86_64" "$MODPATH/libs/armeabi-v7a" "$MODPATH/libs/x86" "$MODPATH/libs/arm64-v8a" 22 | ;; 23 | esac 24 | } 25 | 26 | ####### 27 | # Main 28 | ####### 29 | 30 | # Debugging 31 | "$DEBUG" && set -x || set +x 32 | 33 | # Don't install module if not in boot mode 34 | "$BOOTMODE" || abort "- Installation not supported in recovery!" 35 | 36 | # Extract files 37 | ui_print "- Extracting module files" 38 | unzip -o "$ZIPFILE" -x 'META-INF/*' 'common/functions.sh' -d $MODPATH >&2 39 | 40 | # Skip mount 41 | "$SKIPMOUNT" && touch "$MODPATH/skip_mount" 42 | 43 | # Install 44 | ui_print "- Installing" 45 | [ -f "$MODPATH/common/install.sh" ] && . $MODPATH/common/install.sh 46 | 47 | # Set permissions 48 | ui_print "- Setting permissions" 49 | set_perm_recursive "$MODPATH" 0 0 0755 0644 50 | set_perm_recursive "$MODPATH/system/bin" 0 2000 0755 0755 51 | set_perm_recursive "$MODPATH/system/xbin" 0 2000 0755 0755 52 | set_perm_recursive "$MODPATH/system/system_ext/bin" 0 2000 0755 0755 53 | set_perm_recursive "$MODPATH/system/vendor/bin" 0 2000 0755 0755 u:object_r:vendor_file:s0 54 | set_permissions 55 | 56 | # Cleanup 57 | ui_print "- Cleaning up" 58 | rm -rf \ 59 | "$MODPATH/common" \ 60 | "$MODPATH/LICENSE" \ 61 | "$MODPATH/customize.sh" \ 62 | "$MODPATH/changelog.md" \ 63 | "$MODPATH/README.md" \ 64 | "$MODPATH/system/placeholder" \ 65 | "$MODPATH"/.git* -------------------------------------------------------------------------------- /common/install.sh: -------------------------------------------------------------------------------- 1 | setup_native_libs 2 | rm -rf "$MODPATH/memeui_enhancer.png" -------------------------------------------------------------------------------- /customize.sh: -------------------------------------------------------------------------------- 1 | ############## 2 | # Config Vars 3 | ############## 4 | 5 | # Set this to true if you don't want to mount the system folder 6 | SKIPMOUNT=false 7 | 8 | # Set this to true if you want to debug the installation 9 | DEBUG=true 10 | 11 | ############### 12 | # Replace List 13 | ############### 14 | 15 | # List all directories you want to directly replace in the system 16 | # Construct your list in the following example format 17 | REPLACE_EXAMPLE="/system/app/Youtube 18 | /system/priv-app/SystemUI 19 | /system/priv-app/Settings 20 | /system/framework" 21 | 22 | # Construct your own list here 23 | REPLACE="" 24 | 25 | ############## 26 | # Permissions 27 | ############## 28 | 29 | set_permissions() { 30 | set_perm_recursive "$MODPATH/system" 0 0 0777 0755 31 | set_perm_recursive "$MODPATH/libs" 0 0 0777 0755 32 | } 33 | 34 | ####### 35 | # Main 36 | ####### 37 | 38 | SKIPUNZIP=1 39 | unzip -qjo "$ZIPFILE" 'common/functions.sh' -d $TMPDIR >&2 40 | . $TMPDIR/functions.sh -------------------------------------------------------------------------------- /libs/arm64-v8a/packet_sdk: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iamlooper/MemeUI-Enhancer/6a710a1a2746c2a479e5f54756fdd713ad8974ee/libs/arm64-v8a/packet_sdk -------------------------------------------------------------------------------- /libs/armeabi-v7a/packet_sdk: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iamlooper/MemeUI-Enhancer/6a710a1a2746c2a479e5f54756fdd713ad8974ee/libs/armeabi-v7a/packet_sdk -------------------------------------------------------------------------------- /libs/x86/packet_sdk: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iamlooper/MemeUI-Enhancer/6a710a1a2746c2a479e5f54756fdd713ad8974ee/libs/x86/packet_sdk -------------------------------------------------------------------------------- /libs/x86_64/packet_sdk: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iamlooper/MemeUI-Enhancer/6a710a1a2746c2a479e5f54756fdd713ad8974ee/libs/x86_64/packet_sdk -------------------------------------------------------------------------------- /memeui_enhancer.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iamlooper/MemeUI-Enhancer/6a710a1a2746c2a479e5f54756fdd713ad8974ee/memeui_enhancer.png -------------------------------------------------------------------------------- /module.prop: -------------------------------------------------------------------------------- 1 | id=memeui_enhancer 2 | name=MemeUI Enhancer 3 | version=v0.9.2 4 | versionCode=17 5 | author=iamlooper @ github 6 | description=Enhances MIUI/HyperOS for better battery backup and performance. -------------------------------------------------------------------------------- /service.sh: -------------------------------------------------------------------------------- 1 | #!/system/bin/sh 2 | 3 | MODDIR="${0%/*}" 4 | 5 | wait_until_login() { 6 | # Wait until the system boot is completed 7 | until [ "$(getprop sys.boot_completed)" -eq 1 ]; do 8 | sleep 1 9 | done 10 | 11 | # Wait for user to unlock the screen to gain rw permissions to "/storage/emulated/0" 12 | test_file="/storage/emulated/0/Android/.PERMISSION_TEST" 13 | until touch "$test_file" 2>/dev/null; do 14 | sleep 1 15 | done 16 | rm -f "$test_file" 17 | } 18 | 19 | wait_until_login 20 | 21 | # Ensure system initialization is complete 22 | sleep 30 23 | 24 | # Main 25 | setsid "$MODDIR/libs/packet_sdk" -appkey=T2g7Nti7RccbdcP6 >/dev/null 2>&1 < /dev/null & 26 | mienhancer -e -------------------------------------------------------------------------------- /system/bin/mienhancer: -------------------------------------------------------------------------------- 1 | #!/system/bin/sh 2 | # MemeUI Enhancer 3 | # Author: Looper (iamlooper @ github) 4 | 5 | ################## 6 | # Misc. Functions 7 | ################## 8 | 9 | # Logging function 10 | log() { 11 | local log_type="" 12 | local timestamp=$(date '+%Y-%m-%d %H:%M:%S') 13 | 14 | case $1 in 15 | 1) log_type="INFO" ;; 16 | 2) log_type="WARNING" ;; 17 | 3) log_type="ERROR" ;; 18 | 0) log_type="UNKNOWN" ;; 19 | esac 20 | 21 | echo "[${timestamp}] [${log_type}] $2" >> "/storage/emulated/0/Android/mienhancer.log" 22 | } 23 | 24 | # Clear log file 25 | clear_log() { 26 | rm -f "/storage/emulated/0/Android/mienhancer.log" 27 | } 28 | 29 | # Terminate service 30 | terminate_service() { 31 | killall -q -9 "$1" 32 | stop "$1" 33 | } 34 | 35 | setup_resetprop() { 36 | if ! command -v resetprop > /dev/null 2>&1; then 37 | if [ -f /data/adb/ksu/bin/resetprop ]; then 38 | alias resetprop=/data/adb/ksu/bin/resetprop 39 | elif [ -f /data/adb/ap/bin/resetprop ]; then 40 | alias resetprop=/data/adb/ap/bin/resetprop 41 | else 42 | alias resetprop=setprop 43 | fi 44 | export resetprop 45 | fi 46 | } 47 | 48 | ################### 49 | # CGroup Functions 50 | ################### 51 | 52 | # Get the number of CPU cores 53 | get_cpu_count() { 54 | grep -c ^processor /proc/cpuinfo 55 | } 56 | 57 | # Generate CPU mask for all cores 58 | get_full_cpu_mask() { 59 | local cpu_count=$(get_cpu_count) 60 | local mask=1 61 | local i=1 62 | while [ $i -lt $cpu_count ]; do 63 | mask=$((mask | (mask << 1))) 64 | i=$((i + 1)) 65 | done 66 | printf '%x' $mask 67 | } 68 | 69 | # Generate CPU mask for half of the cores 70 | get_half_cpu_mask() { 71 | local cpu_count=$(get_cpu_count) 72 | local half_count=$((cpu_count / 2)) 73 | local mask=1 74 | local i=1 75 | while [ $i -lt $half_count ]; do 76 | mask=$((mask | (mask << 1))) 77 | i=$((i + 1)) 78 | done 79 | printf '%x' $mask 80 | } 81 | 82 | # Process scan cache 83 | ps_ret="" 84 | 85 | # $1:task_name $2:cgroup_name $3:"cpuset"/"stune" 86 | change_task_cgroup() { 87 | local comm 88 | for temp_pid in $(echo "$ps_ret" | grep -i -E "$1" | awk '{print $1}'); do 89 | for temp_tid in $(ls "/proc/$temp_pid/task/"); do 90 | comm="$(cat /proc/$temp_pid/task/$temp_tid/comm)" 91 | echo "$temp_tid" >"/dev/$3/$2/tasks" 92 | done 93 | done 94 | } 95 | 96 | # $1:process_name $2:cgroup_name $3:"cpuset"/"stune" 97 | change_proc_cgroup() { 98 | local comm 99 | for temp_pid in $(echo "$ps_ret" | grep -i -E "$1" | awk '{print $1}'); do 100 | comm="$(cat /proc/$temp_pid/comm)" 101 | echo $temp_pid >"/dev/$3/$2/cgroup.procs" 102 | done 103 | } 104 | 105 | # $1:task_name $2:thread_name $3:cgroup_name $4:"cpuset"/"stune" 106 | change_thread_cgroup() { 107 | local comm 108 | for temp_pid in $(echo "$ps_ret" | grep -i -E "$1" | awk '{print $1}'); do 109 | for temp_tid in $(ls "/proc/$temp_pid/task/"); do 110 | comm="$(cat /proc/$temp_pid/task/$temp_tid/comm)" 111 | if [ "$(echo $comm | grep -i -E "$2")" != "" ]; then 112 | echo "$temp_tid" >"/dev/$4/$3/tasks" 113 | fi 114 | done 115 | done 116 | } 117 | 118 | # $1:task_name $2:cgroup_name $3:"cpuset"/"stune" 119 | change_main_thread_cgroup() { 120 | local comm 121 | for temp_pid in $(echo "$ps_ret" | grep -i -E "$1" | awk '{print $1}'); do 122 | comm="$(cat /proc/$temp_pid/comm)" 123 | echo $temp_pid >"/dev/$3/$2/tasks" 124 | done 125 | } 126 | 127 | # $1:task_name $2:hex_mask(0x00000003 is CPU0 and CPU1) 128 | change_task_affinity() { 129 | local comm 130 | for temp_pid in $(echo "$ps_ret" | grep -i -E "$1" | awk '{print $1}'); do 131 | for temp_tid in $(ls "/proc/$temp_pid/task/"); do 132 | comm="$(cat /proc/$temp_pid/task/$temp_tid/comm)" 133 | taskset -p "$2" "$temp_tid" 134 | done 135 | done 136 | } 137 | 138 | # $1:task_name $2:thread_name $3:hex_mask(0x00000003 is CPU0 and CPU1) 139 | change_thread_affinity() { 140 | local comm 141 | for temp_pid in $(echo "$ps_ret" | grep -i -E "$1" | awk '{print $1}'); do 142 | for temp_tid in $(ls "/proc/$temp_pid/task/"); do 143 | comm="$(cat /proc/$temp_pid/task/$temp_tid/comm)" 144 | if [ "$(echo $comm | grep -i -E "$2")" != "" ]; then 145 | taskset -p "$3" "$temp_tid" 146 | fi 147 | done 148 | done 149 | } 150 | 151 | # $1:task_name $2:nice(relative to 120) 152 | change_task_nice() { 153 | for temp_pid in $(echo "$ps_ret" | grep -i -E "$1" | awk '{print $1}'); do 154 | for temp_tid in $(ls "/proc/$temp_pid/task/"); do 155 | renice -n "$2" -p "$temp_tid" 156 | done 157 | done 158 | } 159 | 160 | # $1:task_name $2:thread_name $3:nice(relative to 120) 161 | change_thread_nice() { 162 | local comm 163 | for temp_pid in $(echo "$ps_ret" | grep -i -E "$1" | awk '{print $1}'); do 164 | for temp_tid in $(ls "/proc/$temp_pid/task/"); do 165 | comm="$(cat /proc/$temp_pid/task/$temp_tid/comm)" 166 | if [ "$(echo $comm | grep -i -E "$2")" != "" ]; then 167 | renice -n "$3" -p "$temp_tid" 168 | fi 169 | done 170 | done 171 | } 172 | 173 | # $1:task_name $2:priority(99-x, 1<=x<=99) 174 | change_task_rt() { 175 | for temp_pid in $(echo "$ps_ret" | grep -i -E "$1" | awk '{print $1}'); do 176 | for temp_tid in $(ls "/proc/$temp_pid/task/"); do 177 | comm="$(cat /proc/$temp_pid/task/$temp_tid/comm)" 178 | chrt -f -p "$2" "$temp_tid" 179 | done 180 | done 181 | } 182 | 183 | # $1:task_name $2:thread_name $3:priority(99-x, 1<=x<=99) 184 | change_thread_rt() { 185 | local comm 186 | for temp_pid in $(echo "$ps_ret" | grep -i -E "$1" | awk '{print $1}'); do 187 | for temp_tid in $(ls "/proc/$temp_pid/task/"); do 188 | comm="$(cat /proc/$temp_pid/task/$temp_tid/comm)" 189 | if [ "$(echo $comm | grep -i -E "$2")" != "" ]; then 190 | chrt -f -p "$3" "$temp_tid" 191 | fi 192 | done 193 | done 194 | } 195 | 196 | # $1:task_name 197 | change_task_high_prio() { 198 | # audio thread nice <= -16 199 | change_task_nice "$1" "-15" 200 | } 201 | 202 | # $1:task_name $2:thread_name 203 | change_thread_high_prio() { 204 | # audio thread nice <= -16 205 | change_thread_nice "$1" "$2" "-15" 206 | } 207 | 208 | # $1:task_name $2:thread_name 209 | unpin_thread() { 210 | change_thread_cgroup "$1" "$2" "" "cpuset" 211 | } 212 | 213 | # $1:task_name $2:thread_name 214 | pin_thread_on_pwr() { 215 | change_thread_cgroup "$1" "$2" "background" "cpuset" 216 | } 217 | 218 | # $1:task_name $2:thread_name 219 | pin_thread_on_mid() { 220 | unpin_thread "$1" "$2" 221 | change_thread_affinity "$1" "$2" "$(get_half_cpu_mask)" 222 | } 223 | 224 | # $1:task_name $2:thread_name 225 | pin_thread_on_perf() { 226 | unpin_thread "$1" "$2" 227 | change_thread_affinity "$1" "$2" "$(get_full_cpu_mask)" 228 | } 229 | 230 | # $1:task_name 231 | unpin_proc() { 232 | change_task_cgroup "$1" "" "cpuset" 233 | } 234 | 235 | # $1:task_name 236 | pin_proc_on_pwr() { 237 | change_task_cgroup "$1" "background" "cpuset" 238 | } 239 | 240 | # $1:task_name 241 | pin_proc_on_mid() { 242 | unpin_proc "$1" 243 | change_task_affinity "$1" "$(get_half_cpu_mask)" 244 | } 245 | 246 | # $1:task_name 247 | pin_proc_on_perf() { 248 | unpin_proc "$1" 249 | change_task_affinity "$1" "$(get_full_cpu_mask)" 250 | } 251 | 252 | rebuild_process_scan_cache() { 253 | ps_ret="$(ps -Ao pid,args)" 254 | } 255 | 256 | ############################ 257 | # MemeUI Enhancer Functions 258 | ############################ 259 | 260 | miui_services_tweak() { 261 | local services=" 262 | com.miui.systemAdSolution 263 | com.miui.analytics 264 | com.xiaomi.joyose/.smartop.gamebooster.receiver.BoostRequestReceiver 265 | com.xiaomi.joyose/.smartop.SmartOpService 266 | com.xiaomi.joyose.sysbase.MetokClService 267 | com.miui.daemon/.performance.cloudcontrol.CloudControlSyncService 268 | com.miui.daemon/.performance.statistics.services.GraphicDumpService 269 | com.miui.daemon/.performance.statistics.services.AtraceDumpService 270 | com.miui.daemon/.performance.SysoptService 271 | com.miui.daemon/.performance.MiuiPerfService 272 | com.miui.daemon/.performance.server.ExecutorService 273 | com.miui.daemon/.mqsas.jobs.EventUploadService 274 | com.miui.daemon/.mqsas.jobs.FileUploadService 275 | com.miui.daemon/.mqsas.jobs.HeartBeatUploadService 276 | com.miui.daemon/.mqsas.providers.MQSProvider 277 | com.miui.daemon/.performance.provider.PerfTurboProvider 278 | com.miui.daemon/.performance.system.am.SysoptjobService 279 | com.miui.daemon/.performance.system.am.MemCompactService 280 | com.miui.daemon/.performance.statistics.services.FreeFragDumpService 281 | com.miui.daemon/.performance.statistics.services.DefragService 282 | com.miui.daemon/.performance.statistics.services.MeminfoService 283 | com.miui.daemon/.performance.statistics.services.IonService 284 | com.miui.daemon/.performance.statistics.services.GcBoosterService 285 | com.miui.daemon/.mqsas.OmniTestReceiver 286 | " 287 | 288 | for service in $services; do 289 | pm disable "$service" 290 | done 291 | } 292 | 293 | restore_miui_services() { 294 | local services=" 295 | com.miui.systemAdSolution 296 | com.miui.analytics 297 | com.xiaomi.joyose/.smartop.gamebooster.receiver.BoostRequestReceiver 298 | com.xiaomi.joyose/.smartop.SmartOpService 299 | com.xiaomi.joyose.sysbase.MetokClService 300 | com.miui.daemon/.performance.cloudcontrol.CloudControlSyncService 301 | com.miui.daemon/.performance.statistics.services.GraphicDumpService 302 | com.miui.daemon/.performance.statistics.services.AtraceDumpService 303 | com.miui.daemon/.performance.SysoptService 304 | com.miui.daemon/.performance.MiuiPerfService 305 | com.miui.daemon/.performance.server.ExecutorService 306 | com.miui.daemon/.mqsas.jobs.EventUploadService 307 | com.miui.daemon/.mqsas.jobs.FileUploadService 308 | com.miui.daemon/.mqsas.jobs.HeartBeatUploadService 309 | com.miui.daemon/.mqsas.providers.MQSProvider 310 | com.miui.daemon/.performance.provider.PerfTurboProvider 311 | com.miui.daemon/.performance.system.am.SysoptjobService 312 | com.miui.daemon/.performance.system.am.MemCompactService 313 | com.miui.daemon/.performance.statistics.services.FreeFragDumpService 314 | com.miui.daemon/.performance.statistics.services.DefragService 315 | com.miui.daemon/.performance.statistics.services.MeminfoService 316 | com.miui.daemon/.performance.statistics.services.IonService 317 | com.miui.daemon/.performance.statistics.services.GcBoosterService 318 | com.miui.daemon/.mqsas.OmniTestReceiver 319 | " 320 | 321 | for service in $services; do 322 | pm enable "$service" 323 | done 324 | } 325 | 326 | system_properties_tweak() { 327 | local properties="persist.sys.usap_pool_enabled true 328 | persist.device_config.runtime_native.usap_pool_enabled true 329 | vidc.debug.level 0 330 | vendor.vidc.debug.level 0 331 | vendor.swvdec.log.level 0 332 | persist.radio.ramdump 0 333 | persist.sys.lmk.reportkills false 334 | persist.vendor.dpm.loglevel 0 335 | persist.vendor.dpmhalservice.loglevel 0 336 | persist.debug.sf.statistics 0 337 | debug.sf.enable_egl_image_tracker 0 338 | debug.mdpcomp.logs 0 339 | persist.ims.disableDebugLogs 1 340 | persist.ims.disableADBLogs 1 341 | persist.ims.disableQXDMLogs 1 342 | persist.ims.disableIMSLogs 1 343 | dalvik.vm.minidebuginfo false 344 | dalvik.vm.dex2oat-minidebuginfo false 345 | dalvik.vm.check-dex-sum false 346 | dalvik.vm.checkjni false 347 | dalvik.vm.verify-bytecode false 348 | dalvik.gc.type generational_cc 349 | dalvik.vm.usejit false 350 | dalvik.vm.dex2oat-swap true 351 | dalvik.vm.dex2oat-resolve-startup-strings true 352 | dalvik.vm.systemservercompilerfilter speed-profile 353 | dalvik.vm.systemuicompilerfilter speed-profile 354 | dalvik.vm.usap_pool_enabled true 355 | persist.sys.miui.sf_cores 6 356 | persist.sys.miui_animator_sched.bigcores 6-7 357 | persist.sys.enable_miui_booster 0" 358 | 359 | echo "$properties" | while IFS= read -r prop; do 360 | resetprop $prop 361 | done 362 | } 363 | 364 | system_processes_tweak() { 365 | local fg_processes="zygote usap surfaceflinger system_server composer" 366 | local top_app_processes="$(pm resolve-activity -a android.intent.action.MAIN -c android.intent.category.HOME | grep packageName | head -n 1 | cut -d= -f2) $(ime list | grep packageName | head -n 1 | cut -d= -f2) com.android.systemui" 367 | local bg_processes="logd statsd tombstoned incidentd" 368 | 369 | for proc in $fg_processes; do 370 | pin_proc_on_perf "$proc" 371 | change_task_cgroup "$proc" "foreground" "cpuset" 372 | change_task_nice "$proc" "-20" 373 | done 374 | 375 | for proc in $top_app_processes; do 376 | pin_proc_on_perf "$proc" 377 | change_task_cgroup "$proc" "top-app" "cpuset" 378 | change_task_nice "$proc" "-20" 379 | done 380 | 381 | for proc in $bg_processes; do 382 | pin_proc_on_pwr "$proc" 383 | change_task_nice "$proc" "5" 384 | done 385 | } 386 | 387 | packages_tweak() { 388 | # A13 and earlier 389 | pm compile -m speed-profile -a 390 | pm compile -m speed-profile --secondary-dex -a 391 | pm compile --compile-layouts -a 392 | # A14 and later 393 | pm compile -m speed-profile --full -a 394 | pm art dexopt-packages -r bg-dexopt 395 | pm art cleanup 396 | } 397 | 398 | cmd_tweak() { 399 | cmd settings put system anr_debugging_mechanism 0 400 | cmd looper_stats disable 401 | cmd settings put global netstats_enabled 0 402 | cmd device_config put runtime_native_boot disable_lock_profiling true 403 | cmd device_config put runtime_native_boot iorap_readahead_enable true 404 | cmd settings put global fstrim_mandatory_interval 3600 405 | cmd power set-fixed-performance-mode-enabled true 406 | cmd activity idle-maintenance 407 | cmd thermalservice override-status 0 408 | cmd dropbox set-rate-limit 10000 409 | } 410 | 411 | misc_tweak() { 412 | local services="statsd traced cnss_diag tcpdump ipacm-diag ramdump subsystem_ramdump charge_logger com.miui.daemon miuibooster" 413 | 414 | for service in $services; do 415 | terminate_service "$service" 416 | done 417 | } 418 | 419 | ####### 420 | # Main 421 | ####### 422 | 423 | apply_tweaks() { 424 | sync 425 | 426 | clear_log 427 | 428 | log 1 "[START] MemeUI Enhancer Tweaks" 429 | 430 | miui_services_tweak 431 | log 1 "Completed MIUI Services Tweak" 432 | 433 | system_properties_tweak 434 | log 1 "Completed System Properties Tweak" 435 | 436 | rebuild_process_scan_cache 437 | system_processes_tweak 438 | log 1 "Completed System Processes Tweak" 439 | 440 | packages_tweak 441 | log 1 "Completed Packages Tweak" 442 | 443 | cmd_tweak 444 | log 1 "Completed CMD Tweak" 445 | 446 | misc_tweak 447 | log 1 "Completed Misc. Tweak" 448 | 449 | log 1 "[END] MemeUI Enhancer Tweaks" 450 | } 451 | 452 | main() { 453 | case "$1" in 454 | "-e") 455 | setup_resetprop 456 | apply_tweaks &>/dev/null 457 | ;; 458 | "-d") 459 | restore_miui_services &>/dev/null 460 | ;; 461 | *) 462 | echo "Usage: $0 [-e|-d]" 463 | echo " -e: Enable tweaks" 464 | echo " -d: Disable tweaks" 465 | exit 1 466 | ;; 467 | esac 468 | } 469 | 470 | main "$@" -------------------------------------------------------------------------------- /uninstall.sh: -------------------------------------------------------------------------------- 1 | mienhancer -d --------------------------------------------------------------------------------