\subchapter{Develop a Framework Component}{Learn to integrate it in
  Android a Framework component}

After this lab, you will be able to
\begin{itemize}
  \item Modify the Android framework
  \item Use JNI bindings
\end{itemize}

\section{Write and integrate the component in the build system}

Aside from the \code{jni} folder, you'll find in the \code{frameworks}
folder a \code{java} folder that contains a Java Interface,
\code{MissileBackendImpl}. In the same folder, write the
\code{USBBackend} class implementing this interface that uses your
bindings. You have an example of such a class in the
\code{DummyBackend.java} file.

Now you can integrate it into the build system, so that it generates a .jar
library that is in our product, with the proper dependencies expressed.

You can find documentation about how to integrate device-specific parts of the
framework in the \code{device/sample/frameworks} folder.

\section{Testing the bindings}

We should now have a system with the files
\code{/system/framework/com.fe.android.backend.jar}, containing the Java
classes, \code{/system/lib/liblauncher_jni.so}, containing the JNI bindings and
\code{/system/lib/libusb.so}.

Test what you did using the Main class present in the Java source code
by directly invoking Dalvik through the \code{app_process}
command. You will have to provide both the classpath and the class
name to make it work and should look like
\code{CLASSPATH=path/to/java.jar app_process /system/bin com.fe.android.Main}

Once you have a solution that works, you can ask your instructor to
give you a URL where Bootlin's solution is available, and compare
it with what you implemented.
