shawnlin | 9cee68f | 2019-01-25 11:20:18 +0800 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2019 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 | |
| 17 | package com.android.documentsui; |
| 18 | |
| 19 | import androidx.annotation.IntDef; |
| 20 | |
| 21 | import java.lang.annotation.Retention; |
| 22 | import java.lang.annotation.RetentionPolicy; |
| 23 | |
| 24 | /** |
| 25 | * All constants are based on the enums in |
| 26 | * frameworks/base/core/proto/android/stats/docsui/docsui_enums.proto. |
| 27 | */ |
| 28 | public class MetricConsts { |
| 29 | |
| 30 | // Codes representing different root types. |
| 31 | public static final int ROOT_UNKNOWN = 0; |
| 32 | public static final int ROOT_NONE = 1; |
| 33 | public static final int ROOT_OTHER_DOCS_PROVIDER = 2; |
| 34 | public static final int ROOT_AUDIO = 3; |
| 35 | public static final int ROOT_DEVICE_STORAGE = 4; |
| 36 | public static final int ROOT_DOWNLOADS = 5; |
| 37 | public static final int ROOT_HOME = 6; |
| 38 | public static final int ROOT_IMAGES = 7; |
| 39 | public static final int ROOT_RECENTS = 8; |
| 40 | public static final int ROOT_VIDEOS = 9; |
| 41 | public static final int ROOT_MTP = 10; |
| 42 | public static final int ROOT_THIRD_PARTY_APP = 11; |
| 43 | |
| 44 | @IntDef(flag = true, value = { |
| 45 | ROOT_UNKNOWN, |
| 46 | ROOT_NONE, |
| 47 | ROOT_OTHER_DOCS_PROVIDER, |
| 48 | ROOT_AUDIO, |
| 49 | ROOT_DEVICE_STORAGE, |
| 50 | ROOT_DOWNLOADS, |
| 51 | ROOT_HOME, |
| 52 | ROOT_IMAGES, |
| 53 | ROOT_RECENTS, |
| 54 | ROOT_VIDEOS, |
| 55 | ROOT_MTP, |
| 56 | ROOT_THIRD_PARTY_APP |
| 57 | }) |
| 58 | @Retention(RetentionPolicy.SOURCE) |
| 59 | public @interface Root { |
| 60 | } |
| 61 | |
| 62 | // Codes representing different mime types. |
| 63 | static final int MIME_UNKNOWN = 0; |
| 64 | static final int MIME_NONE = 1; // null mime |
| 65 | static final int MIME_ANY = 2; // */* |
| 66 | static final int MIME_APPLICATION = 3; // application/* |
| 67 | static final int MIME_AUDIO = 4; // audio/* |
| 68 | static final int MIME_IMAGE = 5; // image/* |
| 69 | static final int MIME_MESSAGE = 6; // message/* |
| 70 | static final int MIME_MULTIPART = 7; // multipart/* |
| 71 | static final int MIME_TEXT = 8; // text/* |
| 72 | static final int MIME_VIDEO = 9; // video/* |
| 73 | static final int MIME_OTHER = 10; // anything not enumerated below |
| 74 | |
| 75 | @IntDef(flag = true, value = { |
| 76 | MIME_UNKNOWN, |
| 77 | MIME_NONE, |
| 78 | MIME_ANY, |
| 79 | MIME_APPLICATION, |
| 80 | MIME_AUDIO, |
| 81 | MIME_IMAGE, |
| 82 | MIME_MESSAGE, |
| 83 | MIME_MULTIPART, |
| 84 | MIME_TEXT, |
| 85 | MIME_VIDEO, |
| 86 | MIME_OTHER |
| 87 | }) |
| 88 | @Retention(RetentionPolicy.SOURCE) |
| 89 | public @interface Mime { |
| 90 | } |
| 91 | |
| 92 | public static final int UNKNOWN_SCOPE = 0; |
| 93 | public static final int FILES_SCOPE = 1; |
| 94 | public static final int PICKER_SCOPE = 2; |
| 95 | |
| 96 | // Codes representing different scopes(FILE/PICKER mode). |
| 97 | @IntDef({UNKNOWN_SCOPE, FILES_SCOPE, PICKER_SCOPE}) |
| 98 | @Retention(RetentionPolicy.SOURCE) |
| 99 | public @interface ContextScope { |
| 100 | } |
| 101 | |
| 102 | // Codes representing different kinds of file operations. |
| 103 | static final int FILEOP_UNKNOWN = 0; |
| 104 | static final int FILEOP_OTHER = 1; // any file operation not listed below |
| 105 | static final int FILEOP_COPY = 2; |
| 106 | static final int FILEOP_COPY_INTRA_PROVIDER = 3; // Copy within a provider |
| 107 | static final int FILEOP_COPY_SYSTEM_PROVIDER = 4; // Copy to a system provider. |
| 108 | static final int FILEOP_COPY_EXTERNAL_PROVIDER = 5; // Copy to a 3rd-party provider. |
| 109 | static final int FILEOP_MOVE = 6; |
| 110 | static final int FILEOP_MOVE_INTRA_PROVIDER = 7; // Move within a provider. |
| 111 | static final int FILEOP_MOVE_SYSTEM_PROVIDER = 8; // Move to a system provider. |
| 112 | static final int FILEOP_MOVE_EXTERNAL_PROVIDER = 9; // Move to a 3rd-party provider. |
| 113 | static final int FILEOP_DELETE = 10; |
| 114 | static final int FILEOP_RENAME = 11; |
| 115 | static final int FILEOP_CREATE_DIR = 12; |
| 116 | static final int FILEOP_OTHER_ERROR = 13; |
| 117 | static final int FILEOP_DELETE_ERROR = 14; |
| 118 | static final int FILEOP_MOVE_ERROR = 15; |
| 119 | static final int FILEOP_COPY_ERROR = 16; |
| 120 | static final int FILEOP_RENAME_ERROR = 17; |
| 121 | static final int FILEOP_CREATE_DIR_ERROR = 18; |
| 122 | static final int FILEOP_COMPRESS_INTRA_PROVIDER = 19; // Compres within a provider |
| 123 | static final int FILEOP_COMPRESS_SYSTEM_PROVIDER = 20; // Compress to a system provider. |
| 124 | static final int FILEOP_COMPRESS_EXTERNAL_PROVIDER = 21; // Compress to a 3rd-party provider. |
| 125 | static final int FILEOP_EXTRACT_INTRA_PROVIDER = 22; // Extract within a provider |
| 126 | static final int FILEOP_EXTRACT_SYSTEM_PROVIDER = 23; // Extract to a system provider. |
| 127 | static final int FILEOP_EXTRACT_EXTERNAL_PROVIDER = 24; // Extract to a 3rd-party provider. |
| 128 | static final int FILEOP_COMPRESS_ERROR = 25; |
| 129 | static final int FILEOP_EXTRACT_ERROR = 26; |
| 130 | |
| 131 | @IntDef(flag = true, value = { |
| 132 | FILEOP_UNKNOWN, |
| 133 | FILEOP_OTHER, |
| 134 | FILEOP_COPY, |
| 135 | FILEOP_COPY_INTRA_PROVIDER, |
| 136 | FILEOP_COPY_SYSTEM_PROVIDER, |
| 137 | FILEOP_COPY_EXTERNAL_PROVIDER, |
| 138 | FILEOP_MOVE, |
| 139 | FILEOP_MOVE_INTRA_PROVIDER, |
| 140 | FILEOP_MOVE_SYSTEM_PROVIDER, |
| 141 | FILEOP_MOVE_EXTERNAL_PROVIDER, |
| 142 | FILEOP_DELETE, |
| 143 | FILEOP_RENAME, |
| 144 | FILEOP_CREATE_DIR, |
| 145 | FILEOP_OTHER_ERROR, |
| 146 | FILEOP_DELETE_ERROR, |
| 147 | FILEOP_MOVE_ERROR, |
| 148 | FILEOP_COPY_ERROR, |
| 149 | FILEOP_RENAME_ERROR, |
| 150 | FILEOP_CREATE_DIR_ERROR, |
| 151 | FILEOP_COMPRESS_INTRA_PROVIDER, |
| 152 | FILEOP_COMPRESS_SYSTEM_PROVIDER, |
| 153 | FILEOP_COMPRESS_EXTERNAL_PROVIDER, |
| 154 | FILEOP_EXTRACT_INTRA_PROVIDER, |
| 155 | FILEOP_EXTRACT_SYSTEM_PROVIDER, |
| 156 | FILEOP_EXTRACT_EXTERNAL_PROVIDER, |
| 157 | FILEOP_COMPRESS_ERROR, |
| 158 | FILEOP_EXTRACT_ERROR |
| 159 | }) |
| 160 | @Retention(RetentionPolicy.SOURCE) |
| 161 | public @interface FileOp { |
| 162 | } |
| 163 | |
| 164 | // Codes representing different provider types. Used for sorting file operations when logging. |
| 165 | static final int PROVIDER_INTRA = 0; |
| 166 | static final int PROVIDER_SYSTEM = 1; |
| 167 | static final int PROVIDER_EXTERNAL = 2; |
| 168 | |
| 169 | @IntDef(flag = false, value = { |
| 170 | PROVIDER_INTRA, |
| 171 | PROVIDER_SYSTEM, |
| 172 | PROVIDER_EXTERNAL |
| 173 | }) |
| 174 | @Retention(RetentionPolicy.SOURCE) |
| 175 | public @interface Provider { |
| 176 | } |
| 177 | |
| 178 | // Codes representing different types of sub-fileops. |
| 179 | public static final int SUBFILEOP_UNKNOWN = 0; |
| 180 | public static final int SUBFILEOP_QUERY_DOCUMENT = 1; |
| 181 | public static final int SUBFILEOP_QUERY_CHILDREN = 2; |
| 182 | public static final int SUBFILEOP_OPEN_FILE = 3; |
| 183 | public static final int SUBFILEOP_READ_FILE = 4; |
| 184 | public static final int SUBFILEOP_CREATE_DOCUMENT = 5; |
| 185 | public static final int SUBFILEOP_WRITE_FILE = 6; |
| 186 | public static final int SUBFILEOP_DELETE_DOCUMENT = 7; |
| 187 | public static final int SUBFILEOP_OBTAIN_STREAM_TYPE = 8; |
| 188 | public static final int SUBFILEOP_QUICK_MOVE = 9; |
| 189 | public static final int SUBFILEOP_QUICK_COPY = 10; |
| 190 | |
| 191 | @IntDef(flag = false, value = { |
| 192 | SUBFILEOP_UNKNOWN, |
| 193 | SUBFILEOP_QUERY_DOCUMENT, |
| 194 | SUBFILEOP_QUERY_CHILDREN, |
| 195 | SUBFILEOP_OPEN_FILE, |
| 196 | SUBFILEOP_READ_FILE, |
| 197 | SUBFILEOP_CREATE_DOCUMENT, |
| 198 | SUBFILEOP_WRITE_FILE, |
| 199 | SUBFILEOP_DELETE_DOCUMENT, |
| 200 | SUBFILEOP_OBTAIN_STREAM_TYPE, |
| 201 | SUBFILEOP_QUICK_MOVE, |
| 202 | SUBFILEOP_QUICK_COPY |
| 203 | }) |
| 204 | @Retention(RetentionPolicy.SOURCE) |
| 205 | public @interface SubFileOp { |
| 206 | } |
| 207 | |
| 208 | // Codes representing different user actions |
| 209 | public static final int USER_ACTION_UNKNOWN = 0; |
| 210 | public static final int USER_ACTION_OTHER = 1; |
| 211 | public static final int USER_ACTION_GRID = 2; |
| 212 | public static final int USER_ACTION_LIST = 3; |
| 213 | public static final int USER_ACTION_SORT_NAME = 4; |
| 214 | public static final int USER_ACTION_SORT_DATE = 5; |
| 215 | public static final int USER_ACTION_SORT_SIZE = 6; |
| 216 | public static final int USER_ACTION_SORT_TYPE = 7; |
| 217 | public static final int USER_ACTION_SEARCH = 8; |
| 218 | public static final int USER_ACTION_SHOW_SIZE = 9; |
| 219 | public static final int USER_ACTION_HIDE_SIZE = 10; |
| 220 | public static final int USER_ACTION_SETTINGS = 11; |
| 221 | public static final int USER_ACTION_COPY_TO = 12; |
| 222 | public static final int USER_ACTION_MOVE_TO = 13; |
| 223 | public static final int USER_ACTION_DELETE = 14; |
| 224 | public static final int USER_ACTION_RENAME = 15; |
| 225 | public static final int USER_ACTION_CREATE_DIR = 16; |
| 226 | public static final int USER_ACTION_SELECT_ALL = 17; |
| 227 | public static final int USER_ACTION_SHARE = 18; |
| 228 | public static final int USER_ACTION_OPEN = 19; |
| 229 | public static final int USER_ACTION_SHOW_ADVANCED = 20; |
| 230 | public static final int USER_ACTION_HIDE_ADVANCED = 21; |
| 231 | public static final int USER_ACTION_NEW_WINDOW = 22; |
| 232 | public static final int USER_ACTION_PASTE_CLIPBOARD = 23; |
| 233 | public static final int USER_ACTION_COPY_CLIPBOARD = 24; |
| 234 | public static final int USER_ACTION_DRAG_N_DROP = 25; |
| 235 | public static final int USER_ACTION_DRAG_N_DROP_MULTI_WINDOW = 26; |
| 236 | public static final int USER_ACTION_CUT_CLIPBOARD = 27; |
| 237 | public static final int USER_ACTION_COMPRESS = 28; |
| 238 | public static final int USER_ACTION_EXTRACT_TO = 29; |
| 239 | public static final int USER_ACTION_VIEW_IN_APPLICATION = 30; |
| 240 | public static final int USER_ACTION_INSPECTOR = 31; |
| 241 | public static final int USER_ACTION_SEARCH_CHIP = 32; |
| 242 | public static final int USER_ACTION_SEARCH_HISTORY = 33; |
| 243 | |
| 244 | @IntDef(flag = false, value = { |
| 245 | USER_ACTION_UNKNOWN, |
| 246 | USER_ACTION_OTHER, |
| 247 | USER_ACTION_GRID, |
| 248 | USER_ACTION_LIST, |
| 249 | USER_ACTION_SORT_NAME, |
| 250 | USER_ACTION_SORT_DATE, |
| 251 | USER_ACTION_SORT_SIZE, |
| 252 | USER_ACTION_SORT_TYPE, |
| 253 | USER_ACTION_SEARCH, |
| 254 | USER_ACTION_SHOW_SIZE, |
| 255 | USER_ACTION_HIDE_SIZE, |
| 256 | USER_ACTION_SETTINGS, |
| 257 | USER_ACTION_COPY_TO, |
| 258 | USER_ACTION_MOVE_TO, |
| 259 | USER_ACTION_DELETE, |
| 260 | USER_ACTION_RENAME, |
| 261 | USER_ACTION_CREATE_DIR, |
| 262 | USER_ACTION_SELECT_ALL, |
| 263 | USER_ACTION_SHARE, |
| 264 | USER_ACTION_OPEN, |
| 265 | USER_ACTION_SHOW_ADVANCED, |
| 266 | USER_ACTION_HIDE_ADVANCED, |
| 267 | USER_ACTION_NEW_WINDOW, |
| 268 | USER_ACTION_PASTE_CLIPBOARD, |
| 269 | USER_ACTION_COPY_CLIPBOARD, |
| 270 | USER_ACTION_DRAG_N_DROP, |
| 271 | USER_ACTION_DRAG_N_DROP_MULTI_WINDOW, |
| 272 | USER_ACTION_CUT_CLIPBOARD, |
| 273 | USER_ACTION_COMPRESS, |
| 274 | USER_ACTION_EXTRACT_TO, |
| 275 | USER_ACTION_VIEW_IN_APPLICATION, |
| 276 | USER_ACTION_INSPECTOR, |
| 277 | USER_ACTION_SEARCH_CHIP, |
| 278 | USER_ACTION_SEARCH_HISTORY |
| 279 | }) |
| 280 | @Retention(RetentionPolicy.SOURCE) |
| 281 | public @interface UserAction { |
| 282 | } |
| 283 | |
| 284 | // Codes representing different approaches to copy/move a document. OPMODE_PROVIDER indicates |
| 285 | // it's an optimized operation provided by providers; OPMODE_CONVERTED means it's converted from |
| 286 | // a virtual file; and OPMODE_CONVENTIONAL means it's byte copied. |
| 287 | public static final int OPMODE_UNKNOWN = 0; |
| 288 | public static final int OPMODE_PROVIDER = 1; |
| 289 | public static final int OPMODE_CONVERTED = 2; |
| 290 | public static final int OPMODE_CONVENTIONAL = 3; |
| 291 | |
| 292 | @IntDef({OPMODE_UNKNOWN, OPMODE_PROVIDER, OPMODE_CONVERTED, OPMODE_CONVENTIONAL}) |
| 293 | @Retention(RetentionPolicy.SOURCE) |
| 294 | public @interface FileOpMode { |
| 295 | } |
| 296 | |
| 297 | // Codes representing different menu actions. |
| 298 | static final int ACTION_UNKNOWN = 0; |
| 299 | static final int ACTION_OPEN = 1; |
| 300 | static final int ACTION_CREATE = 2; |
| 301 | static final int ACTION_GET_CONTENT = 3; |
| 302 | static final int ACTION_OPEN_TREE = 4; |
| 303 | static final int ACTION_PICK_COPY_DESTINATION = 5; |
| 304 | static final int ACTION_BROWSE = 6; |
| 305 | static final int ACTION_OTHER = 7; |
| 306 | |
| 307 | @IntDef(flag = true, value = { |
| 308 | ACTION_UNKNOWN, |
| 309 | ACTION_OPEN, |
| 310 | ACTION_CREATE, |
| 311 | ACTION_GET_CONTENT, |
| 312 | ACTION_OPEN_TREE, |
| 313 | ACTION_PICK_COPY_DESTINATION, |
| 314 | ACTION_BROWSE, |
| 315 | ACTION_OTHER |
| 316 | }) |
| 317 | @Retention(RetentionPolicy.SOURCE) |
| 318 | public @interface MetricsAction { |
| 319 | } |
| 320 | |
| 321 | public static final int AUTH_UNKNOWN = 0; |
| 322 | public static final int AUTH_OTHER = 1; |
| 323 | public static final int AUTH_MEDIA = 2; |
| 324 | public static final int AUTH_STORAGE_INTERNAL = 3; |
| 325 | public static final int AUTH_STORAGE_EXTERNAL = 4; |
| 326 | public static final int AUTH_DOWNLOADS = 5; |
| 327 | public static final int AUTH_MTP = 6; |
| 328 | |
| 329 | @IntDef(flag = true, value = { |
| 330 | AUTH_UNKNOWN, |
| 331 | AUTH_OTHER, |
| 332 | AUTH_MEDIA, |
| 333 | AUTH_STORAGE_INTERNAL, |
| 334 | AUTH_STORAGE_EXTERNAL, |
| 335 | AUTH_DOWNLOADS, |
| 336 | AUTH_MTP |
| 337 | }) |
| 338 | @Retention(RetentionPolicy.SOURCE) |
| 339 | public @interface MetricsAuth { |
| 340 | } |
| 341 | |
| 342 | // Types for logInvalidScopedAccessRequest |
| 343 | public static final int SCOPED_DIRECTORY_ACCESS_INVALID_ARGUMENTS = 1; |
| 344 | public static final int SCOPED_DIRECTORY_ACCESS_INVALID_DIRECTORY = 2; |
| 345 | public static final int SCOPED_DIRECTORY_ACCESS_ERROR = 3; |
| 346 | public static final int SCOPED_DIRECTORY_ACCESS_DEPRECATED = 4; |
| 347 | |
| 348 | @IntDef(value = { |
| 349 | SCOPED_DIRECTORY_ACCESS_INVALID_ARGUMENTS, |
| 350 | SCOPED_DIRECTORY_ACCESS_INVALID_DIRECTORY, |
| 351 | SCOPED_DIRECTORY_ACCESS_ERROR, |
| 352 | SCOPED_DIRECTORY_ACCESS_DEPRECATED |
| 353 | }) |
| 354 | @Retention(RetentionPolicy.SOURCE) |
| 355 | public @interface InvalidScopedAccess { |
| 356 | } |
shawnlin | e0ba46d | 2019-01-25 15:21:26 +0800 | [diff] [blame] | 357 | |
| 358 | // Codes representing different search types |
| 359 | public static final int TYPE_UNKNOWN = 0; |
| 360 | public static final int TYPE_CHIP_IMAGES = 1; |
| 361 | public static final int TYPE_CHIP_AUDIOS = 2; |
| 362 | public static final int TYPE_CHIP_VIDEOS = 3; |
| 363 | public static final int TYPE_CHIP_DOCS = 4; |
| 364 | public static final int TYPE_SEARCH_HISTORY = 5; |
| 365 | public static final int TYPE_SEARCH_STRING = 6; |
| 366 | |
| 367 | @IntDef(flag = true, value = { |
| 368 | TYPE_UNKNOWN, |
| 369 | TYPE_CHIP_IMAGES, |
| 370 | TYPE_CHIP_AUDIOS, |
| 371 | TYPE_CHIP_VIDEOS, |
| 372 | TYPE_CHIP_DOCS, |
| 373 | TYPE_SEARCH_HISTORY, |
| 374 | TYPE_SEARCH_STRING |
| 375 | }) |
| 376 | @Retention(RetentionPolicy.SOURCE) |
| 377 | public @interface SearchType {} |
| 378 | |
| 379 | // Codes representing different search types |
| 380 | public static final int SEARCH_UNKNOWN = 0; |
| 381 | public static final int SEARCH_KEYWORD = 1; |
| 382 | public static final int SEARCH_CHIPS = 2; |
| 383 | public static final int SEARCH_KEYWORD_N_CHIPS = 3; |
| 384 | |
| 385 | @IntDef(flag = true, value = { |
| 386 | SEARCH_UNKNOWN, |
| 387 | SEARCH_KEYWORD, |
| 388 | SEARCH_CHIPS, |
| 389 | SEARCH_KEYWORD_N_CHIPS |
| 390 | }) |
| 391 | @Retention(RetentionPolicy.SOURCE) |
| 392 | public @interface SearchMode {} |
shawnlin | 9cee68f | 2019-01-25 11:20:18 +0800 | [diff] [blame] | 393 | } |