-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: fix PackageInstaller, change package name & update dependencies
In newer versions, when certain conditions met, the `mOk` (Install) button will be disabled. This commit fixed this. Package name changed to `krtl.xposed.iflytek` from `krtl.xposed.iflytekt10`.
- Loading branch information
Showing
10 changed files
with
86 additions
and
49 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
krtl.xposed.iflytekt10.MainHook | ||
krtl.xposed.iflytek.MainHook |
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,68 @@ | ||
package krtl.xposed.iflytek | ||
|
||
import de.robv.android.xposed.IXposedHookLoadPackage | ||
import de.robv.android.xposed.XC_MethodHook | ||
import de.robv.android.xposed.XC_MethodReplacement | ||
import de.robv.android.xposed.XposedHelpers | ||
import de.robv.android.xposed.XposedHelpers.findAndHookMethod | ||
import de.robv.android.xposed.XposedHelpers.getBooleanField | ||
import de.robv.android.xposed.XposedHelpers.getObjectField | ||
import de.robv.android.xposed.callbacks.XC_LoadPackage | ||
|
||
class MainHook: IXposedHookLoadPackage { | ||
override fun handleLoadPackage(lpparam: XC_LoadPackage.LoadPackageParam) { | ||
val packageName = lpparam.packageName | ||
|
||
when (packageName) { | ||
"com.android.packageinstaller" -> hookPackageInstaller(lpparam) | ||
else -> return | ||
} | ||
} | ||
|
||
private fun hookPackageInstaller(lpparam: XC_LoadPackage.LoadPackageParam) { | ||
val packageInstallerClassLoader = lpparam.classLoader | ||
val packageInstallerActivity = "com.android.packageinstaller.PackageInstallerActivity" | ||
|
||
// Bypass checks and initiate install | ||
findAndHookMethod( | ||
packageInstallerActivity, | ||
packageInstallerClassLoader, | ||
"checkIfAllowedAndInitiateInstall", | ||
object : XC_MethodHook() { | ||
override fun beforeHookedMethod(param: MethodHookParam) { | ||
XposedHelpers.callMethod(param.thisObject, "initiateInstall") | ||
param.result = null // Prevent original method execution | ||
} | ||
} | ||
) | ||
|
||
// Allow new app installs | ||
findAndHookMethod( | ||
packageInstallerActivity, | ||
packageInstallerClassLoader, | ||
// IFlyTek-proprietary method for preventing new app installs | ||
"isPackageInstalled", | ||
String::class.java, | ||
object : XC_MethodReplacement() { | ||
override fun replaceHookedMethod(param: MethodHookParam) = true | ||
} | ||
) | ||
|
||
// Some unknown weird stuff | ||
findAndHookMethod( | ||
packageInstallerActivity, | ||
packageInstallerClassLoader, | ||
"onResume", | ||
object : XC_MethodHook() { | ||
override fun afterHookedMethod(param: MethodHookParam) { | ||
val mOkButton = getObjectField(param.thisObject, "mOk") | ||
val mEnableOk = getBooleanField(param.thisObject, "mEnableOk") | ||
|
||
if (mOkButton != null) { | ||
XposedHelpers.callMethod(mOkButton, "setEnabled", mEnableOk) | ||
} | ||
} | ||
} | ||
) | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
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 |
---|---|---|
@@ -1,5 +1,5 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<resources> | ||
<string name="app_name">去你的科大讯飞 AI 学习机 by Keritial</string> | ||
<string name="xposed_description">恢复包管理安装程序正常的行为。</string> | ||
<string name="app_name">去你的科大讯飞 AI 学习机</string> | ||
<string name="xposed_description">恢复包管理安装程序等 Android 组件正常的行为。</string> | ||
</resources> |
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 |
---|---|---|
@@ -1,4 +1,4 @@ | ||
<resources> | ||
<string name="app_name">Fuck IFlyTek T10 AI Learning Machine</string> | ||
<string name="xposed_description">Restore the normal behaviour of Package Installer.</string> | ||
<string name="app_name">Fuck IFlyTek AI Learning Machine</string> | ||
<string name="xposed_description">Restore normal behaviours of Android components, e.g., Package Installer.</string> | ||
</resources> |
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 |
---|---|---|
@@ -1,5 +1,5 @@ | ||
// Top-level build file where you can add configuration options common to all sub-projects/modules. | ||
plugins { | ||
id("com.android.application") version "8.3.0" apply false | ||
id("com.android.application") version "8.5.0" apply false | ||
id("org.jetbrains.kotlin.android") version "1.9.0" apply false | ||
} |
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 |
---|---|---|
@@ -1,6 +1,6 @@ | ||
#Sat Mar 16 23:23:10 HKT 2024 | ||
distributionBase=GRADLE_USER_HOME | ||
distributionPath=wrapper/dists | ||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.4-bin.zip | ||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-bin.zip | ||
zipStoreBase=GRADLE_USER_HOME | ||
zipStorePath=wrapper/dists |