Fixing the Android GPS Configuration

Preface: This is not a write up. Those can get long and it is more productive to answer user specific questions.

Hey folks. If you use lineage or any custom ROM they are pretty piss poor at optimizing GPS. We know GNSS has also been tampered with but thats not that big of a deal.

There are some issues with most chinese phones coming with a chinese SUPL url and conf which is very bothersome if you live in the US. So I have modified the GPS conf for much higher accuracy and sterilized the SUPL info for google

Speaking of the supl information. I had to use port 7275 instead of 7276 (Secure port). This does not provide too much of a security risk on trusted networks however If someone knows how to get 7276 working I would love to know. Assisted GPS helps with accuracy and that is why I have it enabled and some LTE Positioning tweaks.

Due to popular request I have made a post on it. If you want to know what things do ask below. Here is the configuration. It has been modified a bit. Specifically around SUPL, capabilties, accuracy thresholds, etc

#Uncommenting these urls would only enable
#the power up auto injection and force injection(test case).
#XTRA_SERVER_1=http://xtrapath1.izatcloud.net/xtra2.bin
#XTRA_SERVER_2=http://xtrapath2.izatcloud.net/xtra2.bin
#XTRA_SERVER_3=http://xtrapath3.izatcloud.net/xtra2.bin

#ifdef VENDOR_EDIT
# add gps xtra server for speed up gps cold start
XTRA_SERVER_1=http://xtrapath1.izatcloud.net/xtra3grc.bin
XTRA_SERVER_2=http://xtrapath2.izatcloud.net/xtra3grc.bin
XTRA_SERVER_3=http://xtrapath3.izatcloud.net/xtra3grc.bin
#endif

#ifdef VENDOR_EDIT
# [email protected],XTRA download config for debug
XTRA_TEST_ENABLED = 1
XTRA_THROTTLE_ENABLED = 0
#endif

#Version check for XTRA
#DISABLE = 0
#AUTO    = 1
#XTRA2   = 2
#XTRA3   = 3
XTRA_VERSION_CHECK=1

# Error Estimate
# _SET = 1
# _CLEAR = 0
ERR_ESTIMATE=0

#NTP server
# Change these to your country
# If time is out of sync you will have an inaccurate GPS or lose sync
NTP_SERVER=0.us.pool.ntp.org
NTP_SERVER=1.us.pool.ntp.org
NTP_SERVER=2.us.pool.ntp.org
NTP_SERVER=3.us.pool.ntp.org
NTP_SERVER=0.north-america.pool.ntp.org
NTP_SERVER=1.north-america.pool.ntp.org
NTP_SERVER=2.north-america.pool.ntp.org
NTP_SERVER=3.north-america.pool.ntp.org
NTP_SERVER=us.pool.ntp.org

#XTRA CA path
XTRA_CA_PATH=/system/etc/security/cacerts

# DEBUG LEVELS: 0 - none, 1 - Error, 2 - Warning, 3 - Info
#               4 - Debug, 5 - Verbose
# If DEBUG_LEVEL is commented, Android's logging levels will be used
DEBUG_LEVEL = 2

# Intermediate position report, 1=enable, 0=disable
INTERMEDIATE_POS=1

# Below bit mask configures how GPS functionalities
# should be locked when user turns off GPS on Settings
# Set bit 0x1 if MO GPS functionalities are to be locked
# Set bit 0x2 if NI GPS functionalities are to be locked
# default - non is locked for backward compatibility
#GPS_LOCK = 0

# supl version 1.0
SUPL_VER=0x20000

# Emergency SUPL, 1=enable, 0=disable
#SUPL_ES=0

#Choose PDN for Emergency SUPL
#1 - Use emergency PDN
#0 - Use regular SUPL PDN for Emergency SUPL
#USE_EMERGENCY_PDN_FOR_EMERGENCY_SUPL=0

#SUPL_MODE is a bit mask set in config.xml per carrier by default.
#If it is uncommented here, this value will overwrite the value from
#config.xml.
#MSA=0X2
#MSB=0X1
SUPL_MODE=3

# GPS Capabilities bit mask
# SCHEDULING = 0x01
# MSB = 0x02
# MSA = 0x04
# ON_DEMAND_TIME = 0x10
# GEOFENCE = 0x20
# default = ON_DEMAND_TIME | MSA | MSB | SCHEDULING | GEOFENCE
CAPABILITIES=0x31

# Accuracy threshold for intermediate positions
# less accurate positions are ignored, 0 for passing all positions
ACCURACY_THRES=5000

################################
##### AGPS server settings #####
################################

# Set american server for assisted GPS secure user plane location
SUPL_HOST=supl.google.com
SUPL_PORT=7275

# FOR C2K PDE SUPPORT, set the following
# C2K_HOST=c2k.pde.com or IP
# C2K_PORT=1234

# Bitmask of slots that are available
# for write/install to, where 1s indicate writable,
# and the default value is 0 where no slots
# are writable. For example, AGPS_CERT_WRITABLE_MASK
# of b1000001010 makes 3 slots available
# and the remaining 7 slots unwritable.
#AGPS_CERT_WRITABLE_MASK=0

####################################
#  LTE Positioning Profile Settings
####################################
# 0: Enable RRLP on LTE(Default)
# 1: Enable LPP_User_Plane on LTE
# 2: Enable LPP_Control_Plane
# 3: Enable both LPP_User_Plane and LPP_Control_Plane
LPP_PROFILE = 1

################################
# EXTRA SETTINGS
################################
# NMEA provider (1=Modem Processor, 0=Application Processor)
NMEA_PROVIDER=0
# Mark if it is a SGLTE target (1=SGLTE, 0=nonSGLTE)
SGLTE_TARGET=0

##################################################
# Select Positioning Protocol on A-GLONASS system
##################################################
# 0x1: RRC CPlane
# 0x2: RRLP UPlane
# 0x4: LLP Uplane
#ifndef [email protected] enable all bit mask for GLONASS
#A_GLONASS_POS_PROTOCOL_SELECT = 0
#else
A_GLONASS_POS_PROTOCOL_SELECT = 15
#endif

##################################################
# Select technology for LPPe Control Plane
##################################################
# 0x1: DBH for LPPe CP
# 0x2: WLAN AP Measurements for LPPe CP
# 0x4: SRN AP measurement for CP
# 0x8: Sensor Barometer Measurement LPPe CP
LPPE_CP_TECHNOLOGY = 0

##################################################
# Select technology for LPPe User Plane
##################################################
# 0x1: DBH for LPPe UP
# 0x2: WLAN AP Measurements for LPPe UP
# 0x4: SRN AP measurement for UP
# 0x8: Sensor Barometer Measurement LPPe UP
LPPE_UP_TECHNOLOGY = 0

##################################################
# AGPS_CONFIG_INJECT
##################################################
# enable/disable injection of AGPS configurations:
#     SUPL_VER
#     SUPL_HOST
#     SUPL_PORT
#     C2K_HOST
#     C2K_PORT
#     LPP_PROFILE
#     A_GLONASS_POS_PROTOCOL_SELECT
# 0: disable
# 1: enable
AGPS_CONFIG_INJECT = 1

##################################################
# GNSS settings for automotive use cases
# Configurations in following section are
# specific to automotive use cases, others
# please do not change, keep the default values
##################################################

# AP Coarse Timestamp Uncertainty
##################################################
# default : 10
# AP time stamp uncertainty, until GNSS receiver
# is able to acquire better timing information
AP_TIMESTAMP_UNCERTAINTY = 10

##################################################
# QDR engine availability status
##################################################
# 0 : NO QDR (default)
# 1 : QDR enabled
# This settings enables QDR Configuration for
# automotive use case, if enabled then
# DR_AP_Service needs to be enabled in izat.conf
#EXTERNAL_DR_ENABLED = 0

#####################################
# DR_SYNC Pulse Availability
#####################################
# 0 : DR_SYNC pulse not available (default)
# 1 : DR_SYNC pulse available
# This configuration enables the driver to make use
# of PPS events generated by DR_SYNC pulse
# Standard Linux PPS driver needs to be enabled
DR_SYNC_ENABLED = 0

#####################################
# PPS Device name
#####################################
PPS_DEVICENAME = /dev/pps0

#####################################
# AP Clock Accuracy
#####################################
# Quality of APPS processor clock (in PPM).
# Value specified is used for calculation of
# APPS time stamp uncertainty
AP_CLOCK_PPM = 100

#####################################
# MAX ms difference to detect missing pulse
#####################################
# Specifies time threshold in ms to validate any missing PPS pulses
MISSING_PULSE_TIME_DELTA = 900

#####################################
# Propagation time uncertainty
#####################################
# This settings enables time uncertainty propagation
# logic incase of missing PPS pulse
PROPAGATION_TIME_UNCERTAINTY = 1

#######################################
#  APN / IP Type Configuration
#  APN and IP Type to use for setting
#  up WWAN call.
#  Use below values for IP Type:
#  v4 = 4
#  v6 = 6
#  v4v6 = 10
#######################################
# INTERNET_APN = abc.xyz
# INTERNET_IP_TYPE = 4
# SUPL_APN = abc.xyz
# SUPL_IP_TYPE = 4

Yes you need root to modify

I cannot stress this enough. Backup your stock config before tweaking

Reserved

It is very important you weak and modify this for yourself especially with the ntp pool. GPS needs good synchronized time in order to be particularly accurate.

Answered questions

Q: Where is the configuration located?
A: Depends on the phone sometimes its in /system/etc/gps.conf or in /vendor/etc/gps.conf

Hey Man, thanks for sharing your stuff, it’s awesome to know.
Regarding using 7275, don’t you need a SUPL_ROOT certificate from google?
How did you get that?

I have success using 7276, but I need to change NV 03578 to 0 to disable security check by using QXDM, I assume you phone has QCOM chip in it.

I have updated the guide for this issue I think there is a process you have to go through (don’t quote me i could be wrong)

From what I read on the google group form, they mentioned I need to contact them for SUPL Cert, do you recall doing any of that? I have sent a request email to them, it has been a week with no response.

1 Like

I did do that however amongst a pool of us on XDA I encountered the issue that its hit or miss on them replying