xref: /aosp_15_r20/external/mobile-data-download/proto/log_enums.proto (revision 6fa6b5e213d87a73421ed761ee7d492115d5f98c)
1// Copyright 2022 Google LLC
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7//      http://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14syntax = "proto3";
15
16package mobiledatadownload.logs;
17
18option java_package = "com.google.mobiledatadownload";
19option java_outer_classname = "LogEnumsProto";
20
21// MDD client side events used for logging with MddLogData.
22//
23// Each feature gets a range of 1000 enums starting at X000. 1st enum specifies
24// if the feature is enabled. Subsequent 999 enums can be used to define events
25// within the feature. Unused enums in the range are left for future use for
26// the *same* feature.
27// If a feature ever exhausts it's quota of enums, it should be migrated to a
28// new range of contiguous 2000 enums by deprecating the existing enums.
29//
30// Enums should never be deleted or reused, but they can be renamed*. Old enums
31// should be left in their position with [deprecated=true] attribute.
32//
33// * For renaming enums, see <internal>
34message MddClientEvent {
35  enum Code {
36    // Do not use this default value.
37    EVENT_CODE_UNSPECIFIED = 0;
38
39    // Events for Mobile Data Download (<internal>) (1000-1999).
40    // Next enum for data download: 1114
41
42    // Log in a periodic tasks.
43    // Logged with DataDownloadFileGroupStats, MddFileGroupStatus.
44    DATA_DOWNLOAD_FILE_GROUP_STATUS = 1044;
45
46    // MDD download result log.
47    DATA_DOWNLOAD_RESULT_LOG = 1068;
48
49    // Log MddStorageStats in daily maintenance.
50    DATA_DOWNLOAD_STORAGE_STATS = 1055;
51
52    // Log event for MDD Lib api result.
53    DATA_DOWNLOAD_LIB_API_RESULT = 1108;
54
55    // Log MddNetworkStats in daily maintenance.
56    DATA_DOWNLOAD_NETWORK_STATS = 1056;
57
58    // File group download started.
59    DATA_DOWNLOAD_STARTED = 1070;
60
61    // File group download complete.
62    DATA_DOWNLOAD_COMPLETE = 1007;
63
64    // The log event for MDD download latency.
65    DATA_DOWNLOAD_LATENCY_LOG = 1080;
66
67    // All files in the group were already available when the file group was
68    // added.
69    DATA_DOWNLOAD_COMPLETE_IMMEDIATE = 1032;
70
71    DATA_DOWNLOAD_PENDING_GROUP_REPLACED = 1115;
72
73    reserved 1000 to 1006;
74    reserved 1008 to 1031;
75    reserved 1033 to 1043;
76    reserved 1045 to 1054;
77    reserved 1057 to 1067;
78    reserved 1069;
79    reserved 1071 to 1079;
80    reserved 1081 to 1107;
81    reserved 1109 to 1114;
82
83    reserved 2000 to 2999, 3000 to 3999, 4000 to 4099, 4100 to 4199,
84        5000 to 5999, 6000 to 6999, 7000 to 7999, 8000 to 8999, 9000 to 9999,
85        10000 to 10999, 11000 to 11999, 12000 to 12999, 13000, 13999,
86        14000 to 14999, 15000 to 15999, 16000 to 16999, 17000 to 17999,
87        18000 to 18999, 19000 to 19999;
88  }
89}
90
91message MddFileGroupDownloadStatus {
92  enum Code {
93    INVALID = 0;
94    COMPLETE = 1;
95    PENDING = 2;
96    FAILED = 3;
97  }
98}
99
100// Result of MDD download api call.
101message MddDownloadResult {
102  enum Code {
103    UNSPECIFIED = 0;  // unset value
104
105    // File downloaded successfully.
106    SUCCESS = 1;
107
108    // The error we don't know.
109    UNKNOWN_ERROR = 2;
110
111    // The errors from the android downloader v1 outside MDD, which comes from:
112    // <internal>
113    // The block 100-199 (included) is reserved for android downloader v1.
114    // Next tag: 112
115    ANDROID_DOWNLOADER_UNKNOWN = 100;
116    ANDROID_DOWNLOADER_CANCELED = 101;
117    ANDROID_DOWNLOADER_INVALID_REQUEST = 102;
118    ANDROID_DOWNLOADER_HTTP_ERROR = 103;
119    ANDROID_DOWNLOADER_REQUEST_ERROR = 104;
120    ANDROID_DOWNLOADER_RESPONSE_OPEN_ERROR = 105;
121    ANDROID_DOWNLOADER_RESPONSE_CLOSE_ERROR = 106;
122    ANDROID_DOWNLOADER_NETWORK_IO_ERROR = 107;
123    ANDROID_DOWNLOADER_DISK_IO_ERROR = 108;
124    ANDROID_DOWNLOADER_FILE_SYSTEM_ERROR = 109;
125    ANDROID_DOWNLOADER_UNKNOWN_IO_ERROR = 110;
126    ANDROID_DOWNLOADER_OAUTH_ERROR = 111;
127
128    // The errors from the android downloader v2 outside MDD, which comes from:
129    // <internal>
130    // The block 200-299 (included) is reserved for android downloader v2.
131    // Next tag: 201
132    ANDROID_DOWNLOADER2_ERROR = 200;
133
134    // The data file group has not been added to MDD by the time the caller
135    // makes download API call.
136    GROUP_NOT_FOUND_ERROR = 300;
137
138    // The DownloadListener is present but the DownloadMonitor is not provided.
139    DOWNLOAD_MONITOR_NOT_PROVIDED_ERROR = 301;
140
141    // Errors from unsatisfied download preconditions.
142    INSECURE_URL_ERROR = 302;
143    LOW_DISK_ERROR = 303;
144
145    // Errors from download preparation.
146    UNABLE_TO_CREATE_FILE_URI_ERROR = 304;
147    SHARED_FILE_NOT_FOUND_ERROR = 305;
148    MALFORMED_FILE_URI_ERROR = 306;
149    UNABLE_TO_CREATE_MOBSTORE_RESPONSE_WRITER_ERROR = 307;
150
151    // Errors from file validation.
152    UNABLE_TO_VALIDATE_DOWNLOAD_FILE_ERROR = 308;
153    DOWNLOADED_FILE_NOT_FOUND_ERROR = 309;
154    DOWNLOADED_FILE_CHECKSUM_MISMATCH_ERROR = 310;
155    CUSTOM_FILEGROUP_VALIDATION_FAILED = 330;
156
157    // Errors from download transforms.
158    UNABLE_TO_SERIALIZE_DOWNLOAD_TRANSFORM_ERROR = 311;
159    DOWNLOAD_TRANSFORM_IO_ERROR = 312;
160    FINAL_FILE_CHECKSUM_MISMATCH_ERROR = 313;
161
162    // Errors from delta download.
163    DELTA_DOWNLOAD_BASE_FILE_NOT_FOUND_ERROR = 314;
164    DELTA_DOWNLOAD_DECODE_IO_ERROR = 315;
165
166    // The error occurs after the file is ready.
167    UNABLE_TO_UPDATE_FILE_STATE_ERROR = 316;
168
169    // Fail to update the file group metadata.
170    UNABLE_TO_UPDATE_GROUP_METADATA_ERROR = 317;
171
172    // Errors from sharing files with the blob storage.
173    // Failed to update the metadata max_expiration_date.
174    UNABLE_TO_UPDATE_FILE_MAX_EXPIRATION_DATE = 318;
175    UNABLE_SHARE_FILE_BEFORE_DOWNLOAD_ERROR = 319;
176    UNABLE_SHARE_FILE_AFTER_DOWNLOAD_ERROR = 320;
177
178    // Download errors related to isolated file structure
179    UNABLE_TO_REMOVE_SYMLINK_STRUCTURE = 321;
180    UNABLE_TO_CREATE_SYMLINK_STRUCTURE = 322;
181
182    // Download errors related to importing inline files
183    UNABLE_TO_RESERVE_FILE_ENTRY = 323;
184    INVALID_INLINE_FILE_URL_SCHEME = 324;
185    INLINE_FILE_IO_ERROR = 327;
186    MISSING_INLINE_DOWNLOAD_PARAMS = 328;
187    MISSING_INLINE_FILE_SOURCE = 329;
188
189    // Download errors related to URL parsing
190    MALFORMED_DOWNLOAD_URL = 325;
191    UNSUPPORTED_DOWNLOAD_URL_SCHEME = 326;
192
193    // Download errors for manifest file group populator.
194    MANIFEST_FILE_GROUP_POPULATOR_INVALID_FLAG_ERROR = 400;
195    MANIFEST_FILE_GROUP_POPULATOR_CONTENT_CHANGED_DURING_DOWNLOAD_ERROR = 401;
196    MANIFEST_FILE_GROUP_POPULATOR_PARSE_MANIFEST_FILE_ERROR = 402;
197    MANIFEST_FILE_GROUP_POPULATOR_DELETE_MANIFEST_FILE_ERROR = 403;
198    MANIFEST_FILE_GROUP_POPULATOR_METADATA_IO_ERROR = 404;
199
200    reserved 1000 to 3000;
201  }
202}
203
204// Collection of MDD Lib's Public API methods used when logging the result of an
205// MDD Lib API call.
206message MddLibApiName {
207  enum Code {
208    UNKNOWN = 0;
209
210    // File Group metadata management APIs.
211    // NOTE: These APIs will include DataDownloadFileGroupStats in their
212    // logs.
213    ADD_FILE_GROUP = 1;
214    GET_FILE_GROUP = 2;
215    REMOVE_FILE_GROUP = 3;
216    REPORT_USAGE = 4;
217
218    // File Group data management APIs.
219    // NOTE: These APIs will include DataDownloadFileGroupStats in their
220    // logs.
221    CANCEL_FOREGROUND_DOWNLOAD = 5;
222    DOWNLOAD_FILE_GROUP = 6;
223    DOWNLOAD_FILE_GROUP_WITH_FOREGROUND_SERVICE = 7;
224    IMPORT_FILES = 8;
225
226    // File Group metadata bulk management APIs
227    // NOTE: These APIs will not include DataDownloadFileGroupStats in
228    // their logs.
229    CLEAR = 9;
230    GET_FILE_GROUPS_BY_FILTER = 10;
231    MAINTENANCE = 11;
232    REMOVE_FILE_GROUPS_BY_FILTER = 12;
233
234    // File data management APIs
235    // NOTE: These APIs will not include DataDownloadFileGroupStats in
236    // their logs.
237    DOWNLOAD_FILE = 13;
238    DOWNLOAD_FILE_WITH_FOREGROUND_SERVICE = 14;
239
240    // Task scheduling APIs.
241    // NOTE: These APIs will not include DataDownloadFileGroupStats in
242    // their logs.
243    HANDLE_TASK = 15;
244    SCHEDULE_PERIODIC_BACKGROUND_TASKS = 16;
245    SYNC = 17;
246
247    // Calls to phenotype external experiment id setting
248
249    // NOTE: this isn't actually an MDD API but the data is in the same format.
250    // DataDownloadFileGroupStats will be populated when available.
251    PHENOTYPE_CLEAR_EXPERIMENT_IDS = 18;
252    PHENOTYPE_UPDATE_EXPERIMENT_IDS = 19;
253    PHENOTYPE_CLEAR_ALL = 20;
254  }
255}
256
257// Result enum when logging the result of an MDD Lib API call.
258message MddLibApiResult {
259  enum Code {
260    RESULT_UNKNOWN = 0;
261    RESULT_SUCCESS = 1;
262
263    // Codes for failures
264    // Used for failures whose is reason is unknown.
265    RESULT_FAILURE = 2;
266    // Request cancelled
267    RESULT_CANCELLED = 3;
268    // Interrupted
269    RESULT_INTERRUPTED = 4;
270    RESULT_IO_ERROR = 5;
271    RESULT_ILLEGAL_STATE = 6;
272    RESULT_ILLEGAL_ARGUMENT = 7;
273    RESULT_UNSUPPORTED_OPERATION = 8;
274    RESULT_DOWNLOAD_ERROR = 9;
275  }
276}
277