[Autofill PCC Metrics] Add latency of the classification service
Approved Eldar: https://eldar.corp.google.com/assessments/659945603/revisions/6?jsmode=o&mods=eldarui_search
Approved Bug: 274622942
Bug: 269484106
Test: m

Change-Id: If4525bec3634f36e5ace4d74bf3947d8fe06190f
diff --git a/stats/atoms.proto b/stats/atoms.proto
index 06c22ed..ecb62c0 100644
--- a/stats/atoms.proto
+++ b/stats/atoms.proto
@@ -28,7 +28,6 @@
 import "frameworks/proto_logging/stats/atoms/art/art_atoms.proto";
 import "frameworks/proto_logging/stats/atoms/art/background_dexopt_atoms.proto";
 import "frameworks/proto_logging/stats/atoms/art/odrefresh_atoms.proto";
-import "frameworks/proto_logging/stats/atoms/autofill/autofill_atoms.proto";
 import "frameworks/proto_logging/stats/atoms/corenetworking/connectivity/connectivity_atoms.proto";
 import "frameworks/proto_logging/stats/atoms/display/display_atoms.proto";
 import "frameworks/proto_logging/stats/atoms/dnd/dnd_atoms.proto";
@@ -938,11 +937,6 @@
         corenetworking.connectivity.NetworkValidationFailureStatsDailyReported
             network_validation_failure_stats_daily_reported = 601 [(module) = "connectivity"];
         wearservices.WsComplicationTapped ws_complication_tapped = 602 [(module) = "wearservices"];
-        autofill.AutofillUiEventReported autofill_ui_event_reported = 603 [(module) = "framework"];
-        autofill.AutofillFillRequestReported autofill_fill_request_reported = 604 [(module) = "framework"];
-        autofill.AutofillFillResponseReported autofill_fill_response_reported = 605 [(module) = "framework"];
-        autofill.AutofillSaveEventReported autofill_save_event_reported = 606 [(module) = "framework"];
-        autofill.AutofillSessionCommitted autofill_session_committed = 607 [(module) = "framework"];
         wearservices.WsWearTimeSession ws_wear_time_session = 610 [(module) = "wearservices"];
         // StatsdStats tracks platform atoms with ids up to 750.
         // Update StatsdStats::kMaxPushedAtomId when atom ids here approach that value.
@@ -956,6 +950,11 @@
     extensions 598; // AdServicesBackCompatGetTopicsReported ad_services_back_compat_get_topics_reported
     extensions 599; // AdServicesBackCompatEpochComputationClassifierReported ad_services_back_compat_epoch_computation_classifier_reported
     extensions 600; // MediaCodecReclaimRequestCompleted media_codec_reclaim_request_completed
+    extensions 603; // AutofillUiEventReported autofill_ui_event_reported
+    extensions 604; // AutofillFillRequestReported autofill_fill_request_reported
+    extensions 605; // AutofillFillResponseReported autofill_fill_response_reported
+    extensions 606; // AutofillSaveEventReported autofill_save_event_reported
+    extensions 607; // AutofillSessionCommitted autofill_session_committed
     extensions 608; // MediaActionReported media_action_reported
     extensions 609; // MediaControlsLaunched media_controls_launched
     extensions 611; // LockscreenShortcutSelected lockscreen_shortcut_selected
@@ -1006,6 +1005,7 @@
     extensions 656; // BluetoothLeSessionConnected bluetooth_le_session_connected
     extensions 657; // DNDStateChanged dnd_state_changed
     extensions 658; // ExpressUidHistogramSampleReported express_uid_histogram_sample_reported
+    extensions 659; // AuotifllFieldClassificationEventReported autofill_field_classification_event_reported
     extensions 9999; // Atom9999 atom_9999
 
     // Pulled events will start at field 10000.
diff --git a/stats/atoms/autofill/autofill_atoms.proto b/stats/atoms/autofill/autofill_extension_atoms.proto
similarity index 82%
rename from stats/atoms/autofill/autofill_atoms.proto
rename to stats/atoms/autofill/autofill_extension_atoms.proto
index be2e78f..f6a3ee7 100644
--- a/stats/atoms/autofill/autofill_atoms.proto
+++ b/stats/atoms/autofill/autofill_extension_atoms.proto
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2022 The Android Open Source Project
+ * Copyright (C) 2023 The Android Open Source Project
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -18,12 +18,22 @@
 
 package android.os.statsd.autofill;
 
+import "frameworks/proto_logging/stats/atoms.proto";
 import "frameworks/proto_logging/stats/atom_field_options.proto";
 import "frameworks/proto_logging/stats/enums/autofill/enums.proto";
 
 option java_package = "com.android.os.autofill";
 option java_multiple_files = true;
 
+extend Atom {
+    optional AutofillUiEventReported autofill_ui_event_reported = 603 [(module) = "framework"];
+    optional AutofillFillRequestReported autofill_fill_request_reported = 604 [(module) = "framework"];
+    optional AutofillFillResponseReported autofill_fill_response_reported = 605 [(module) = "framework"];
+    optional AutofillSaveEventReported autofill_save_event_reported = 606 [(module) = "framework"];
+    optional AutofillSessionCommitted autofill_session_committed = 607 [(module) = "framework"];
+    optional AutofillFieldClassificationEventReported autofill_field_classification_event_reported =
+            659 [(module) = "framework"];
+}
 /**
  * Log Autofill related system UI events.
  *
@@ -105,6 +115,11 @@
   optional int64 latency_dataset_display_millis = 12 [deprecated = true];
   // The result of Autofill response.
   optional FillResponseStatus response_status = 13;
+  // Time taken to process the datasets.
+  // For eg: In case of PCC detection, we need to merge the datasets to be
+  // shown for presentataion. This encapsulates the time taken for preparing
+  // final eligible datasets to be shown.
+  optional int64 latency_response_processing_millis = 14;
 }
 
 /**
@@ -162,3 +177,12 @@
   // Duration of session: Time from session start to session end
   optional int64 session_duration_millis = 5;
 }
+
+/**
+* Logs Fieldclassification event. This event is captured after the request
+* for the classification service has been made.
+*/
+message AutofillFieldClassificationEventReported {
+    // Latency of the request to the field classification service.
+    optional int64 latency_millis = 1;
+}