Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

unhook并优化性能,修复release模式下编译后无法正常运行的问题 #24

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion app/proguard-rules.pro
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@
private final android.content.SharedPreferences$OnSharedPreferenceChangeListener listener;
}

-keep class me.gm.cleaner.plugin.xposed.XposedInit
-keep class me.gm.cleaner.plugin.xposed.XposedInit {
*;
}

-assumenosideeffects class kotlin.jvm.internal.Intrinsics {
public static void check*(...);
Expand Down
5 changes: 4 additions & 1 deletion app/src/main/java/me/gm/cleaner/plugin/xposed/XposedInit.kt
Original file line number Diff line number Diff line change
Expand Up @@ -62,12 +62,14 @@ class XposedInit : ManagerService(), IXposedHookLoadPackage, IXposedHookZygoteIn
XposedHelpers.findAndHookMethod(File::class.java, "mkdirs", FileHooker())
}

lateinit var methodHook: XC_MethodHook.Unhook

@Throws(Throwable::class)
override fun handleLoadPackage(lpparam: LoadPackageParam) {
if (lpparam.appInfo.flags and ApplicationInfo.FLAG_SYSTEM == 0) {
return
}
XposedHelpers.findAndHookMethod(
methodHook = XposedHelpers.findAndHookMethod(
ContentProvider::class.java, "attachInfo",
Context::class.java, ProviderInfo::class.java, Boolean::class.java,
object : XC_MethodHook() {
Expand All @@ -80,6 +82,7 @@ class XposedInit : ManagerService(), IXposedHookLoadPackage, IXposedHookZygoteIn
MediaStore.AUTHORITY -> onMediaProviderLoaded(lpparam, context)
Downloads_Impl_AUTHORITY -> onDownloadManagerLoaded(lpparam, context)
}
methodHook.unhook()
}
}
)
Expand Down