Skip to content

Commit

Permalink
Merge pull request #1 from rapperskull/master
Browse files Browse the repository at this point in the history
Added support for Android 8.0/8.1 Oreo
  • Loading branch information
ttimasdf authored Jan 30, 2018
2 parents 48832b2 + 6a4018c commit 79a712b
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 17 deletions.
4 changes: 2 additions & 2 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ android {
applicationId "pw.rabit.xposed.xdebuggable"
minSdkVersion 23
targetSdkVersion 26
versionCode 3
versionName "1.2"
versionCode 4
versionName "1.3"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
Expand Down
50 changes: 35 additions & 15 deletions app/src/main/java/pw/rabit/xposed/xdebuggable/DebugHook.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,22 +18,42 @@
public class DebugHook implements IXposedHookLoadPackage {
@Override
public void handleLoadPackage(XC_LoadPackage.LoadPackageParam loadPackageParam) throws Throwable {
XC_MethodHook myHook = new XC_MethodHook() {
@Override
protected void beforeHookedMethod(MethodHookParam param) throws Throwable {
Activity app = (Activity) param.thisObject;
Intent intent = app.getIntent();
intent.putExtra("com.android.settings.extra.DEBUGGABLE", false);
app.setIntent(intent);
}
};
if (loadPackageParam.packageName.equals("com.android.settings")) {
XposedHelpers.findAndHookMethod(
"com.android.settings.AppPicker",
loadPackageParam.classLoader,
"onCreate",
"android.os.Bundle",
new XC_MethodHook() {
@Override
protected void beforeHookedMethod(MethodHookParam param) throws Throwable {
Activity app = (Activity) param.thisObject;
Intent intent = app.getIntent();
intent.putExtra("com.android.settings.extra.DEBUGGABLE", false);
app.setIntent(intent);
}
}
);
String className = "";
try{
XposedHelpers.findClass("com.android.settings.AppPicker", loadPackageParam.classLoader);
className = "com.android.settings.AppPicker";
XposedBridge.log("XDebuggable: Class com.android.settings.AppPicker FOUND!");
} catch(XposedHelpers.ClassNotFoundError e) {
XposedBridge.log("XDebuggable: Class com.android.settings.AppPicker not found.");
}
try{
XposedHelpers.findClass("com.android.settings.development.AppPicker", loadPackageParam.classLoader);
className = "com.android.settings.development.AppPicker";
XposedBridge.log("XDebuggable: Class com.android.settings.development.AppPicker FOUND!");
} catch(XposedHelpers.ClassNotFoundError e) {
XposedBridge.log("XDebuggable: Class com.android.settings.development.AppPicker not found.");
}

if(!className.equals("")){
XposedHelpers.findAndHookMethod(
className,
loadPackageParam.classLoader,
"onCreate",
"android.os.Bundle",
myHook
);
}

} else if (loadPackageParam.packageName.equals("android")) {
// Inspired from https://github.com/jecelyin/buildprop/blob/master/app/src/main/java/com/jecelyin/buildprop/BuildPropEditor.java
XposedBridge.hookAllMethods(android.os.Process.class, "start", new XC_MethodHook() {
Expand Down

0 comments on commit 79a712b

Please sign in to comment.