This page will follow the last article to continue introducing the android fingerprint framework knowledge. The content is focused on android source code inspecting and analysis.
Step one - startup fingerprintd service
Looking at the init.rc file, a task is assigned at init.rc when the android system boots up - start the fingerprint daemon service.
Let’s go on to check the fingerprintd program.
Here I would recommend a useful website for you viewing the android source code. Android Community
We can see the android path of the fingerprintd.cpp is system/core/fingerprintd/ and the directory structure is as below.
FingerprintDaemonProxy.h
We find the remote service is fingerprint daemon. Fingerprinted registers the remote service to the servicemanager for the client to use.
The protocol interface is IFingerprintdaemon. FingerprintService in the framework will eventually call the remote service, that is, the method in
fingerprintdaemonproxy.cpp.
fingerprintdaemonproxy.cpp
Step two - Startup FingerprintService
Next, we will move to the framework layer to find how the Fingerprint Service starts up.
open the
SystemServer.java
SystemServer.java
This class is in charge of system service management, include start-up the necessary service.
When the Android system loads the system server, starts Fingerprint Service.
FingerprintService is a subclass of SystemService class and implements the IHwbinder interface.
Let’s see the method getFingerprintDaemon(), this method will acquire the fingerprint remote service object, that is, the object of fingerprint daemon (system/core/fingerprintd), which has been registered in the init.rc. Then initialize the remote service fingerprintdaemon and set the callback mDaemonCallback.
It can be seen from the above that the fingerprint service in the framework calls the fingerprint remote service of the native layer fingerprint daemon (related to the hardware), which can be regarded as the client of the fingerprint remote service fingerprint daemon.
Ok, we have already gone through the working process of the framework layer and how they register the system service and access the HAL code by calling the remote Fingerprint Service through Binder. Let’s move to the native layer in the next article.