Here we present the full set of steps/commands one should follow in order to effectively test a modification in one of ASM's LSM module's hook signature (and corresponding callback information).
We will provide some details over new commands, and you can find other useful information on the other compilation commands here.
$ cd <project directory root>/kernel/goldfish $ ARCH=x86 make -j8 goldfish_defconfig $ ARCH=x86 make -j8
$ cd <project directory root> $ . build/envsetup.sh $ lunch 2
Here you should just edit our hook signature.
$ mma <project directory root>/frameworks/base/core/java/android/os/
Here you should create new variables to hold potential new parameters of our hook signature, and you should also be careful about the type of those parameters when using method getUpcallArguments(…).
Finally you should call your newly defined hook, previously defined in IASMAPP.aidl.
$ mma <project directory root>/frameworks/base/services/java/com/android/server/
It is important to note that this file is automatically generated when you build the system and so although it belongs to package android.os it will not show in our package view.
Instead you can either open your project view and browse through the directories, or you can simply hover over a reference to it in the ASMService class file and click on Android Studio's helper reference.(file android.os.IASMAPP.java)
Even though the file is automatically generated you still need to edit it in order for our system to compile.
The changes in this class concern:
$ make update-api $ m $ make snod $ cp out/target/common/obj/JAVA_LIBRARIES/android_stubs_current_intermediates/classes.jar ~/Android/Sdk/platforms/android-19/android.jar
Command make update-api
will update the list of available methods, so that your new method can be used.
Command m
compiles the whole project in the most time efficient way. For more information on compilation click here.
Command make snod
recreates the img file containing our system, making it available to be run by the emulator.
Finally command cp …
copies the jar containing every class necessary to the development of ASM apps to Android Studio's sdk directory.
Open Android Studio and synchronize your project (it can take a minute).
Adapt your IASMAPP.Stub field in your app's ASMService and test the results on the emulator.