1/*
2 * Copyright (C) 2023 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 *      http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17syntax = "proto2";
18
19package android.os.statsd.autofill;
20
21import "frameworks/proto_logging/stats/atoms.proto";
22import "frameworks/proto_logging/stats/atom_field_options.proto";
23import "frameworks/proto_logging/stats/enums/autofill/enums.proto";
24
25option java_package = "com.android.os.autofill";
26option java_multiple_files = true;
27
28extend Atom {
29    optional AutofillUiEventReported autofill_ui_event_reported = 603 [(module) = "framework"];
30    optional AutofillFillRequestReported autofill_fill_request_reported = 604 [(module) = "framework"];
31    optional AutofillFillResponseReported autofill_fill_response_reported = 605 [(module) = "framework"];
32    optional AutofillSaveEventReported autofill_save_event_reported = 606 [(module) = "framework"];
33    optional AutofillSessionCommitted autofill_session_committed = 607 [(module) = "framework"];
34    optional AutofillFieldClassificationEventReported autofill_field_classification_event_reported =
35            659 [(module) = "framework"];
36}
37/**
38 * Log Autofill related system UI events.
39 *
40 * Logged from:
41 *   packages/apps/Settings/src/com/android/settings/
42 */
43message AutofillUiEventReported {
44  optional UiEventType event_type = 1;
45  optional int32 autofill_service_uid = 2 [(is_uid) = true];
46  optional int32 app_package_uid = 3 [(is_uid) = true];
47}
48
49/**
50 * Log information for Autofill FillRequest. It is logged after a
51 * FillRequest is sent to the Autofill provider.
52 *
53 * Logged from:
54 *   frameworks/base/services/autofill/java/com/android/server/autofill/
55 */
56message AutofillFillRequestReported {
57  // Id number which increases for each subsequent request.
58  optional int32 request_id = 1;
59  // SessionId to aggregate requests within a session, and see overall
60  // performance.
61  optional int32 session_id = 2;
62  // App package Uid
63  optional int32 app_package_uid = 11 [(is_uid) = true];
64  // Autofill Service Provider's uid
65  optional int32 autofill_service_uid = 3 [(is_uid) = true];
66  // Inline suggestion host's uid. Populated only when
67  // AutofillDisplayPresentationType = INLINE
68  optional int32 inline_suggestion_host_uid = 4 [(is_uid) = true];
69  // True if the request is augmented.
70  optional bool is_augmented = 5;
71  // True if the request is a fallback of client suggestion request to the
72  // service provider.
73  optional bool is_client_suggestion_fallback = 6;
74  // True if the request is eligible for fill dialog.
75  optional bool is_fill_dialog_eligible = 7;
76  optional FillRequestTriggerReason request_trigger_reason = 8;
77  optional int64 flags = 9;
78  // Timestamp of FillRequest is sent to Autofill provider
79  // Latency of framework before provider is called = fillRequestSentTimestampMs
80  optional int32 latency_fill_request_sent_millis = 10;
81}
82
83/**
84 * Log information for Autofill FillResponse. It is logged after a
85 * FillResponse is received from the Autofill provider.
86 *
87 * Logged from:
88 *   frameworks/base/services/autofill/java/com/android/server/autofill/
89 */
90message AutofillFillResponseReported {
91  // Id number which increases for each subsequent request.
92  optional int32 request_id = 1;
93  // SessionId to aggregate requests within a session, and see overall
94  // performance.
95  optional int32 session_id = 2;
96  // App package uid
97  optional int32 app_package_uid = 3 [(is_uid) = true];
98  // Tells how the Autofill dataset was/will-be displayed.
99  // How the dataset is supposed to be shown to the user
100  optional AutofillDisplayPresentationType display_presentation_type = 4;
101  // Count of datasets that should've been available for display. If the request
102  // times out, this won't be populated. This is the count after PCC detected
103  // datasets are processed and ineligeble datasets have been filtered off.
104  optional int32 available_count = 5;
105  optional int64 save_ui_trigger_ids = 6;
106  // Timestamp of when Autofill provider returns a FillResponse
107  // Latency of Autofill provider = fillResponseReceivedTimestampMs -
108  // fillRequestSentTimestampMs
109  optional int32 latency_fill_response_received_millis = 7;
110  optional AuthenticationType authentication_type = 8 [deprecated = true];
111  optional AuthenticationResult authentication_result = 9 [deprecated = true];
112  optional int64 authentication_failure_reason = 10 [deprecated = true];
113  // From response received to authentication UI displayed to the user.
114  optional int64 latency_authentication_ui_display_millis = 11 [deprecated = true];
115  // From the user finishing authentication to the dataset is displayed to the user.
116  optional int64 latency_dataset_display_millis = 12 [deprecated = true];
117  // The result of Autofill response.
118  optional FillResponseStatus response_status = 13;
119  // Time taken to process the datasets.
120  // For eg: In case of PCC detection, we need to merge the datasets to be
121  // shown for presentataion. This encapsulates the time taken for preparing
122  // final eligible datasets to be shown.
123  optional int64 latency_response_processing_millis = 14;
124
125  // Count of datasets that were provided by the Autofill Provider by
126  // specifying type. These datasets may additionally contain autofill ids for
127  // which this same dataset is applicable that are available due to PCC
128  // detection. These can include datasets available via provider response,
129  // and would be eligible because of PCC too.
130  // If PCC detection is preferred over Autofill Provider, it may include
131  // datasets applicable to autofill ids. So the same datasets would've shown
132  // if Autofill Provider detection was preferred.
133  // In such a case and if the detection of both the Autofill Provider and PCC
134  // detection were the same, the following invariants holds, provided same
135  // datasets were provided.
136  // available_pcc_count = available_count
137  // available_pcc_only_count = 0
138  // If PCC detection is not preferred, the following invariant holds.
139  // available_pcc_count = available_pcc_only_count
140  optional int32 available_pcc_count = 15;
141  // Count of datasets that are available only due to PCC Detection. These
142  // datasets are the ones provided by Autofill Provider by specifying types
143  // only. These datasets don't have any autofill id associated with them.
144  optional int32 available_pcc_only_count = 16;
145  // Count of datasets that are returned by the Autofill Provider. This count
146  // is before any filtering based on PCC detection is performed. This contains
147  // datasets set by both type and autofill ids.
148  optional int32 total_datasets_provided = 17;
149  // Which detection was preferred
150  optional DetectionPreference detection_preference = 18;
151}
152
153/**
154 * Log information for Autofill Save event. It is logged after onSaveRequest
155 * is called.
156 *
157 * Logged from:
158 *   frameworks/base/services/autofill/java/com/android/server/autofill/
159 */
160message AutofillSaveEventReported {
161  // Id number which increases for each subsequent request.
162  optional int32 request_id = 1;
163  // SessionId to aggregate requests within a session, and see overall
164  // performance.
165  optional int32 session_id = 2;
166  // App package uid
167  optional int32 app_package_uid = 3 [(is_uid) = true];
168  // Same as the one from AutofillPresentationEventReported.
169  optional int64 save_ui_trigger_ids = 4;
170  optional int64 flag = 5;
171  // True if attempting to save a new field, rather than updating an existing one.
172  optional bool is_new_field = 6;
173
174  optional SaveUiShownReason save_ui_shown_reason = 7;
175  optional SaveUiNotShownReason save_ui_not_shown_reason = 8;
176
177  optional bool save_button_clicked = 9;
178  optional bool cancel_button_clicked = 10;
179  optional bool dialog_dismissed = 11;
180  optional bool is_saved = 12;
181
182  // From framework detected that any of the “savable” fields(during session
183  // commitment) were changed to the save UI displayed to the user.
184  optional int64 latency_save_ui_display_millis = 13;
185  // From the user clicking the “save” button to the framework making the
186  // onSave request.
187  optional  int64 latency_save_request_millis = 14;
188  // From onSave request to save is finished.
189  optional int64 latency_save_finish_millis = 15;
190
191  // Whether the framework created the save info object.
192  // This is true if provider didn't specify any autofill ids in saveInfo object.
193  optional bool is_framework_created_save_info = 16;
194
195  optional int32 autofill_service_uid = 17 [(is_uid) = true];
196}
197
198/**
199 * Log information about an Autofill session. It is logged after the session
200 * has been committed.
201 *
202 * Logged from:
203 *   frameworks/base/services/autofill/java/com/android/server/autofill/
204 */
205message AutofillSessionCommitted {
206  optional int32 session_id = 1;
207  optional int32 component_package_uid = 2;
208  optional int64 request_count = 3;
209  // Commit reason
210  optional AutofillCommitReason commit_reason = 4;
211  // Duration of session: Time from session start to session end
212  optional int64 session_duration_millis = 5;
213  optional int32 autofill_service_uid = 6 [(is_uid) = true];
214  // Count of save infos in current session
215  optional int32 save_info_count = 7;
216  // Count of distinct save data types in current session
217  // For example, if there are three save infos, two with type password
218  // and another with type payment, the total count of save data types would
219  // be two
220  optional int32 save_data_types_count = 8;
221  // Whether the last fill response has save info
222  optional bool last_fill_response_has_save_info = 9;
223}
224
225/**
226* Logs FieldClassification event. This event is captured after the request
227* for the classification service has been made.
228*/
229message AutofillFieldClassificationEventReported {
230  // Latency of the request to the field classification service.
231  optional int64 latency_millis = 1;
232  // Count of fields that were classified.
233  optional int32 count_classifications = 2;
234  // SessionId to attribute classifications within a session, and measure overall performance.
235  optional int32 session_id = 3;
236  // field_classification request id.
237  optional int32 request_id = 4;
238  // request_id of the next fill request that'll use this result.
239  optional int32 next_fill_request_id = 5;
240  // App package Uid
241  optional int32 app_package_uid = 6 [(is_uid) = true];
242  // Status of the request
243  optional FieldClassificationRequestStatus status = 7;
244  // Indicates the session that called this request was garbage collected
245  optional bool is_session_gc = 8;
246}
247