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

hook 不到 android.app.ActivityThread 的 systemMain 方法 #7

Closed
bmax121 opened this issue Feb 19, 2019 · 4 comments
Closed

hook 不到 android.app.ActivityThread 的 systemMain 方法 #7

bmax121 opened this issue Feb 19, 2019 · 4 comments

Comments

@bmax121
Copy link

bmax121 commented Feb 19, 2019

arm64, android 7.1.2 , lineageos14

@WindySha
Copy link

systemMain()只在system_server进程启动时才会调用,你自己的进程启动更本不会调用到,因此无法hook到

@WindySha
Copy link

SystemServer.java

private void createSystemContext() {
        ActivityThread activityThread = ActivityThread.systemMain();
        mSystemContext = activityThread.getSystemContext();
        mSystemContext.setTheme(DEFAULT_SYSTEM_THEME);

        final Context systemUiContext = activityThread.getSystemUiContext();
        systemUiContext.setTheme(DEFAULT_SYSTEM_THEME);
    }

@bmax121
Copy link
Author

bmax121 commented Feb 20, 2019

在 zygote 进程中 hook 的,类似 xposed

@bmax121
Copy link
Author

bmax121 commented Feb 20, 2019

    } else if (startsSystemServer) {
        Log.d("xxxx", "startsSystemServer");

        findAndHookMethod(ActivityThread.class, "systemMain", new XC_MethodHook() {
            @Override
            protected void afterHookedMethod(MethodHookParam param) throws Throwable {
                final ClassLoader cl = Thread.currentThread().getContextClassLoader();

                Log.d("xxxxxx", "systemMain");

我在 414 进程,也就是 zygote 进程做的上面的代码的 hook ,
然后:

02-17 12:24:18.845: D/xxxx(414): startsSystemServer
02-17 12:24:20.062: I/Zygote(414): System server process 963 has been created
02-17 12:24:28.698: I/SystemServer(963): Entered the Android system server!
02-17 12:24:28.768: D/added-source-log(963): /frameworks/base/core/java/android/app/ActivityThread.java#systemMain()

但是 963 进程并没有打印出 systemMain

其他 app 进程的 hook 正常

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants