Take camera as an example to see how the app gets a picture taken.
The method for taking a photo in the camera class is capture (). It gets response data by inheriting the interface callback function picturecallback In the android. Hardware. Camera class,
This external data is the image data obtained from the underlying layer.
When we press the shutter button, the camera application calls the capture method to enable a camera thread. After the entire camera process is completed at the underlying layer, this thread will send the captured photo data to the camera object through the message mechanism,
The underlying data enters the Java space from the C ++ space and requires an JN layer interface. Here is posteventfromnative ()
Let's move on to the camera local code. We know that the camera system consists of the client T and the server,
The client is our application. The server cameraservice calls the abstraction layer method to obtain the underlying data.
Here, the client obtains the cameraservice: Client: datacallback () data from the camera: datacallback () server,
The code is much more confusing, and the final conclusion is as follows.