From 212edc735bfb7f1015b267308a2a219462c75d5e Mon Sep 17 00:00:00 2001 From: Blake Kragten Date: Tue, 15 Oct 2019 13:26:50 -0700 Subject: [PATCH] GPS Atoms Addition Porting gps location status (success/failure) logging to atom GpsLocationStatusReported will be used by 2 count metrics to determine the location failure rate. Porting gps time to first fix seconds logging to atom GPsTimeToFirstFixReported will be used by a value metric to determine the average time to first fix on a GPS signal. CTS tests will be added for these atoms in subsequent CL Test: On Device using test script and gnsslogger.apk > make statsd_testdrive > ./out/host/linux-x86/bin/statsd_testdrive Bug: 141631388 Bug: 142740230 Change-Id: If8aed8f475078b05b977a73b4bba91c85af7716a --- cmds/statsd/src/atoms.proto | 23 +++++++++++++++++++ .../location/gnssmetrics/GnssMetrics.java | 3 +++ 2 files changed, 26 insertions(+) diff --git a/cmds/statsd/src/atoms.proto b/cmds/statsd/src/atoms.proto index b0570fd83bbf8..f359ead9c0101 100644 --- a/cmds/statsd/src/atoms.proto +++ b/cmds/statsd/src/atoms.proto @@ -340,6 +340,8 @@ message Atom { PerfettoUploaded perfetto_uploaded = 229 [(log_from_module) = "perfetto"]; VmsClientConnectionStateChanged vms_client_connection_state_changed = 230; + GpsLocationStatusReported gps_location_status_reported = 231; + GpsTimeToFirstFixReported gps_time_to_first_fix_reported = 232; } // Pulled events will start at field 10000. @@ -734,6 +736,27 @@ message GpsSignalQualityChanged { optional android.server.location.GpsSignalQualityEnum level = 1; } +/** + * Gps location status report + * + * Logged from: + * /frameworks/base/location/java/com/android/internal/location/gnssmetrics/GnssMetrics.java + */ +message GpsLocationStatusReported { + // Boolean stating if location was acquired + optional bool location_success = 1; +} + +/** + * Gps log time to first fix report + * + * Logged from: + * /frameworks/base/location/java/com/android/internal/location/gnssmetrics/GnssMetrics.java + */ +message GpsTimeToFirstFixReported { + // int32 reporting the time to first fix in milliseconds + optional int32 time_to_first_fix_millis = 1; +} /** * Logs when a sync manager sync state changes. diff --git a/location/java/com/android/internal/location/gnssmetrics/GnssMetrics.java b/location/java/com/android/internal/location/gnssmetrics/GnssMetrics.java index e0bff74fd5883..c20dc615529b1 100644 --- a/location/java/com/android/internal/location/gnssmetrics/GnssMetrics.java +++ b/location/java/com/android/internal/location/gnssmetrics/GnssMetrics.java @@ -114,6 +114,7 @@ public class GnssMetrics { * Logs the status of a location report received from the HAL */ public void logReceivedLocationStatus(boolean isSuccessful) { + StatsLog.write(StatsLog.GPS_LOCATION_STATUS_REPORTED, isSuccessful); if (!isSuccessful) { mLocationFailureStatistics.addItem(1.0); return; @@ -130,6 +131,7 @@ public class GnssMetrics { DEFAULT_TIME_BETWEEN_FIXES_MILLISECS, desiredTimeBetweenFixesMilliSeconds)) - 1; if (numReportMissed > 0) { for (int i = 0; i < numReportMissed; i++) { + StatsLog.write(StatsLog.GPS_LOCATION_STATUS_REPORTED, false); mLocationFailureStatistics.addItem(1.0); } } @@ -140,6 +142,7 @@ public class GnssMetrics { */ public void logTimeToFirstFixMilliSecs(int timeToFirstFixMilliSeconds) { mTimeToFirstFixSecStatistics.addItem((double) (timeToFirstFixMilliSeconds / 1000)); + StatsLog.write(StatsLog.GPS_TIME_TO_FIRST_FIX_REPORTED, timeToFirstFixMilliSeconds); } /**