Coder Social home page Coder Social logo

neoblackxt / miuianesthetist Goto Github PK

View Code? Open in Web Editor NEW
111.0 7.0 18.0 199 KB

Cut out those cancer apps on MIUI painlessly with the help of this Xposed module.

Home Page: https://repo.xposed.info/module/com.xposed.miuianesthetist

License: MIT License

Java 100.00%
android xposed xposed-module miui miui10 bloatware debloat coolapk

miuianesthetist's Introduction

MIUI Anesthetist

Carry out surgical strikes against MIUI. This module is committed to remove the limitations of MIUI, allowing you to enter the God mode of MIUI.

中文版

FEATURES

Disable MIUI integrity check during boot to prevent boot-loop, so that you can safely force delete System Updater and other system apps.

Remove limit for disabling some packages and prevent some packages from re-enabling during reboot.(For some ultra-sticky system apps we have to reboot after disabling them to take effect)

Prevent MI Market from hijacking Google Play on MIUI China ROMs. Thanks to & for the inspiration from: 跟悟空扯关系@CoolApk 去除MIUI强制调用小米应用商店(非改build)、ccat3z@github 我不要小米应用市场

Remove limit for third-party launchers on MIUI China ROMs. Thanks to & for the inspiration from: tianma8023@github FuckMiui

Allow users to use Security - Manage apps to disable system apps.

Remove limit for installing system apps from unofficial channels on MIUI China ROMs.

USAGE

Install and enable this Xposed module, then reboot.

Freely disable the packages which you don't need. (These packages will be keep disabled after updating system)

To remove system apps, use MIUI Anesthetist Helper Magisk module(hereinafter referred to as "helper module") in release, and Magisk Manager for Recovery Mode(hereinafter referred to as "mm") is also needed. (These packages will be kept removed after updating system)
Modify install.sh file in helper module: add the directory paths which the apps you want to remove are located in to REPLACE="", one path per line, there is a good example in a couple of lines above in this file. Once finished, you can add it to Magisk Manager or install it in recovery mode.
This helper module only removes MiuiSuperMarket by default, it's useless for MIUI global edition users, so remove that line.
You may share your modified and tested helper modules with you friends. :)

Learn more: Magisk guides

NOTICE

The toolchain is as: Magisk -> (Riru-Core) -> (Riru-Ed)Xposed -> MIUI Anesthetist

You should flash Magisk immediately as soon as you update system in recovery mode to ensure the toolchain is working.

If this module is disabled by accident, its magic will disappear and then your phone may boot-loop. (See RESCUE)
The case can be:
①This Xposed module is disabled
②Xposed framework is disabled
③Magisk which Xposed relies on is disabled
④After reinstalling or updating this Xposed module, Xposed installer doesn't detect its update.(You have to disable it and then re-enable it manually in Xposed module list)

Some system apps are Android core programs, they should never be disabled or removed. If you have no idea about a system app, you should Google it first and think twice.

RESCUE

If you have disabled some system apps, remove or rename /data/system/users/0/package-restrictions.xml file to reset disabling app settings.

If you have removed some system apps, disable the helper module using mm to recover all system apps. BTW, you'd better read its README to know its usage early.

If you have really removed some system app files from ROM, flash ROM (NOT need to wipe /data).

Advanced:
①In /data/system/users/0/package-restrictions.xml file, the enabled attribute determines if a package is disabled. enabled=3 means it is disabled, and remove enabled=3 to enable it.
②Magisk determines if a Magisk module is enabled by looking for /data/adb/modules/<module-id>/disable file. If it exists, it means the module is disabled.(Some old versions don't support this)
③(Ed)Xposed's config file is /data/user_de/0/<(Ed)Xposed-installer(manager)-package-name>/conf/modules.list file, its format is Xposed module apk files' absolute paths, one path per line, like /data/app/<Xposed-module-package-name>-<random-string>/base.apk

MISCELLANEOUS

Help me translate or optimize this README if you like.

miuianesthetist's People

Contributors

abc1763613206 avatar neoblackxt avatar

Stargazers

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

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

miuianesthetist's Issues

Prevent bootloop manually

Hello,

I'm trying to remove apps from a Nexus 5 MIUI ROM available on the official site. Is there a way to prevent bootloop without xposed and this module? Something that can be done manually?

Thanks!

优化需求:更安全的卸载系统应用的方式,动态的设置应用的安装状态

动态设置的好处在于,模块本身故障时,其对系统的修改也随之消失或是自动还原,是一种失效安全机制。

在MIUI系统的services.jar中:

package com.android.server.pm;
public class PackageManagerServiceInjector {
//...
    public static void checkPackageInstallerStatus(PackageManagerService pms, Settings curPkgSettings) {
        if (VERSION.SDK_INT >= 23 && !Build.IS_INTERNATIONAL_BUILD && !Build.IS_TABLET) {
            PackageSetting miuiInstaller = (PackageSetting) curPkgSettings.mPackages.get(MIUI_INSTALLER_PACKAGE);
            PackageSetting googleInstaller = (PackageSetting) curPkgSettings.mPackages.get(PACKAGE_INSTALLER_NAME);
            PackageSetting androidInstaller = (PackageSetting) curPkgSettings.mPackages.get("com.android.packageinstaller");
            boolean isCtsBuild = AppOpsUtils.isXOptMode();
            if (isCtsBuild) {
                if (miuiInstaller != null) {
                    miuiInstaller.setInstalled(!isCtsBuild, 0);
                }
                mMiuiInstallerPackageSetting = (PackageSetting) curPkgSettings.mPackages.get(MIUI_INSTALLER_PACKAGE);
                mMiuiInstallerPackage = (Package) pms.mPackages.get(MIUI_INSTALLER_PACKAGE);
                curPkgSettings.mPackages.remove(MIUI_INSTALLER_PACKAGE);
                if (curPkgSettings.isDisabledSystemPackageLPr(MIUI_INSTALLER_PACKAGE)) {
                    curPkgSettings.removeDisabledSystemPackageLPw(MIUI_INSTALLER_PACKAGE);
                }
                pms.mPackages.remove(MIUI_INSTALLER_PACKAGE);
            } else {
                if (mMiuiInstallerPackageSetting != null) {
                    mMiuiInstallerPackageSetting.setInstalled(!isCtsBuild, 0);
                    curPkgSettings.mPackages.put(MIUI_INSTALLER_PACKAGE, mMiuiInstallerPackageSetting);
                    if ((mMiuiInstallerPackageSetting.pkgFlags & 128) != 0) {
                        curPkgSettings.disableSystemPackageLPw(MIUI_INSTALLER_PACKAGE, true);
                    }
                }
                if (mMiuiInstallerPackage != null) {
                    pms.mPackages.put(MIUI_INSTALLER_PACKAGE, mMiuiInstallerPackage);
                }
            }
            if (googleInstaller != null) {
                googleInstaller.setInstalled(isCtsBuild, 0);
            }
            if (androidInstaller != null) {
                androidInstaller.setInstalled(isCtsBuild, 0);
            }
        }
    }
//...
}

可以仿照这个思路动态的设置一个包的安装状态,上面代码伴随持久化过程,不可直接利用。
可以考虑拦截掉相关持久化过程。在读取包安装状态时注入自定义包安装配置。
做这些之前必须详细弄清楚包安装状态的完整处理流程。

在Edexposed上启用模块后,出现一系列问题。

机型mi8,开发版系统9.5.30,在Edexposed上启用模块后,出现一系列问题:
1.默认桌面变成未选择,导致无法正常回到桌面;
2.所有apk文件无法打开,显示“没有找到应用打开该类型的文件”;
3.长按音量键无法唤醒小爱同学。

新需求:安装app时无视版本限制

设备信息

  • 系统: miui开发版9.11.7和9.11.28
  • 版本:3.0

卸载新版再装旧版app时会被阻止,希望能解除限制

提示:

安装失败
失败原因:其他原因
处理意见:请前往小米应用商店安装最新版本

截图

尝试着自己修改了下,Android 10 MIUI 11可用

看着MIUI 11反编译出来的代码

private void checkSystemSelfProtection(boolean arg2) {
        new Thread(arg2) {
            public void run() {
                PackageInfo v4_1;
                Process.setThreadPriority(10);
                if(!Build.IS_TABLET && !this.val$onlyCore) {
                    System.currentTimeMillis();
                    PackageManager v2 = SecurityManagerService.this.mContext.getPackageManager();
                    try {
                        v4_1 = v2.getPackageInfo("android", 0x40);
                    }
                    catch(PackageManager$NameNotFoundException v4) {
                        v4.printStackTrace();
                        throw new RuntimeException("System error: cannot find android package.");
                    }

                    Signature[] v4_2 = v4_1.signatures;
                    if(SecurityManagerService.this.nativeIsReleased()) {
                        SecurityManagerService.this.enforcePlatformSignature(v4_2);
                    }

                    ArrayList v5 = new ArrayList();
                    v5.add("com.lbe.security.miui");
                    String v6 = "com.android.updater";
                    v5.add(v6);
                    String v7 = "com.miui.securitycenter";
                    v5.add(v7);
                    String v8 = "com.xiaomi.finddevice";
                    v5.add(v8);
                    v5.add("com.miui.home");
                    v5.add("com.miui.guardprovider");
                    v5.add("com.miui.gallery");
                    String v10 = "com.xiaomi.market";
                    if(!Build.IS_INTERNATIONAL_BUILD && !Build.IS_CM_CUSTOMIZATION && !Build.IS_CM_CUSTOMIZATION_TEST) {
                        v5.add("com.miui.player");
                        v5.add("com.android.browser");
                        v5.add(v10);
                    }

                    Iterator v9 = v5.iterator();
                    while(v9.hasNext()) {
                        SecurityManagerService.this.checkEnabled(v2, v9.next());
                    }

                    SecurityManagerService.this.enforceAppSignature(v4_2, v6, true);
                    int v9_1 = 0;
                    SecurityManagerService.this.enforceAppSignature(v4_2, v7, false);
                    SecurityManagerService.this.enforceAppSignature(v4_2, v8, true);
                    if(!Build.IS_INTERNATIONAL_BUILD && !Build.IS_CM_CUSTOMIZATION && !Build.IS_CM_CUSTOMIZATION_TEST) {
                        SecurityManagerService.this.enforceAppSignature(v4_2, v10, false);
                    }

                    boolean v6_1 = SecurityManagerService.this.isOldmanMode();
                    v8 = "SecurityManagerService";
                    if(!SecurityManagerService.this.nativeIsReleased() || (v6_1)) {
                        Log.d(v8, "nativeIsReleased not set or " + v6_1);
                    }
                    else {
                        Log.d(v8, "nativeIsReleased set and " + v6_1);
                        SecurityManagerService v7_2 = SecurityManagerService.this;
                        if(v7_2.checkSysAppCrack()) {
                            v9_1 = 1;
                        }

                        v7_2.mSysAppCracked = v9_1;
                    }

                    System.currentTimeMillis();
                }
            }
        }.start();
    }

再看原来的代码,没搞懂


的用意何在,然后看到注释说onlyCore模式,猜想是这里的传值变了,翻遍这个services.jar也没找到哪里有这个val$onlyCore的赋值操作,就粗暴的使用

setIntField(param.thisObject, "val$onlyCore", 1);

试一下,成功了。
我的是K20 Pro 12+512. MIUI 是 11.0.8
配合Magisk模块终于可以去掉自带的应用商店,使用Google Play作为默认商店了。
修改后的源码在此
其他地方没认真验证过是否生效,不敢PR。
#15

附上成功冻结不反弹的列表
Screenshot_2020-06-20-20-33-57-057_com catchingnow icebox
Screenshot_2020-06-20-20-34-11-738_com catchingnow icebox

新需求:禁用系统特权应用的wifi联网权限

系统应用的数据流量联网可以被禁止,但WiFi联网权限禁止不了。有些系统应用会偷偷上传广告偏好数据,这一定涉及到隐私信息。
是否有必要做出这个功能,毕竟现在已经有冻结和卸载系统应用的功能了。

Recommend Projects

  • React photo React

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

  • Vue.js photo Vue.js

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

  • Typescript photo Typescript

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

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

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

Recommend Topics

  • javascript

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

  • web

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

  • server

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

  • Machine learning

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

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

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

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.