154b6cfa9a9e5b861a9930af873580d6dc20f773The Android Open Source Project/*
254b6cfa9a9e5b861a9930af873580d6dc20f773The Android Open Source Project * Copyright (C) 2008 The Android Open Source Project
354b6cfa9a9e5b861a9930af873580d6dc20f773The Android Open Source Project *
454b6cfa9a9e5b861a9930af873580d6dc20f773The Android Open Source Project * Licensed under the Apache License, Version 2.0 (the "License");
554b6cfa9a9e5b861a9930af873580d6dc20f773The Android Open Source Project * you may not use this file except in compliance with the License.
654b6cfa9a9e5b861a9930af873580d6dc20f773The Android Open Source Project * You may obtain a copy of the License at
754b6cfa9a9e5b861a9930af873580d6dc20f773The Android Open Source Project *
854b6cfa9a9e5b861a9930af873580d6dc20f773The Android Open Source Project *      http://www.apache.org/licenses/LICENSE-2.0
954b6cfa9a9e5b861a9930af873580d6dc20f773The Android Open Source Project *
1054b6cfa9a9e5b861a9930af873580d6dc20f773The Android Open Source Project * Unless required by applicable law or agreed to in writing, software
1154b6cfa9a9e5b861a9930af873580d6dc20f773The Android Open Source Project * distributed under the License is distributed on an "AS IS" BASIS,
1254b6cfa9a9e5b861a9930af873580d6dc20f773The Android Open Source Project * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1354b6cfa9a9e5b861a9930af873580d6dc20f773The Android Open Source Project * See the License for the specific language governing permissions and
1454b6cfa9a9e5b861a9930af873580d6dc20f773The Android Open Source Project * limitations under the License.
1554b6cfa9a9e5b861a9930af873580d6dc20f773The Android Open Source Project */
1654b6cfa9a9e5b861a9930af873580d6dc20f773The Android Open Source Project
1754b6cfa9a9e5b861a9930af873580d6dc20f773The Android Open Source Projectpackage android.provider;
1854b6cfa9a9e5b861a9930af873580d6dc20f773The Android Open Source Project
194c6e5dfa1c38f32843d209258388b97d4e32314fVasu Noriimport android.app.DownloadManager;
20948eef82546c15086d0b78ce18ee874aa5c634f7Jeff Sharkeyimport android.content.Context;
211a303953589fdddf21d88b8fa660136f5b060d0dJeff Sharkeyimport android.net.NetworkPolicyManager;
2254b6cfa9a9e5b861a9930af873580d6dc20f773The Android Open Source Projectimport android.net.Uri;
2354b6cfa9a9e5b861a9930af873580d6dc20f773The Android Open Source Project
2454b6cfa9a9e5b861a9930af873580d6dc20f773The Android Open Source Project/**
25e99f41f193aaf484d3cf650f6567c8f5e949986fJean-Baptiste Queru * The Download Manager
2654b6cfa9a9e5b861a9930af873580d6dc20f773The Android Open Source Project *
27e99f41f193aaf484d3cf650f6567c8f5e949986fJean-Baptiste Queru * @pending
2854b6cfa9a9e5b861a9930af873580d6dc20f773The Android Open Source Project */
29843e89757ab2f829ebacd48bd29ef408a5dc301cJean-Baptiste Querupublic final class Downloads {
3054b6cfa9a9e5b861a9930af873580d6dc20f773The Android Open Source Project    private Downloads() {}
31f013e1afd1e68af5e3b868c26a653bbfb39538f8The Android Open Source Project
32f013e1afd1e68af5e3b868c26a653bbfb39538f8The Android Open Source Project    /**
3332d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru     * Implementation details
34e99f41f193aaf484d3cf650f6567c8f5e949986fJean-Baptiste Queru     *
35e99f41f193aaf484d3cf650f6567c8f5e949986fJean-Baptiste Queru     * Exposes constants used to interact with the download manager's
36e99f41f193aaf484d3cf650f6567c8f5e949986fJean-Baptiste Queru     * content provider.
37e99f41f193aaf484d3cf650f6567c8f5e949986fJean-Baptiste Queru     * The constants URI ... STATUS are the names of columns in the downloads table.
38e99f41f193aaf484d3cf650f6567c8f5e949986fJean-Baptiste Queru     *
39e99f41f193aaf484d3cf650f6567c8f5e949986fJean-Baptiste Queru     * @hide
4032d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru     */
4132d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru    public static final class Impl implements BaseColumns {
4232d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru        private Impl() {}
4332d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru
440a17db1cc5942ea000ca87bb72853de57a15ec64Jeff Sharkey        public static final String AUTHORITY = "downloads";
450a17db1cc5942ea000ca87bb72853de57a15ec64Jeff Sharkey
4632d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru        /**
4732d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         * The permission to access the download manager
4832d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         */
4932d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru        public static final String PERMISSION_ACCESS = "android.permission.ACCESS_DOWNLOAD_MANAGER";
5032d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru
5132d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru        /**
5232d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         * The permission to access the download manager's advanced functions
5332d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         */
5432d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru        public static final String PERMISSION_ACCESS_ADVANCED =
5532d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru                "android.permission.ACCESS_DOWNLOAD_MANAGER_ADVANCED";
5632d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru
5732d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru        /**
581de2eac9d0a9ef03ecf9f964893ca889487f5403Kenny Root         * The permission to access the all the downloads in the manager.
591de2eac9d0a9ef03ecf9f964893ca889487f5403Kenny Root         */
601de2eac9d0a9ef03ecf9f964893ca889487f5403Kenny Root        public static final String PERMISSION_ACCESS_ALL =
611de2eac9d0a9ef03ecf9f964893ca889487f5403Kenny Root                "android.permission.ACCESS_ALL_DOWNLOADS";
621de2eac9d0a9ef03ecf9f964893ca889487f5403Kenny Root
631de2eac9d0a9ef03ecf9f964893ca889487f5403Kenny Root        /**
641de2eac9d0a9ef03ecf9f964893ca889487f5403Kenny Root         * The permission to directly access the download manager's cache
651de2eac9d0a9ef03ecf9f964893ca889487f5403Kenny Root         * directory
6632d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         */
6732d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru        public static final String PERMISSION_CACHE = "android.permission.ACCESS_CACHE_FILESYSTEM";
6832d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru
6932d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru        /**
7032d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         * The permission to send broadcasts on download completion
7132d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         */
7232d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru        public static final String PERMISSION_SEND_INTENTS =
7332d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru                "android.permission.SEND_DOWNLOAD_COMPLETED_INTENTS";
7432d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru
7532d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru        /**
768e15afe799bbe8d332640c1f2b57b5e0458a9625Steve Howard         * The permission to download files to the cache partition that won't be automatically
77a13a02cd0ec6c0584fc2423feb974d77d0945964Steve Howard         * purged when space is needed.
78a13a02cd0ec6c0584fc2423feb974d77d0945964Steve Howard         */
79a13a02cd0ec6c0584fc2423feb974d77d0945964Steve Howard        public static final String PERMISSION_CACHE_NON_PURGEABLE =
80a13a02cd0ec6c0584fc2423feb974d77d0945964Steve Howard                "android.permission.DOWNLOAD_CACHE_NON_PURGEABLE";
81a13a02cd0ec6c0584fc2423feb974d77d0945964Steve Howard
82a13a02cd0ec6c0584fc2423feb974d77d0945964Steve Howard        /**
838e15afe799bbe8d332640c1f2b57b5e0458a9625Steve Howard         * The permission to download files without any system notification being shown.
848e15afe799bbe8d332640c1f2b57b5e0458a9625Steve Howard         */
858e15afe799bbe8d332640c1f2b57b5e0458a9625Steve Howard        public static final String PERMISSION_NO_NOTIFICATION =
868e15afe799bbe8d332640c1f2b57b5e0458a9625Steve Howard                "android.permission.DOWNLOAD_WITHOUT_NOTIFICATION";
878e15afe799bbe8d332640c1f2b57b5e0458a9625Steve Howard
888e15afe799bbe8d332640c1f2b57b5e0458a9625Steve Howard        /**
89eca77fcdc64dcbd2915e7f5e1e26dbe4a7105314Steve Howard         * The content:// URI to access downloads owned by the caller's UID.
9032d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         */
9132d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru        public static final Uri CONTENT_URI =
92eca77fcdc64dcbd2915e7f5e1e26dbe4a7105314Steve Howard                Uri.parse("content://downloads/my_downloads");
93eca77fcdc64dcbd2915e7f5e1e26dbe4a7105314Steve Howard
94eca77fcdc64dcbd2915e7f5e1e26dbe4a7105314Steve Howard        /**
95eca77fcdc64dcbd2915e7f5e1e26dbe4a7105314Steve Howard         * The content URI for accessing all downloads across all UIDs (requires the
96eca77fcdc64dcbd2915e7f5e1e26dbe4a7105314Steve Howard         * ACCESS_ALL_DOWNLOADS permission).
97eca77fcdc64dcbd2915e7f5e1e26dbe4a7105314Steve Howard         */
98eca77fcdc64dcbd2915e7f5e1e26dbe4a7105314Steve Howard        public static final Uri ALL_DOWNLOADS_CONTENT_URI =
99eca77fcdc64dcbd2915e7f5e1e26dbe4a7105314Steve Howard                Uri.parse("content://downloads/all_downloads");
10032d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru
1015be894e636522addc40dad3b631f0249e6cc25cfVasu Nori        /** URI segment to access a publicly accessible downloaded file */
1025be894e636522addc40dad3b631f0249e6cc25cfVasu Nori        public static final String PUBLICLY_ACCESSIBLE_DOWNLOADS_URI_SEGMENT = "public_downloads";
1035be894e636522addc40dad3b631f0249e6cc25cfVasu Nori
1045be894e636522addc40dad3b631f0249e6cc25cfVasu Nori        /**
1055be894e636522addc40dad3b631f0249e6cc25cfVasu Nori         * The content URI for accessing publicly accessible downloads (i.e., it requires no
1065be894e636522addc40dad3b631f0249e6cc25cfVasu Nori         * permissions to access this downloaded file)
1075be894e636522addc40dad3b631f0249e6cc25cfVasu Nori         */
1085be894e636522addc40dad3b631f0249e6cc25cfVasu Nori        public static final Uri PUBLICLY_ACCESSIBLE_DOWNLOADS_URI =
1095be894e636522addc40dad3b631f0249e6cc25cfVasu Nori                Uri.parse("content://downloads/" + PUBLICLY_ACCESSIBLE_DOWNLOADS_URI_SEGMENT);
1105be894e636522addc40dad3b631f0249e6cc25cfVasu Nori
11132d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru        /**
11232d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         * Broadcast Action: this is sent by the download manager to the app
11332d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         * that had initiated a download when that download completes. The
11432d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         * download's content: uri is specified in the intent's data.
11532d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         */
11632d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru        public static final String ACTION_DOWNLOAD_COMPLETED =
1178d5d065cdf4cbd141eb1d57cb9fc7216a807d5d1Jeff Sharkey                DownloadManager.ACTION_DOWNLOAD_COMPLETED;
11832d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru
11932d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru        /**
12032d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         * Broadcast Action: this is sent by the download manager to the app
12132d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         * that had initiated a download when the user selects the notification
12232d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         * associated with that download. The download's content: uri is specified
12332d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         * in the intent's data if the click is associated with a single download,
12432d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         * or Downloads.CONTENT_URI if the notification is associated with
12532d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         * multiple downloads.
12632d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         * Note: this is not currently sent for downloads that have completed
12732d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         * successfully.
12832d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         */
12932d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru        public static final String ACTION_NOTIFICATION_CLICKED =
1308d5d065cdf4cbd141eb1d57cb9fc7216a807d5d1Jeff Sharkey                DownloadManager.ACTION_NOTIFICATION_CLICKED;
13132d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru
13232d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru        /**
13332d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         * The name of the column containing the URI of the data being downloaded.
13432d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         * <P>Type: TEXT</P>
13532d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         * <P>Owner can Init/Read</P>
13632d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         */
13732d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru        public static final String COLUMN_URI = "uri";
13832d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru
13932d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru        /**
14032d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         * The name of the column containing application-specific data.
14132d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         * <P>Type: TEXT</P>
14232d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         * <P>Owner can Init/Read/Write</P>
14332d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         */
14432d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru        public static final String COLUMN_APP_DATA = "entity";
14532d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru
14632d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru        /**
14732d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         * The name of the column containing the flags that indicates whether
14832d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         * the initiating application is capable of verifying the integrity of
14932d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         * the downloaded file. When this flag is set, the download manager
15032d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         * performs downloads and reports success even in some situations where
15132d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         * it can't guarantee that the download has completed (e.g. when doing
15232d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         * a byte-range request without an ETag, or when it can't determine
15332d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         * whether a download fully completed).
15432d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         * <P>Type: BOOLEAN</P>
15532d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         * <P>Owner can Init</P>
15632d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         */
15732d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru        public static final String COLUMN_NO_INTEGRITY = "no_integrity";
15832d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru
15932d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru        /**
16032d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         * The name of the column containing the filename that the initiating
16132d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         * application recommends. When possible, the download manager will attempt
16232d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         * to use this filename, or a variation, as the actual name for the file.
16332d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         * <P>Type: TEXT</P>
16432d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         * <P>Owner can Init</P>
16532d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         */
16632d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru        public static final String COLUMN_FILE_NAME_HINT = "hint";
16732d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru
16832d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru        /**
16932d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         * The name of the column containing the filename where the downloaded data
17032d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         * was actually stored.
17132d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         * <P>Type: TEXT</P>
17232d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         * <P>Owner can Read</P>
17332d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         */
17432d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru        public static final String _DATA = "_data";
17532d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru
17632d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru        /**
17732d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         * The name of the column containing the MIME type of the downloaded data.
17832d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         * <P>Type: TEXT</P>
17932d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         * <P>Owner can Init/Read</P>
18032d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         */
18132d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru        public static final String COLUMN_MIME_TYPE = "mimetype";
18232d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru
18332d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru        /**
18432d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         * The name of the column containing the flag that controls the destination
18532d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         * of the download. See the DESTINATION_* constants for a list of legal values.
18632d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         * <P>Type: INTEGER</P>
18732d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         * <P>Owner can Init</P>
18832d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         */
18932d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru        public static final String COLUMN_DESTINATION = "destination";
19032d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru
19132d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru        /**
19232d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         * The name of the column containing the flags that controls whether the
19332d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         * download is displayed by the UI. See the VISIBILITY_* constants for
19432d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         * a list of legal values.
19532d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         * <P>Type: INTEGER</P>
19632d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         * <P>Owner can Init/Read/Write</P>
19732d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         */
19832d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru        public static final String COLUMN_VISIBILITY = "visibility";
19932d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru
20032d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru        /**
20132d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         * The name of the column containing the current control state  of the download.
20232d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         * Applications can write to this to control (pause/resume) the download.
20332d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         * the CONTROL_* constants for a list of legal values.
20432d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         * <P>Type: INTEGER</P>
20532d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         * <P>Owner can Read</P>
20632d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         */
20732d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru        public static final String COLUMN_CONTROL = "control";
20832d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru
20932d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru        /**
21032d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         * The name of the column containing the current status of the download.
21132d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         * Applications can read this to follow the progress of each download. See
21232d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         * the STATUS_* constants for a list of legal values.
21332d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         * <P>Type: INTEGER</P>
21432d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         * <P>Owner can Read</P>
21532d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         */
21632d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru        public static final String COLUMN_STATUS = "status";
21732d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru
21832d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru        /**
21932d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         * The name of the column containing the date at which some interesting
22032d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         * status changed in the download. Stored as a System.currentTimeMillis()
22132d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         * value.
22232d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         * <P>Type: BIGINT</P>
22332d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         * <P>Owner can Read</P>
22432d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         */
22532d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru        public static final String COLUMN_LAST_MODIFICATION = "lastmod";
22632d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru
22732d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru        /**
22832d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         * The name of the column containing the package name of the application
22932d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         * that initiating the download. The download manager will send
23032d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         * notifications to a component in this package when the download completes.
23132d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         * <P>Type: TEXT</P>
23232d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         * <P>Owner can Init/Read</P>
23332d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         */
23432d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru        public static final String COLUMN_NOTIFICATION_PACKAGE = "notificationpackage";
23532d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru
23632d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru        /**
23732d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         * The name of the column containing the component name of the class that
23832d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         * will receive notifications associated with the download. The
23932d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         * package/class combination is passed to
24032d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         * Intent.setClassName(String,String).
24132d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         * <P>Type: TEXT</P>
24232d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         * <P>Owner can Init/Read</P>
24332d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         */
24432d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru        public static final String COLUMN_NOTIFICATION_CLASS = "notificationclass";
24532d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru
24632d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru        /**
24732d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         * If extras are specified when requesting a download they will be provided in the intent that
24832d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         * is sent to the specified class and package when a download has finished.
24932d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         * <P>Type: TEXT</P>
25032d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         * <P>Owner can Init</P>
25132d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         */
25232d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru        public static final String COLUMN_NOTIFICATION_EXTRAS = "notificationextras";
25332d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru
25432d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru        /**
25532d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         * The name of the column contain the values of the cookie to be used for
25632d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         * the download. This is used directly as the value for the Cookie: HTTP
25732d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         * header that gets sent with the request.
25832d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         * <P>Type: TEXT</P>
25932d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         * <P>Owner can Init</P>
26032d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         */
26132d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru        public static final String COLUMN_COOKIE_DATA = "cookiedata";
26232d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru
26332d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru        /**
26432d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         * The name of the column containing the user agent that the initiating
26532d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         * application wants the download manager to use for this download.
26632d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         * <P>Type: TEXT</P>
26732d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         * <P>Owner can Init</P>
26832d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         */
26932d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru        public static final String COLUMN_USER_AGENT = "useragent";
27032d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru
27132d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru        /**
27232d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         * The name of the column containing the referer (sic) that the initiating
27332d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         * application wants the download manager to use for this download.
27432d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         * <P>Type: TEXT</P>
27532d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         * <P>Owner can Init</P>
27632d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         */
27732d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru        public static final String COLUMN_REFERER = "referer";
27832d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru
27932d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru        /**
28032d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         * The name of the column containing the total size of the file being
28132d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         * downloaded.
28232d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         * <P>Type: INTEGER</P>
28332d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         * <P>Owner can Read</P>
28432d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         */
28532d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru        public static final String COLUMN_TOTAL_BYTES = "total_bytes";
28632d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru
28732d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru        /**
28832d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         * The name of the column containing the size of the part of the file that
28932d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         * has been downloaded so far.
29032d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         * <P>Type: INTEGER</P>
29132d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         * <P>Owner can Read</P>
29232d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         */
29332d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru        public static final String COLUMN_CURRENT_BYTES = "current_bytes";
29432d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru
29532d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru        /**
29632d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         * The name of the column where the initiating application can provide the
29732d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         * UID of another application that is allowed to access this download. If
29832d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         * multiple applications share the same UID, all those applications will be
29932d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         * allowed to access this download. This column can be updated after the
30032d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         * download is initiated. This requires the permission
30132d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         * android.permission.ACCESS_DOWNLOAD_MANAGER_ADVANCED.
30232d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         * <P>Type: INTEGER</P>
30332d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         * <P>Owner can Init</P>
30432d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         */
30532d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru        public static final String COLUMN_OTHER_UID = "otheruid";
30632d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru
30732d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru        /**
30832d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         * The name of the column where the initiating application can provided the
30932d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         * title of this download. The title will be displayed ito the user in the
31032d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         * list of downloads.
31132d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         * <P>Type: TEXT</P>
31232d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         * <P>Owner can Init/Read/Write</P>
31332d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         */
31432d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru        public static final String COLUMN_TITLE = "title";
31532d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru
31632d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru        /**
31732d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         * The name of the column where the initiating application can provide the
31832d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         * description of this download. The description will be displayed to the
31932d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         * user in the list of downloads.
32032d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         * <P>Type: TEXT</P>
32132d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         * <P>Owner can Init/Read/Write</P>
32232d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         */
32332d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru        public static final String COLUMN_DESCRIPTION = "description";
32432d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru
325b8e07a51c1849d6894c5773a3daacedd01294218Steve Howard        /**
326b8e07a51c1849d6894c5773a3daacedd01294218Steve Howard         * The name of the column indicating whether the download was requesting through the public
327b8e07a51c1849d6894c5773a3daacedd01294218Steve Howard         * API.  This controls some differences in behavior.
328b8e07a51c1849d6894c5773a3daacedd01294218Steve Howard         * <P>Type: BOOLEAN</P>
329b8e07a51c1849d6894c5773a3daacedd01294218Steve Howard         * <P>Owner can Init/Read</P>
330b8e07a51c1849d6894c5773a3daacedd01294218Steve Howard         */
331b8e07a51c1849d6894c5773a3daacedd01294218Steve Howard        public static final String COLUMN_IS_PUBLIC_API = "is_public_api";
332b8e07a51c1849d6894c5773a3daacedd01294218Steve Howard
333b8e07a51c1849d6894c5773a3daacedd01294218Steve Howard        /**
33415ec7d6d7f23ec197a88619b5e03320cfebd2240Jeff Sharkey         * The name of the column holding a bitmask of allowed network types.  This is only used for
33515ec7d6d7f23ec197a88619b5e03320cfebd2240Jeff Sharkey         * public API downloads.
33615ec7d6d7f23ec197a88619b5e03320cfebd2240Jeff Sharkey         * <P>Type: INTEGER</P>
33715ec7d6d7f23ec197a88619b5e03320cfebd2240Jeff Sharkey         * <P>Owner can Init/Read</P>
33815ec7d6d7f23ec197a88619b5e03320cfebd2240Jeff Sharkey         */
33915ec7d6d7f23ec197a88619b5e03320cfebd2240Jeff Sharkey        public static final String COLUMN_ALLOWED_NETWORK_TYPES = "allowed_network_types";
34015ec7d6d7f23ec197a88619b5e03320cfebd2240Jeff Sharkey
34115ec7d6d7f23ec197a88619b5e03320cfebd2240Jeff Sharkey        /**
342b8e07a51c1849d6894c5773a3daacedd01294218Steve Howard         * The name of the column indicating whether roaming connections can be used.  This is only
343b8e07a51c1849d6894c5773a3daacedd01294218Steve Howard         * used for public API downloads.
344b8e07a51c1849d6894c5773a3daacedd01294218Steve Howard         * <P>Type: BOOLEAN</P>
345b8e07a51c1849d6894c5773a3daacedd01294218Steve Howard         * <P>Owner can Init/Read</P>
346b8e07a51c1849d6894c5773a3daacedd01294218Steve Howard         */
347b8e07a51c1849d6894c5773a3daacedd01294218Steve Howard        public static final String COLUMN_ALLOW_ROAMING = "allow_roaming";
348b8e07a51c1849d6894c5773a3daacedd01294218Steve Howard
349b8e07a51c1849d6894c5773a3daacedd01294218Steve Howard        /**
35015ec7d6d7f23ec197a88619b5e03320cfebd2240Jeff Sharkey         * The name of the column indicating whether metered connections can be used.  This is only
35115ec7d6d7f23ec197a88619b5e03320cfebd2240Jeff Sharkey         * used for public API downloads.
35215ec7d6d7f23ec197a88619b5e03320cfebd2240Jeff Sharkey         * <P>Type: BOOLEAN</P>
353b8e07a51c1849d6894c5773a3daacedd01294218Steve Howard         * <P>Owner can Init/Read</P>
354b8e07a51c1849d6894c5773a3daacedd01294218Steve Howard         */
35515ec7d6d7f23ec197a88619b5e03320cfebd2240Jeff Sharkey        public static final String COLUMN_ALLOW_METERED = "allow_metered";
356b8e07a51c1849d6894c5773a3daacedd01294218Steve Howard
35790fb15a7e52b1208b8d4f7518a61efb99580b5b0Steve Howard        /**
35890fb15a7e52b1208b8d4f7518a61efb99580b5b0Steve Howard         * Whether or not this download should be displayed in the system's Downloads UI.  Defaults
35990fb15a7e52b1208b8d4f7518a61efb99580b5b0Steve Howard         * to true.
36090fb15a7e52b1208b8d4f7518a61efb99580b5b0Steve Howard         * <P>Type: INTEGER</P>
36190fb15a7e52b1208b8d4f7518a61efb99580b5b0Steve Howard         * <P>Owner can Init/Read</P>
36290fb15a7e52b1208b8d4f7518a61efb99580b5b0Steve Howard         */
36390fb15a7e52b1208b8d4f7518a61efb99580b5b0Steve Howard        public static final String COLUMN_IS_VISIBLE_IN_DOWNLOADS_UI = "is_visible_in_downloads_ui";
36490fb15a7e52b1208b8d4f7518a61efb99580b5b0Steve Howard
365f176681ecc19f3bffa3d9cb00b3460cf5a128d28Steve Howard        /**
366f176681ecc19f3bffa3d9cb00b3460cf5a128d28Steve Howard         * If true, the user has confirmed that this download can proceed over the mobile network
367f176681ecc19f3bffa3d9cb00b3460cf5a128d28Steve Howard         * even though it exceeds the recommended maximum size.
368f176681ecc19f3bffa3d9cb00b3460cf5a128d28Steve Howard         * <P>Type: BOOLEAN</P>
369f176681ecc19f3bffa3d9cb00b3460cf5a128d28Steve Howard         */
370f176681ecc19f3bffa3d9cb00b3460cf5a128d28Steve Howard        public static final String COLUMN_BYPASS_RECOMMENDED_SIZE_LIMIT =
371f176681ecc19f3bffa3d9cb00b3460cf5a128d28Steve Howard            "bypass_recommended_size_limit";
372f176681ecc19f3bffa3d9cb00b3460cf5a128d28Steve Howard
373216fa22791889774b83977341632c4570dcec35dVasu Nori        /**
374216fa22791889774b83977341632c4570dcec35dVasu Nori         * Set to true if this download is deleted. It is completely removed from the database
375216fa22791889774b83977341632c4570dcec35dVasu Nori         * when MediaProvider database also deletes the metadata asociated with this downloaded file.
376216fa22791889774b83977341632c4570dcec35dVasu Nori         * <P>Type: BOOLEAN</P>
377216fa22791889774b83977341632c4570dcec35dVasu Nori         * <P>Owner can Read</P>
378216fa22791889774b83977341632c4570dcec35dVasu Nori         */
379216fa22791889774b83977341632c4570dcec35dVasu Nori        public static final String COLUMN_DELETED = "deleted";
380216fa22791889774b83977341632c4570dcec35dVasu Nori
381216fa22791889774b83977341632c4570dcec35dVasu Nori        /**
382216fa22791889774b83977341632c4570dcec35dVasu Nori         * The URI to the corresponding entry in MediaProvider for this downloaded entry. It is
383216fa22791889774b83977341632c4570dcec35dVasu Nori         * used to delete the entries from MediaProvider database when it is deleted from the
384216fa22791889774b83977341632c4570dcec35dVasu Nori         * downloaded list.
385216fa22791889774b83977341632c4570dcec35dVasu Nori         * <P>Type: TEXT</P>
386216fa22791889774b83977341632c4570dcec35dVasu Nori         * <P>Owner can Read</P>
387216fa22791889774b83977341632c4570dcec35dVasu Nori         */
388216fa22791889774b83977341632c4570dcec35dVasu Nori        public static final String COLUMN_MEDIAPROVIDER_URI = "mediaprovider_uri";
389216fa22791889774b83977341632c4570dcec35dVasu Nori
3905be894e636522addc40dad3b631f0249e6cc25cfVasu Nori        /**
3915be894e636522addc40dad3b631f0249e6cc25cfVasu Nori         * The column that is used to remember whether the media scanner was invoked.
3925be894e636522addc40dad3b631f0249e6cc25cfVasu Nori         * It can take the values: null or 0(not scanned), 1(scanned), 2 (not scannable).
3935be894e636522addc40dad3b631f0249e6cc25cfVasu Nori         * <P>Type: TEXT</P>
3945be894e636522addc40dad3b631f0249e6cc25cfVasu Nori         */
3955be894e636522addc40dad3b631f0249e6cc25cfVasu Nori        public static final String COLUMN_MEDIA_SCANNED = "scanned";
3965be894e636522addc40dad3b631f0249e6cc25cfVasu Nori
3974015de2a0803998ee5ffdf1d765378ed0e360ae1Vasu Nori        /**
3984015de2a0803998ee5ffdf1d765378ed0e360ae1Vasu Nori         * The column with errorMsg for a failed downloaded.
3994015de2a0803998ee5ffdf1d765378ed0e360ae1Vasu Nori         * Used only for debugging purposes.
4004015de2a0803998ee5ffdf1d765378ed0e360ae1Vasu Nori         * <P>Type: TEXT</P>
4014015de2a0803998ee5ffdf1d765378ed0e360ae1Vasu Nori         */
4024015de2a0803998ee5ffdf1d765378ed0e360ae1Vasu Nori        public static final String COLUMN_ERROR_MSG = "errorMsg";
4034015de2a0803998ee5ffdf1d765378ed0e360ae1Vasu Nori
4048da7a4e3451a41808972bfec0af0740e999d9c8aVasu Nori        /**
4058da7a4e3451a41808972bfec0af0740e999d9c8aVasu Nori         *  This column stores the source of the last update to this row.
4068da7a4e3451a41808972bfec0af0740e999d9c8aVasu Nori         *  This column is only for internal use.
4078da7a4e3451a41808972bfec0af0740e999d9c8aVasu Nori         *  Valid values are indicated by LAST_UPDATESRC_* constants.
4088da7a4e3451a41808972bfec0af0740e999d9c8aVasu Nori         * <P>Type: INT</P>
4098da7a4e3451a41808972bfec0af0740e999d9c8aVasu Nori         */
4108da7a4e3451a41808972bfec0af0740e999d9c8aVasu Nori        public static final String COLUMN_LAST_UPDATESRC = "lastUpdateSrc";
4118da7a4e3451a41808972bfec0af0740e999d9c8aVasu Nori
41254781207d31fd0fb33c6038b6999ba649fc488b2Jeff Sharkey        /** The column that is used to count retries */
41354781207d31fd0fb33c6038b6999ba649fc488b2Jeff Sharkey        public static final String COLUMN_FAILED_CONNECTIONS = "numfailed";
41454781207d31fd0fb33c6038b6999ba649fc488b2Jeff Sharkey
415b180a65d41adc731cbff1536c7ede15174bc08e1Jeff Sharkey        public static final String COLUMN_ALLOW_WRITE = "allow_write";
416b180a65d41adc731cbff1536c7ede15174bc08e1Jeff Sharkey
417f07c7b9fd0a640bff4bf7690373613da217fe69bJeff Sharkey        public static final int FLAG_REQUIRES_CHARGING = 1 << 0;
418f07c7b9fd0a640bff4bf7690373613da217fe69bJeff Sharkey        public static final int FLAG_REQUIRES_DEVICE_IDLE = 1 << 1;
419f07c7b9fd0a640bff4bf7690373613da217fe69bJeff Sharkey
420f07c7b9fd0a640bff4bf7690373613da217fe69bJeff Sharkey        public static final String COLUMN_FLAGS = "flags";
421f07c7b9fd0a640bff4bf7690373613da217fe69bJeff Sharkey
4228da7a4e3451a41808972bfec0af0740e999d9c8aVasu Nori        /**
4238da7a4e3451a41808972bfec0af0740e999d9c8aVasu Nori         * default value for {@link #COLUMN_LAST_UPDATESRC}.
4248da7a4e3451a41808972bfec0af0740e999d9c8aVasu Nori         * This value is used when this column's value is not relevant.
4258da7a4e3451a41808972bfec0af0740e999d9c8aVasu Nori         */
4268da7a4e3451a41808972bfec0af0740e999d9c8aVasu Nori        public static final int LAST_UPDATESRC_NOT_RELEVANT = 0;
4278da7a4e3451a41808972bfec0af0740e999d9c8aVasu Nori
4288da7a4e3451a41808972bfec0af0740e999d9c8aVasu Nori        /**
4298da7a4e3451a41808972bfec0af0740e999d9c8aVasu Nori         * One of the values taken by {@link #COLUMN_LAST_UPDATESRC}.
4308da7a4e3451a41808972bfec0af0740e999d9c8aVasu Nori         * This value is used when the update is NOT to be relayed to the DownloadService
4318da7a4e3451a41808972bfec0af0740e999d9c8aVasu Nori         * (and thus spare DownloadService from scanning the database when this change occurs)
4328da7a4e3451a41808972bfec0af0740e999d9c8aVasu Nori         */
4338da7a4e3451a41808972bfec0af0740e999d9c8aVasu Nori        public static final int LAST_UPDATESRC_DONT_NOTIFY_DOWNLOADSVC = 1;
4348da7a4e3451a41808972bfec0af0740e999d9c8aVasu Nori
43532d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru        /*
43632d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         * Lists the destinations that an application can specify for a download.
43732d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         */
43832d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru
43932d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru        /**
44032d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         * This download will be saved to the external storage. This is the
44132d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         * default behavior, and should be used for any file that the user
44232d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         * can freely access, copy, delete. Even with that destination,
44332d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         * unencrypted DRM files are saved in secure internal storage.
44432d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         * Downloads to the external destination only write files for which
44532d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         * there is a registered handler. The resulting files are accessible
44632d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         * by filename to all applications.
44732d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         */
44832d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru        public static final int DESTINATION_EXTERNAL = 0;
44932d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru
45032d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru        /**
45132d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         * This download will be saved to the download manager's private
45232d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         * partition. This is the behavior used by applications that want to
45332d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         * download private files that are used and deleted soon after they
45432d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         * get downloaded. All file types are allowed, and only the initiating
45532d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         * application can access the file (indirectly through a content
45632d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         * provider). This requires the
45732d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         * android.permission.ACCESS_DOWNLOAD_MANAGER_ADVANCED permission.
45832d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         */
45932d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru        public static final int DESTINATION_CACHE_PARTITION = 1;
46032d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru
46132d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru        /**
46232d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         * This download will be saved to the download manager's private
46332d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         * partition and will be purged as necessary to make space. This is
46432d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         * for private files (similar to CACHE_PARTITION) that aren't deleted
46532d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         * immediately after they are used, and are kept around by the download
46632d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         * manager as long as space is available.
46732d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         */
46832d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru        public static final int DESTINATION_CACHE_PARTITION_PURGEABLE = 2;
46932d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru
47032d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru        /**
47132d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         * This download will be saved to the download manager's private
47232d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         * partition, as with DESTINATION_CACHE_PARTITION, but the download
47332d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         * will not proceed if the user is on a roaming data connection.
47432d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         */
47532d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru        public static final int DESTINATION_CACHE_PARTITION_NOROAMING = 3;
47632d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru
47732d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru        /**
478adcb697826753391f02f6b3bd35b4edfb3032ad1Steve Howard         * This download will be saved to the location given by the file URI in
479adcb697826753391f02f6b3bd35b4edfb3032ad1Steve Howard         * {@link #COLUMN_FILE_NAME_HINT}.
480adcb697826753391f02f6b3bd35b4edfb3032ad1Steve Howard         */
481adcb697826753391f02f6b3bd35b4edfb3032ad1Steve Howard        public static final int DESTINATION_FILE_URI = 4;
482adcb697826753391f02f6b3bd35b4edfb3032ad1Steve Howard
483adcb697826753391f02f6b3bd35b4edfb3032ad1Steve Howard        /**
484f83e6e4b7a7fcbfcc8e3b6078f4655fa3e64bce3Vasu Nori         * This download will be saved to the system cache ("/cache")
485f83e6e4b7a7fcbfcc8e3b6078f4655fa3e64bce3Vasu Nori         * partition. This option is only used by system apps and so it requires
486f83e6e4b7a7fcbfcc8e3b6078f4655fa3e64bce3Vasu Nori         * android.permission.ACCESS_CACHE_FILESYSTEM permission.
487f83e6e4b7a7fcbfcc8e3b6078f4655fa3e64bce3Vasu Nori         */
4884233f032fd41e82d1ce09b48860f8ae3f73fa5e0Jeff Sharkey        @Deprecated
489f83e6e4b7a7fcbfcc8e3b6078f4655fa3e64bce3Vasu Nori        public static final int DESTINATION_SYSTEMCACHE_PARTITION = 5;
490f83e6e4b7a7fcbfcc8e3b6078f4655fa3e64bce3Vasu Nori
491f83e6e4b7a7fcbfcc8e3b6078f4655fa3e64bce3Vasu Nori        /**
492c0e5075739574e67c825e4841d5cccee55cbfd29Vasu Nori         * This download was completed by the caller (i.e., NOT downloadmanager)
493c0e5075739574e67c825e4841d5cccee55cbfd29Vasu Nori         * and caller wants to have this download displayed in Downloads App.
494c0e5075739574e67c825e4841d5cccee55cbfd29Vasu Nori         */
495c0e5075739574e67c825e4841d5cccee55cbfd29Vasu Nori        public static final int DESTINATION_NON_DOWNLOADMANAGER_DOWNLOAD = 6;
496c0e5075739574e67c825e4841d5cccee55cbfd29Vasu Nori
497c0e5075739574e67c825e4841d5cccee55cbfd29Vasu Nori        /**
49832d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         * This download is allowed to run.
49932d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         */
50032d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru        public static final int CONTROL_RUN = 0;
50132d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru
50232d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru        /**
50332d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         * This download must pause at the first opportunity.
50432d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         */
50532d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru        public static final int CONTROL_PAUSED = 1;
50632d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru
50732d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru        /*
50832d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         * Lists the states that the download manager can set on a download
50932d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         * to notify applications of the download progress.
51032d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         * The codes follow the HTTP families:<br>
51132d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         * 1xx: informational<br>
51232d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         * 2xx: success<br>
51332d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         * 3xx: redirects (not used by the download manager)<br>
51432d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         * 4xx: client errors<br>
51532d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         * 5xx: server errors
51632d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         */
51732d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru
51832d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru        /**
51932d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         * Returns whether the status is informational (i.e. 1xx).
52032d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         */
52132d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru        public static boolean isStatusInformational(int status) {
52232d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru            return (status >= 100 && status < 200);
52332d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru        }
52432d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru
52532d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru        /**
52632d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         * Returns whether the status is a success (i.e. 2xx).
52732d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         */
52832d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru        public static boolean isStatusSuccess(int status) {
52932d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru            return (status >= 200 && status < 300);
53032d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru        }
53132d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru
53232d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru        /**
53332d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         * Returns whether the status is an error (i.e. 4xx or 5xx).
53432d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         */
53532d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru        public static boolean isStatusError(int status) {
53632d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru            return (status >= 400 && status < 600);
53732d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru        }
53832d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru
53932d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru        /**
54032d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         * Returns whether the status is a client error (i.e. 4xx).
54132d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         */
54232d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru        public static boolean isStatusClientError(int status) {
54332d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru            return (status >= 400 && status < 500);
54432d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru        }
54532d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru
54632d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru        /**
54732d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         * Returns whether the status is a server error (i.e. 5xx).
54832d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         */
54932d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru        public static boolean isStatusServerError(int status) {
55032d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru            return (status >= 500 && status < 600);
55132d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru        }
55232d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru
55332d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru        /**
554f9e8523e62fa391e85d393c23a3345887565d426Vasu Nori         * this method determines if a notification should be displayed for a
555f9e8523e62fa391e85d393c23a3345887565d426Vasu Nori         * given {@link #COLUMN_VISIBILITY} value
556f9e8523e62fa391e85d393c23a3345887565d426Vasu Nori         * @param visibility the value of {@link #COLUMN_VISIBILITY}.
557f9e8523e62fa391e85d393c23a3345887565d426Vasu Nori         * @return true if the notification should be displayed. false otherwise.
558f9e8523e62fa391e85d393c23a3345887565d426Vasu Nori         */
559f9e8523e62fa391e85d393c23a3345887565d426Vasu Nori        public static boolean isNotificationToBeDisplayed(int visibility) {
560f9e8523e62fa391e85d393c23a3345887565d426Vasu Nori            return visibility == DownloadManager.Request.VISIBILITY_VISIBLE_NOTIFY_COMPLETED ||
561f9e8523e62fa391e85d393c23a3345887565d426Vasu Nori                    visibility == DownloadManager.Request.VISIBILITY_VISIBLE_NOTIFY_ONLY_COMPLETION;
562f9e8523e62fa391e85d393c23a3345887565d426Vasu Nori        }
563f9e8523e62fa391e85d393c23a3345887565d426Vasu Nori
564f9e8523e62fa391e85d393c23a3345887565d426Vasu Nori        /**
56532d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         * Returns whether the download has completed (either with success or
56632d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         * error).
56732d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         */
56832d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru        public static boolean isStatusCompleted(int status) {
56932d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru            return (status >= 200 && status < 300) || (status >= 400 && status < 600);
57032d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru        }
57132d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru
57232d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru        /**
57332d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         * This download hasn't stated yet
57432d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         */
57532d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru        public static final int STATUS_PENDING = 190;
57632d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru
57732d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru        /**
5783e8c1d3a467bab889de7f92379be1f43d9c2d81eSteve Howard         * This download has started
57932d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         */
5803e8c1d3a467bab889de7f92379be1f43d9c2d81eSteve Howard        public static final int STATUS_RUNNING = 192;
58132d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru
58232d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru        /**
5833e8c1d3a467bab889de7f92379be1f43d9c2d81eSteve Howard         * This download has been paused by the owning app.
58432d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         */
5853e8c1d3a467bab889de7f92379be1f43d9c2d81eSteve Howard        public static final int STATUS_PAUSED_BY_APP = 193;
5863e8c1d3a467bab889de7f92379be1f43d9c2d81eSteve Howard
5873e8c1d3a467bab889de7f92379be1f43d9c2d81eSteve Howard        /**
5883e8c1d3a467bab889de7f92379be1f43d9c2d81eSteve Howard         * This download encountered some network error and is waiting before retrying the request.
5893e8c1d3a467bab889de7f92379be1f43d9c2d81eSteve Howard         */
5903e8c1d3a467bab889de7f92379be1f43d9c2d81eSteve Howard        public static final int STATUS_WAITING_TO_RETRY = 194;
5913e8c1d3a467bab889de7f92379be1f43d9c2d81eSteve Howard
5923e8c1d3a467bab889de7f92379be1f43d9c2d81eSteve Howard        /**
5933e8c1d3a467bab889de7f92379be1f43d9c2d81eSteve Howard         * This download is waiting for network connectivity to proceed.
5943e8c1d3a467bab889de7f92379be1f43d9c2d81eSteve Howard         */
5953e8c1d3a467bab889de7f92379be1f43d9c2d81eSteve Howard        public static final int STATUS_WAITING_FOR_NETWORK = 195;
59632d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru
59732d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru        /**
5983e8c1d3a467bab889de7f92379be1f43d9c2d81eSteve Howard         * This download exceeded a size limit for mobile networks and is waiting for a Wi-Fi
5993e8c1d3a467bab889de7f92379be1f43d9c2d81eSteve Howard         * connection to proceed.
60032d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         */
6013e8c1d3a467bab889de7f92379be1f43d9c2d81eSteve Howard        public static final int STATUS_QUEUED_FOR_WIFI = 196;
60232d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru
60332d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru        /**
6040ba3055b1e657b0948001d48b19345fb0cd626ffVasu Nori         * This download couldn't be completed due to insufficient storage
6050ba3055b1e657b0948001d48b19345fb0cd626ffVasu Nori         * space.  Typically, this is because the SD card is full.
6060ba3055b1e657b0948001d48b19345fb0cd626ffVasu Nori         */
6070ba3055b1e657b0948001d48b19345fb0cd626ffVasu Nori        public static final int STATUS_INSUFFICIENT_SPACE_ERROR = 198;
6080ba3055b1e657b0948001d48b19345fb0cd626ffVasu Nori
6090ba3055b1e657b0948001d48b19345fb0cd626ffVasu Nori        /**
6100ba3055b1e657b0948001d48b19345fb0cd626ffVasu Nori         * This download couldn't be completed because no external storage
6110ba3055b1e657b0948001d48b19345fb0cd626ffVasu Nori         * device was found.  Typically, this is because the SD card is not
6120ba3055b1e657b0948001d48b19345fb0cd626ffVasu Nori         * mounted.
6130ba3055b1e657b0948001d48b19345fb0cd626ffVasu Nori         */
6140ba3055b1e657b0948001d48b19345fb0cd626ffVasu Nori        public static final int STATUS_DEVICE_NOT_FOUND_ERROR = 199;
6150ba3055b1e657b0948001d48b19345fb0cd626ffVasu Nori
6160ba3055b1e657b0948001d48b19345fb0cd626ffVasu Nori        /**
61732d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         * This download has successfully completed.
61832d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         * Warning: there might be other status values that indicate success
61932d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         * in the future.
620996dab2e48399df3a6e0e8cd92418d19fd6a426dSteve McKay         * Use isStatusSuccess() to capture the entire category.
62132d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         */
62232d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru        public static final int STATUS_SUCCESS = 200;
62332d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru
62432d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru        /**
62532d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         * This request couldn't be parsed. This is also used when processing
62632d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         * requests with unknown/unsupported URI schemes.
62732d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         */
62832d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru        public static final int STATUS_BAD_REQUEST = 400;
62932d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru
63032d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru        /**
63132d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         * This download can't be performed because the content type cannot be
63232d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         * handled.
63332d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         */
63432d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru        public static final int STATUS_NOT_ACCEPTABLE = 406;
63532d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru
63632d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru        /**
63732d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         * This download cannot be performed because the length cannot be
63832d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         * determined accurately. This is the code for the HTTP error "Length
63932d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         * Required", which is typically used when making requests that require
64032d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         * a content length but don't have one, and it is also used in the
64132d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         * client when a response is received whose length cannot be determined
64232d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         * accurately (therefore making it impossible to know when a download
64332d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         * completes).
64432d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         */
64532d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru        public static final int STATUS_LENGTH_REQUIRED = 411;
64632d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru
64732d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru        /**
64832d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         * This download was interrupted and cannot be resumed.
64932d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         * This is the code for the HTTP error "Precondition Failed", and it is
65032d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         * also used in situations where the client doesn't have an ETag at all.
65132d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         */
65232d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru        public static final int STATUS_PRECONDITION_FAILED = 412;
65332d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru
65432d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru        /**
65533bbd12a05005ac92a0ecf82695893148227bb22Steve Howard         * The lowest-valued error status that is not an actual HTTP status code.
65633bbd12a05005ac92a0ecf82695893148227bb22Steve Howard         */
657a9e87c9cc375b8be43a05ad641545db26eee0d46Steve Howard        public static final int MIN_ARTIFICIAL_ERROR_STATUS = 488;
658a9e87c9cc375b8be43a05ad641545db26eee0d46Steve Howard
659a9e87c9cc375b8be43a05ad641545db26eee0d46Steve Howard        /**
660a9e87c9cc375b8be43a05ad641545db26eee0d46Steve Howard         * The requested destination file already exists.
661a9e87c9cc375b8be43a05ad641545db26eee0d46Steve Howard         */
662a9e87c9cc375b8be43a05ad641545db26eee0d46Steve Howard        public static final int STATUS_FILE_ALREADY_EXISTS_ERROR = 488;
66333bbd12a05005ac92a0ecf82695893148227bb22Steve Howard
66433bbd12a05005ac92a0ecf82695893148227bb22Steve Howard        /**
66533bbd12a05005ac92a0ecf82695893148227bb22Steve Howard         * Some possibly transient error occurred, but we can't resume the download.
66633bbd12a05005ac92a0ecf82695893148227bb22Steve Howard         */
66733bbd12a05005ac92a0ecf82695893148227bb22Steve Howard        public static final int STATUS_CANNOT_RESUME = 489;
66833bbd12a05005ac92a0ecf82695893148227bb22Steve Howard
66933bbd12a05005ac92a0ecf82695893148227bb22Steve Howard        /**
67032d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         * This download was canceled
67132d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         */
67232d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru        public static final int STATUS_CANCELED = 490;
67332d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru
67432d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru        /**
67532d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         * This download has completed with an error.
67632d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         * Warning: there will be other status values that indicate errors in
67732d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         * the future. Use isStatusError() to capture the entire category.
67832d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         */
67932d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru        public static final int STATUS_UNKNOWN_ERROR = 491;
68032d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru
68132d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru        /**
68232d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         * This download couldn't be completed because of a storage issue.
68332d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         * Typically, that's because the filesystem is missing or full.
684f238ad7746d04d641f55bbed3461ba87a2ba4aebAttila Bodis         * Use the more specific {@link #STATUS_INSUFFICIENT_SPACE_ERROR}
685f238ad7746d04d641f55bbed3461ba87a2ba4aebAttila Bodis         * and {@link #STATUS_DEVICE_NOT_FOUND_ERROR} when appropriate.
68632d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         */
68732d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru        public static final int STATUS_FILE_ERROR = 492;
68832d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru
68932d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru        /**
69032d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         * This download couldn't be completed because of an HTTP
69132d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         * redirect response that the download manager couldn't
69232d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         * handle.
69332d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         */
69432d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru        public static final int STATUS_UNHANDLED_REDIRECT = 493;
69532d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru
69632d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru        /**
69732d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         * This download couldn't be completed because of an
69832d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         * unspecified unhandled HTTP code.
69932d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         */
70032d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru        public static final int STATUS_UNHANDLED_HTTP_CODE = 494;
70132d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru
70232d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru        /**
70332d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         * This download couldn't be completed because of an
70432d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         * error receiving or processing data at the HTTP level.
70532d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         */
70632d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru        public static final int STATUS_HTTP_DATA_ERROR = 495;
70732d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru
70832d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru        /**
70932d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         * This download couldn't be completed because of an
71032d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         * HttpException while setting up the request.
71132d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         */
71232d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru        public static final int STATUS_HTTP_EXCEPTION = 496;
71332d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru
71432d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru        /**
71532d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         * This download couldn't be completed because there were
71632d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         * too many redirects.
71732d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         */
71832d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru        public static final int STATUS_TOO_MANY_REDIRECTS = 497;
71932d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru
72032d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru        /**
721fdfef57f498e3021a34342538aef9f1c7ccbae78Jeff Sharkey         * This download has failed because requesting application has been
722fdfef57f498e3021a34342538aef9f1c7ccbae78Jeff Sharkey         * blocked by {@link NetworkPolicyManager}.
723fdfef57f498e3021a34342538aef9f1c7ccbae78Jeff Sharkey         *
724fdfef57f498e3021a34342538aef9f1c7ccbae78Jeff Sharkey         * @hide
72515ec7d6d7f23ec197a88619b5e03320cfebd2240Jeff Sharkey         * @deprecated since behavior now uses
72615ec7d6d7f23ec197a88619b5e03320cfebd2240Jeff Sharkey         *             {@link #STATUS_WAITING_FOR_NETWORK}
727fdfef57f498e3021a34342538aef9f1c7ccbae78Jeff Sharkey         */
72815ec7d6d7f23ec197a88619b5e03320cfebd2240Jeff Sharkey        @Deprecated
729fdfef57f498e3021a34342538aef9f1c7ccbae78Jeff Sharkey        public static final int STATUS_BLOCKED = 498;
730fdfef57f498e3021a34342538aef9f1c7ccbae78Jeff Sharkey
73158d9fb6220ea2070b0af5db3031e9cdaead6e36dJeff Sharkey        /** {@hide} */
73258d9fb6220ea2070b0af5db3031e9cdaead6e36dJeff Sharkey        public static String statusToString(int status) {
73358d9fb6220ea2070b0af5db3031e9cdaead6e36dJeff Sharkey            switch (status) {
73458d9fb6220ea2070b0af5db3031e9cdaead6e36dJeff Sharkey                case STATUS_PENDING: return "PENDING";
73558d9fb6220ea2070b0af5db3031e9cdaead6e36dJeff Sharkey                case STATUS_RUNNING: return "RUNNING";
73658d9fb6220ea2070b0af5db3031e9cdaead6e36dJeff Sharkey                case STATUS_PAUSED_BY_APP: return "PAUSED_BY_APP";
73758d9fb6220ea2070b0af5db3031e9cdaead6e36dJeff Sharkey                case STATUS_WAITING_TO_RETRY: return "WAITING_TO_RETRY";
73858d9fb6220ea2070b0af5db3031e9cdaead6e36dJeff Sharkey                case STATUS_WAITING_FOR_NETWORK: return "WAITING_FOR_NETWORK";
73958d9fb6220ea2070b0af5db3031e9cdaead6e36dJeff Sharkey                case STATUS_QUEUED_FOR_WIFI: return "QUEUED_FOR_WIFI";
74058d9fb6220ea2070b0af5db3031e9cdaead6e36dJeff Sharkey                case STATUS_INSUFFICIENT_SPACE_ERROR: return "INSUFFICIENT_SPACE_ERROR";
74158d9fb6220ea2070b0af5db3031e9cdaead6e36dJeff Sharkey                case STATUS_DEVICE_NOT_FOUND_ERROR: return "DEVICE_NOT_FOUND_ERROR";
74258d9fb6220ea2070b0af5db3031e9cdaead6e36dJeff Sharkey                case STATUS_SUCCESS: return "SUCCESS";
74358d9fb6220ea2070b0af5db3031e9cdaead6e36dJeff Sharkey                case STATUS_BAD_REQUEST: return "BAD_REQUEST";
74458d9fb6220ea2070b0af5db3031e9cdaead6e36dJeff Sharkey                case STATUS_NOT_ACCEPTABLE: return "NOT_ACCEPTABLE";
74558d9fb6220ea2070b0af5db3031e9cdaead6e36dJeff Sharkey                case STATUS_LENGTH_REQUIRED: return "LENGTH_REQUIRED";
74658d9fb6220ea2070b0af5db3031e9cdaead6e36dJeff Sharkey                case STATUS_PRECONDITION_FAILED: return "PRECONDITION_FAILED";
74758d9fb6220ea2070b0af5db3031e9cdaead6e36dJeff Sharkey                case STATUS_FILE_ALREADY_EXISTS_ERROR: return "FILE_ALREADY_EXISTS_ERROR";
74858d9fb6220ea2070b0af5db3031e9cdaead6e36dJeff Sharkey                case STATUS_CANNOT_RESUME: return "CANNOT_RESUME";
74958d9fb6220ea2070b0af5db3031e9cdaead6e36dJeff Sharkey                case STATUS_CANCELED: return "CANCELED";
75058d9fb6220ea2070b0af5db3031e9cdaead6e36dJeff Sharkey                case STATUS_UNKNOWN_ERROR: return "UNKNOWN_ERROR";
75158d9fb6220ea2070b0af5db3031e9cdaead6e36dJeff Sharkey                case STATUS_FILE_ERROR: return "FILE_ERROR";
75258d9fb6220ea2070b0af5db3031e9cdaead6e36dJeff Sharkey                case STATUS_UNHANDLED_REDIRECT: return "UNHANDLED_REDIRECT";
75358d9fb6220ea2070b0af5db3031e9cdaead6e36dJeff Sharkey                case STATUS_UNHANDLED_HTTP_CODE: return "UNHANDLED_HTTP_CODE";
75458d9fb6220ea2070b0af5db3031e9cdaead6e36dJeff Sharkey                case STATUS_HTTP_DATA_ERROR: return "HTTP_DATA_ERROR";
75558d9fb6220ea2070b0af5db3031e9cdaead6e36dJeff Sharkey                case STATUS_HTTP_EXCEPTION: return "HTTP_EXCEPTION";
75658d9fb6220ea2070b0af5db3031e9cdaead6e36dJeff Sharkey                case STATUS_TOO_MANY_REDIRECTS: return "TOO_MANY_REDIRECTS";
75758d9fb6220ea2070b0af5db3031e9cdaead6e36dJeff Sharkey                case STATUS_BLOCKED: return "BLOCKED";
75858d9fb6220ea2070b0af5db3031e9cdaead6e36dJeff Sharkey                default: return Integer.toString(status);
75958d9fb6220ea2070b0af5db3031e9cdaead6e36dJeff Sharkey            }
76058d9fb6220ea2070b0af5db3031e9cdaead6e36dJeff Sharkey        }
76158d9fb6220ea2070b0af5db3031e9cdaead6e36dJeff Sharkey
762fdfef57f498e3021a34342538aef9f1c7ccbae78Jeff Sharkey        /**
76332d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         * This download is visible but only shows in the notifications
76432d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         * while it's in progress.
76532d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         */
7664c6e5dfa1c38f32843d209258388b97d4e32314fVasu Nori        public static final int VISIBILITY_VISIBLE = DownloadManager.Request.VISIBILITY_VISIBLE;
76732d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru
76832d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru        /**
76932d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         * This download is visible and shows in the notifications while
77032d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         * in progress and after completion.
77132d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         */
7724c6e5dfa1c38f32843d209258388b97d4e32314fVasu Nori        public static final int VISIBILITY_VISIBLE_NOTIFY_COMPLETED =
7734c6e5dfa1c38f32843d209258388b97d4e32314fVasu Nori                DownloadManager.Request.VISIBILITY_VISIBLE_NOTIFY_COMPLETED;
77432d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru
77532d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru        /**
77632d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         * This download doesn't show in the UI or in the notifications.
77732d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         */
7784c6e5dfa1c38f32843d209258388b97d4e32314fVasu Nori        public static final int VISIBILITY_HIDDEN = DownloadManager.Request.VISIBILITY_HIDDEN;
779ea9147df00ee6e098cd02d901424ae5a4fe0fafdSteve Howard
780ea9147df00ee6e098cd02d901424ae5a4fe0fafdSteve Howard        /**
781ea9147df00ee6e098cd02d901424ae5a4fe0fafdSteve Howard         * Constants related to HTTP request headers associated with each download.
782ea9147df00ee6e098cd02d901424ae5a4fe0fafdSteve Howard         */
783ea9147df00ee6e098cd02d901424ae5a4fe0fafdSteve Howard        public static class RequestHeaders {
784ea9147df00ee6e098cd02d901424ae5a4fe0fafdSteve Howard            public static final String HEADERS_DB_TABLE = "request_headers";
785ea9147df00ee6e098cd02d901424ae5a4fe0fafdSteve Howard            public static final String COLUMN_DOWNLOAD_ID = "download_id";
786ea9147df00ee6e098cd02d901424ae5a4fe0fafdSteve Howard            public static final String COLUMN_HEADER = "header";
787ea9147df00ee6e098cd02d901424ae5a4fe0fafdSteve Howard            public static final String COLUMN_VALUE = "value";
788ea9147df00ee6e098cd02d901424ae5a4fe0fafdSteve Howard
789ea9147df00ee6e098cd02d901424ae5a4fe0fafdSteve Howard            /**
790ea9147df00ee6e098cd02d901424ae5a4fe0fafdSteve Howard             * Path segment to add to a download URI to retrieve request headers
791ea9147df00ee6e098cd02d901424ae5a4fe0fafdSteve Howard             */
792ea9147df00ee6e098cd02d901424ae5a4fe0fafdSteve Howard            public static final String URI_SEGMENT = "headers";
793ea9147df00ee6e098cd02d901424ae5a4fe0fafdSteve Howard
794ea9147df00ee6e098cd02d901424ae5a4fe0fafdSteve Howard            /**
795ea9147df00ee6e098cd02d901424ae5a4fe0fafdSteve Howard             * Prefix for ContentValues keys that contain HTTP header lines, to be passed to
796ea9147df00ee6e098cd02d901424ae5a4fe0fafdSteve Howard             * DownloadProvider.insert().
797ea9147df00ee6e098cd02d901424ae5a4fe0fafdSteve Howard             */
798ea9147df00ee6e098cd02d901424ae5a4fe0fafdSteve Howard            public static final String INSERT_KEY_PREFIX = "http_header_";
799ea9147df00ee6e098cd02d901424ae5a4fe0fafdSteve Howard        }
80032d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru    }
801948eef82546c15086d0b78ce18ee874aa5c634f7Jeff Sharkey
802948eef82546c15086d0b78ce18ee874aa5c634f7Jeff Sharkey    /**
803948eef82546c15086d0b78ce18ee874aa5c634f7Jeff Sharkey     * Query where clause for general querying.
804948eef82546c15086d0b78ce18ee874aa5c634f7Jeff Sharkey     */
805948eef82546c15086d0b78ce18ee874aa5c634f7Jeff Sharkey    private static final String QUERY_WHERE_CLAUSE = Impl.COLUMN_NOTIFICATION_PACKAGE + "=? AND "
806948eef82546c15086d0b78ce18ee874aa5c634f7Jeff Sharkey            + Impl.COLUMN_NOTIFICATION_CLASS + "=?";
807948eef82546c15086d0b78ce18ee874aa5c634f7Jeff Sharkey
808948eef82546c15086d0b78ce18ee874aa5c634f7Jeff Sharkey    /**
809948eef82546c15086d0b78ce18ee874aa5c634f7Jeff Sharkey     * Delete all the downloads for a package/class pair.
810948eef82546c15086d0b78ce18ee874aa5c634f7Jeff Sharkey     */
811948eef82546c15086d0b78ce18ee874aa5c634f7Jeff Sharkey    public static final void removeAllDownloadsByPackage(
812948eef82546c15086d0b78ce18ee874aa5c634f7Jeff Sharkey            Context context, String notification_package, String notification_class) {
813948eef82546c15086d0b78ce18ee874aa5c634f7Jeff Sharkey        context.getContentResolver().delete(Impl.CONTENT_URI, QUERY_WHERE_CLAUSE,
814948eef82546c15086d0b78ce18ee874aa5c634f7Jeff Sharkey                new String[] { notification_package, notification_class });
815948eef82546c15086d0b78ce18ee874aa5c634f7Jeff Sharkey    }
81654b6cfa9a9e5b861a9930af873580d6dc20f773The Android Open Source Project}
817