This section discusses about some Android OS specific LTO information.
LTO or Long Time Orbit is a way to maintain 2, 4 or 7 days of Ephemeris on the device to decrease the TTFF in COLD START condition or HOT START whenever the GPS engine needs assistance data. The GPS engine asks for it when needed. The more days of ephemeris the bigger the file size.
LTO is a shared feature which is also used with the LBS feature see LBS Description or as standalone HTTP feature. This feature requires a special build delivery which is subject to licensing agreement.
Also the GPS engine asks for LTO, the framework can also ask for it. Any Java application can request LTO (XTRA) download with the following call: sendExtraCommand("force_xtra_injection") and this is out of the GPS daemon control. We support only the following: If LTO is too old (from GPS XML settings), we will request to download it.
Here is what you need to add inside gps.conf when using XTRA api to download LTO.
XTRA_SERVER_1=http://gllto.glpals.com/7day/glo/v2/latest/lto2.dat
If the XTRA_SERVER entry is not defined in the gps.conf file, by default we will not download LTO unless using LbsSyncLto flag see /ref usinglbssynclto which comes with Lbs delivery.
In order to prevent LTO to be downloaded too often, the GPS engine can rely on XML attributes to download it only after a specific amount of time has elapsed since the last download. Because LTO can store up to 7 days of Ephemeris we consider the medium interval to be the best tuning for the GPS engine. This is why it is set to 3 days by default. The following attributes needs to be added in the hal section of /ref glxmlconfigcross. All download requests initiated by the GPS engine will end up inside the proxy_gps_xtra_download_request_cb Libgps function. It is possible to add extra customer specific conditions to prevent the proxy_gps_xtra_download_request_cb to initiate a framework download request based for instances of the modem or the data connection state send by the Framework in proxy_agps_ril_update_network_state...
<hal HttpSyncLto="true" LtoSyncThresholdDays="3" LtoFileName="lto2.dat" LtoDir="/data/gps/" />
To see the gps sequence you can type the following command on windows adb logcat | findstr gps
During boot sequence Android framework might download the file and inject the buffer inside Libgps and the LTO file will be saved to disk again there is no control to prevent the download to occur and since the file has been downloaded we save the new file with updated Ephemeris.
BOOT SEQUENCE
02-25 15:27:32.394 131 131 D slog : IPC Connection with libgps has been established 02-25 15:27:32.394 131 131 D slog : IsIpcConnected = true 02-25 15:27:32.395 131 131 D slog : GpsSerialCom::ProvideFdListForSelect 02-25 15:27:32.397 131 131 D slog : GPSIS.INP.gps_init(); 02-25 15:27:32.397 131 131 D slog : IsGpsEnabled = true 02-25 15:27:32.397 131 131 D slog : GpsInterfaceImpl::init() D/libgps ( 374): proxy_gps_xtra_init: called ---> GpsXtraInterfaceImpl::init() 02-25 15:27:32.397 131 131 D slog : GpsXtraInterfaceImpl::init() 02-25 15:27:32.397 131 131 D slog : AGpsInterfaceImpl::init() 02-25 15:27:32.397 131 131 D slog : GpsNiInterfaceImpl::init() 02-25 15:27:32.397 131 131 D slog : AGpsRilInterfaceImpl::init() Optional Customer Module workflow can be added to marshall XML settings between CustomerModule and Libgps so that libgps can access files stored under folder pointed by LtoDir etc... I/libgps ( 375): OnGpsExtensionMessage: MSG_LCS_SET_LTOSYNCTHRESHOLDDAYS 3 <--- CustomerModule -> Libgps -> CustomerModule I/libgps ( 375): OnGpsExtensionMessage: MSG_LCS_SET_LTODIR /data/gps/ <--- CustomerModule -> Libgps -> CustomerModule I/ActivityManager( 375): Start proc com.broadcom.test.gpslogrecorder for broadcast com.broadcom.test.gpslogrecorder/.BroadcastReceiverStartup: pid=1008 uid=10070 gids={1007, 3003, 1015, 1028} D/gpsd ( 131): LogJava: Connection with GPS Log Service was established D/libgps ( 375): proxy_agps_ril_request_setid_cb: flags(1) D/libgps ( 375): proxy_agps_ril_update_network_state: called D/libgps ( 375): proxy_gps_inject_time() D/libgps ( 375): proxy_gps_inject_time: exit D/libgps ( 375): proxy_gps_xtra_inject_xtra_data: called data length(82704) <--- Framework --> GPS : inject XTRA buffer and engine will save to disk
COLD START SET INITIATED REQUEST
D/libgps ( 374): proxy_gps_set_position_mode() D/libgps ( 374): proxy_gps_status_cb: called. status(3) D/libgps ( 374): proxy_gps_status_cb: normal GPS icon mode. D/libgps ( 374): proxy_gps_status_cb: called. status(1) D/libgps ( 374): proxy_gps_status_cb: normal GPS icon mode. D/libgps ( 374): proxy_gps_xtra_download_request_cb: called <--- GPS --> proxy --> Framework : Framework will download XTRA and inject XTRA buffer Gps will request for LTO download through proxy_gps_xtra_download_request_cb only if the time since last download is greater than the LtoSyncThresholdDays value set in XML or the LTO file is missing. D/libgps ( 374): proxy_agps_ril_request_refloc_cb:refLocationSaved(0), time1(293586), time2(0) D/libgps ( 374): proxy_agps_ril_set_ref_location:agps_reflocation->type(2), refLocationInfo.refLocationSaved(0) D/libgps ( 374): proxy_agps_ril_request_setid_cb: flags(1) D/libgps ( 374): proxy_gps_sv_status_cb() D/libgps ( 374): proxy_gps_xtra_inject_xtra_data: called data length(82944) <--- Framework --> GPS : inject XTRA buffer and engine will save to disk 02-22 12:34:09.173 130 130 D slog : GPSIS.INP.gps_xtra_inject_xtra_data(82944); 02-22 12:34:09.174 130 130 D slog : GpsXtraInterfaceImpl::inject_xtra_data(82944) 02-22 12:34:09.174 130 130 D slog : LtoCache::SetLtoData(0x4098d028, 82944) 02-22 12:34:09.174 130 130 D slog : LtoCache::WriteLtoFile() 02-22 12:34:09.174 130 130 D slog : GpsInterfaceStateIdle : OnInjectLTO 02-22 12:34:09.175 130 1202 D slog : LTO file path : /data/gps/lto2.dat 02-22 12:34:09.177 130 1202 D slog : LTO status file path : /data/gps/ltoStatus.txt 02-22 12:34:09.178 130 1202 D slog : LTO downloaded at 1361565249 02-22 12:34:09.178 130 130 D slog : LtoCache::ReleaseCache(0x40ef6488)
DATA CONNECTION WIFI GOES DOWN THEN ON AGAIN FOLLOWED BY HOT START REQUEST
D/libgps ( 374): proxy_agps_ril_request_setid_cb: flags(1) D/libgps ( 374): proxy_agps_ril_update_network_state: called D/libgps ( 374): proxy_agps_ril_request_setid_cb: flags(1) D/libgps ( 374): proxy_agps_ril_update_network_state: called 02-22 12:47:34.500 130 130 D slog : GPSIS.INP.agps_ril_update_network_state(1,AGPS_RIL_NETWORK_TYPE_WIFI(1), 0, NULL); 02-22 12:47:34.500 130 130 D slog : AGpsRilInterfaceImpl::update_network_state(1, 1, 0, (null)) /** Network types for update_network_state "type" parameter */ #define AGPS_RIL_NETWORK_TYPE_MOBILE 0 #define AGPS_RIL_NETWORK_TYPE_WIFI 1 #define AGPS_RIL_NETWORK_TYPE_MOBILE_MMS 2 #define AGPS_RIL_NETWORK_TYPE_MOBILE_SUPL 3 #define AGPS_RIL_NETWORK_TTYPE_MOBILE_DUN 4 #define AGPS_RIL_NETWORK_TTYPE_MOBILE_HIPRI 5 #define AGPS_RIL_NETWORK_TTYPE_WIMAX 6 Will download LTO only if the connection is using WIFI and the time since last download is greater than the LtoSyncThresholdDays value set in XML or the LTO file is missing 02-22 12:47:34.500 130 130 D slog : LTO last downloaded at 2/22/2013 12:36:31 02-22 12:47:34.500 130 130 D slog : ChkLtoSync : current 1361566054 previous 1361565391 threshold 259200 02-22 12:47:34.500 130 130 D slog : No need to download LTO now <-- LTO is not written to disk
DELETE AIDING SET INITIATED
D/libgps ( 374): proxy_gps_delete_aiding_data() customer can decide to delete /data/gps/lto2.dat and /data/gps/ltoStatus.txt
COLD START SET INITIATED REQUEST
D/libgps ( 374): proxy_gps_delete_aiding_data() D/libgps ( 374): proxy_gps_set_position_mode() D/libgps ( 374): proxy_gps_status_cb: called. status(3) D/libgps ( 374): proxy_gps_status_cb: normal GPS icon mode. D/libgps ( 374): proxy_gps_status_cb: called. status(1) D/libgps ( 374): proxy_gps_status_cb: normal GPS icon mode. I/LocationManagerService( 374): request gps (pid 1185) 1000 1000 D/gpsd ( 130): CALL_SENTRY: GlEngine::OnStart took 121 ms (from1315349 to 1315470) (log=1,1,15), start: 12:53:32.640 D/gpsd ( 130): CALL_SENTRY: marshal_gps_start took 156 ms (from1315348 to 1315504) (log=19,3,549), start: 12:53:32.638 D/gpsd ( 130): CALL_SENTRY: ProcessEvent took 156 ms (from1315348 to 1315504) (log=19,3,550), start: 12:53:32.638 I/libgps ( 374): [proxy_gps_acquire_wakelock_cb][line = 625]: acquire_wakelock D/libgps ( 374): proxy_gps_xtra_download_request_cb: called <--- GPS --> proxy --> Framework : Framework will download XTRA and inject XTRA buffer Gps will request for LTO download through proxy_gps_xtra_download_request_cb only if the time since last download is greater than the LtoSyncThresholdDays value set in XML or the LTO file is missing D/libgps ( 374): proxy_agps_ril_request_refloc_cb: refLocationSaved(0), time1(1315515), time2(1022473) D/libgps ( 374): proxy_agps_ril_set_ref_location: agps_reflocation->type(2), refLocationInfo.refLocationSaved(0) D/libgps ( 374): proxy_agps_ril_request_setid_cb: flags(1) D/libgps ( 374): proxy_gps_sv_status_cb() D/libgps ( 374): proxy_gps_xtra_inject_xtra_data: called data length(82944) 02-22 12:53:33.669 130 130 D slog : GPSIS.INP.gps_xtra_inject_xtra_data(82944); 02-22 12:53:33.669 130 130 D slog : GpsXtraInterfaceImpl::inject_xtra_data(82944) 02-22 12:53:33.669 130 130 D slog : LtoCache::SetLtoData(0x4098d028, 82944) 02-22 12:53:33.669 130 130 D slog : LtoCache::WriteLtoFile() 02-22 12:53:33.670 130 130 D slog : GpsInterfaceStateRunningRequest: OnInjectLTO 02-22 12:53:33.670 130 130 D slog : $316380D GlEngineImplStd::ForceReadLTOFile 02-22 12:53:33.670 130 1440 D slog : LTO file path : /data/gps/lto2.dat 02-22 12:53:33.673 130 1440 D slog : LTO status file path : /data/gps/ltoStatus.txt 02-22 12:53:33.673 130 1440 D slog : LTO downloaded at 1361566413 02-22 12:53:33.673 130 130 D slog : LtoCache::ReleaseCache(0x40f03c58)
In case you are using LBS feature the following attribute is needed to download LTO and you need to keep HttpSyncLto="true" in this case all GPS initiated request for LTO will not invoke the proxy XTRA download request so you need to remove XTRA_SERVER_1 entry from gps.conf.
<hal LbsSyncLto="true" LtoSyncThresholdDays="3" LtoFileName="lto2.dat" LtoDir="/data/gps/" />
When LbsSyncLto and HttpSyncLto are set the download will occur internally using the Lbs feature only.