GnssMetrics

These metrics will pull different metrics that tell the performance of the gnss subsystem.

Metrics include:
Location reports
% of location failure
Num times GPS had to first fix
Mean time to first fix on signal
Num position accuracy logs
Mean position accuracy in meters
Num top 4 Cn0 messages
Mean top 4 average Cn0 (signal quality)
Num L5 top 4 Cn0 messages
Mean L5 top 4 average Cn0 (signal quality)
Num Satellite status messages received
Num of Satellites used in fix
L5 Satellite status messages received
L5 of Satellites used in fix

metric_id: 1111
gauge_metrics {
  data {
    bucket_info {
      atom {
        gnss_stats {
          location_reports: 12
          location_failure_reports: 3
          time_to_first_fix_reports: 2
          time_to_first_fix_milli_s: 43588
          position_accuracy_reports: 9
          position_accuracy_meters: 112
          top_four_average_cn0_reports: 31
          top_four_average_cn0_db_mhz: 734711
          l5_top_four_average_cn0_reports: 1
          l5_top_four_average_cn0_db_mhz: 21500
          sv_status_reports: 1015
          sv_status_reports_used_in_fix: 100
          l5_sv_status_reports: 7
          l5_sv_status_reports_used_in_fix: 0
        }
      }
      elapsed_timestamp_nanos: 537249375445
      start_bucket_elapsed_millis: 522186
      end_bucket_elapsed_millis: 549283
    }
  }
}
time_base_elapsed_nano_seconds: 9283624934
bucket_size_nano_seconds: 60000000000
is_active: true

Bug: 147910698
Test: On Device using test script and gnsslogger.apk
>  make statsd_testdrive
>  ./out/host/linux-x86/bin/statsd_testdrive <ATOM_ID>

Change-Id: I92461eb8533ec810bb67d76a25931295cfa1efbd
diff --git a/cmds/statsd/src/atoms.proto b/cmds/statsd/src/atoms.proto
index 27c4f4e..652775b 100644
--- a/cmds/statsd/src/atoms.proto
+++ b/cmds/statsd/src/atoms.proto
@@ -396,7 +396,7 @@
     }
 
     // Pulled events will start at field 10000.
-    // Next: 10074
+    // Next: 10075
     oneof pulled {
         WifiBytesTransfer wifi_bytes_transfer = 10000 [(module) = "framework"];
         WifiBytesTransferByFgBg wifi_bytes_transfer_by_fg_bg = 10001 [(module) = "framework"];
@@ -477,6 +477,7 @@
                 10072 [(module) = "framework"];
         PackageNotificationChannelGroupPreferences package_notification_channel_group_preferences =
                 10073 [(module) = "framework"];
+        GnssStats gnss_stats = 10074 [(module) = "framework"];
     }
 
     // DO NOT USE field numbers above 100,000 in AOSP.
@@ -8475,20 +8476,71 @@
  *   frameworks/base/services/core/java/com/android/server/am/CachedAppOptimizer.java
  */
 message AppFreezeChanged {
-  // The type of event.
-  enum Action {
-    UNKNOWN = 0;
-    FREEZE_APP = 1;
-    UNFREEZE_APP = 2;
-  }
-  optional Action action = 1;
+    // The type of event.
+    enum Action {
+        UNKNOWN = 0;
+        FREEZE_APP = 1;
+        UNFREEZE_APP = 2;
+    }
+    optional Action action = 1;
 
-  // Pid of the process being frozen.
-  optional int32 pid = 2;
+    // Pid of the process being frozen.
+    optional int32 pid = 2;
 
-  // Name of the process being frozen.
-  optional string process_name = 3;
+    // Name of the process being frozen.
+    optional string process_name = 3;
 
-  // Time since last unfrozen.
-  optional int64 time_unfrozen_millis = 4;
+    // Time since last unfrozen.
+    optional int64 time_unfrozen_millis = 4;
+}
+
+/**
+ * Logs gnss stats from location service provider
+ *
+ * Pulled from:
+ *  frameworks/base/location/java/com/android/internal/location/gnssmetrics/GnssMetrics.java
+ */
+
+message GnssStats {
+    // Number of location reports since boot
+    optional int64 location_reports = 1;
+
+    // Total pulled reports of Location failures since boot
+    optional int64 location_failure_reports = 2;
+
+    // Number of time to first fix reports since boot
+    optional int64 time_to_first_fix_reports = 3;
+
+    // Total pulled reported time to first fix (in milli-seconds) since boot
+    optional int64 time_to_first_fix_milli_s = 4;
+
+    // Number of position accuracy reports since boot
+    optional int64 position_accuracy_reports = 5;
+
+    // Total pulled reported position accuracy (in meters) since boot
+    optional int64 position_accuracy_meters = 6;
+
+    // Number of top 4 average CN0 reports since boot
+    optional int64 top_four_average_cn0_reports = 7;
+
+    // Total pulled reported of top 4 average CN0 (dB-mHz) since boot
+    optional int64 top_four_average_cn0_db_mhz = 8;
+
+    // Number of l5 top 4 average CN0 reports since boot
+    optional int64 l5_top_four_average_cn0_reports = 9;
+
+    // Total pulled reported of l5 top 4 average CN0 (dB-mHz) since boot
+    optional int64 l5_top_four_average_cn0_db_mhz = 10;
+
+    // Total number of sv status messages reports since boot
+    optional int64 sv_status_reports = 11;
+
+    // Total number of sv status messages reports, where sv is used in fix since boot
+    optional int64 sv_status_reports_used_in_fix = 12;
+
+    // Total number of L5 sv status messages reports since boot
+    optional int64 l5_sv_status_reports = 13;
+
+    // Total number of L5 sv status messages reports, where sv is used in fix since boot
+    optional int64 l5_sv_status_reports_used_in_fix = 14;
 }