Android GPS module is gps.default.so in the system/lib/hw/directory, general GPS-enabled mobile phones should implement this module and real GPS hardware interaction
the GPS in QEMU is to construct a gps.default.so, but this so does not deal with real hardware, just an analog interface, its code in in Sdk/emulator/gps/gps_qemu.c
The Qemu container implements a GPS device externally, but this device and Android interaction can only be piped, so Gps_qemu.c's function is to work with the pipeline and provide the Android required GPS functions, as follows:
static const Gpsinterface Qemugpsinterface = {
sizeof (Gpsinterface), qemu_gps_init, Qemu_gps_start, qemu_gps_stop, qemu_gps_cleanup, qemu _gps_inject_time, qemu_gps_inject_location, qemu_gps_delete_aiding_data, qemu_gps_set_position_ mode, qemu_gps_get_extension,};
QEMU external GPS sends data to the GPS module via the Qemu_channel_name pipeline, format NMEA, so the GPS module has several functions responsible for the parse of these data
The GPS module has a requirement that it must use its callback to create the thread (Gps_state_thread), while the position information callback is only approached (Gps_state_thread) on this line, because the framework Need a VM visible Java thread, Gps_state_thread will be attach to the VM, never callback Java layer function
"Gps_state_thread", Gps_state_thread, state);
So when Qemu_channel_nameGps_state_thread sent to Android framework
Gps.default.so call Epoll function to listen to the file FD, the implementation of the location information in the Gps_state_thread returned
Simple analysis of Android Qemu GPS module