[Galaxy S III Android Development] leleobhz:
A point to @ChronoMonochrome about GPS status:

GPS does not work (Tested with GPS Status app). Searching about it a little, I found a interesting thing:

While forcing GPS status + caffeine mode:

m0:/ # ps -Aw | grep glgps
gps 26768 26767 16792 4912 poll_schedule_timeout 40ce1d38 S glgps

PID is 26768.

Env:

m0:/ # tr '\0' '\n' < /proc/26768/environ
_=/vendor/bin/glgps
ANDROID_DATA=/data
EXTERNAL_STORAGE=/sdcard
ANDROID_ROOT=/system
ANDROID_BOOTLOGO=1
ANDROID_ASSETS=/system/app
ANDROID_SOCKET_gps=11
BOOTCLASSPATH=/system/framework/core-oj.jar:/system/framework/core-libart.jar:/system/framework/conscrypt.jar:/system/framework/okhttp.jar:/system/framework/bouncycastle.jar:/system/framework/apache-xml.jar:/system/framework/ext.jar:/system/framework/framework.jar:/system/framework/telephony-common.jar:/system/framework/voip-common.jar:/system/framework/ims-common.jar:/system/framework/android.hidl.base-V1.0-java.jar:/system/framework/android.hidl.manager-V1.0-java.jar:/system/framework/framework-oahl-backward-compatibility.jar:/system/framework/android.test.base.jar
ASEC_MOUNTPOINT=/mnt/asec
DOWNLOAD_CACHE=/data/cache
ANDROID_STORAGE=/storage
LD_SHIM_LIBS=/system/lib/libsec-ril.so|libsamsung_symbols.so
PATH=/sbin:/system/sbin:/system/bin:/system/xbin:/odm/bin:/vendor/bin:/vendor/xbin
SYSTEMSERVERCLASSPATH=/system/framework/org.lineageos.platform.jar:/system/framework/org.lineageos.hardware.jar:/system/framework/services.jar:/system/framework/ethernet-service.jar:/system/framework/wifi-service.jar:/system/framework/com.android.location.provider.jar

PROC/FD:

130|m0:/ # ls -lah /proc/26768/fd/
total 0
dr-x------ 2 gps system 0 2019-03-16 15:20 .
dr-xr-xr-x 8 gps system 0 2019-03-16 15:18 ..
lrwx------ 1 gps system 64 2019-03-16 15:21 0 -> /dev/null
lrwx------ 1 gps system 64 2019-03-16 15:21 1 -> /dev/null
lr-x------ 1 gps system 64 2019-03-16 15:21 10 -> /data/gps/.gps.interface.pipe.to_gpsd
lrwx------ 1 gps system 64 2019-03-16 15:21 11 -> socket:[428419]
l-wx------ 1 gps system 64 2019-03-16 15:21 12 -> /data/gps/.gps.interface.pipe.to_jni
lrwx------ 1 gps system 64 2019-03-16 15:21 13 -> /dev/ttySAC1
lrwx------ 1 gps system 64 2019-03-16 15:21 2 -> /dev/null
lr-x------ 1 gps system 64 2019-03-16 15:21 3 -> pipe:[428481]
l-wx------ 1 gps system 64 2019-03-16 15:21 4 -> pipe:[428481]
lrwx------ 1 gps system 64 2019-03-16 15:21 5 -> socket:[428482]
l-wx------ 1 gps system 64 2019-03-16 15:21 6 -> /data/gps/.gpsd.lock
lr-x------ 1 gps system 64 2019-03-16 15:21 7 -> /data/gps/glgpsctrl
lr-x------ 1 gps system 64 2019-03-16 15:21 8 -> pipe:[428486]
l-wx------ 1 gps system 64 2019-03-16 15:21 9 -> pipe:[428486]

Curiously the pipe to jni works, pointing no failure at all from JNI:

130|m0:/ # head -n 20 /data/gps/.gps.interface.pipe.to_jni
��ER�E��ći�ERjj$PGLOR,4,STA,001052.00,0.000,0.000,0,2000,9999,0,P,F,L,1,C,0,S,0000,0,0,R,FFFFFFFF,tPeF,0,653,OSC,,,,*73
@�ER�E��ći�ER$PGLOR,1,SAT*31
52.��ER�E��ći�ER__$PGLOR,1,SIO,TxERR,0,RxERR,0,TxCNT,92,RxCNT,1204,DTMS,1001,DTIN,2,12,DTOUT,38,964,HATMD,89*3D
St�ER�E��ći�ERHH$PGLOR,0,HLA,001052.00,L,,Al,,A,,H,,,M,,Ac,,Gr,,S,,,Sx,,,T,,Tr,,Mn,*00
��ER�E��ći�ERTT$PGLOR,1,PWR,AvgP,105.320007,RFTm,1000,RunT,1000,OscTm,1000,SlpTm,0,MeasTm,1000*2D
l�ER�E��ći�ER>>$GPGSV,4,1,14,07,01,000,,06,01,000,,09,01,000,,08,01,000,*79
pTl�ER�E��ći�ER>>$GPGSV,4,2,14,13,01,000,,10,01,000,,17,01,000,,15,01,000,*7B
pTl�ER�E��ći�ER>>$GPGSV,4,3,14,22,01,000,,20,01,000,,25,01,000,,23,01,000,*7F
pTT�ER�E��ći�ER(($GPGSV,4,4,14,31,01,000,,27,01,000,*7B
`�ER�E��ći�ER33$GLGSV,1,1,03,76,01,000,,66,01,000,,75,01,000,*54
1L�ER�E��ći�ER$QZGSV,1,1,01,02,01,000,*57
1,0X�ER�E��ći�ER++$GPGSA,A,1,,,,,,,,,,,,,140.0,99.0,99.0*35
0X�ER�E��ći�ER++$GNGSA,A,1,,,,,,,,,,,,,140.0,99.0,99.0*2B
0X�ER�E��ći�ER++$GNGSA,A,1,,,,,,,,,,,,,140.0,99.0,99.0*2B
0X�ER�E��ći�ER++$QZGSA,A,1,,,,,,,,,,,,,140.0,99.0,99.0*29
0T�ER�E��ći�ER(($GPRMC,001052.00,V,,,,,,,010112,,,N*78
��ER�ER��X�ER�E��ći�ER,,$GPGGA,001053.00,,,,,0,00,999.9,,M,,M,,*61
��ER�E��ći�ERjj$PGLOR,4,STA,001053.00,0.000,0.000,0,2000,9999,0,P,F,L,1,C,0,S,0000,0,0,R,FFFFFFFF,tPeF,0,654,OSC,,,,*75
@�ER�E��ći�ER$PGLOR,1,SAT*31
53.��ER�E��ći�ER__$PGLOR,1,SIO,TxERR,0,RxERR,0,TxCNT,92,RxCNT,1224,DTMS,1000,DTIN,3,16,DTOUT,38,976,HATMD,89*38

An attempt to redefine AGPS status returned this on /data/gps/.gps.interface.pipe.to_gpsd:

130|m0:/ # cat /data/gps/.gps.interface.pipe.to_gpsd
�ER�ER�ER�ER

And there is no other output on any momment. Also after this for some unknown reason, systemui died and glgps too.

I decided to pkill -9 glgpd and relaunch it with strace. I know all envirionment got messed up, but since I'm suspecting some bad interaction with /dev/ttySAC1, it will not hurt. The line i used to get the strace data was

strace -o /sdcard/gps.data -f -s 2000 /vendor/bin/glgps -c /system/etc/gps.xml

GPS related strace (fd):

[leonardo@manauara ~]$ egrep -C 2 '(\(12,|SAC1)' gps.data
24619 munmap(0x40545000, 8192) = 0
24619 munmap(0x40543000, 8192) = 0
24619 fstat64(12, {st_mode=S_IFREG|0644, st_size=636400, ...}) = 0
24619 fstatfs64(12, 88, 0xbeade478) = 0
24619 mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x40543000
24619 prctl(PR_SET_VMA, PR_SET_VMA_ANON_NAME, 0x40543000, 4096, "linker_alloc_small_objects") = 0
24619 pread64(12, "\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0(\0\1\0\0\0\0\0\0\0004\0\0\0\270\261\t\0\0\2\0\0054\0 \0\10\0(\0\33\0\32\0", 52, 0) = 52
24619 mmap2(NULL, 360, PROT_READ, MAP_PRIVATE, 12, 0) = 0x40544000
24619 mmap2(NULL, 1960, PROT_READ, MAP_PRIVATE, 12, 0x9b000) = 0x40545000
--
24619 fcntl64(7, F_GETFL) = 0x20000 (flags O_RDONLY|O_LARGEFILE)
24619 fcntl64(7, F_SETFL, O_WRONLY|O_LARGEFILE) = 0
24619 read(7, "\357\273\277<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<glgps xmlns=\"http://www.glpals.com/\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:schemaLocation=\"http://www.glpals.com/glconfig.xsd\" >\n <!--HAL Confguration -->\n <hal\n acPortName=\"/dev/ttySAC1\"\n lBaudRate=\"115200\"\n gpioNStdbyPath=\"/sys/class/sec/gps/GPS_PWR_EN/value\"\n gpioNResetPath=\"/sys/class/sec/gps/GPS_nRST/value\"\n gpioDelayMs=\"250\"\n acNvStoDir=\"/data/gps/\"\n acNmeaOutName=\"/data/gps/nmea_out\"\n ctrlPipe=\"/data/gps/glgpsctrl\"\n\n acLogDirectory=\"/sdcard/gps/broadcom/\"\n\n arp-supl-enable=\"true\"\n arp-supl-cap-msb=\"true\"\n arp-supl-cap-msa=\"true\"\n arp-supl-cap-ecid=\"false\"\n arp-supl-use-apn=\"false\"\n acSuplServer=\"supl.google.com\"\n SuplPort=\"7276\"\n tlsCertPath=\"/system/bin/gps.cer\"\n tlsEnable=\"false\"\n ReAidingIntervalSec=\"1200\"\n SuplUT1Seconds=\"20\"\n SuplUT2Seconds=\"20\"\n SuplUT3Seconds=\"20\"\n SuplVersion=\"1\"\n\n LbsSy", 1023) = 1023
24619 madvise(0x41731000, 4096, MADV_DONTNEED) = 0
24619 read(7, "ncLto=\"false\"\n SyncLto=\"true\"\n ltoFileName=\"lto2.dat\"\n acLtoDir=\"/data/gps/\"\n LbsSyncLtoThresholdDays=\"3\"\n\n IgnoreJniTime=\"true\"\n AssertEnabled=\"false\"\n />\n\n <gll\n LogPriMask=\"LOG_INFO\"\n LogFacMask=\"LOG_GLLAPI | LOG_NMEA | LOG_RAWDATA\"\n FrqPlan=\"FRQ_PLAN_26MHZ_2PPM_26MHZ_300PPB\"\n RfType=\"GL_RF_47511_BRCM_EXT_LNA\"\n WarmStandbyTimeout1Seconds=\"10\"\n WarmStandbyTimeout2Seconds=\"15\"\n >\n </gll>\n <gll_features\n EnableLowPowerEls=\"false\"\n EnableLowPowerPmm=\"true\"\n />\n\n</glgps>\n", 3072) = 568
--
24619 <... openat resumed> ) = 12
24622 <... clock_gettime resumed> {tv_sec=16429, tv_nsec=102588254}) = 0
24619 fcntl64(12, F_GETFL <unfinished ...>
24622 pselect6(4, [3], NULL, NULL, NULL, NULL <unfinished ...>
24619 <... fcntl64 resumed> ) = 0x20002 (flags O_RDWR|O_LARGEFILE)
24622 <... pselect6 resumed> ) = 1 (in [3])
24619 fcntl64(12, F_SETFL, O_ACCMODE|O_LARGEFILE <unfinished ...>
24622 clock_gettime(CLOCK_MONOTONIC, <unfinished ...>
24619 <... fcntl64 resumed> ) = 0
24622 <... clock_gettime resumed> {tv_sec=16429, tv_nsec=103298212}) = 0
24619 read(12, <unfinished ...>
24622 read(3, <unfinished ...>
24619 <... read resumed> "0", 1) = 1
--
24619 <... close resumed> ) = 0
24619 openat(AT_FDCWD, "/sys/class/sec/gps/GPS_PWR_EN/value", O_RDWR|O_LARGEFILE) = 12
24619 fcntl64(12, F_GETFL) = 0x20002 (flags O_RDWR|O_LARGEFILE)
24619 fcntl64(12, F_SETFL, O_ACCMODE|O_LARGEFILE) = 0
24619 write(12, "1\n", 2) = 2
24619 close(12) = 0
24619 nanosleep({tv_sec=0, tv_nsec=250000000}, NULL) = 0
24619 openat(AT_FDCWD, "/dev/ttySAC1", O_RDWR|O_NOCTTY|O_NONBLOCK|O_LARGEFILE) = 12
24619 fcntl64(12, F_GETFL) = 0x20802 (flags O_RDWR|O_NONBLOCK|O_LARGEFILE)
24619 fcntl64(12, F_SETFL, O_ACCMODE|O_NONBLOCK|O_LARGEFILE) = 0
24619 ioctl(12, TCGETS, {B115200 -opost -isig -icanon -echo ...}) = 0
24619 ioctl(12, TCFLSH, TCIOFLUSH) = 0
24619 ioctl(12, SNDCTL_TMR_START or TCSETS, {B115200 -opost -isig -icanon -echo ...}) = 0
24619 ioctl(12, TCFLSH, TCIOFLUSH) = 0
24619 ioctl(12, TCGETS, {B115200 -opost -isig -icanon -echo ...}) = 0
24619 clock_gettime(CLOCK_MONOTONIC, {tv_sec=16429, tv_nsec=363349962}) = 0
24619 gettimeofday({tv_sec=1552763636, tv_usec=792127}, NULL) = 0
--
24619 pselect6(13, [7 8 10 12], [12], NULL, {tv_sec=0, tv_nsec=1000000}, NULL) = 3 (in [8 10], out [12], left {tv_sec=0, tv_nsec=978834})
24619 clock_gettime(CLOCK_MONOTONIC, {tv_sec=16429, tv_nsec=400179463}) = 0
24619 write(12, "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200", 20) = 20
24619 clock_gettime(CLOCK_MONOTONIC, {tv_sec=16429, tv_nsec=400489921}) = 0
24619 clock_gettime(CLOCK_MONOTONIC, {tv_sec=16429, tv_nsec=400629296}) = 0

Return code:

[leonardo@manauara ~]$ tail -n1 gps.data
24619 +++ exited with 1 +++

I guess something is wrong in gpsd way to handle /dev/ttySAC1 (GPS device) and everything else is working. I can't remember now if the following happened with i9300 or with P1000: People used to put gpsd from stock samsung in some roms to allow the correct GPS initialization and readings.

I'm thinking how to proceed now to try get GPS working well. If someone or @ChronoMonochrome can tell-me what I can do here to find a way, i'll be very glad!

EDIT: Oh dmesg :(

[17599.840000] init: Created socket '/dev/socket/gps', mode 660, user 1021, group 1000
[17600.060000] type=1400 audit(1552764807.488:19790): avc: denied { write } for pid=26635 comm="glgps" name=".gpsd.lock" dev="mmcblk0p12" ino=121922 scontext=u:r:glgps:s0 tcontext=u:object_r:system_data_file:s0 tclass=file permissive=1
[17600.315000] set_gps_uart_op: on
[17600.410000] type=1400 audit(1552764807.488:19790): avc: denied { write } for pid=26635 comm="glgps" name=".gpsd.lock" dev="mmcblk0p12" ino=121922 scontext=u:r:glgps:s0 tcontext=u:object_r:system_data_file:s0 tclass=file permissive=1
[17604.805000] type=1400 audit(1552764812.233:19829): avc: denied { getopt } for pid=26635 comm="glgps" laddr=192.168.42.158 lport=45071 faddr=64.233.190.192 fport=7276 scontext=u:r:glgps:s0 tcontext=u:r:glgps:s0 tclass=tcp_socket permissive=1
[17611.050000] type=1400 audit(1552764812.233:19829): avc: denied { getopt } for pid=26635 comm="glgps" laddr=192.168.42.158 lport=45071 faddr=64.233.190.192 fport=7276 scontext=u:r:glgps:s0 tcontext=u:r:glgps:s0 tclass=tcp_socket permissive=1
[17614.730000] type=1400 audit(1552764822.158:19831): avc: denied { create } for pid=26635 comm="glgps" scontext=u:r:glgps:s0 tcontext=u:r:glgps:s0 tclass=tcp_socket permissive=1
[17614.735000] type=1400 audit(1552764822.158:19831): avc: denied { create } for pid=26635 comm="glgps" scontext=u:r:glgps:s0 tcontext=u:r:glgps:s0 tclass=tcp_socket permissive=1
[17614.735000] type=1400 audit(1552764822.158:19832): avc: denied { connect } for pid=26635 comm="glgps" scontext=u:r:glgps:s0 tcontext=u:r:glgps:s0 tclass=tcp_socket permissive=1
[17614.735000] type=1400 audit(1552764822.158:19832): avc: denied { connect } for pid=26635 comm="glgps" scontext=u:r:glgps:s0 tcontext=u:r:glgps:s0 tclass=tcp_socket permissive=1
[17614.735000] type=1400 audit(1552764822.158:19833): avc: denied { name_connect } for pid=26635 comm="glgps" dest=7276 scontext=u:r:glgps:s0 tcontext=u:object_r:port:s0 tclass=tcp_socket permissive=1
[17614.795000] type=1400 audit(1552764822.158:19833): avc: denied { name_connect } for pid=26635 comm="glgps" dest=7276 scontext=u:r:glgps:s0 tcontext=u:object_r:port:s0 tclass=tcp_socket permissive=1
[17614.795000] type=1400 audit(1552764822.223:19834): avc: denied { getopt } for pid=26635 comm="glgps" laddr=192.168.42.158 lport=45073 faddr=64.233.190.192 fport=7276 scontext=u:r:glgps:s0 tcontext=u:r:glgps:s0 tclass=tcp_socket permissive=1
[17622.465000] type=1400 audit(1552764822.223:19834): avc: denied { getopt } for pid=26635 comm="glgps" laddr=192.168.42.158 lport=45073 faddr=64.233.190.192 fport=7276 scontext=u:r:glgps:s0 tcontext=u:r:glgps:s0 tclass=tcp_socket permissive=1
[17622.465000] type=1400 audit(1552764829.893:19835): avc: denied { write } for pid=26635 comm="glgps" path="socket:[794138]" dev="sockfs" ino=794138 scontext=u:r:glgps:s0 tcontext=u:r:glgps:s0 tclass=tcp_socket permissive=1
[17622.595000] type=1400 audit(1552764829.893:19835): avc: denied { write } for pid=26635 comm="glgps" path="socket:[794138]" dev="sockfs" ino=794138 scontext=u:r:glgps:s0 tcontext=u:r:glgps:s0 tclass=tcp_socket permissive=1
[17622.595000] type=1400 audit(1552764830.023:19836): avc: denied { read } for pid=26635 comm="glgps" path="socket:[794138]" dev="sockfs" ino=794138 scontext=u:r:glgps:s0 tcontext=u:r:glgps:s0 tclass=tcp_socket permissive=1
[17771.015000] type=1400 audit(1552764830.023:19836): avc: denied { read } for pid=26635 comm="glgps" path="socket:[794138]" dev="sockfs" ino=794138 scontext=u:r:glgps:s0 tcontext=u:r:glgps:s0 tclass=tcp_socket permissive=1

Plus:

[leonardo@manauara ~]$ adb logcat -d '*' | fpaste -t "LOGCAT: LOS16 + i9300 boot + GPS app"

Uploading (227.6KiB)...

https://paste.fedoraproject.org/paste/kbP4Cq55cXtq7MuU8Wz9OA

[leonardo@manauara ~]$ adb shell dmesg | fpaste -t "DMESG: LOS16 + i9300 boot + GPS APP"

WARNING: your paste size (615.1KiB) is very large and may be rejected by the server. A pastebin is NOT a file hosting service!

Uploading (615.1KiB)...

https://paste.fedoraproject.org/paste/UBKIWrTU0kXqlDrTiq7Aug