I got error message like below. (I'm using Android 7.0 nougot)
[1: gpsd: 2855] CPU: 1 MPIDR: 80000001 PID: 2855 Comm: gpsd Tainted: G W 3.18.14-g6077be6-dirty #59 // This line is printed dump_stack. I added dump_stack() in wakelock.c to know which process requesting wakelock. it means that below messages are related with gpsd application.
1740 2855 E GNSS : 10:27:40.919|E| lal_wakelock.c.0164| Wakelock: write /sys/power/wake_lock fd:31 ret:-1 errno 1
1740 2855 E GNSS : 10:27:41.037|E| lal_wakelock.c.0164| Wakelock: write /sys/power/wake_unlock fd:31 ret:-1 errno 1
Finally I found that it occurred by whether allowed CAP_BLOCK_SUSPEND.
So I added some code. but it is still happening. I need help...at least I want know how to debug it.
init.mydevice.rc
@@ -276,6 +276,7 @@ service gpsd /system/bin/gpsd
class main
user gps
group system inet wakelock
+ capabilities BLOCK_SUSPEND
sepolicy/gpsd.te
@@ -1,4 +1,5 @@
# gpsd - GPS daemon
+wakelock_use(gpsd);
allow gpsd sysfs_wake_lock:file w_file_perms;