├── .github └── FUNDING.yml ├── LICENSE ├── META-INF └── com │ └── google │ └── android │ ├── update-binary │ └── updater-script ├── README.md ├── action.sh ├── arm64-v8a └── libmagiskpolicy.so ├── armeabi-v7a └── libmagiskpolicy.so ├── cleaner.sh ├── customize.sh ├── function.sh ├── module.prop ├── package.txt ├── post-fs-data.sh ├── sepolicy.rule ├── service.sh ├── system.prop ├── system ├── etc │ ├── default-permissions │ │ ├── default-com.miui.cleanmaster.xml │ │ ├── default-com.miui.guardprovider.xml │ │ ├── default-com.miui.securityadd.xml │ │ └── default-com.miui.securitycenter.xml │ ├── permissions │ │ ├── privapp-com.miui.cleanmaster.xml │ │ ├── privapp-com.miui.guardprovider.xml │ │ ├── privapp-com.miui.securityadd.xml │ │ └── privapp-com.miui.securitycenter.xml │ ├── selinux │ │ └── placeholder │ └── sysconfig │ │ ├── config-com.miui.cleanmaster.xml │ │ ├── config-com.miui.guardprovider.xml │ │ ├── config-com.miui.securityadd.xml │ │ └── config-com.miui.securitycenter.xml └── priv-app │ ├── CleanMaster │ ├── CleanMaster.apk │ │ ├── AndroidManifest.xml │ │ ├── classes.dex │ │ └── resources.arsc │ └── extract │ ├── GuardProvider │ ├── GuardProvider.apk │ └── extract │ ├── SecurityCenter │ ├── SecurityCenter.apk │ │ ├── AndroidManifest.xml │ │ ├── classes.dex │ │ ├── classes2.dex │ │ ├── classes3.dex │ │ └── resources.arsc │ └── extract │ └── securityadd │ ├── extract │ └── securityadd.apk ├── uninstall.sh ├── update.sh ├── x86 └── libmagiskpolicy.so └── x86_64 └── libmagiskpolicy.so /.github/FUNDING.yml: -------------------------------------------------------------------------------- 1 | # These are supported funding model platforms 2 | 3 | github: reiryuki # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2] 4 | patreon: # Replace with a single Patreon username 5 | open_collective: # Replace with a single Open Collective username 6 | ko_fi: reiryuki # Replace with a single Ko-fi username 7 | tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel 8 | community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry 9 | liberapay: # Replace with a single Liberapay username 10 | issuehunt: # Replace with a single IssueHunt username 11 | otechie: # Replace with a single Otechie username 12 | lfx_crowdfunding: # Replace with a single LFX Crowdfunding project-name e.g., cloud-foundry 13 | custom: https://www.paypal.me/reiryuki # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2'] 14 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2021 Rei Ryuki 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 | # 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 | -------------------------------------------------------------------------------- /META-INF/com/google/android/updater-script: -------------------------------------------------------------------------------- 1 | #MAGISK 2 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Miui Security Magisk Module 2 | 3 | ## DISCLAIMER 4 | - Miui apps are owned by Xiaomi™. 5 | - The MIT license specified here is for the Magisk Module only, not for Miui apps. 6 | 7 | ## Descriptions 8 | - Security, Cleaner, Scanner, and Game Booster by Xiaomi Inc. ported and integrated as a Magisk Module for all supported and rooted devices with Magisk 9 | 10 | ## Sources 11 | - https://apkmirror.com com.miui.securitycenter, com.miui.securityadd, com.miui.cleanmaster, & com.miui.guardprovider by Xiaomi Inc. 12 | - libmagiskpolicy.so: Kitsune Mask R6687BB53 13 | 14 | ## Screenshots 15 | - https://t.me/androidryukimods/219 16 | 17 | ## Requirements 18 | - NOT in Miui ROM 19 | - Android 5 (SDK 21) and up 20 | - Magisk or KernelSU installed 21 | - Any AOSP Signatured ROM to allow android.uid.system 22 | - Disabled Android Signature Verification for non-AOSP Signatured ROM to allow android.uid.system. Tap here: https://t.me/ryukinotes/81 23 | - Miui Core Magisk Module installed 24 | 25 | ## Installation Guide & Download Link 26 | - Install Miui Core Magisk Module first: https://github.com/reiryuki/Miui-Core-Magisk-Module 27 | - Install this module https://www.pling.com/p/1593896/ via Magisk app or KernelSU app or Recovery if Magisk installed 28 | - If installation failed, READ Troubleshootings bellow! 29 | - If you are using KernelSU, you need to disable Unmount Modules by Default in KernelSU app settings 30 | - Reboot 31 | - If you are using KernelSU, you need to allow superuser list manually all package name listed in package.txt (and your home launcher app also) (enable show system apps) and reboot afterwards 32 | - If you are using SUList, you need to allow list manually your home launcher app (enable show system apps) and reboot afterwards 33 | - Go to app info of Security, Cleaner, System service plugin, and MIUI security components app and allow their network access 34 | 35 | ## Known Issues 36 | - Lock apps, hide apps, data restriction, & and some fratures in Game Booster doesn't work 37 | 38 | ## Optionals 39 | - https://t.me/ryukinotes/42 40 | - Global: https://t.me/ryukinotes/35 41 | 42 | ## Troubleshootings 43 | - https://t.me/ryukinotes/19 44 | - Global: https://t.me/ryukinotes/34 45 | 46 | ## Support & Bug Report 47 | - https://t.me/ryukinotes/54 48 | - If you don't do above, issues will be closed immediately 49 | 50 | ## Credits and Contributors 51 | - https://t.me/androidryukimodsdiscussions 52 | - You can contribute ideas about this Magisk Module here: https://t.me/androidappsportdevelopment 53 | 54 | ## Sponsors 55 | - https://t.me/ryukinotes/25 56 | 57 | 58 | -------------------------------------------------------------------------------- /action.sh: -------------------------------------------------------------------------------- 1 | MODPATH=${0%/*} 2 | 3 | # info 4 | echo "- Apps caches from this module will be re-cleaned" 5 | echo " at the next boot." 6 | echo " " 7 | 8 | # rename 9 | FILE=$MODPATH/cleaner.sh 10 | if [ -f $FILE.txt ]; then 11 | mv -f $FILE.txt $FILE 12 | fi 13 | 14 | 15 | -------------------------------------------------------------------------------- /arm64-v8a/libmagiskpolicy.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/reiryuki/Miui-Security-Magisk-Module/0e65933ada6e0e61631aa6ddc9ed1419ada1a298/arm64-v8a/libmagiskpolicy.so -------------------------------------------------------------------------------- /armeabi-v7a/libmagiskpolicy.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/reiryuki/Miui-Security-Magisk-Module/0e65933ada6e0e61631aa6ddc9ed1419ada1a298/armeabi-v7a/libmagiskpolicy.so -------------------------------------------------------------------------------- /cleaner.sh: -------------------------------------------------------------------------------- 1 | [ ! "$MODPATH" ] && MODPATH=${0%/*} 2 | UID=`id -u` 3 | 4 | # run 5 | . $MODPATH/function.sh 6 | 7 | # cleaning 8 | remove_cache 9 | PKGS=`cat $MODPATH/package.txt` 10 | for PKG in $PKGS; do 11 | rm -rf /data/user*/"$UID"/$PKG/cache/* 12 | done 13 | 14 | 15 | -------------------------------------------------------------------------------- /customize.sh: -------------------------------------------------------------------------------- 1 | # space 2 | ui_print " " 3 | 4 | # info 5 | MODVER=`grep_prop version $MODPATH/module.prop` 6 | MODVERCODE=`grep_prop versionCode $MODPATH/module.prop` 7 | ui_print " ID=$MODID" 8 | ui_print " Version=$MODVER" 9 | ui_print " VersionCode=$MODVERCODE" 10 | if [ "$KSU" == true ]; then 11 | ui_print " KSUVersion=$KSU_VER" 12 | ui_print " KSUVersionCode=$KSU_VER_CODE" 13 | ui_print " KSUKernelVersionCode=$KSU_KERNEL_VER_CODE" 14 | sed -i 's|#k||g' $MODPATH/post-fs-data.sh 15 | else 16 | ui_print " MagiskVersion=$MAGISK_VER" 17 | ui_print " MagiskVersionCode=$MAGISK_VER_CODE" 18 | fi 19 | ui_print " " 20 | 21 | # var 22 | UID=`id -u` 23 | [ ! "$UID" ] && UID=0 24 | FIRARCH=`grep_get_prop ro.bionic.arch` 25 | SECARCH=`grep_get_prop ro.bionic.2nd_arch` 26 | ABILIST=`grep_get_prop ro.product.cpu.abilist` 27 | if [ ! "$ABILIST" ]; then 28 | ABILIST=`grep_get_prop ro.system.product.cpu.abilist` 29 | fi 30 | if [ "$FIRARCH" == arm64 ]\ 31 | && ! echo "$ABILIST" | grep -q arm64-v8a; then 32 | if [ "$ABILIST" ]; then 33 | ABILIST="$ABILIST,arm64-v8a" 34 | else 35 | ABILIST=arm64-v8a 36 | fi 37 | fi 38 | if [ "$FIRARCH" == x64 ]\ 39 | && ! echo "$ABILIST" | grep -q x86_64; then 40 | if [ "$ABILIST" ]; then 41 | ABILIST="$ABILIST,x86_64" 42 | else 43 | ABILIST=x86_64 44 | fi 45 | fi 46 | if [ "$SECARCH" == arm ]\ 47 | && ! echo "$ABILIST" | grep -q armeabi; then 48 | if [ "$ABILIST" ]; then 49 | ABILIST="$ABILIST,armeabi" 50 | else 51 | ABILIST=armeabi 52 | fi 53 | fi 54 | if [ "$SECARCH" == arm ]\ 55 | && ! echo "$ABILIST" | grep -q armeabi-v7a; then 56 | if [ "$ABILIST" ]; then 57 | ABILIST="$ABILIST,armeabi-v7a" 58 | else 59 | ABILIST=armeabi-v7a 60 | fi 61 | fi 62 | if [ "$SECARCH" == x86 ]\ 63 | && ! echo "$ABILIST" | grep -q x86; then 64 | if [ "$ABILIST" ]; then 65 | ABILIST="$ABILIST,x86" 66 | else 67 | ABILIST=x86 68 | fi 69 | fi 70 | ABILIST32=`grep_get_prop ro.product.cpu.abilist32` 71 | if [ ! "$ABILIST32" ]; then 72 | ABILIST32=`grep_get_prop ro.system.product.cpu.abilist32` 73 | fi 74 | if [ "$SECARCH" == arm ]\ 75 | && ! echo "$ABILIST32" | grep -q armeabi; then 76 | if [ "$ABILIST32" ]; then 77 | ABILIST32="$ABILIST32,armeabi" 78 | else 79 | ABILIST32=armeabi 80 | fi 81 | fi 82 | if [ "$SECARCH" == arm ]\ 83 | && ! echo "$ABILIST32" | grep -q armeabi-v7a; then 84 | if [ "$ABILIST32" ]; then 85 | ABILIST32="$ABILIST32,armeabi-v7a" 86 | else 87 | ABILIST32=armeabi-v7a 88 | fi 89 | fi 90 | if [ "$SECARCH" == x86 ]\ 91 | && ! echo "$ABILIST32" | grep -q x86; then 92 | if [ "$ABILIST32" ]; then 93 | ABILIST32="$ABILIST32,x86" 94 | else 95 | ABILIST32=x86 96 | fi 97 | fi 98 | if [ ! "$ABILIST32" ]; then 99 | [ -f /system/lib/libandroid.so ] && ABILIST32=true 100 | fi 101 | 102 | # log 103 | if [ "$BOOTMODE" != true ]; then 104 | FILE=/data/media/"$UID"/$MODID\_recovery.log 105 | ui_print "- Log will be saved at $FILE" 106 | exec 2>$FILE 107 | ui_print " " 108 | fi 109 | 110 | # optionals 111 | OPTIONALS=/data/media/"$UID"/optionals.prop 112 | if [ ! -f $OPTIONALS ]; then 113 | touch $OPTIONALS 114 | fi 115 | 116 | # debug 117 | if [ "`grep_prop debug.log $OPTIONALS`" == 1 ]; then 118 | ui_print "- The install log will contain detailed information" 119 | set -x 120 | ui_print " " 121 | fi 122 | 123 | # recovery 124 | if [ "$BOOTMODE" != true ]; then 125 | MODPATH_UPDATE=`echo $MODPATH | sed 's|modules/|modules_update/|g'` 126 | rm -f $MODPATH/update 127 | rm -rf $MODPATH_UPDATE 128 | fi 129 | 130 | # sdk 131 | NUM=21 132 | if [ "$API" -lt $NUM ]; then 133 | ui_print "! Unsupported SDK $API." 134 | ui_print " You have to upgrade your Android version" 135 | ui_print " at least SDK $NUM to use this module." 136 | abort 137 | else 138 | ui_print "- SDK $API" 139 | ui_print " " 140 | fi 141 | 142 | # boot mode 143 | if [ "$BOOTMODE" != true ]; then 144 | abort "! Please install via Magisk/KernelSU app only!" 145 | fi 146 | 147 | # run 148 | . $MODPATH/function.sh 149 | 150 | # sepolicy 151 | FILE=$MODPATH/sepolicy.rule 152 | DES=$MODPATH/sepolicy.pfsd 153 | if [ "`grep_prop sepolicy.sh $OPTIONALS`" == 1 ]\ 154 | && [ -f $FILE ]; then 155 | mv -f $FILE $DES 156 | fi 157 | 158 | # miuicore 159 | if [ ! -d /data/adb/modules/MiuiCore ]; then 160 | ui_print "! Miui Core Magisk Module is not installed." 161 | ui_print " Please read github installation guide!" 162 | abort 163 | else 164 | rm -f /data/adb/modules/MiuiCore/remove 165 | rm -f /data/adb/modules/MiuiCore/disable 166 | fi 167 | 168 | # cleaning 169 | ui_print "- Cleaning..." 170 | PKGS=`cat $MODPATH/package.txt` 171 | if [ "$BOOTMODE" == true ]; then 172 | for PKG in $PKGS; do 173 | FILE=`find /data/app -name *$PKG*` 174 | if [ "$FILE" ]; then 175 | RES=`pm uninstall $PKG 2>/dev/null` 176 | fi 177 | done 178 | fi 179 | remove_sepolicy_rule 180 | ui_print " " 181 | # power save 182 | FILE=$MODPATH/system/etc/sysconfig/* 183 | if [ "`grep_prop power.save $OPTIONALS`" == 1 ]; then 184 | ui_print "- $MODNAME will not be allowed in power save." 185 | ui_print " It may save your battery but decreasing $MODNAME performance." 186 | for PKG in $PKGS; do 187 | sed -i "s|||g" $FILE 188 | sed -i "s|||g" $FILE 189 | done 190 | ui_print " " 191 | fi 192 | 193 | # cleanup 194 | DIR=/data/adb/modules/$MODID 195 | FILE=$DIR/module.prop 196 | PREVMODNAME=`grep_prop name $FILE` 197 | if [ "`grep_prop data.cleanup $OPTIONALS`" == 1 ]; then 198 | sed -i 's|^data.cleanup=1|data.cleanup=0|g' $OPTIONALS 199 | ui_print "- Cleaning-up $MODID data..." 200 | cleanup 201 | ui_print " " 202 | #elif [ -d $DIR ]\ 203 | #&& [ "$PREVMODNAME" != "$MODNAME" ]; then 204 | # ui_print "- Different module name is detected" 205 | # ui_print " Cleaning-up $MODID data..." 206 | # cleanup 207 | # ui_print " " 208 | fi 209 | 210 | # function 211 | test_signature() { 212 | FILE=`find $MODPATH/system -type f -name $APP.apk` 213 | ui_print "- Testing signature..." 214 | RES=`pm install -g -i com.android.vending $FILE 2>&1` 215 | if [ "$RES" ]; then 216 | ui_print " $RES" 217 | fi 218 | if [ "$RES" == Success ]; then 219 | RES=`pm uninstall -k $PKG 2>/dev/null` 220 | ui_print " Signature test is passed" 221 | elif echo "$RES" | grep -q INSTALL_FAILED_SHARED_USER_INCOMPATIBLE; then 222 | ui_print " Signature test is failed" 223 | ui_print " But installation is allowed for this case" 224 | ui_print " Make sure you have deactivated your Android Signature" 225 | ui_print " Verification, otherwise the app cannot be installed correctly." 226 | ui_print " If you don't know what is it, please READ Troubleshootings!" 227 | elif echo "$RES" | grep -Eq 'INSTALL_FAILED_INSUFFICIENT_STORAGE|not enough space'; then 228 | ui_print " Please free-up your internal storage first!" 229 | abort 230 | else 231 | ui_print " ! Signature test is failed" 232 | ui_print " You need to disable Signature Verification of your" 233 | ui_print " Android first to use this module. READ Troubleshootings!" 234 | if [ "`grep_prop force.install $OPTIONALS`" != 1 ]; then 235 | abort 236 | fi 237 | fi 238 | ui_print " " 239 | } 240 | 241 | # test 242 | APP=SecurityCenter 243 | PKG=com.miui.securitycenter 244 | if [ "$BOOTMODE" == true ]; then 245 | if ! appops get $PKG > /dev/null 2>&1; then 246 | test_signature 247 | fi 248 | fi 249 | 250 | # function 251 | conflict() { 252 | for NAME in $NAMES; do 253 | DIR=/data/adb/modules_update/$NAME 254 | if [ -f $DIR/uninstall.sh ]; then 255 | sh $DIR/uninstall.sh 256 | fi 257 | rm -rf $DIR 258 | DIR=/data/adb/modules/$NAME 259 | rm -f $DIR/update 260 | touch $DIR/remove 261 | FILE=/data/adb/modules/$NAME/uninstall.sh 262 | if [ -f $FILE ]; then 263 | sh $FILE 264 | rm -f $FILE 265 | fi 266 | rm -rf /metadata/magisk/$NAME\ 267 | /mnt/vendor/persist/magisk/$NAME\ 268 | /persist/magisk/$NAME\ 269 | /data/unencrypted/magisk/$NAME\ 270 | /cache/magisk/$NAME\ 271 | /cust/magisk/$NAME 272 | done 273 | } 274 | 275 | # conflict 276 | NAMES=MiuiSecurityCenter 277 | conflict 278 | 279 | # function 280 | permissive_2() { 281 | sed -i 's|#2||g' $MODPATH/post-fs-data.sh 282 | } 283 | permissive() { 284 | FILE=/sys/fs/selinux/enforce 285 | SELINUX=`cat $FILE` 286 | if [ "$SELINUX" == 1 ]; then 287 | if ! setenforce 0; then 288 | echo 0 > $FILE 289 | fi 290 | SELINUX=`cat $FILE` 291 | if [ "$SELINUX" == 1 ]; then 292 | ui_print " Your device can't be turned to Permissive state." 293 | ui_print " Using Magisk Permissive mode instead." 294 | permissive_2 295 | else 296 | if ! setenforce 1; then 297 | echo 1 > $FILE 298 | fi 299 | sed -i 's|#1||g' $MODPATH/post-fs-data.sh 300 | fi 301 | else 302 | sed -i 's|#1||g' $MODPATH/post-fs-data.sh 303 | fi 304 | } 305 | 306 | # permissive 307 | if [ "`grep_prop permissive.mode $OPTIONALS`" == 1 ]; then 308 | ui_print "- Using device Permissive mode." 309 | rm -f $MODPATH/sepolicy.rule 310 | permissive 311 | ui_print " " 312 | elif [ "`grep_prop permissive.mode $OPTIONALS`" == 2 ]; then 313 | ui_print "- Using Magisk Permissive mode." 314 | rm -f $MODPATH/sepolicy.rule 315 | permissive_2 316 | ui_print " " 317 | fi 318 | 319 | # function 320 | extract_lib() { 321 | for APP in $APPS; do 322 | FILE=`find $MODPATH/system -type f -name $APP.apk` 323 | if [ -f `dirname $FILE`/extract ]; then 324 | ui_print "- Extracting..." 325 | DIR=`dirname $FILE`/lib/"$ARCHLIB" 326 | mkdir -p $DIR 327 | rm -rf $TMPDIR/* 328 | DES=lib/"$ABILIB"/* 329 | unzip -d $TMPDIR -o $FILE $DES 330 | cp -f $TMPDIR/$DES $DIR 331 | ui_print " " 332 | fi 333 | done 334 | } 335 | hide_oat() { 336 | for APP in $APPS; do 337 | REPLACE="$REPLACE 338 | `find $MODPATH/system -type d -name $APP | sed "s|$MODPATH||g"`/oat" 339 | done 340 | } 341 | 342 | # extract 343 | APPS="`ls $MODPATH/system/priv-app` 344 | `ls $MODPATH/system/app`" 345 | ARCHLIB=arm64 346 | ABILIB=arm64-v8a 347 | extract_lib 348 | ARCHLIB=arm 349 | if echo "$ABILIST" | grep -q armeabi-v7a; then 350 | ABILIB=armeabi-v7a 351 | extract_lib 352 | elif echo "$ABILIST" | grep -q armeabi; then 353 | ABILIB=armeabi 354 | extract_lib 355 | else 356 | ABILIB=armeabi-v7a 357 | extract_lib 358 | fi 359 | ARCHLIB=x64 360 | ABILIB=x86_64 361 | extract_lib 362 | ARCHLIB=x86 363 | ABILIB=x86 364 | extract_lib 365 | rm -f `find $MODPATH/system -type f -name extract` 366 | # hide 367 | hide_oat 368 | 369 | # global 370 | FILE=$MODPATH/service.sh 371 | NAME=ro.security.mod_device 372 | if [ "`grep_prop miui.security.global $OPTIONALS`" == 1 ]; then 373 | ui_print "- Security global mode" 374 | sed -i "s|#resetprop -n $NAME|resetprop -n $NAME|g" $FILE 375 | ui_print " " 376 | fi 377 | 378 | 379 | 380 | 381 | 382 | 383 | 384 | 385 | 386 | -------------------------------------------------------------------------------- /function.sh: -------------------------------------------------------------------------------- 1 | # function 2 | remove_cache() { 3 | FILES=`find $MODPATH -type f -name *.apk | sed 's|.apk||g'` 4 | APPS=`for FILE in $FILES; do basename $FILE; done` 5 | for APP in $APPS; do 6 | rm -f `find /data/system/package_cache\ 7 | /data/dalvik-cache /data/resource-cache\ 8 | -type f -name *$APP*` 9 | done 10 | } 11 | remove_sepolicy_rule() { 12 | rm -rf /metadata/magisk/"$MODID"\ 13 | /mnt/vendor/persist/magisk/"$MODID"\ 14 | /persist/magisk/"$MODID"\ 15 | /data/unencrypted/magisk/"$MODID"\ 16 | /cache/magisk/"$MODID"\ 17 | /cust/magisk/"$MODID" 18 | } 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /module.prop: -------------------------------------------------------------------------------- 1 | id=MiuiSecurity 2 | name=Miui Security 3 | version=v1.19 4 | versionCode=19 5 | author=Rei Ryuki the Fixer 6 | description=Security, Cleaner, Scanner, and Game Booster by Xiaomi Inc. ported for any Android 5 (SDK 21) and up non-Miui ROM. 7 | 8 | 9 | -------------------------------------------------------------------------------- /package.txt: -------------------------------------------------------------------------------- 1 | com.miui.securitycenter 2 | com.miui.cleanmaster 3 | com.miui.securityadd 4 | com.miui.guardprovider 5 | -------------------------------------------------------------------------------- /post-fs-data.sh: -------------------------------------------------------------------------------- 1 | mount -o rw,remount /data 2 | MODPATH=${0%/*} 3 | 4 | # log 5 | exec 2>$MODPATH/debug-pfsd.log 6 | set -x 7 | 8 | # var 9 | ABI=`getprop ro.product.cpu.abi` 10 | 11 | # function 12 | permissive() { 13 | if [ "$SELINUX" == Enforcing ]; then 14 | if ! setenforce 0; then 15 | echo 0 > /sys/fs/selinux/enforce 16 | fi 17 | fi 18 | } 19 | magisk_permissive() { 20 | if [ "$SELINUX" == Enforcing ]; then 21 | if [ -x "`command -v magiskpolicy`" ]; then 22 | magiskpolicy --live "permissive *" 23 | else 24 | $MODPATH/$ABI/libmagiskpolicy.so --live "permissive *" 25 | fi 26 | fi 27 | } 28 | sepolicy_sh() { 29 | if [ -f $FILE ]; then 30 | if [ -x "`command -v magiskpolicy`" ]; then 31 | magiskpolicy --live --apply $FILE 2>/dev/null 32 | else 33 | $MODPATH/$ABI/libmagiskpolicy.so --live --apply $FILE 2>/dev/null 34 | fi 35 | fi 36 | } 37 | 38 | # selinux 39 | SELINUX=`getenforce` 40 | chmod 0755 $MODPATH/*/libmagiskpolicy.so 41 | #1permissive 42 | #2magisk_permissive 43 | #kFILE=$MODPATH/sepolicy.rule 44 | #ksepolicy_sh 45 | FILE=$MODPATH/sepolicy.pfsd 46 | sepolicy_sh 47 | 48 | # dependency 49 | #rm -f /data/adb/modules/MiuiCore/remove 50 | #rm -f /data/adb/modules/MiuiCore/disable 51 | 52 | # patch plat_seapp_contexts 53 | FILE=/system/etc/selinux/plat_seapp_contexts 54 | rm -f $MODPATH$FILE 55 | if ! grep 'user=system seinfo=default domain=system_app type=system_app_data_file' $FILE; then 56 | cp -af $FILE $MODPATH$FILE 57 | sed -i '1i\ 58 | user=system seinfo=default domain=system_app type=system_app_data_file' $MODPATH$FILE 59 | fi 60 | 61 | # cleaning 62 | FILE=$MODPATH/cleaner.sh 63 | if [ -f $FILE ]; then 64 | . $FILE 65 | mv -f $FILE $FILE.txt 66 | fi 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | -------------------------------------------------------------------------------- /sepolicy.rule: -------------------------------------------------------------------------------- 1 | # debug 2 | allow system_server system_file file write 3 | 4 | # context 5 | create { system_lib_file vendor_file vendor_configs_file } 6 | allow { system_file system_lib_file vendor_file vendor_configs_file } labeledfs filesystem associate 7 | allow init { system_file system_lib_file vendor_file vendor_configs_file } { dir file } relabelfrom 8 | 9 | # sock_file 10 | allow { system_app priv_app platform_app untrusted_app_29 untrusted_app_27 untrusted_app } property_socket sock_file write 11 | 12 | # file 13 | allow { system_app priv_app platform_app untrusted_app_29 untrusted_app_27 untrusted_app } * file { read open getattr map } 14 | allow { system_app priv_app platform_app untrusted_app_29 untrusted_app_27 untrusted_app } { system_app_data_file privapp_data_file } file execute 15 | allow { system_app priv_app platform_app untrusted_app_29 untrusted_app_27 untrusted_app } apk_data_file file ioctl 16 | allow { system_app priv_app platform_app untrusted_app_29 untrusted_app_27 untrusted_app } system_file file lock 17 | allow { system_app priv_app platform_app untrusted_app_29 untrusted_app_27 untrusted_app } system_linker_exec file execute_no_trans 18 | allow crash_dump { fuse app_data_file resourcecache_data_file } file { read open getattr } 19 | 20 | # dir 21 | allow { system_app priv_app platform_app untrusted_app_29 untrusted_app_27 untrusted_app } * dir { search getattr read open } 22 | allow { system_app priv_app platform_app untrusted_app_29 untrusted_app_27 untrusted_app } apk_data_file dir write 23 | allow crash_dump { mnt_user_file fuse } dir search 24 | 25 | # unix_stream_socket 26 | allow { system_app priv_app platform_app untrusted_app_29 untrusted_app_27 untrusted_app } init unix_stream_socket connectto 27 | 28 | # process 29 | allow system_app system_app process ptrace 30 | allow platform_app platform_app process ptrace 31 | allow priv_app priv_app process ptrace 32 | allow untrusted_app_29 untrusted_app_29 process ptrace 33 | allow untrusted_app_27 untrusted_app_27 process ptrace 34 | allow untrusted_app untrusted_app process ptrace 35 | 36 | # hwservice_manager 37 | allow { system_app priv_app platform_app untrusted_app_29 untrusted_app_27 untrusted_app } default_android_hwservice hwservice_manager find 38 | 39 | # service_manager 40 | allow { system_app priv_app platform_app untrusted_app_29 untrusted_app_27 untrusted_app } default_android_service service_manager { find add } 41 | allow { system_app priv_app platform_app untrusted_app_29 untrusted_app_27 untrusted_app } { perfshielder ProcessManager } service_manager add 42 | 43 | # property_service 44 | allow { system_app priv_app platform_app untrusted_app_29 untrusted_app_27 untrusted_app } { system_prop debug.prop } property_service set 45 | 46 | # lnk_file 47 | allow { system_app priv_app platform_app untrusted_app_29 untrusted_app_27 untrusted_app } sysfs_mmc_host lnk_file read 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | -------------------------------------------------------------------------------- /service.sh: -------------------------------------------------------------------------------- 1 | MODPATH=${0%/*} 2 | 3 | # log 4 | exec 2>$MODPATH/debug.log 5 | set -x 6 | 7 | # var 8 | API=`getprop ro.build.version.sdk` 9 | 10 | # property 11 | PROP=`getprop ro.product.device` 12 | resetprop --delete ro.security.mod_device 13 | #resetprop ro.security.mod_device "$PROP"_global 14 | #resetprop -n log.tag.autodensity.debug.enable 1 15 | resetprop -n ro.vendor.fps.switch.default true 16 | resetprop -n ro.vendor.audio.dpaudio true 17 | resetprop -n ro.vendor.audio.game.mode true 18 | resetprop -n ro.vendor.audio.game.effect true 19 | resetprop -n ro.vendor.audio.game.vibrate true 20 | resetprop -n ro.vendor.audio.voice.change.support true 21 | resetprop -n ro.vendor.audio.voice.change.version 2 22 | resetprop -n ro.vendor.audio.voice.change.youme.support true 23 | resetprop -n ro.vendor.audio.videobox.switch true 24 | resetprop -n ro.vendor.video_box.version 2 25 | resetprop -n ro.vendor.video.style.by.layer.support true 26 | resetprop -n ro.vendor.media.video.frc.support true 27 | resetprop -n ro.vendor.media.video.vpp.support true 28 | resetprop -n ro.vendor.media.video.style.support true 29 | resetprop -n ro.vendor.display.dynamic_refresh_rate true 30 | resetprop -n ro.vendor.gcp.enable true 31 | PROP=ro.vendor.touchfeature.type 32 | if [ ! "`getprop $PROP`" ]; then 33 | resetprop -n $PROP 43 34 | fi 35 | 36 | # wait 37 | until [ "`getprop sys.boot_completed`" == 1 ]; do 38 | sleep 10 39 | done 40 | 41 | # list 42 | PKGS="`cat $MODPATH/package.txt` 43 | com.miui.cleanmaster:micleansdk 44 | com.miui.securitycenter.remote 45 | com.miui.securitycenter.bootaware 46 | com.miui.securitycenter:ui 47 | com.miui.securityadd.home" 48 | for PKG in $PKGS; do 49 | magisk --denylist rm $PKG 2>/dev/null 50 | magisk --sulist add $PKG 2>/dev/null 51 | done 52 | if magisk magiskhide sulist; then 53 | for PKG in $PKGS; do 54 | magisk magiskhide add $PKG 55 | done 56 | else 57 | for PKG in $PKGS; do 58 | magisk magiskhide rm $PKG 59 | done 60 | fi 61 | 62 | # settings 63 | DES=system 64 | NAME=status_bar_notification_style 65 | SET=`settings get $DES $NAME` 66 | VAL=1 67 | if [ "$SET" == null ] || [ "$SET" == 0 ]; then 68 | settings put $DES $NAME $VAL 69 | fi 70 | 71 | # function 72 | appops_set() { 73 | appops set $PKG LEGACY_STORAGE allow 74 | appops set $PKG READ_EXTERNAL_STORAGE allow 75 | appops set $PKG WRITE_EXTERNAL_STORAGE allow 76 | appops set $PKG READ_MEDIA_AUDIO allow 77 | appops set $PKG READ_MEDIA_VIDEO allow 78 | appops set $PKG READ_MEDIA_IMAGES allow 79 | appops set $PKG WRITE_MEDIA_AUDIO allow 80 | appops set $PKG WRITE_MEDIA_VIDEO allow 81 | appops set $PKG WRITE_MEDIA_IMAGES allow 82 | if [ "$API" -ge 29 ]; then 83 | appops set $PKG ACCESS_MEDIA_LOCATION allow 84 | fi 85 | if [ "$API" -ge 30 ]; then 86 | appops set $PKG MANAGE_EXTERNAL_STORAGE allow 87 | appops set $PKG NO_ISOLATED_STORAGE allow 88 | appops set $PKG AUTO_REVOKE_PERMISSIONS_IF_UNUSED ignore 89 | fi 90 | if [ "$API" -ge 31 ]; then 91 | appops set $PKG MANAGE_MEDIA allow 92 | fi 93 | if [ "$API" -ge 33 ]; then 94 | appops set $PKG ACCESS_RESTRICTED_SETTINGS allow 95 | fi 96 | if [ "$API" -ge 34 ]; then 97 | appops set $PKG READ_MEDIA_VISUAL_USER_SELECTED allow 98 | fi 99 | PKGOPS=`appops get $PKG` 100 | UID=`dumpsys package $PKG 2>/dev/null | grep -m 1 Id= | sed -e 's| userId=||g' -e 's| appId=||g'` 101 | if [ "$UID" ] && [ "$UID" -gt 9999 ]; then 102 | appops set --uid "$UID" LEGACY_STORAGE allow 103 | appops set --uid "$UID" READ_EXTERNAL_STORAGE allow 104 | appops set --uid "$UID" WRITE_EXTERNAL_STORAGE allow 105 | if [ "$API" -ge 29 ]; then 106 | appops set --uid "$UID" ACCESS_MEDIA_LOCATION allow 107 | fi 108 | if [ "$API" -ge 34 ]; then 109 | appops set --uid "$UID" READ_MEDIA_VISUAL_USER_SELECTED allow 110 | fi 111 | UIDOPS=`appops get --uid "$UID"` 112 | fi 113 | } 114 | 115 | # grant 116 | PKG=com.miui.securitycenter 117 | if appops get $PKG > /dev/null 2>&1; then 118 | pm grant --all-permissions $PKG 119 | appops set $PKG SYSTEM_ALERT_WINDOW allow 120 | appops set $PKG GET_USAGE_STATS allow 121 | appops set $PKG WRITE_SETTINGS allow 122 | APP=SecurityCenter 123 | NAME=android.permission.READ_CALL_LOG 124 | NAME2=android.permission.READ_SMS 125 | NAME3=android.permission.ACCESS_BACKGROUND_LOCATION 126 | if ! dumpsys package $PKG | grep "$NAME: granted=true"\ 127 | || ! dumpsys package $PKG | grep "$NAME2: granted=true"\ 128 | || ! dumpsys package $PKG | grep "$NAME3: granted=true"; then 129 | FILE=`find $MODPATH/system -type f -name $APP.apk` 130 | if pm install -g -i com.android.vending $FILE; then 131 | pm uninstall -k $PKG 132 | fi 133 | fi 134 | appops_set 135 | fi 136 | 137 | # grant 138 | PKG=com.miui.guardprovider 139 | if appops get $PKG > /dev/null 2>&1; then 140 | pm grant --all-permissions $PKG 141 | appops set $PKG WRITE_SETTINGS allow 142 | appops_set 143 | fi 144 | 145 | # grant 146 | PKG=com.miui.securityadd 147 | if appops get $PKG > /dev/null 2>&1; then 148 | pm grant --all-permissions $PKG 149 | appops set $PKG SYSTEM_ALERT_WINDOW allow 150 | appops_set 151 | fi 152 | 153 | # grant 154 | PKG=com.miui.cleanmaster 155 | if appops get $PKG > /dev/null 2>&1; then 156 | pm grant --all-permissions $PKG 157 | appops set $PKG GET_USAGE_STATS allow 158 | appops_set 159 | fi 160 | 161 | 162 | 163 | 164 | 165 | 166 | 167 | 168 | 169 | 170 | 171 | -------------------------------------------------------------------------------- /system.prop: -------------------------------------------------------------------------------- 1 | # prevent bootloop 2 | ro.control_privapp_permissions=log 3 | 4 | # miui 5 | persist.sys.power.default.powermode=1 6 | -------------------------------------------------------------------------------- /system/etc/default-permissions/default-com.miui.cleanmaster.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /system/etc/default-permissions/default-com.miui.guardprovider.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /system/etc/default-permissions/default-com.miui.securityadd.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /system/etc/default-permissions/default-com.miui.securitycenter.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /system/etc/permissions/privapp-com.miui.cleanmaster.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /system/etc/permissions/privapp-com.miui.guardprovider.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /system/etc/permissions/privapp-com.miui.securityadd.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /system/etc/permissions/privapp-com.miui.securitycenter.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | -------------------------------------------------------------------------------- /system/etc/selinux/placeholder: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /system/etc/sysconfig/config-com.miui.cleanmaster.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /system/etc/sysconfig/config-com.miui.guardprovider.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /system/etc/sysconfig/config-com.miui.securityadd.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /system/etc/sysconfig/config-com.miui.securitycenter.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /system/priv-app/CleanMaster/CleanMaster.apk/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 13 | 17 | 18 | 21 | 22 | 25 | 26 | 29 | 30 | 33 | 34 | 37 | 38 | 41 | 42 | 45 | 46 | 49 | 50 | 53 | 54 | 57 | 58 | 61 | 62 | 65 | 66 | 69 | 70 | 73 | 74 | 77 | 78 | 81 | 82 | 85 | 86 | 89 | 90 | 93 | 94 | 97 | 98 | 101 | 102 | 105 | 106 | 109 | 110 | 113 | 114 | 117 | 118 | 121 | 122 | 125 | 126 | 129 | 130 | 133 | 134 | 137 | 138 | 141 | 142 | 145 | 146 | 149 | 150 | 153 | 154 | 157 | 158 | 161 | 162 | 165 | 166 | 169 | 170 | 173 | 174 | 177 | 178 | 181 | 182 | 185 | 186 | 189 | 190 | 193 | 194 | 197 | 198 | 201 | 202 | 205 | 206 | 209 | 210 | 213 | 214 | 217 | 218 | 221 | 222 | 225 | 226 | 229 | 230 | 233 | 234 | 237 | 238 | 241 | 242 | 245 | 246 | 249 | 250 | 253 | 254 | 257 | 258 | 275 | 279 | 280 | 289 | 291 | 294 | 295 | 298 | 299 | 300 | 302 | 307 | 308 | 311 | 312 | 315 | 316 | 319 | 320 | 321 | 322 | 330 | 332 | 337 | 338 | 341 | 342 | 345 | 346 | 349 | 350 | 351 | 353 | 356 | 357 | 360 | 361 | 362 | 363 | 371 | 373 | 378 | 379 | 382 | 383 | 386 | 387 | 390 | 391 | 392 | 394 | 397 | 398 | 401 | 402 | 403 | 404 | 411 | 413 | 418 | 419 | 422 | 423 | 426 | 427 | 430 | 431 | 432 | 434 | 439 | 440 | 443 | 444 | 447 | 448 | 451 | 452 | 453 | 455 | 458 | 459 | 462 | 463 | 464 | 466 | 469 | 470 | 473 | 474 | 475 | 476 | 483 | 484 | 492 | 494 | 499 | 500 | 503 | 504 | 507 | 508 | 511 | 512 | 513 | 515 | 518 | 519 | 522 | 523 | 524 | 525 | 532 | 533 | 540 | 541 | 548 | 549 | 557 | 559 | 564 | 565 | 568 | 569 | 572 | 573 | 576 | 577 | 578 | 580 | 583 | 584 | 587 | 588 | 589 | 590 | 598 | 600 | 605 | 606 | 609 | 610 | 613 | 614 | 617 | 618 | 619 | 621 | 624 | 625 | 628 | 629 | 630 | 631 | 639 | 641 | 646 | 647 | 650 | 651 | 654 | 655 | 658 | 659 | 660 | 662 | 665 | 666 | 669 | 670 | 671 | 673 | 676 | 677 | 680 | 681 | 682 | 683 | 691 | 693 | 698 | 699 | 702 | 703 | 706 | 707 | 710 | 711 | 712 | 714 | 717 | 718 | 721 | 722 | 723 | 724 | 732 | 733 | 741 | 742 | 749 | 750 | 758 | 759 | 767 | 768 | 776 | 777 | 785 | 787 | 792 | 793 | 796 | 797 | 800 | 801 | 804 | 805 | 806 | 808 | 811 | 812 | 815 | 816 | 817 | 818 | 826 | 828 | 833 | 834 | 837 | 838 | 841 | 842 | 845 | 846 | 847 | 849 | 852 | 853 | 856 | 857 | 858 | 859 | 866 | 868 | 871 | 872 | 875 | 876 | 877 | 878 | 885 | 886 | 894 | 896 | 899 | 900 | 903 | 904 | 905 | 906 | 913 | 914 | 921 | 922 | 929 | 931 | 934 | 935 | 938 | 939 | 940 | 941 | 948 | 950 | 953 | 954 | 957 | 958 | 959 | 960 | 964 | 966 | 969 | 970 | 971 | 973 | 976 | 977 | 978 | 980 | 983 | 984 | 985 | 987 | 990 | 991 | 992 | 993 | 997 | 998 | 1002 | 1003 | 1007 | 1008 | 1012 | 1013 | 1017 | 1018 | 1022 | 1023 | 1027 | 1028 | 1032 | 1033 | 1037 | 1039 | 1042 | 1043 | 1046 | 1047 | 1048 | 1050 | 1053 | 1054 | 1057 | 1058 | 1059 | 1061 | 1064 | 1065 | 1068 | 1069 | 1070 | 1072 | 1075 | 1076 | 1079 | 1080 | 1081 | 1082 | 1086 | 1088 | 1091 | 1092 | 1095 | 1096 | 1097 | 1098 | 1102 | 1104 | 1107 | 1108 | 1111 | 1112 | 1113 | 1115 | 1118 | 1119 | 1122 | 1123 | 1124 | 1126 | 1129 | 1130 | 1133 | 1134 | 1135 | 1136 | 1140 | 1141 | 1145 | 1146 | 1150 | 1151 | 1155 | 1156 | 1160 | 1161 | 1165 | 1166 | 1171 | 1173 | 1176 | 1177 | 1180 | 1181 | 1182 | 1183 | 1190 | 1192 | 1195 | 1196 | 1199 | 1200 | 1201 | 1202 | 1209 | 1210 | 1213 | 1215 | 1218 | 1219 | 1220 | 1221 | 1225 | 1226 | 1230 | 1231 | 1236 | 1237 | 1243 | 1247 | 1248 | 1249 | 1254 | 1256 | 1259 | 1260 | 1263 | 1264 | 1265 | 1266 | 1271 | 1273 | 1276 | 1277 | 1278 | 1279 | 1284 | 1285 | 1291 | 1293 | 1296 | 1297 | 1298 | 1299 | 1304 | 1306 | 1309 | 1310 | 1311 | 1312 | 1316 | 1317 | 1321 | 1322 | 1326 | 1327 | 1331 | 1332 | 1336 | 1337 | 1341 | 1342 | 1346 | 1347 | 1351 | 1352 | 1356 | 1357 | 1361 | 1362 | 1366 | 1367 | 1371 | 1372 | 1376 | 1377 | 1381 | 1382 | 1386 | 1387 | 1391 | 1392 | 1396 | 1397 | 1401 | 1402 | 1406 | 1407 | 1411 | 1412 | 1416 | 1417 | 1421 | 1422 | 1426 | 1427 | 1431 | 1432 | 1436 | 1437 | 1438 | 1439 | -------------------------------------------------------------------------------- /system/priv-app/CleanMaster/CleanMaster.apk/classes.dex: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/reiryuki/Miui-Security-Magisk-Module/0e65933ada6e0e61631aa6ddc9ed1419ada1a298/system/priv-app/CleanMaster/CleanMaster.apk/classes.dex -------------------------------------------------------------------------------- /system/priv-app/CleanMaster/CleanMaster.apk/resources.arsc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/reiryuki/Miui-Security-Magisk-Module/0e65933ada6e0e61631aa6ddc9ed1419ada1a298/system/priv-app/CleanMaster/CleanMaster.apk/resources.arsc -------------------------------------------------------------------------------- /system/priv-app/CleanMaster/extract: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/reiryuki/Miui-Security-Magisk-Module/0e65933ada6e0e61631aa6ddc9ed1419ada1a298/system/priv-app/CleanMaster/extract -------------------------------------------------------------------------------- /system/priv-app/GuardProvider/GuardProvider.apk: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/reiryuki/Miui-Security-Magisk-Module/0e65933ada6e0e61631aa6ddc9ed1419ada1a298/system/priv-app/GuardProvider/GuardProvider.apk -------------------------------------------------------------------------------- /system/priv-app/GuardProvider/extract: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/reiryuki/Miui-Security-Magisk-Module/0e65933ada6e0e61631aa6ddc9ed1419ada1a298/system/priv-app/GuardProvider/extract -------------------------------------------------------------------------------- /system/priv-app/SecurityCenter/SecurityCenter.apk/classes.dex: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/reiryuki/Miui-Security-Magisk-Module/0e65933ada6e0e61631aa6ddc9ed1419ada1a298/system/priv-app/SecurityCenter/SecurityCenter.apk/classes.dex -------------------------------------------------------------------------------- /system/priv-app/SecurityCenter/SecurityCenter.apk/classes2.dex: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/reiryuki/Miui-Security-Magisk-Module/0e65933ada6e0e61631aa6ddc9ed1419ada1a298/system/priv-app/SecurityCenter/SecurityCenter.apk/classes2.dex -------------------------------------------------------------------------------- /system/priv-app/SecurityCenter/SecurityCenter.apk/classes3.dex: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/reiryuki/Miui-Security-Magisk-Module/0e65933ada6e0e61631aa6ddc9ed1419ada1a298/system/priv-app/SecurityCenter/SecurityCenter.apk/classes3.dex -------------------------------------------------------------------------------- /system/priv-app/SecurityCenter/SecurityCenter.apk/resources.arsc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/reiryuki/Miui-Security-Magisk-Module/0e65933ada6e0e61631aa6ddc9ed1419ada1a298/system/priv-app/SecurityCenter/SecurityCenter.apk/resources.arsc -------------------------------------------------------------------------------- /system/priv-app/SecurityCenter/extract: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/reiryuki/Miui-Security-Magisk-Module/0e65933ada6e0e61631aa6ddc9ed1419ada1a298/system/priv-app/SecurityCenter/extract -------------------------------------------------------------------------------- /system/priv-app/securityadd/extract: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/reiryuki/Miui-Security-Magisk-Module/0e65933ada6e0e61631aa6ddc9ed1419ada1a298/system/priv-app/securityadd/extract -------------------------------------------------------------------------------- /system/priv-app/securityadd/securityadd.apk: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/reiryuki/Miui-Security-Magisk-Module/0e65933ada6e0e61631aa6ddc9ed1419ada1a298/system/priv-app/securityadd/securityadd.apk -------------------------------------------------------------------------------- /uninstall.sh: -------------------------------------------------------------------------------- 1 | mount -o rw,remount /data 2 | [ ! "$MODPATH" ] && MODPATH=${0%/*} 3 | [ ! "$MODID" ] && MODID=`basename "$MODPATH"` 4 | UID=`id -u` 5 | [ ! "$UID" ] && UID=0 6 | 7 | # log 8 | exec 2>/data/adb/$MODID\_uninstall.log 9 | set -x 10 | 11 | # run 12 | . $MODPATH/function.sh 13 | 14 | # cleaning 15 | remove_cache 16 | PKGS=`cat $MODPATH/package.txt | sed 's|com.miui.securitycenter||g'` 17 | for PKG in $PKGS; do 18 | rm -rf /data/user*/"$UID"/$PKG 19 | done 20 | remove_sepolicy_rule 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | -------------------------------------------------------------------------------- /update.sh: -------------------------------------------------------------------------------- 1 | copy_library() { 2 | if echo "$ABI" | grep 64; then 3 | DES="`find /data/app -type d -name *$PKG*`/lib/*64" 4 | if echo $DES | grep $PKG; then 5 | for NAMES in $NAME; do 6 | if [ -f /system/lib64/$NAMES ]; then 7 | cp -f /system/lib64/$NAMES $DES 8 | else 9 | cp -f /system/apex/*/lib64/$NAMES $DES 10 | cp -f /apex/*/lib64/$NAMES $DES 11 | fi 12 | done 13 | chmod 0755 $DES/* 14 | chown 1000.1000 $DES/* 15 | fi 16 | else 17 | DES="`find /data/app -type d -name *$PKG*`/lib/*" 18 | if echo $DES | grep $PKG; then 19 | for NAMES in $NAME; do 20 | if [ -f /system/lib/$NAMES ]; then 21 | cp -f /system/lib/$NAMES $DES 22 | else 23 | cp -f /system/apex/*/lib/$NAMES $DES 24 | cp -f /apex/*/lib/$NAMES $DES 25 | fi 26 | done 27 | chmod 0755 $DES/* 28 | chown 1000.1000 $DES/* 29 | fi 30 | fi 31 | } 32 | 33 | ABI=`getprop ro.product.cpu.abi` 34 | PKG=com.miui.securitycenter 35 | NAME="libnativehelper.so libmiuinative.so libmiuiblur.so" 36 | copy_library 37 | 38 | 39 | -------------------------------------------------------------------------------- /x86/libmagiskpolicy.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/reiryuki/Miui-Security-Magisk-Module/0e65933ada6e0e61631aa6ddc9ed1419ada1a298/x86/libmagiskpolicy.so -------------------------------------------------------------------------------- /x86_64/libmagiskpolicy.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/reiryuki/Miui-Security-Magisk-Module/0e65933ada6e0e61631aa6ddc9ed1419ada1a298/x86_64/libmagiskpolicy.so --------------------------------------------------------------------------------