forked from LSPosed/LSPosed
-
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.
Fix hook may not work on debuggable runtime (LSPosed#1892)
Co-authored-by: Wang Han <wanghan1995315@gmail.com>
- Loading branch information
1 parent
5991325
commit 177c2cd
Showing
17 changed files
with
84 additions
and
315 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
31 changes: 31 additions & 0 deletions
31
core/src/main/java/org/lsposed/lspd/hooker/OpenDexFileHooker.java
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,31 @@ | ||
package org.lsposed.lspd.hooker; | ||
|
||
import android.os.Build; | ||
|
||
import org.lsposed.lspd.nativebridge.HookBridge; | ||
|
||
import de.robv.android.xposed.XC_MethodHook; | ||
import de.robv.android.xposed.XposedHelpers; | ||
|
||
public class OpenDexFileHooker extends XC_MethodHook { | ||
@Override | ||
protected void afterHookedMethod(MethodHookParam param) throws Throwable { | ||
ClassLoader classLoader = null; | ||
for (var arg : param.args) { | ||
if (arg instanceof ClassLoader) { | ||
classLoader = (ClassLoader) arg; | ||
} | ||
} | ||
if (Build.VERSION.SDK_INT == Build.VERSION_CODES.P && classLoader == null) { | ||
classLoader = XposedHelpers.class.getClassLoader(); | ||
} | ||
while (classLoader != null) { | ||
if (classLoader == XposedHelpers.class.getClassLoader()) { | ||
HookBridge.setTrusted(param.getResult()); | ||
return; | ||
} else { | ||
classLoader = classLoader.getParent(); | ||
} | ||
} | ||
} | ||
} |
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 was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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
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
Oops, something went wrong.