Symptoms
Customer want to add gps dynamic link library as service in android system,but can not be allowed by Android SE Policy.
Diagnosis
Customer didn't set the correct config file.
Solution
① Open the file android_build/device/fsl/imx8q/mek_8q/mek_8q.mk, add gnss service
# GNSS HAL PUALPRODUCT_PACKAGES += \android.hardware.gnss@1.0-impl \android.hardware.gnss@1.0-service
② Open the file android_build/device/fsl/imx8q/mek_8q/manifest.xml and add gnss hidl
android.hardware.gnsshwbinder 1.0 IGnss default
③ Open the file android_build/device/fsl/imx8q/mek_8q/BoardConfig.mk, add
#GNSS PUALBOARD_HAS_GPS_HARDWARE := true
④ Open the file android_build/device/fsl/imx8q/mek_8q/ueventd.freescale.rc, add
/dev/ttyLP1 0660 system gps
Add Selinux permissions
Add in device/fsl/imx8q/sepolicy/system_server.te:
allow hal_gnss_default vndbinder_device:chr_file {read };
After adding the test, there are also permission issues such as write, open, etc., we add it all at once:
allow hal_gnss_default vndbinder_device:chr_file {open read write execute getattr create ioctl map};