1 /* 2 * Copyright (C) 2008 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 android.provider; 18 19 import android.app.DownloadManager; 20 import android.net.NetworkPolicyManager; 21 import android.net.Uri; 22 23 /** 24 * The Download Manager 25 * 26 * @pending 27 */ 28 public final class Downloads { Downloads()29 private Downloads() {} 30 31 /** 32 * Implementation details 33 * 34 * Exposes constants used to interact with the download manager's 35 * content provider. 36 * The constants URI ... STATUS are the names of columns in the downloads table. 37 * 38 * @hide 39 */ 40 public static final class Impl implements BaseColumns { Impl()41 private Impl() {} 42 43 /** 44 * The permission to access the download manager 45 */ 46 public static final String PERMISSION_ACCESS = "android.permission.ACCESS_DOWNLOAD_MANAGER"; 47 48 /** 49 * The permission to access the download manager's advanced functions 50 */ 51 public static final String PERMISSION_ACCESS_ADVANCED = 52 "android.permission.ACCESS_DOWNLOAD_MANAGER_ADVANCED"; 53 54 /** 55 * The permission to access the all the downloads in the manager. 56 */ 57 public static final String PERMISSION_ACCESS_ALL = 58 "android.permission.ACCESS_ALL_DOWNLOADS"; 59 60 /** 61 * The permission to directly access the download manager's cache 62 * directory 63 */ 64 public static final String PERMISSION_CACHE = "android.permission.ACCESS_CACHE_FILESYSTEM"; 65 66 /** 67 * The permission to send broadcasts on download completion 68 */ 69 public static final String PERMISSION_SEND_INTENTS = 70 "android.permission.SEND_DOWNLOAD_COMPLETED_INTENTS"; 71 72 /** 73 * The permission to download files to the cache partition that won't be automatically 74 * purged when space is needed. 75 */ 76 public static final String PERMISSION_CACHE_NON_PURGEABLE = 77 "android.permission.DOWNLOAD_CACHE_NON_PURGEABLE"; 78 79 /** 80 * The permission to download files without any system notification being shown. 81 */ 82 public static final String PERMISSION_NO_NOTIFICATION = 83 "android.permission.DOWNLOAD_WITHOUT_NOTIFICATION"; 84 85 /** 86 * The content:// URI to access downloads owned by the caller's UID. 87 */ 88 public static final Uri CONTENT_URI = 89 Uri.parse("content://downloads/my_downloads"); 90 91 /** 92 * The content URI for accessing all downloads across all UIDs (requires the 93 * ACCESS_ALL_DOWNLOADS permission). 94 */ 95 public static final Uri ALL_DOWNLOADS_CONTENT_URI = 96 Uri.parse("content://downloads/all_downloads"); 97 98 /** URI segment to access a publicly accessible downloaded file */ 99 public static final String PUBLICLY_ACCESSIBLE_DOWNLOADS_URI_SEGMENT = "public_downloads"; 100 101 /** 102 * The content URI for accessing publicly accessible downloads (i.e., it requires no 103 * permissions to access this downloaded file) 104 */ 105 public static final Uri PUBLICLY_ACCESSIBLE_DOWNLOADS_URI = 106 Uri.parse("content://downloads/" + PUBLICLY_ACCESSIBLE_DOWNLOADS_URI_SEGMENT); 107 108 /** 109 * Broadcast Action: this is sent by the download manager to the app 110 * that had initiated a download when that download completes. The 111 * download's content: uri is specified in the intent's data. 112 */ 113 public static final String ACTION_DOWNLOAD_COMPLETED = 114 "android.intent.action.DOWNLOAD_COMPLETED"; 115 116 /** 117 * Broadcast Action: this is sent by the download manager to the app 118 * that had initiated a download when the user selects the notification 119 * associated with that download. The download's content: uri is specified 120 * in the intent's data if the click is associated with a single download, 121 * or Downloads.CONTENT_URI if the notification is associated with 122 * multiple downloads. 123 * Note: this is not currently sent for downloads that have completed 124 * successfully. 125 */ 126 public static final String ACTION_NOTIFICATION_CLICKED = 127 "android.intent.action.DOWNLOAD_NOTIFICATION_CLICKED"; 128 129 /** 130 * The name of the column containing the URI of the data being downloaded. 131 * <P>Type: TEXT</P> 132 * <P>Owner can Init/Read</P> 133 */ 134 public static final String COLUMN_URI = "uri"; 135 136 /** 137 * The name of the column containing application-specific data. 138 * <P>Type: TEXT</P> 139 * <P>Owner can Init/Read/Write</P> 140 */ 141 public static final String COLUMN_APP_DATA = "entity"; 142 143 /** 144 * The name of the column containing the flags that indicates whether 145 * the initiating application is capable of verifying the integrity of 146 * the downloaded file. When this flag is set, the download manager 147 * performs downloads and reports success even in some situations where 148 * it can't guarantee that the download has completed (e.g. when doing 149 * a byte-range request without an ETag, or when it can't determine 150 * whether a download fully completed). 151 * <P>Type: BOOLEAN</P> 152 * <P>Owner can Init</P> 153 */ 154 public static final String COLUMN_NO_INTEGRITY = "no_integrity"; 155 156 /** 157 * The name of the column containing the filename that the initiating 158 * application recommends. When possible, the download manager will attempt 159 * to use this filename, or a variation, as the actual name for the file. 160 * <P>Type: TEXT</P> 161 * <P>Owner can Init</P> 162 */ 163 public static final String COLUMN_FILE_NAME_HINT = "hint"; 164 165 /** 166 * The name of the column containing the filename where the downloaded data 167 * was actually stored. 168 * <P>Type: TEXT</P> 169 * <P>Owner can Read</P> 170 */ 171 public static final String _DATA = "_data"; 172 173 /** 174 * The name of the column containing the MIME type of the downloaded data. 175 * <P>Type: TEXT</P> 176 * <P>Owner can Init/Read</P> 177 */ 178 public static final String COLUMN_MIME_TYPE = "mimetype"; 179 180 /** 181 * The name of the column containing the flag that controls the destination 182 * of the download. See the DESTINATION_* constants for a list of legal values. 183 * <P>Type: INTEGER</P> 184 * <P>Owner can Init</P> 185 */ 186 public static final String COLUMN_DESTINATION = "destination"; 187 188 /** 189 * The name of the column containing the flags that controls whether the 190 * download is displayed by the UI. See the VISIBILITY_* constants for 191 * a list of legal values. 192 * <P>Type: INTEGER</P> 193 * <P>Owner can Init/Read/Write</P> 194 */ 195 public static final String COLUMN_VISIBILITY = "visibility"; 196 197 /** 198 * The name of the column containing the current control state of the download. 199 * Applications can write to this to control (pause/resume) the download. 200 * the CONTROL_* constants for a list of legal values. 201 * <P>Type: INTEGER</P> 202 * <P>Owner can Read</P> 203 */ 204 public static final String COLUMN_CONTROL = "control"; 205 206 /** 207 * The name of the column containing the current status of the download. 208 * Applications can read this to follow the progress of each download. See 209 * the STATUS_* constants for a list of legal values. 210 * <P>Type: INTEGER</P> 211 * <P>Owner can Read</P> 212 */ 213 public static final String COLUMN_STATUS = "status"; 214 215 /** 216 * The name of the column containing the date at which some interesting 217 * status changed in the download. Stored as a System.currentTimeMillis() 218 * value. 219 * <P>Type: BIGINT</P> 220 * <P>Owner can Read</P> 221 */ 222 public static final String COLUMN_LAST_MODIFICATION = "lastmod"; 223 224 /** 225 * The name of the column containing the package name of the application 226 * that initiating the download. The download manager will send 227 * notifications to a component in this package when the download completes. 228 * <P>Type: TEXT</P> 229 * <P>Owner can Init/Read</P> 230 */ 231 public static final String COLUMN_NOTIFICATION_PACKAGE = "notificationpackage"; 232 233 /** 234 * The name of the column containing the component name of the class that 235 * will receive notifications associated with the download. The 236 * package/class combination is passed to 237 * Intent.setClassName(String,String). 238 * <P>Type: TEXT</P> 239 * <P>Owner can Init/Read</P> 240 */ 241 public static final String COLUMN_NOTIFICATION_CLASS = "notificationclass"; 242 243 /** 244 * If extras are specified when requesting a download they will be provided in the intent that 245 * is sent to the specified class and package when a download has finished. 246 * <P>Type: TEXT</P> 247 * <P>Owner can Init</P> 248 */ 249 public static final String COLUMN_NOTIFICATION_EXTRAS = "notificationextras"; 250 251 /** 252 * The name of the column contain the values of the cookie to be used for 253 * the download. This is used directly as the value for the Cookie: HTTP 254 * header that gets sent with the request. 255 * <P>Type: TEXT</P> 256 * <P>Owner can Init</P> 257 */ 258 public static final String COLUMN_COOKIE_DATA = "cookiedata"; 259 260 /** 261 * The name of the column containing the user agent that the initiating 262 * application wants the download manager to use for this download. 263 * <P>Type: TEXT</P> 264 * <P>Owner can Init</P> 265 */ 266 public static final String COLUMN_USER_AGENT = "useragent"; 267 268 /** 269 * The name of the column containing the referer (sic) that the initiating 270 * application wants the download manager to use for this download. 271 * <P>Type: TEXT</P> 272 * <P>Owner can Init</P> 273 */ 274 public static final String COLUMN_REFERER = "referer"; 275 276 /** 277 * The name of the column containing the total size of the file being 278 * downloaded. 279 * <P>Type: INTEGER</P> 280 * <P>Owner can Read</P> 281 */ 282 public static final String COLUMN_TOTAL_BYTES = "total_bytes"; 283 284 /** 285 * The name of the column containing the size of the part of the file that 286 * has been downloaded so far. 287 * <P>Type: INTEGER</P> 288 * <P>Owner can Read</P> 289 */ 290 public static final String COLUMN_CURRENT_BYTES = "current_bytes"; 291 292 /** 293 * The name of the column where the initiating application can provide the 294 * UID of another application that is allowed to access this download. If 295 * multiple applications share the same UID, all those applications will be 296 * allowed to access this download. This column can be updated after the 297 * download is initiated. This requires the permission 298 * android.permission.ACCESS_DOWNLOAD_MANAGER_ADVANCED. 299 * <P>Type: INTEGER</P> 300 * <P>Owner can Init</P> 301 */ 302 public static final String COLUMN_OTHER_UID = "otheruid"; 303 304 /** 305 * The name of the column where the initiating application can provided the 306 * title of this download. The title will be displayed ito the user in the 307 * list of downloads. 308 * <P>Type: TEXT</P> 309 * <P>Owner can Init/Read/Write</P> 310 */ 311 public static final String COLUMN_TITLE = "title"; 312 313 /** 314 * The name of the column where the initiating application can provide the 315 * description of this download. The description will be displayed to the 316 * user in the list of downloads. 317 * <P>Type: TEXT</P> 318 * <P>Owner can Init/Read/Write</P> 319 */ 320 public static final String COLUMN_DESCRIPTION = "description"; 321 322 /** 323 * The name of the column indicating whether the download was requesting through the public 324 * API. This controls some differences in behavior. 325 * <P>Type: BOOLEAN</P> 326 * <P>Owner can Init/Read</P> 327 */ 328 public static final String COLUMN_IS_PUBLIC_API = "is_public_api"; 329 330 /** 331 * The name of the column indicating whether roaming connections can be used. This is only 332 * used for public API downloads. 333 * <P>Type: BOOLEAN</P> 334 * <P>Owner can Init/Read</P> 335 */ 336 public static final String COLUMN_ALLOW_ROAMING = "allow_roaming"; 337 338 /** 339 * The name of the column holding a bitmask of allowed network types. This is only used for 340 * public API downloads. 341 * <P>Type: INTEGER</P> 342 * <P>Owner can Init/Read</P> 343 */ 344 public static final String COLUMN_ALLOWED_NETWORK_TYPES = "allowed_network_types"; 345 346 /** 347 * Whether or not this download should be displayed in the system's Downloads UI. Defaults 348 * to true. 349 * <P>Type: INTEGER</P> 350 * <P>Owner can Init/Read</P> 351 */ 352 public static final String COLUMN_IS_VISIBLE_IN_DOWNLOADS_UI = "is_visible_in_downloads_ui"; 353 354 /** 355 * If true, the user has confirmed that this download can proceed over the mobile network 356 * even though it exceeds the recommended maximum size. 357 * <P>Type: BOOLEAN</P> 358 */ 359 public static final String COLUMN_BYPASS_RECOMMENDED_SIZE_LIMIT = 360 "bypass_recommended_size_limit"; 361 362 /** 363 * Set to true if this download is deleted. It is completely removed from the database 364 * when MediaProvider database also deletes the metadata asociated with this downloaded file. 365 * <P>Type: BOOLEAN</P> 366 * <P>Owner can Read</P> 367 */ 368 public static final String COLUMN_DELETED = "deleted"; 369 370 /** 371 * The URI to the corresponding entry in MediaProvider for this downloaded entry. It is 372 * used to delete the entries from MediaProvider database when it is deleted from the 373 * downloaded list. 374 * <P>Type: TEXT</P> 375 * <P>Owner can Read</P> 376 */ 377 public static final String COLUMN_MEDIAPROVIDER_URI = "mediaprovider_uri"; 378 379 /** 380 * The column that is used to remember whether the media scanner was invoked. 381 * It can take the values: null or 0(not scanned), 1(scanned), 2 (not scannable). 382 * <P>Type: TEXT</P> 383 */ 384 public static final String COLUMN_MEDIA_SCANNED = "scanned"; 385 386 /** 387 * The column with errorMsg for a failed downloaded. 388 * Used only for debugging purposes. 389 * <P>Type: TEXT</P> 390 */ 391 public static final String COLUMN_ERROR_MSG = "errorMsg"; 392 393 /** 394 * This column stores the source of the last update to this row. 395 * This column is only for internal use. 396 * Valid values are indicated by LAST_UPDATESRC_* constants. 397 * <P>Type: INT</P> 398 */ 399 public static final String COLUMN_LAST_UPDATESRC = "lastUpdateSrc"; 400 401 /** 402 * default value for {@link #COLUMN_LAST_UPDATESRC}. 403 * This value is used when this column's value is not relevant. 404 */ 405 public static final int LAST_UPDATESRC_NOT_RELEVANT = 0; 406 407 /** 408 * One of the values taken by {@link #COLUMN_LAST_UPDATESRC}. 409 * This value is used when the update is NOT to be relayed to the DownloadService 410 * (and thus spare DownloadService from scanning the database when this change occurs) 411 */ 412 public static final int LAST_UPDATESRC_DONT_NOTIFY_DOWNLOADSVC = 1; 413 414 /* 415 * Lists the destinations that an application can specify for a download. 416 */ 417 418 /** 419 * This download will be saved to the external storage. This is the 420 * default behavior, and should be used for any file that the user 421 * can freely access, copy, delete. Even with that destination, 422 * unencrypted DRM files are saved in secure internal storage. 423 * Downloads to the external destination only write files for which 424 * there is a registered handler. The resulting files are accessible 425 * by filename to all applications. 426 */ 427 public static final int DESTINATION_EXTERNAL = 0; 428 429 /** 430 * This download will be saved to the download manager's private 431 * partition. This is the behavior used by applications that want to 432 * download private files that are used and deleted soon after they 433 * get downloaded. All file types are allowed, and only the initiating 434 * application can access the file (indirectly through a content 435 * provider). This requires the 436 * android.permission.ACCESS_DOWNLOAD_MANAGER_ADVANCED permission. 437 */ 438 public static final int DESTINATION_CACHE_PARTITION = 1; 439 440 /** 441 * This download will be saved to the download manager's private 442 * partition and will be purged as necessary to make space. This is 443 * for private files (similar to CACHE_PARTITION) that aren't deleted 444 * immediately after they are used, and are kept around by the download 445 * manager as long as space is available. 446 */ 447 public static final int DESTINATION_CACHE_PARTITION_PURGEABLE = 2; 448 449 /** 450 * This download will be saved to the download manager's private 451 * partition, as with DESTINATION_CACHE_PARTITION, but the download 452 * will not proceed if the user is on a roaming data connection. 453 */ 454 public static final int DESTINATION_CACHE_PARTITION_NOROAMING = 3; 455 456 /** 457 * This download will be saved to the location given by the file URI in 458 * {@link #COLUMN_FILE_NAME_HINT}. 459 */ 460 public static final int DESTINATION_FILE_URI = 4; 461 462 /** 463 * This download will be saved to the system cache ("/cache") 464 * partition. This option is only used by system apps and so it requires 465 * android.permission.ACCESS_CACHE_FILESYSTEM permission. 466 */ 467 public static final int DESTINATION_SYSTEMCACHE_PARTITION = 5; 468 469 /** 470 * This download was completed by the caller (i.e., NOT downloadmanager) 471 * and caller wants to have this download displayed in Downloads App. 472 */ 473 public static final int DESTINATION_NON_DOWNLOADMANAGER_DOWNLOAD = 6; 474 475 /** 476 * This download is allowed to run. 477 */ 478 public static final int CONTROL_RUN = 0; 479 480 /** 481 * This download must pause at the first opportunity. 482 */ 483 public static final int CONTROL_PAUSED = 1; 484 485 /* 486 * Lists the states that the download manager can set on a download 487 * to notify applications of the download progress. 488 * The codes follow the HTTP families:<br> 489 * 1xx: informational<br> 490 * 2xx: success<br> 491 * 3xx: redirects (not used by the download manager)<br> 492 * 4xx: client errors<br> 493 * 5xx: server errors 494 */ 495 496 /** 497 * Returns whether the status is informational (i.e. 1xx). 498 */ isStatusInformational(int status)499 public static boolean isStatusInformational(int status) { 500 return (status >= 100 && status < 200); 501 } 502 503 /** 504 * Returns whether the status is a success (i.e. 2xx). 505 */ isStatusSuccess(int status)506 public static boolean isStatusSuccess(int status) { 507 return (status >= 200 && status < 300); 508 } 509 510 /** 511 * Returns whether the status is an error (i.e. 4xx or 5xx). 512 */ isStatusError(int status)513 public static boolean isStatusError(int status) { 514 return (status >= 400 && status < 600); 515 } 516 517 /** 518 * Returns whether the status is a client error (i.e. 4xx). 519 */ isStatusClientError(int status)520 public static boolean isStatusClientError(int status) { 521 return (status >= 400 && status < 500); 522 } 523 524 /** 525 * Returns whether the status is a server error (i.e. 5xx). 526 */ isStatusServerError(int status)527 public static boolean isStatusServerError(int status) { 528 return (status >= 500 && status < 600); 529 } 530 531 /** 532 * this method determines if a notification should be displayed for a 533 * given {@link #COLUMN_VISIBILITY} value 534 * @param visibility the value of {@link #COLUMN_VISIBILITY}. 535 * @return true if the notification should be displayed. false otherwise. 536 */ isNotificationToBeDisplayed(int visibility)537 public static boolean isNotificationToBeDisplayed(int visibility) { 538 return visibility == DownloadManager.Request.VISIBILITY_VISIBLE_NOTIFY_COMPLETED || 539 visibility == DownloadManager.Request.VISIBILITY_VISIBLE_NOTIFY_ONLY_COMPLETION; 540 } 541 542 /** 543 * Returns whether the download has completed (either with success or 544 * error). 545 */ isStatusCompleted(int status)546 public static boolean isStatusCompleted(int status) { 547 return (status >= 200 && status < 300) || (status >= 400 && status < 600); 548 } 549 550 /** 551 * This download hasn't stated yet 552 */ 553 public static final int STATUS_PENDING = 190; 554 555 /** 556 * This download has started 557 */ 558 public static final int STATUS_RUNNING = 192; 559 560 /** 561 * This download has been paused by the owning app. 562 */ 563 public static final int STATUS_PAUSED_BY_APP = 193; 564 565 /** 566 * This download encountered some network error and is waiting before retrying the request. 567 */ 568 public static final int STATUS_WAITING_TO_RETRY = 194; 569 570 /** 571 * This download is waiting for network connectivity to proceed. 572 */ 573 public static final int STATUS_WAITING_FOR_NETWORK = 195; 574 575 /** 576 * This download exceeded a size limit for mobile networks and is waiting for a Wi-Fi 577 * connection to proceed. 578 */ 579 public static final int STATUS_QUEUED_FOR_WIFI = 196; 580 581 /** 582 * This download couldn't be completed due to insufficient storage 583 * space. Typically, this is because the SD card is full. 584 */ 585 public static final int STATUS_INSUFFICIENT_SPACE_ERROR = 198; 586 587 /** 588 * This download couldn't be completed because no external storage 589 * device was found. Typically, this is because the SD card is not 590 * mounted. 591 */ 592 public static final int STATUS_DEVICE_NOT_FOUND_ERROR = 199; 593 594 /** 595 * This download has successfully completed. 596 * Warning: there might be other status values that indicate success 597 * in the future. 598 * Use isSucccess() to capture the entire category. 599 */ 600 public static final int STATUS_SUCCESS = 200; 601 602 /** 603 * This request couldn't be parsed. This is also used when processing 604 * requests with unknown/unsupported URI schemes. 605 */ 606 public static final int STATUS_BAD_REQUEST = 400; 607 608 /** 609 * This download can't be performed because the content type cannot be 610 * handled. 611 */ 612 public static final int STATUS_NOT_ACCEPTABLE = 406; 613 614 /** 615 * This download cannot be performed because the length cannot be 616 * determined accurately. This is the code for the HTTP error "Length 617 * Required", which is typically used when making requests that require 618 * a content length but don't have one, and it is also used in the 619 * client when a response is received whose length cannot be determined 620 * accurately (therefore making it impossible to know when a download 621 * completes). 622 */ 623 public static final int STATUS_LENGTH_REQUIRED = 411; 624 625 /** 626 * This download was interrupted and cannot be resumed. 627 * This is the code for the HTTP error "Precondition Failed", and it is 628 * also used in situations where the client doesn't have an ETag at all. 629 */ 630 public static final int STATUS_PRECONDITION_FAILED = 412; 631 632 /** 633 * The lowest-valued error status that is not an actual HTTP status code. 634 */ 635 public static final int MIN_ARTIFICIAL_ERROR_STATUS = 488; 636 637 /** 638 * The requested destination file already exists. 639 */ 640 public static final int STATUS_FILE_ALREADY_EXISTS_ERROR = 488; 641 642 /** 643 * Some possibly transient error occurred, but we can't resume the download. 644 */ 645 public static final int STATUS_CANNOT_RESUME = 489; 646 647 /** 648 * This download was canceled 649 */ 650 public static final int STATUS_CANCELED = 490; 651 652 /** 653 * This download has completed with an error. 654 * Warning: there will be other status values that indicate errors in 655 * the future. Use isStatusError() to capture the entire category. 656 */ 657 public static final int STATUS_UNKNOWN_ERROR = 491; 658 659 /** 660 * This download couldn't be completed because of a storage issue. 661 * Typically, that's because the filesystem is missing or full. 662 * Use the more specific {@link #STATUS_INSUFFICIENT_SPACE_ERROR} 663 * and {@link #STATUS_DEVICE_NOT_FOUND_ERROR} when appropriate. 664 */ 665 public static final int STATUS_FILE_ERROR = 492; 666 667 /** 668 * This download couldn't be completed because of an HTTP 669 * redirect response that the download manager couldn't 670 * handle. 671 */ 672 public static final int STATUS_UNHANDLED_REDIRECT = 493; 673 674 /** 675 * This download couldn't be completed because of an 676 * unspecified unhandled HTTP code. 677 */ 678 public static final int STATUS_UNHANDLED_HTTP_CODE = 494; 679 680 /** 681 * This download couldn't be completed because of an 682 * error receiving or processing data at the HTTP level. 683 */ 684 public static final int STATUS_HTTP_DATA_ERROR = 495; 685 686 /** 687 * This download couldn't be completed because of an 688 * HttpException while setting up the request. 689 */ 690 public static final int STATUS_HTTP_EXCEPTION = 496; 691 692 /** 693 * This download couldn't be completed because there were 694 * too many redirects. 695 */ 696 public static final int STATUS_TOO_MANY_REDIRECTS = 497; 697 698 /** 699 * This download has failed because requesting application has been 700 * blocked by {@link NetworkPolicyManager}. 701 * 702 * @hide 703 */ 704 public static final int STATUS_BLOCKED = 498; 705 706 /** 707 * This download is visible but only shows in the notifications 708 * while it's in progress. 709 */ 710 public static final int VISIBILITY_VISIBLE = DownloadManager.Request.VISIBILITY_VISIBLE; 711 712 /** 713 * This download is visible and shows in the notifications while 714 * in progress and after completion. 715 */ 716 public static final int VISIBILITY_VISIBLE_NOTIFY_COMPLETED = 717 DownloadManager.Request.VISIBILITY_VISIBLE_NOTIFY_COMPLETED; 718 719 /** 720 * This download doesn't show in the UI or in the notifications. 721 */ 722 public static final int VISIBILITY_HIDDEN = DownloadManager.Request.VISIBILITY_HIDDEN; 723 724 /** 725 * Constants related to HTTP request headers associated with each download. 726 */ 727 public static class RequestHeaders { 728 public static final String HEADERS_DB_TABLE = "request_headers"; 729 public static final String COLUMN_DOWNLOAD_ID = "download_id"; 730 public static final String COLUMN_HEADER = "header"; 731 public static final String COLUMN_VALUE = "value"; 732 733 /** 734 * Path segment to add to a download URI to retrieve request headers 735 */ 736 public static final String URI_SEGMENT = "headers"; 737 738 /** 739 * Prefix for ContentValues keys that contain HTTP header lines, to be passed to 740 * DownloadProvider.insert(). 741 */ 742 public static final String INSERT_KEY_PREFIX = "http_header_"; 743 } 744 } 745 } 746