-
-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
ec2b76d
commit 84ed571
Showing
14 changed files
with
448 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
23 changes: 23 additions & 0 deletions
23
app/src/main/kotlin/star/sky/voyager/hook/apps/PackageInstaller.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
package star.sky.voyager.hook.apps | ||
|
||
import de.robv.android.xposed.callbacks.XC_LoadPackage | ||
import star.sky.voyager.hook.hooks.packageinstaller.DisableCountCheck | ||
import star.sky.voyager.hook.hooks.packageinstaller.DisableSafeModelTip | ||
import star.sky.voyager.hook.hooks.packageinstaller.RemovePackageInstallerAds | ||
import star.sky.voyager.hook.hooks.packageinstaller.ShowMoreApkInfo | ||
import star.sky.voyager.utils.init.AppRegister | ||
|
||
object PackageInstaller : AppRegister() { | ||
override val packageName: String = "com.miui.packageinstaller" | ||
|
||
override fun handleLoadPackage(lpparam: XC_LoadPackage.LoadPackageParam) { | ||
autoInitHooks( | ||
lpparam, | ||
DisableCountCheck, // 禁用频繁安装应用检查 | ||
RemovePackageInstallerAds, // 去广告 | ||
DisableSafeModelTip, // // 禁用安全守护提示 | ||
// AllowUpdateSystemApp, // 允许更新系统应用 | ||
ShowMoreApkInfo, // 显示更多应用信息 | ||
) | ||
} | ||
} |
45 changes: 45 additions & 0 deletions
45
app/src/main/kotlin/star/sky/voyager/hook/hooks/packageinstaller/AllowUpdateSystemApp.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
package star.sky.voyager.hook.hooks.packageinstaller | ||
|
||
import android.content.pm.ApplicationInfo | ||
import com.github.kyuubiran.ezxhelper.ClassUtils.loadClassOrNull | ||
import com.github.kyuubiran.ezxhelper.EzXHelper | ||
import com.github.kyuubiran.ezxhelper.HookFactory.`-Static`.createHook | ||
import com.github.kyuubiran.ezxhelper.Log | ||
import com.github.kyuubiran.ezxhelper.finders.MethodFinder.`-Static`.methodFinder | ||
import star.sky.voyager.utils.api.hookBeforeMethod | ||
import star.sky.voyager.utils.init.HookRegister | ||
import star.sky.voyager.utils.key.hasEnable | ||
|
||
|
||
object AllowUpdateSystemApp : HookRegister() { | ||
override fun init() = hasEnable("package_installer_allow_update_system_app") { | ||
try { | ||
"android.os.SystemProperties".hookBeforeMethod( | ||
EzXHelper.classLoader, | ||
"getBoolean", String::class.java, Boolean::class.java | ||
) { | ||
if (it.args[0] == "persist.sys.allow_sys_app_update") it.result = true | ||
} | ||
} catch (e: Throwable) { | ||
Log.ex(e) | ||
} | ||
|
||
var letter = 'a' | ||
for (i in 0..25) { | ||
val classIfExists = loadClassOrNull("j2.${letter}") | ||
classIfExists?.let { | ||
if (it.declaredMethods.size in 15..25) { | ||
it.methodFinder().first { | ||
parameterTypes[0] == ApplicationInfo::class.java | ||
}.createHook { | ||
before { hookParam -> | ||
hookParam.result = false | ||
} | ||
} | ||
} | ||
} | ||
Log.i(letter.toString() + classIfExists.toString()) | ||
letter++ | ||
} | ||
} | ||
} |
21 changes: 21 additions & 0 deletions
21
app/src/main/kotlin/star/sky/voyager/hook/hooks/packageinstaller/DisableCountCheck.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
package star.sky.voyager.hook.hooks.packageinstaller | ||
|
||
import com.github.kyuubiran.ezxhelper.ClassUtils.loadClass | ||
import com.github.kyuubiran.ezxhelper.HookFactory.`-Static`.createHook | ||
import com.github.kyuubiran.ezxhelper.Log | ||
import com.github.kyuubiran.ezxhelper.finders.MethodFinder.`-Static`.methodFinder | ||
import star.sky.voyager.utils.init.HookRegister | ||
import star.sky.voyager.utils.key.hasEnable | ||
|
||
object DisableCountCheck : HookRegister() { | ||
override fun init() = hasEnable("package_installer_remove_check") { | ||
loadClass("com.miui.packageInstaller.model.RiskControlRules").methodFinder().first { | ||
name == "getCurrentLevel" | ||
}.createHook { | ||
before { param -> | ||
Log.i("Hooked getCurrentLevel, param result = ${param.result}") | ||
param.result = 0 | ||
} | ||
} | ||
} | ||
} |
39 changes: 39 additions & 0 deletions
39
app/src/main/kotlin/star/sky/voyager/hook/hooks/packageinstaller/DisableSafeModelTip.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
package star.sky.voyager.hook.hooks.packageinstaller | ||
|
||
import com.github.kyuubiran.ezxhelper.ClassUtils.loadClass | ||
import com.github.kyuubiran.ezxhelper.HookFactory.`-Static`.createHook | ||
import com.github.kyuubiran.ezxhelper.finders.FieldFinder.`-Static`.fieldFinder | ||
import com.github.kyuubiran.ezxhelper.finders.MethodFinder.`-Static`.methodFinder | ||
import star.sky.voyager.utils.init.HookRegister | ||
import star.sky.voyager.utils.key.hasEnable | ||
|
||
object DisableSafeModelTip : HookRegister() { | ||
override fun init() = hasEnable("Disable_Safe_Model_Tip") { | ||
loadClass("com.miui.packageInstaller.model.ApkInfo").methodFinder().first { | ||
name == "getSystemApp" | ||
}.createHook { | ||
returnConstant(true) | ||
} | ||
loadClass("com.miui.packageInstaller.InstallProgressActivity").methodFinder().first { | ||
name == "g0" | ||
}.createHook { | ||
returnConstant(false) | ||
} | ||
loadClass("com.miui.packageInstaller.InstallProgressActivity").methodFinder().first { | ||
name == "Q1" | ||
}.createHook { | ||
before { | ||
it.result = null | ||
} | ||
} | ||
loadClass("com.miui.packageInstaller.InstallProgressActivity").methodFinder().first { | ||
true | ||
}.createHook { | ||
after { param -> | ||
param.thisObject.javaClass.fieldFinder().first { | ||
type == Boolean::class.java | ||
}.setBoolean(param.thisObject, false) | ||
} | ||
} | ||
} | ||
} |
63 changes: 63 additions & 0 deletions
63
...src/main/kotlin/star/sky/voyager/hook/hooks/packageinstaller/RemovePackageInstallerAds.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
package star.sky.voyager.hook.hooks.packageinstaller | ||
|
||
import android.content.Context | ||
import com.github.kyuubiran.ezxhelper.ClassUtils.loadClass | ||
import com.github.kyuubiran.ezxhelper.EzXHelper | ||
import com.github.kyuubiran.ezxhelper.HookFactory.`-Static`.createHook | ||
import com.github.kyuubiran.ezxhelper.MemberExtensions.paramCount | ||
import com.github.kyuubiran.ezxhelper.finders.MethodFinder.`-Static`.methodFinder | ||
import star.sky.voyager.utils.api.findClassOrNull | ||
import star.sky.voyager.utils.api.setBooleanField | ||
import star.sky.voyager.utils.init.HookRegister | ||
import star.sky.voyager.utils.key.hasEnable | ||
|
||
object RemovePackageInstallerAds : HookRegister() { | ||
override fun init() = hasEnable("package_installer_remove_ads") { | ||
loadClass("com.android.packageinstaller.compat.MiuiSettingsCompat").methodFinder().first { | ||
name == "isPersonalizedAdEnabled" && returnType == Boolean::class.java | ||
}.createHook { | ||
after { | ||
it.result = false | ||
} | ||
} | ||
loadClass("com.android.packageinstaller.compat.MiuiSettingsCompat").methodFinder().first { | ||
name == "isInstallRiskEnabled" && | ||
paramCount == 1 && | ||
parameterTypes[0] == Context::class.java | ||
}.createHook { | ||
after { | ||
it.result = false | ||
} | ||
} | ||
val qaq = listOf("s", "q", "f", "t", "r") | ||
loadClass("m2.b").methodFinder().apply { | ||
qaq.forEach { qaq -> | ||
first { | ||
name == qaq | ||
}.createHook { | ||
returnConstant(false) | ||
} | ||
} | ||
} | ||
var letter = 'a' | ||
for (i in 0..25) { | ||
try { | ||
val classIfExists = | ||
"com.miui.packageInstaller.ui.listcomponets.${letter}0".findClassOrNull( | ||
EzXHelper.classLoader | ||
) | ||
classIfExists?.let { | ||
it.methodFinder().first { | ||
name == "a" | ||
}.createHook { | ||
after { hookParam -> | ||
hookParam.thisObject.setBooleanField("l", false) | ||
} | ||
} | ||
} | ||
} catch (t: Throwable) { | ||
letter++ | ||
} | ||
} | ||
} | ||
} |
Oops, something went wrong.