要编写一个满足你需求的Magisk模块,你需要按照以下步骤进行操作:

  1. 创建一个名为module.prop的文件,其中包含模块的基本信息。例如:
id=google_freeze
name=Google Freeze
version=1.0
versionCode=1
author=Your Name
description=Freezes Google Services and Google Services Framework
  1. 创建一个名为system.prop的文件,其中包含以下内容:
# 冻结Google Services和Google Services Framework
ro.config.disable_gms=1
  1. 创建名为service.sh的文件,其中包含以下内容:
#!/system/bin/sh

MODPATH=/sbin/.magisk/modules/google_freeze

# 当模块被加载时
on_post_fs_data() {
    # 解冻Google Services和Google Services Framework
    pm enable com.google.android.gms
    pm enable com.google.android.gsf
}

# 当模块被卸载时
on_uninstall() {
    # 冻结Google Services和Google Services Framework
    pm disable com.google.android.gms
    pm disable com.google.android.gsf
}

# 当APP启动时
on_boot() {
    # 解冻Google Services和Google Services Framework
    pm enable com.google.android.gms
    pm enable com.google.android.gsf
}

# 当APP退出时
on_shutdown() {
    # 冻结Google Services和Google Services Framework
    pm disable com.google.android.gms
    pm disable com.google.android.gsf
}
  1. 创建名为uninstall.sh的文件,其中包含以下内容:
#!/system/bin/sh

# 清除模块的残留
rm -rf /data/adb/modules/google_freeze
  1. 将上述文件复制到一个名为google_freeze的文件夹中。

  2. google_freeze文件夹压缩成google_freeze.zip

  3. google_freeze.zip文件移动到你的设备中的任意位置。

  4. 在Magisk Manager中,点击模块选项卡,然后点击"+"按钮。

  5. 选择google_freeze.zip文件并进行安装。

  6. 安装完成后,重新启动设备。

这样,你的Magisk模块就会在系统启动时冻结Google Services和Google Services Framework,在APP启动时解冻它们,在APP退出时重新冻结它们。当你卸载模块时,它会完全移除模块的所有残留。

请注意,这只是一个简单的示例,可能需要根据你的设备和系统进行一些调整

写一个magisk模块冻结谷歌服务和谷歌服务框架当有APP调用谷歌服务或需要谷歌服务时自动解冻APP退出自动冻结。并且请为该模块写一个非常完美的卸载脚本以确保模块卸载后能没有任何残留。

原文地址: https://www.cveoy.top/t/topic/h21e 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录