prevent loading of class specified by "zygotePreloadName" #2367
Unanswered
Karanveer7921
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I have an app with a class which implements ZygotePreload and mention it in AndroidManifest.xml's application tag with
android:zygotePreloadName="<reference to the class>"
. This app here do some root detection, intergrity check, etc by loading a native shared lib. This part of code i.e loading of native lib is done before thehandleLoadPackage
method , so I can't place hooks here since app does its task beforehandleLoadPackage
is invoked and hooks are placed. Then I decided to useinitZygote(StartupParam startupParam)
. I dig into the system framework and found thatclass com.android.internal.os.AppZygoteInit$AppZygoteConnection
has a methodhandlePreloadApp(ApplicationInfo appInfo)
which invokes thedoPreload
method of that class which implementsclass ZygotePreload
. I tried to place hooks here, initially I just tried to logcom.android.internal.os.AppZygoteInit$AppZygoteConnection #handlePreloadApp(ApplicationInfo appInfo)
this method call and it didn't worked. The hook was placed but the code I wrote in hook never got executed. This means, the class defined inandroid:zygotePreloadName
is loaded even beforeinitZygote
method. How can I hookhandlePreloadApp(ApplicationInfo appInfo)
method of classcom.android.internal.os.AppZygoteInit$AppZygoteConnection
?Beta Was this translation helpful? Give feedback.
All reactions