⚠️ 本模块已并入「药师 HonorAdvancedSettings」/ Merged into HonorAdvancedSettings

全部功能已整合进 HonorAdvancedSettings(药师) 并持续更新。请迁移到新模块并卸载本模块——两者勿同时启用(钩子会重复挂载)。 All features now live in HonorAdvancedSettings and are maintained there. Please migrate and uninstall this module — do not run both at once.

HonorInstallerPurify(荣耀安装器净化)

⚠️ 本模块由 AI 生成 / This module is AI-generated

本项目由大语言模型(AI)在人类指导下生成并迭代维护,包括全部逆向分析、Hook 代码、 构建流水线与文档。代码未经人工长期审计,请自行评估风险后使用;欢迎人工审查与 PR。

This project was generated and iterated by a large language model (AI) under human direction, including all reverse engineering, hook code, the build pipeline and these docs. The code has not been long-term audited by humans — evaluate the risk yourself; human review and PRs are welcome.

面向荣耀 MagicOS 系统「软件包安装程序」com.android.packageinstaller 的 LSPosed 模块: 跳过安装第三方 APK 时的联网安全检测与安装前指纹验证,点开即装;同时禁止安装器联网上报、展示安装包信息卡,并允许降级安装低版本 APK。

An LSPosed module targeting Honor MagicOS's stock PackageInstaller (com.android.packageinstaller): it skips the online security scan and the pre-install fingerprint prompt when sideloading APKs — tap and install, no waiting. It also blocks the installer's network access, shows an APK info card, and allows version downgrades.

为什么做这个模块 / Why

荣耀 MagicOS 的安装器在每次安装第三方 APK 时:

  1. 强制联网安全检测:先请求荣耀云端安全策略,再调用手机管家做本地病毒扫描。检测期间「安装」按钮转圈不可用;即使你断网或用 root 禁止安装器联网,它也会死等回调超时,转圈时间反而更长。
  2. 安装前指纹/锁屏验证:检测完成后,云端下发的策略还可能要求指纹或锁屏密码确认,才能继续安装。

关键点:这套检测逻辑在安装器自身(PackageInstaller + 内置安全插件),并不是手机管家弹的窗,所以禁网、冻结手机管家都绕不开。

On Honor MagicOS, every sideloaded APK triggers a mandatory online security check (cloud policy + local system-manager scan) inside the stock PackageInstaller itself. The install button spins until the check completes — blocking the network only makes it wait for the timeout. Depending on the cloud-issued policy, a fingerprint or lock-screen prompt may also gate the install. This module removes both.

功能一览 / Features

功能 Feature 说明 Description
跳过联网安全检测 / Skip online security check Hook 检测总入口 ly1.h(),直接投递官方「免检测通过」结果;安装按钮秒亮,不转圈、不调手机管家扫描 / Hooks the single check entry point and immediately delivers the system's own "trusted source, no check needed" result — install button lights up instantly
跳过安装前指纹 / Skip pre-install fingerprint Hook 安装流程指纹入口 qf2.g(),直接回调验证成功 / Hooks the install-flow fingerprint entry and reports success immediately
禁止安装器联网 / Block installer network Hook Socket.connect(),安装器进程内一切联网尝试立即失败,不再云端上报 / Hooks Socket.connect in the installer process — every network attempt fails instantly, nothing is reported
展示安装包信息卡 / APK info card 借壳原「安全模式」卡片显示:版本(覆盖安装时新旧对比)、大小、SDK、架构、包名;降级安装红字标注 / Repurposes the safe-mode card to show version (old → new on updates), size, SDK, ABI and package name; downgrades flagged in red
允许降级安装 / Allow downgrade 安装低版本 APK 不再报「系统已经存在较高版本」:安装器侧补 INSTALL_ALLOW_DOWNGRADE 标志 + system_server 侧放行降级校验(需勾选「系统框架」作用域)/ Adds the downgrade install flag on the installer side and bypasses the downgrade check in system_server (requires the System Framework scope)
隐藏"未发现风险"横幅 / Hide "no risk" banner Hook PackageInstallerActivity.e2()/k2(),结果横幅渲染后置为 GONE / Hides the check-result banner after render
隐藏"安全模式"推广卡片 / Hide safe-mode promo card Hook 卡片显示决策 r12.j()、底部弹窗 r12.s() 置空,安装前后页面均生效 / Gates the safe-mode card off on both pre- and post-install pages
屏蔽"用过该应用的还喜欢"推荐 / Block "you may also like" strip Hook 广告请求入口 AbstractAdBusinessPresenter.l() 置空,直接不发起广告请求 / No-ops the ad request entry so the recommendation strip never loads
屏蔽"清理缓存"提醒 / Hide cache-clean prompt Hook z62.E() 恒返 true,安装页不再弹「清理缓存」提醒 / Suppresses the cache-clean prompt on the install page
断网秒开 / No offline delay Hook 分流请求 g82.f() 直接走失败分支,断网时不再死等 2 秒超时 / Short-circuits the diversion request so an offline install no longer waits out the 2s timeout
不动设置页验证 / Settings prompts untouched 安装器设置页的指纹入口 qf2.h() 未 Hook,其余系统行为不受影响 / The settings-page auth entry is deliberately left alone

原理 / How it works

通过 jadx 逆向 PackageInstaller.apk 与内置安全插件 HnSecurityPluginBase.apk 得到检测链路(类名为混淆名,已在 DEX 中逐一验证):

点击 APK
  └─ PackageInstallerActivity.W0()
       └─ ly1.h(…, sy1回调)                    ← 检测总入口(全 App 唯一调用点)
            ├─ py1  新荣耀检测(云端 + 本地)
            └─ qy1  旧华为检测(fz1 云请求 / w92 名单 / bz1 手机管家扫描)
                 └─ 完成后回调 sy1.b(oy1结果, jz1)
点击「安装」
  └─ iz1.p() / my1  →  qf2.g()  →  FusionAuth 指纹/锁屏弹窗

模块当前共 6 组 Hook:

  1. ly1.h(boolean, sy1) → 替换为:调用官方自带的「可信来源免检测」结果工厂 ly1.a() 构造通过结果,主线程直接回调 sy1.b()。这是系统给可信来源设计的原生放行路径,后续 UI 流程零改动。
  2. qf2.g(Context, qf2$a) → 替换为:直接回调 onAuthStart + onAuthResult(true),指纹弹窗不再出现。
  3. r12.j(...) 恒返 false + r12.s(...) 置空 → 安全模式推广卡片的显示决策与底部弹窗同时失效,安装前/安装后页面通杀。
  4. PackageInstallerActivity.e2()/k2() 后置 setVisibility(GONE) → 普通样式与安全模式样式的「未发现风险」结果横幅渲染后立即隐藏。
  5. AbstractAdBusinessPresenter.l(...) 置空 → 三个页面的广告 Presenter 均继承该方法,置空后推荐条不再发起广告请求。

The detection chain was recovered with jadx (obfuscated class names verified directly in the DEX). The core hook replaces the single check entry ly1.h with an immediate delivery of the system's own "trusted-source pass" result (ly1.a()); the fingerprint entry qf2.g gets an instant success callback; additional hooks hide the safe-mode promo card, the "no risk" banner and the recommendation strip.

环境要求 / Requirements

  • 已 root 的荣耀 MagicOS 设备:Magisk / KernelSU / ReSukkiSU + LSPosed(或 Vector 等第三方管理器)。 A rooted Honor MagicOS device: Magisk / KernelSU / ReSukkiSU + LSPosed (or a third-party manager such as Vector).
  • 实测适配:MagicOS 11(Android 17)自带 PackageInstaller(4.0);MagicOS 10(Android 16)使用 3.2。 Tested against MagicOS 11 (Android 17) PackageInstaller with v4.0; MagicOS 10 (Android 16) users should use v3.2.

安装器经过代码混淆,其他系统版本的类名可能变化导致功能静默失效; 可在 LSPosed 日志过滤 InstallBypass 查看 hook ok / skipped / bypassed 行确认 Hook 是否命中。 The installer APK is obfuscated; class names may change across versions and hooks can silently miss. Filter LSPosed logs for InstallBypass to confirm hooks are in place.

使用方法 / Usage

  1. 根据系统版本选择对应 Release:MagicOS 11 用 4.0,MagicOS 10 用 3.2。模块无界面,装完在 LSPosed/Vector 里可见。 Pick the Release matching your OS: 4.0 for MagicOS 11, 3.2 for MagicOS 10 (no launcher UI; it appears in your LSPosed manager).
  2. 在 LSPosed/Vector 中启用「荣耀安装器净化」,作用域勾选 软件包安装程序;如需降级安装功能,再勾选 系统框架(Android 系统)。 Enable the module and select the Package Installer (com.android.packageinstaller) scope; for the downgrade feature also select System Framework (android).
  3. 强制停止「软件包安装程序」或重启手机使 Hook 生效(勾选系统框架后必须重启)。 Force-stop Package Installer (or reboot) for the hooks to take effect (reboot is required after enabling the System Framework scope).
  4. 点击任意 APK 测试:应直接出现「开始安装」,无转圈、无指纹弹窗。 Tap any APK: the install button should be ready immediately, no spinner, no fingerprint.

如需恢复原版行为:在 LSPosed/Vector 中停用模块(或卸载),再强停一次软件包安装程序即可。 To revert: disable or uninstall the module, then force-stop Package Installer again.

从源码构建 / Build from source

本项目刻意不依赖 Gradle / Android Studio,使用最小命令行工具链:

powershell -ExecutionPolicy Bypass -File build.ps1

流程:ecj 编译 Java 8 → d8 转 dex → aapt2 打包 → zipalign 对齐 → apksigner 签名。 产物输出至 build/HonorInstallerPurify.apk。

需自行下载放入 tools/(体积原因未提交本仓库):

文件 来源
ecj.jar Maven Central org.eclipse.jdt:ecj
android.jar Android SDK platform-36(从 platform zip 中提取)
build-tools/ Android SDK build-tools r34+(需 d8/aapt2/zipalign/apksigner)
api-82.jar Xposed API 82(仅编译期引用,运行时由框架提供)

build.ps1 顶部的 $jreBin 指向任意 JDK/JRE 8+ 的 bin 目录即可(用 java/keytool)。

The build deliberately avoids Gradle and Android Studio: compile with plain ecj, dex with d8, package with aapt2, align with zipalign, sign with apksigner. Download the four toolchain pieces listed above into tools/ and point $jreBin at any JRE 8+.

项目结构 / Project layout

├── AndroidManifest.xml        # xposedmodule 元数据与作用域 / module meta + scope
├── assets/xposed_init         # Xposed 入口声明 / entry declaration
├── res/values/strings.xml     # 应用名与 xposedscope / app name + scope array
├── src/io/github/voreulch/installerpurify/
│   └── MainHook.java          # 全部 Hook 逻辑 / all hook logic
└── build.ps1                  # 一键构建流水线 / one-shot build pipeline

版本选择 / Version selection

系统版本 / OS 推荐版本 / Recommended 说明
MagicOS 11(Android 17) 4.0 重新适配 MagicOS 11 PackageInstaller 的混淆类名 / Re-adapted for MagicOS 11 PI obfuscation
MagicOS 10(Android 16) 3.2 3.2 在 MagicOS 10 上稳定运行;MagicOS 11 因 PI 混淆变化不兼容 / 3.2 is stable on MagicOS 10; MagicOS 11 changed PI obfuscation and is incompatible

装错版本不会变砖——Hook 类名不匹配时功能静默失效,模块本身不报错。 Installing the wrong version won't brick anything — mismatched class names just silently fail.

版本历史 / Changelog

  • 4.0(2026-09-30):MagicOS 11 适配版——重新适配 MagicOS 11(Android 17)PackageInstaller 的混淆类名;移除「不同签名覆盖安装」功能(描述简化为「跳过验证/禁止联网/展示信息/允许降级」);versionCode 提升至 13。MagicOS 10 用户请继续使用 3.2。
  • 3.2(2026-09-24):允许降级安装——安装低版本 APK 不再报「系统已经存在较高版本」,信息卡红字标注「↓ 降级安装」;需在作用域勾选「系统框架」并重启。
  • 3.1(2026-09-24):信息卡——借壳原「安全模式」卡片展示版本、大小、SDK、架构、包名,覆盖安装显示新旧对比;右上角「by VoreulCH」作者标识可点击跳转仓库。
  • 3.0(2026-09-22):描述更新,模块更名「荣耀安装器净化」。
  • 2.2(2026-09-22):修复断网后解析安装包慢 2 秒的问题(Hook 分流请求 g82.f() 直接走失败分支,2178ms → 198ms)。
  • 2.1(2026-09-22):禁止安装器联网上报(Socket.connect);隐藏「清理缓存」提醒。
  • 2.0(2026-09-22):界面净化——隐藏「未发现风险」横幅、「安全模式 建议开启」卡片(安装前后两页)、屏蔽「用过该应用的还喜欢」推荐条;修复广告 Hook 的混淆类名解析。
  • 1.0(2026-09-22):首个版本——跳过联网安全检测与安装前指纹验证。

免责声明 / Disclaimer

  • 本项目仅供学习与研究 Android Hook 技术使用,请勿用于商业用途。 For learning and research on Android hook techniques only; do not use commercially.
  • 与荣耀公司/HONOR 无任何关联;「软件包安装程序」相关商标与原应用版权归原厂所有。 Not affiliated with Honor Device Co., Ltd. All trademarks and rights to the original app belong to their owner.
  • 跳过安全检测会削弱系统对恶意应用的拦截能力,请只为来源可信的 APK 使用本模块。 Skipping security checks weakens protection against malicious apps — only install APKs from sources you trust.
  • 使用本模块产生的任何后果由使用者自行承担。 Use at your own risk.

Releases

9/30/2026, 8:37:46 AM

4.0 — MagicOS 11 适配版

本版本针对 MagicOS 11(Android 17) 的 PackageInstaller 重新适配混淆类名。

版本选择

系统版本 推荐版本
MagicOS 11(Android 17) 4.0(本 Release)
MagicOS 10(Android 16) 3.x(见 v3.x Release)

装错版本不会变砖——Hook 类名不匹配时功能静默失效,模块本身不报错。

与 3.x 的区别

  • 重新适配 MagicOS 11 PackageInstaller 的混淆类名
  • versionCode 提升至 13

功能

功能 说明
跳过联网安全检测 Hook 检测总入口,安装按钮秒亮
跳过安装前指纹 Hook 指纹入口,直接回调成功
禁止安装器联网 Hook Socket.connect,联网尝试立即失败
展示安装包信息卡 版本/大小/SDK/架构/包名,降级红字标注
允许降级安装 需勾选「系统框架」作用域并重启
隐藏「未发现风险」横幅 结果横幅渲染后隐藏
隐藏「安全模式」推广卡片 安装前后页面通杀
屏蔽推荐条 广告请求入口置空
屏蔽清理缓存提醒 安装页不再弹提醒
断网秒开 分流请求直接走失败分支

注意事项

  • 安装器经过代码混淆,跨版本类名可能变化导致功能静默失效
  • 可在 LSPosed 日志过滤 InstallBypass 查看 Hook 是否命中
  • 如需降级安装功能,请在作用域勾选「系统框架」并重启

This is an AI-generated module. See README for details.

Assets

1

3.2

Stable

9/29/2026, 7:16:11 PM

降级安装版

功能

功能 说明
跳过联网安全检测 Hook 检测总入口,安装按钮秒亮
跳过安装前指纹 Hook 指纹入口,直接回调成功
禁止安装器联网 Hook Socket.connect,联网尝试立即失败
展示安装包信息卡 版本/大小/SDK/架构/包名,降级红字标注
允许降级安装 需勾选「系统框架」作用域并重启
隐藏「未发现风险」横幅 结果横幅渲染后隐藏
隐藏「安全模式」推广卡片 安装前后页面通杀
屏蔽推荐条 广告请求入口置空
屏蔽清理缓存提醒 安装页不再弹提醒
断网秒开 分流请求直接走失败分支

注意事项

  • 安装器经过代码混淆,跨版本类名可能变化导致功能静默失效
  • 可在 LSPosed 日志过滤 InstallBypass 查看 Hook 是否命中
  • 如需降级安装功能,请在作用域勾选「系统框架」并重启

This is an AI-generated module. See README for details.

Assets

1

3.1

Stable

9/28/2026, 4:35:25 AM

信息卡版本。

  • 借壳原「安全模式」卡片展示安装包信息:版本、大小、SDK、架构、包名;覆盖安装时显示新旧对比(版本号变化、大小增减、SDK 变化)
  • 卡片右上角新增蓝色「by VoreulCH」作者标识,点击跳转源码仓库
  • 卡片原点击事件已移除,不再跳转安全模式设置
  • 安装完成页不显示信息卡

源码仓库:https://github.com/VoreulCH/HonorInstallerPurify

Assets

1

2.1

Stable

9/22/2026, 1:38:23 PM

净化加强版。

  • 隐藏安装后「清理缓存」推荐卡片(z62 卡组整体停用)
  • 安装器进程全面断网:云配置、广告 SDK、统计上报(hianalytics/听云)的 TCP 连接全部在 Socket 层拦截

注意:本版在「解析安装包」阶段会多等约 2 秒(安装器分流请求的超时处理缺陷,断网后触发),已在后续版本修复,建议等待 2.2。

源码仓库:https://github.com/VoreulCH/HonorInstallerPurify

Assets

1

2.0

Stable

9/22/2026, 1:38:15 PM

界面净化版。

  • 隐藏「未发现风险」检测结果横幅(普通/安全模式两种样式)
  • 隐藏「安全模式 建议开启」推广卡片(安装前、安装后页面均生效)
  • 屏蔽「用过该应用的还喜欢」推荐条(直接拦截广告请求入口,不再发起请求)

安装后在 LSPosed/Vector 启用,作用域勾选「软件包安装程序」,强停一次生效。源码仓库:https://github.com/VoreulCH/HonorInstallerPurify

Assets

1

1.0

Stable

9/22/2026, 1:38:07 PM

首个版本。

  • 跳过安装器联网安全检测(Hook ly1.h,安装按钮秒亮)
  • 跳过安装前指纹验证(Hook qf2.g)
  • 适配 MagicOS 11(Android 17)自带软件包安装程序

安装后在 LSPosed/Vector 启用,作用域勾选「软件包安装程序」,强停一次生效。源码仓库:https://github.com/VoreulCH/HonorInstallerPurify

Assets

1