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
4432d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru        /**
4532d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         * The permission to access the download manager
4632d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         */
4732d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru        public static final String PERMISSION_ACCESS = "android.permission.ACCESS_DOWNLOAD_MANAGER";
4832d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru
4932d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru        /**
5032d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         * The permission to access the download manager's advanced functions
5132d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         */
5232d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru        public static final String PERMISSION_ACCESS_ADVANCED =
5332d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru                "android.permission.ACCESS_DOWNLOAD_MANAGER_ADVANCED";
5432d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru
5532d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru        /**
561de2eac9d0a9ef03ecf9f964893ca889487f5403Kenny Root         * The permission to access the all the downloads in the manager.
571de2eac9d0a9ef03ecf9f964893ca889487f5403Kenny Root         */
581de2eac9d0a9ef03ecf9f964893ca889487f5403Kenny Root        public static final String PERMISSION_ACCESS_ALL =
591de2eac9d0a9ef03ecf9f964893ca889487f5403Kenny Root                "android.permission.ACCESS_ALL_DOWNLOADS";
601de2eac9d0a9ef03ecf9f964893ca889487f5403Kenny Root
611de2eac9d0a9ef03ecf9f964893ca889487f5403Kenny Root        /**
621de2eac9d0a9ef03ecf9f964893ca889487f5403Kenny Root         * The permission to directly access the download manager's cache
631de2eac9d0a9ef03ecf9f964893ca889487f5403Kenny Root         * directory
6432d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         */
6532d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru        public static final String PERMISSION_CACHE = "android.permission.ACCESS_CACHE_FILESYSTEM";
6632d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru
6732d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru        /**
6832d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         * The permission to send broadcasts on download completion
6932d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         */
7032d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru        public static final String PERMISSION_SEND_INTENTS =
7132d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru                "android.permission.SEND_DOWNLOAD_COMPLETED_INTENTS";
7232d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru
7332d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru        /**
748e15afe799bbe8d332640c1f2b57b5e0458a9625Steve Howard         * The permission to download files to the cache partition that won't be automatically
75a13a02cd0ec6c0584fc2423feb974d77d0945964Steve Howard         * purged when space is needed.
76a13a02cd0ec6c0584fc2423feb974d77d0945964Steve Howard         */
77a13a02cd0ec6c0584fc2423feb974d77d0945964Steve Howard        public static final String PERMISSION_CACHE_NON_PURGEABLE =
78a13a02cd0ec6c0584fc2423feb974d77d0945964Steve Howard                "android.permission.DOWNLOAD_CACHE_NON_PURGEABLE";
79a13a02cd0ec6c0584fc2423feb974d77d0945964Steve Howard
80a13a02cd0ec6c0584fc2423feb974d77d0945964Steve Howard        /**
818e15afe799bbe8d332640c1f2b57b5e0458a9625Steve Howard         * The permission to download files without any system notification being shown.
828e15afe799bbe8d332640c1f2b57b5e0458a9625Steve Howard         */
838e15afe799bbe8d332640c1f2b57b5e0458a9625Steve Howard        public static final String PERMISSION_NO_NOTIFICATION =
848e15afe799bbe8d332640c1f2b57b5e0458a9625Steve Howard                "android.permission.DOWNLOAD_WITHOUT_NOTIFICATION";
858e15afe799bbe8d332640c1f2b57b5e0458a9625Steve Howard
868e15afe799bbe8d332640c1f2b57b5e0458a9625Steve Howard        /**
87eca77fcdc64dcbd2915e7f5e1e26dbe4a7105314Steve Howard         * The content:// URI to access downloads owned by the caller's UID.
8832d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         */
8932d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru        public static final Uri CONTENT_URI =
90eca77fcdc64dcbd2915e7f5e1e26dbe4a7105314Steve Howard                Uri.parse("content://downloads/my_downloads");
91eca77fcdc64dcbd2915e7f5e1e26dbe4a7105314Steve Howard
92eca77fcdc64dcbd2915e7f5e1e26dbe4a7105314Steve Howard        /**
93eca77fcdc64dcbd2915e7f5e1e26dbe4a7105314Steve Howard         * The content URI for accessing all downloads across all UIDs (requires the
94eca77fcdc64dcbd2915e7f5e1e26dbe4a7105314Steve Howard         * ACCESS_ALL_DOWNLOADS permission).
95eca77fcdc64dcbd2915e7f5e1e26dbe4a7105314Steve Howard         */
96eca77fcdc64dcbd2915e7f5e1e26dbe4a7105314Steve Howard        public static final Uri ALL_DOWNLOADS_CONTENT_URI =
97eca77fcdc64dcbd2915e7f5e1e26dbe4a7105314Steve Howard                Uri.parse("content://downloads/all_downloads");
9832d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru
995be894e636522addc40dad3b631f0249e6cc25cfVasu Nori        /** URI segment to access a publicly accessible downloaded file */
1005be894e636522addc40dad3b631f0249e6cc25cfVasu Nori        public static final String PUBLICLY_ACCESSIBLE_DOWNLOADS_URI_SEGMENT = "public_downloads";
1015be894e636522addc40dad3b631f0249e6cc25cfVasu Nori
1025be894e636522addc40dad3b631f0249e6cc25cfVasu Nori        /**
1035be894e636522addc40dad3b631f0249e6cc25cfVasu Nori         * The content URI for accessing publicly accessible downloads (i.e., it requires no
1045be894e636522addc40dad3b631f0249e6cc25cfVasu Nori         * permissions to access this downloaded file)
1055be894e636522addc40dad3b631f0249e6cc25cfVasu Nori         */
1065be894e636522addc40dad3b631f0249e6cc25cfVasu Nori        public static final Uri PUBLICLY_ACCESSIBLE_DOWNLOADS_URI =
1075be894e636522addc40dad3b631f0249e6cc25cfVasu Nori                Uri.parse("content://downloads/" + PUBLICLY_ACCESSIBLE_DOWNLOADS_URI_SEGMENT);
1085be894e636522addc40dad3b631f0249e6cc25cfVasu Nori
10932d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru        /**
11032d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         * Broadcast Action: this is sent by the download manager to the app
11132d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         * that had initiated a download when that download completes. The
11232d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         * download's content: uri is specified in the intent's data.
11332d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         */
11432d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru        public static final String ACTION_DOWNLOAD_COMPLETED =
11532d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru                "android.intent.action.DOWNLOAD_COMPLETED";
11632d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru
11732d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru        /**
11832d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         * Broadcast Action: this is sent by the download manager to the app
11932d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         * that had initiated a download when the user selects the notification
12032d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         * associated with that download. The download's content: uri is specified
12132d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         * in the intent's data if the click is associated with a single download,
12232d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         * or Downloads.CONTENT_URI if the notification is associated with
12332d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         * multiple downloads.
12432d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         * Note: this is not currently sent for downloads that have completed
12532d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         * successfully.
12632d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         */
12732d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru        public static final String ACTION_NOTIFICATION_CLICKED =
12832d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru                "android.intent.action.DOWNLOAD_NOTIFICATION_CLICKED";
12932d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru
13032d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru        /**
13132d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         * The name of the column containing the URI of the data being downloaded.
13232d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         * <P>Type: TEXT</P>
13332d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         * <P>Owner can Init/Read</P>
13432d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         */
13532d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru        public static final String COLUMN_URI = "uri";
13632d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru
13732d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru        /**
13832d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         * The name of the column containing application-specific data.
13932d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         * <P>Type: TEXT</P>
14032d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         * <P>Owner can Init/Read/Write</P>
14132d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         */
14232d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru        public static final String COLUMN_APP_DATA = "entity";
14332d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru
14432d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru        /**
14532d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         * The name of the column containing the flags that indicates whether
14632d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         * the initiating application is capable of verifying the integrity of
14732d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         * the downloaded file. When this flag is set, the download manager
14832d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         * performs downloads and reports success even in some situations where
14932d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         * it can't guarantee that the download has completed (e.g. when doing
15032d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         * a byte-range request without an ETag, or when it can't determine
15132d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         * whether a download fully completed).
15232d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         * <P>Type: BOOLEAN</P>
15332d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         * <P>Owner can Init</P>
15432d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         */
15532d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru        public static final String COLUMN_NO_INTEGRITY = "no_integrity";
15632d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru
15732d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru        /**
15832d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         * The name of the column containing the filename that the initiating
15932d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         * application recommends. When possible, the download manager will attempt
16032d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         * to use this filename, or a variation, as the actual name for the file.
16132d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         * <P>Type: TEXT</P>
16232d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         * <P>Owner can Init</P>
16332d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         */
16432d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru        public static final String COLUMN_FILE_NAME_HINT = "hint";
16532d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru
16632d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru        /**
16732d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         * The name of the column containing the filename where the downloaded data
16832d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         * was actually stored.
16932d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         * <P>Type: TEXT</P>
17032d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         * <P>Owner can Read</P>
17132d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         */
17232d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru        public static final String _DATA = "_data";
17332d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru
17432d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru        /**
17532d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         * The name of the column containing the MIME type of the downloaded data.
17632d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         * <P>Type: TEXT</P>
17732d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         * <P>Owner can Init/Read</P>
17832d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         */
17932d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru        public static final String COLUMN_MIME_TYPE = "mimetype";
18032d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru
18132d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru        /**
18232d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         * The name of the column containing the flag that controls the destination
18332d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         * of the download. See the DESTINATION_* constants for a list of legal values.
18432d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         * <P>Type: INTEGER</P>
18532d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         * <P>Owner can Init</P>
18632d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         */
18732d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru        public static final String COLUMN_DESTINATION = "destination";
18832d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru
18932d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru        /**
19032d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         * The name of the column containing the flags that controls whether the
19132d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         * download is displayed by the UI. See the VISIBILITY_* constants for
19232d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         * a list of legal values.
19332d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         * <P>Type: INTEGER</P>
19432d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         * <P>Owner can Init/Read/Write</P>
19532d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         */
19632d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru        public static final String COLUMN_VISIBILITY = "visibility";
19732d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru
19832d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru        /**
19932d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         * The name of the column containing the current control state  of the download.
20032d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         * Applications can write to this to control (pause/resume) the download.
20132d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         * the CONTROL_* constants for a list of legal values.
20232d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         * <P>Type: INTEGER</P>
20332d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         * <P>Owner can Read</P>
20432d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         */
20532d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru        public static final String COLUMN_CONTROL = "control";
20632d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru
20732d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru        /**
20832d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         * The name of the column containing the current status of the download.
20932d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         * Applications can read this to follow the progress of each download. See
21032d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         * the STATUS_* constants for a list of legal values.
21132d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         * <P>Type: INTEGER</P>
21232d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         * <P>Owner can Read</P>
21332d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         */
21432d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru        public static final String COLUMN_STATUS = "status";
21532d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru
21632d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru        /**
21732d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         * The name of the column containing the date at which some interesting
21832d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         * status changed in the download. Stored as a System.currentTimeMillis()
21932d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         * value.
22032d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         * <P>Type: BIGINT</P>
22132d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         * <P>Owner can Read</P>
22232d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         */
22332d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru        public static final String COLUMN_LAST_MODIFICATION = "lastmod";
22432d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru
22532d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru        /**
22632d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         * The name of the column containing the package name of the application
22732d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         * that initiating the download. The download manager will send
22832d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         * notifications to a component in this package when the download completes.
22932d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         * <P>Type: TEXT</P>
23032d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         * <P>Owner can Init/Read</P>
23132d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         */
23232d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru        public static final String COLUMN_NOTIFICATION_PACKAGE = "notificationpackage";
23332d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru
23432d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru        /**
23532d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         * The name of the column containing the component name of the class that
23632d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         * will receive notifications associated with the download. The
23732d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         * package/class combination is passed to
23832d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         * Intent.setClassName(String,String).
23932d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         * <P>Type: TEXT</P>
24032d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         * <P>Owner can Init/Read</P>
24132d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         */
24232d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru        public static final String COLUMN_NOTIFICATION_CLASS = "notificationclass";
24332d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru
24432d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru        /**
24532d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         * If extras are specified when requesting a download they will be provided in the intent that
24632d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         * is sent to the specified class and package when a download has finished.
24732d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         * <P>Type: TEXT</P>
24832d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         * <P>Owner can Init</P>
24932d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         */
25032d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru        public static final String COLUMN_NOTIFICATION_EXTRAS = "notificationextras";
25132d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru
25232d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru        /**
25332d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         * The name of the column contain the values of the cookie to be used for
25432d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         * the download. This is used directly as the value for the Cookie: HTTP
25532d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         * header that gets sent with the request.
25632d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         * <P>Type: TEXT</P>
25732d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         * <P>Owner can Init</P>
25832d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         */
25932d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru        public static final String COLUMN_COOKIE_DATA = "cookiedata";
26032d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru
26132d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru        /**
26232d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         * The name of the column containing the user agent that the initiating
26332d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         * application wants the download manager to use for this download.
26432d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         * <P>Type: TEXT</P>
26532d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         * <P>Owner can Init</P>
26632d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         */
26732d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru        public static final String COLUMN_USER_AGENT = "useragent";
26832d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru
26932d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru        /**
27032d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         * The name of the column containing the referer (sic) that the initiating
27132d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         * application wants the download manager to use for this download.
27232d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         * <P>Type: TEXT</P>
27332d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         * <P>Owner can Init</P>
27432d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         */
27532d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru        public static final String COLUMN_REFERER = "referer";
27632d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru
27732d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru        /**
27832d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         * The name of the column containing the total size of the file being
27932d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         * downloaded.
28032d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         * <P>Type: INTEGER</P>
28132d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         * <P>Owner can Read</P>
28232d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         */
28332d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru        public static final String COLUMN_TOTAL_BYTES = "total_bytes";
28432d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru
28532d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru        /**
28632d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         * The name of the column containing the size of the part of the file that
28732d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         * has been downloaded so far.
28832d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         * <P>Type: INTEGER</P>
28932d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         * <P>Owner can Read</P>
29032d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         */
29132d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru        public static final String COLUMN_CURRENT_BYTES = "current_bytes";
29232d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru
29332d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru        /**
29432d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         * The name of the column where the initiating application can provide the
29532d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         * UID of another application that is allowed to access this download. If
29632d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         * multiple applications share the same UID, all those applications will be
29732d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         * allowed to access this download. This column can be updated after the
29832d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         * download is initiated. This requires the permission
29932d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         * android.permission.ACCESS_DOWNLOAD_MANAGER_ADVANCED.
30032d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         * <P>Type: INTEGER</P>
30132d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         * <P>Owner can Init</P>
30232d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         */
30332d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru        public static final String COLUMN_OTHER_UID = "otheruid";
30432d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru
30532d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru        /**
30632d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         * The name of the column where the initiating application can provided the
30732d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         * title of this download. The title will be displayed ito the user in the
30832d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         * list of downloads.
30932d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         * <P>Type: TEXT</P>
31032d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         * <P>Owner can Init/Read/Write</P>
31132d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         */
31232d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru        public static final String COLUMN_TITLE = "title";
31332d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru
31432d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru        /**
31532d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         * The name of the column where the initiating application can provide the
31632d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         * description of this download. The description will be displayed to the
31732d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         * user in the list of downloads.
31832d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         * <P>Type: TEXT</P>
31932d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         * <P>Owner can Init/Read/Write</P>
32032d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         */
32132d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru        public static final String COLUMN_DESCRIPTION = "description";
32232d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru
323b8e07a51c1849d6894c5773a3daacedd01294218Steve Howard        /**
324b8e07a51c1849d6894c5773a3daacedd01294218Steve Howard         * The name of the column indicating whether the download was requesting through the public
325b8e07a51c1849d6894c5773a3daacedd01294218Steve Howard         * API.  This controls some differences in behavior.
326b8e07a51c1849d6894c5773a3daacedd01294218Steve Howard         * <P>Type: BOOLEAN</P>
327b8e07a51c1849d6894c5773a3daacedd01294218Steve Howard         * <P>Owner can Init/Read</P>
328b8e07a51c1849d6894c5773a3daacedd01294218Steve Howard         */
329b8e07a51c1849d6894c5773a3daacedd01294218Steve Howard        public static final String COLUMN_IS_PUBLIC_API = "is_public_api";
330b8e07a51c1849d6894c5773a3daacedd01294218Steve Howard
331b8e07a51c1849d6894c5773a3daacedd01294218Steve Howard        /**
33215ec7d6d7f23ec197a88619b5e03320cfebd2240Jeff Sharkey         * The name of the column holding a bitmask of allowed network types.  This is only used for
33315ec7d6d7f23ec197a88619b5e03320cfebd2240Jeff Sharkey         * public API downloads.
33415ec7d6d7f23ec197a88619b5e03320cfebd2240Jeff Sharkey         * <P>Type: INTEGER</P>
33515ec7d6d7f23ec197a88619b5e03320cfebd2240Jeff Sharkey         * <P>Owner can Init/Read</P>
33615ec7d6d7f23ec197a88619b5e03320cfebd2240Jeff Sharkey         */
33715ec7d6d7f23ec197a88619b5e03320cfebd2240Jeff Sharkey        public static final String COLUMN_ALLOWED_NETWORK_TYPES = "allowed_network_types";
33815ec7d6d7f23ec197a88619b5e03320cfebd2240Jeff Sharkey
33915ec7d6d7f23ec197a88619b5e03320cfebd2240Jeff Sharkey        /**
340b8e07a51c1849d6894c5773a3daacedd01294218Steve Howard         * The name of the column indicating whether roaming connections can be used.  This is only
341b8e07a51c1849d6894c5773a3daacedd01294218Steve Howard         * used for public API downloads.
342b8e07a51c1849d6894c5773a3daacedd01294218Steve Howard         * <P>Type: BOOLEAN</P>
343b8e07a51c1849d6894c5773a3daacedd01294218Steve Howard         * <P>Owner can Init/Read</P>
344b8e07a51c1849d6894c5773a3daacedd01294218Steve Howard         */
345b8e07a51c1849d6894c5773a3daacedd01294218Steve Howard        public static final String COLUMN_ALLOW_ROAMING = "allow_roaming";
346b8e07a51c1849d6894c5773a3daacedd01294218Steve Howard
347b8e07a51c1849d6894c5773a3daacedd01294218Steve Howard        /**
34815ec7d6d7f23ec197a88619b5e03320cfebd2240Jeff Sharkey         * The name of the column indicating whether metered connections can be used.  This is only
34915ec7d6d7f23ec197a88619b5e03320cfebd2240Jeff Sharkey         * used for public API downloads.
35015ec7d6d7f23ec197a88619b5e03320cfebd2240Jeff Sharkey         * <P>Type: BOOLEAN</P>
351b8e07a51c1849d6894c5773a3daacedd01294218Steve Howard         * <P>Owner can Init/Read</P>
352b8e07a51c1849d6894c5773a3daacedd01294218Steve Howard         */
35315ec7d6d7f23ec197a88619b5e03320cfebd2240Jeff Sharkey        public static final String COLUMN_ALLOW_METERED = "allow_metered";
354b8e07a51c1849d6894c5773a3daacedd01294218Steve Howard
35590fb15a7e52b1208b8d4f7518a61efb99580b5b0Steve Howard        /**
35690fb15a7e52b1208b8d4f7518a61efb99580b5b0Steve Howard         * Whether or not this download should be displayed in the system's Downloads UI.  Defaults
35790fb15a7e52b1208b8d4f7518a61efb99580b5b0Steve Howard         * to true.
35890fb15a7e52b1208b8d4f7518a61efb99580b5b0Steve Howard         * <P>Type: INTEGER</P>
35990fb15a7e52b1208b8d4f7518a61efb99580b5b0Steve Howard         * <P>Owner can Init/Read</P>
36090fb15a7e52b1208b8d4f7518a61efb99580b5b0Steve Howard         */
36190fb15a7e52b1208b8d4f7518a61efb99580b5b0Steve Howard        public static final String COLUMN_IS_VISIBLE_IN_DOWNLOADS_UI = "is_visible_in_downloads_ui";
36290fb15a7e52b1208b8d4f7518a61efb99580b5b0Steve Howard
363f176681ecc19f3bffa3d9cb00b3460cf5a128d28Steve Howard        /**
364f176681ecc19f3bffa3d9cb00b3460cf5a128d28Steve Howard         * If true, the user has confirmed that this download can proceed over the mobile network
365f176681ecc19f3bffa3d9cb00b3460cf5a128d28Steve Howard         * even though it exceeds the recommended maximum size.
366f176681ecc19f3bffa3d9cb00b3460cf5a128d28Steve Howard         * <P>Type: BOOLEAN</P>
367f176681ecc19f3bffa3d9cb00b3460cf5a128d28Steve Howard         */
368f176681ecc19f3bffa3d9cb00b3460cf5a128d28Steve Howard        public static final String COLUMN_BYPASS_RECOMMENDED_SIZE_LIMIT =
369f176681ecc19f3bffa3d9cb00b3460cf5a128d28Steve Howard            "bypass_recommended_size_limit";
370f176681ecc19f3bffa3d9cb00b3460cf5a128d28Steve Howard
371216fa22791889774b83977341632c4570dcec35dVasu Nori        /**
372216fa22791889774b83977341632c4570dcec35dVasu Nori         * Set to true if this download is deleted. It is completely removed from the database
373216fa22791889774b83977341632c4570dcec35dVasu Nori         * when MediaProvider database also deletes the metadata asociated with this downloaded file.
374216fa22791889774b83977341632c4570dcec35dVasu Nori         * <P>Type: BOOLEAN</P>
375216fa22791889774b83977341632c4570dcec35dVasu Nori         * <P>Owner can Read</P>
376216fa22791889774b83977341632c4570dcec35dVasu Nori         */
377216fa22791889774b83977341632c4570dcec35dVasu Nori        public static final String COLUMN_DELETED = "deleted";
378216fa22791889774b83977341632c4570dcec35dVasu Nori
379216fa22791889774b83977341632c4570dcec35dVasu Nori        /**
380216fa22791889774b83977341632c4570dcec35dVasu Nori         * The URI to the corresponding entry in MediaProvider for this downloaded entry. It is
381216fa22791889774b83977341632c4570dcec35dVasu Nori         * used to delete the entries from MediaProvider database when it is deleted from the
382216fa22791889774b83977341632c4570dcec35dVasu Nori         * downloaded list.
383216fa22791889774b83977341632c4570dcec35dVasu Nori         * <P>Type: TEXT</P>
384216fa22791889774b83977341632c4570dcec35dVasu Nori         * <P>Owner can Read</P>
385216fa22791889774b83977341632c4570dcec35dVasu Nori         */
386216fa22791889774b83977341632c4570dcec35dVasu Nori        public static final String COLUMN_MEDIAPROVIDER_URI = "mediaprovider_uri";
387216fa22791889774b83977341632c4570dcec35dVasu Nori
3885be894e636522addc40dad3b631f0249e6cc25cfVasu Nori        /**
3895be894e636522addc40dad3b631f0249e6cc25cfVasu Nori         * The column that is used to remember whether the media scanner was invoked.
3905be894e636522addc40dad3b631f0249e6cc25cfVasu Nori         * It can take the values: null or 0(not scanned), 1(scanned), 2 (not scannable).
3915be894e636522addc40dad3b631f0249e6cc25cfVasu Nori         * <P>Type: TEXT</P>
3925be894e636522addc40dad3b631f0249e6cc25cfVasu Nori         */
3935be894e636522addc40dad3b631f0249e6cc25cfVasu Nori        public static final String COLUMN_MEDIA_SCANNED = "scanned";
3945be894e636522addc40dad3b631f0249e6cc25cfVasu Nori
3954015de2a0803998ee5ffdf1d765378ed0e360ae1Vasu Nori        /**
3964015de2a0803998ee5ffdf1d765378ed0e360ae1Vasu Nori         * The column with errorMsg for a failed downloaded.
3974015de2a0803998ee5ffdf1d765378ed0e360ae1Vasu Nori         * Used only for debugging purposes.
3984015de2a0803998ee5ffdf1d765378ed0e360ae1Vasu Nori         * <P>Type: TEXT</P>
3994015de2a0803998ee5ffdf1d765378ed0e360ae1Vasu Nori         */
4004015de2a0803998ee5ffdf1d765378ed0e360ae1Vasu Nori        public static final String COLUMN_ERROR_MSG = "errorMsg";
4014015de2a0803998ee5ffdf1d765378ed0e360ae1Vasu Nori
4028da7a4e3451a41808972bfec0af0740e999d9c8aVasu Nori        /**
4038da7a4e3451a41808972bfec0af0740e999d9c8aVasu Nori         *  This column stores the source of the last update to this row.
4048da7a4e3451a41808972bfec0af0740e999d9c8aVasu Nori         *  This column is only for internal use.
4058da7a4e3451a41808972bfec0af0740e999d9c8aVasu Nori         *  Valid values are indicated by LAST_UPDATESRC_* constants.
4068da7a4e3451a41808972bfec0af0740e999d9c8aVasu Nori         * <P>Type: INT</P>
4078da7a4e3451a41808972bfec0af0740e999d9c8aVasu Nori         */
4088da7a4e3451a41808972bfec0af0740e999d9c8aVasu Nori        public static final String COLUMN_LAST_UPDATESRC = "lastUpdateSrc";
4098da7a4e3451a41808972bfec0af0740e999d9c8aVasu Nori
4108da7a4e3451a41808972bfec0af0740e999d9c8aVasu Nori        /**
4118da7a4e3451a41808972bfec0af0740e999d9c8aVasu Nori         * default value for {@link #COLUMN_LAST_UPDATESRC}.
4128da7a4e3451a41808972bfec0af0740e999d9c8aVasu Nori         * This value is used when this column's value is not relevant.
4138da7a4e3451a41808972bfec0af0740e999d9c8aVasu Nori         */
4148da7a4e3451a41808972bfec0af0740e999d9c8aVasu Nori        public static final int LAST_UPDATESRC_NOT_RELEVANT = 0;
4158da7a4e3451a41808972bfec0af0740e999d9c8aVasu Nori
4168da7a4e3451a41808972bfec0af0740e999d9c8aVasu Nori        /**
4178da7a4e3451a41808972bfec0af0740e999d9c8aVasu Nori         * One of the values taken by {@link #COLUMN_LAST_UPDATESRC}.
4188da7a4e3451a41808972bfec0af0740e999d9c8aVasu Nori         * This value is used when the update is NOT to be relayed to the DownloadService
4198da7a4e3451a41808972bfec0af0740e999d9c8aVasu Nori         * (and thus spare DownloadService from scanning the database when this change occurs)
4208da7a4e3451a41808972bfec0af0740e999d9c8aVasu Nori         */
4218da7a4e3451a41808972bfec0af0740e999d9c8aVasu Nori        public static final int LAST_UPDATESRC_DONT_NOTIFY_DOWNLOADSVC = 1;
4228da7a4e3451a41808972bfec0af0740e999d9c8aVasu Nori
42332d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru        /*
42432d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         * Lists the destinations that an application can specify for a download.
42532d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         */
42632d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru
42732d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru        /**
42832d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         * This download will be saved to the external storage. This is the
42932d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         * default behavior, and should be used for any file that the user
43032d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         * can freely access, copy, delete. Even with that destination,
43132d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         * unencrypted DRM files are saved in secure internal storage.
43232d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         * Downloads to the external destination only write files for which
43332d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         * there is a registered handler. The resulting files are accessible
43432d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         * by filename to all applications.
43532d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         */
43632d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru        public static final int DESTINATION_EXTERNAL = 0;
43732d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru
43832d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru        /**
43932d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         * This download will be saved to the download manager's private
44032d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         * partition. This is the behavior used by applications that want to
44132d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         * download private files that are used and deleted soon after they
44232d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         * get downloaded. All file types are allowed, and only the initiating
44332d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         * application can access the file (indirectly through a content
44432d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         * provider). This requires the
44532d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         * android.permission.ACCESS_DOWNLOAD_MANAGER_ADVANCED permission.
44632d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         */
44732d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru        public static final int DESTINATION_CACHE_PARTITION = 1;
44832d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru
44932d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru        /**
45032d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         * This download will be saved to the download manager's private
45132d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         * partition and will be purged as necessary to make space. This is
45232d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         * for private files (similar to CACHE_PARTITION) that aren't deleted
45332d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         * immediately after they are used, and are kept around by the download
45432d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         * manager as long as space is available.
45532d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         */
45632d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru        public static final int DESTINATION_CACHE_PARTITION_PURGEABLE = 2;
45732d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru
45832d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru        /**
45932d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         * This download will be saved to the download manager's private
46032d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         * partition, as with DESTINATION_CACHE_PARTITION, but the download
46132d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         * will not proceed if the user is on a roaming data connection.
46232d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         */
46332d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru        public static final int DESTINATION_CACHE_PARTITION_NOROAMING = 3;
46432d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru
46532d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru        /**
466adcb697826753391f02f6b3bd35b4edfb3032ad1Steve Howard         * This download will be saved to the location given by the file URI in
467adcb697826753391f02f6b3bd35b4edfb3032ad1Steve Howard         * {@link #COLUMN_FILE_NAME_HINT}.
468adcb697826753391f02f6b3bd35b4edfb3032ad1Steve Howard         */
469adcb697826753391f02f6b3bd35b4edfb3032ad1Steve Howard        public static final int DESTINATION_FILE_URI = 4;
470adcb697826753391f02f6b3bd35b4edfb3032ad1Steve Howard
471adcb697826753391f02f6b3bd35b4edfb3032ad1Steve Howard        /**
472f83e6e4b7a7fcbfcc8e3b6078f4655fa3e64bce3Vasu Nori         * This download will be saved to the system cache ("/cache")
473f83e6e4b7a7fcbfcc8e3b6078f4655fa3e64bce3Vasu Nori         * partition. This option is only used by system apps and so it requires
474f83e6e4b7a7fcbfcc8e3b6078f4655fa3e64bce3Vasu Nori         * android.permission.ACCESS_CACHE_FILESYSTEM permission.
475f83e6e4b7a7fcbfcc8e3b6078f4655fa3e64bce3Vasu Nori         */
476f83e6e4b7a7fcbfcc8e3b6078f4655fa3e64bce3Vasu Nori        public static final int DESTINATION_SYSTEMCACHE_PARTITION = 5;
477f83e6e4b7a7fcbfcc8e3b6078f4655fa3e64bce3Vasu Nori
478f83e6e4b7a7fcbfcc8e3b6078f4655fa3e64bce3Vasu Nori        /**
479c0e5075739574e67c825e4841d5cccee55cbfd29Vasu Nori         * This download was completed by the caller (i.e., NOT downloadmanager)
480c0e5075739574e67c825e4841d5cccee55cbfd29Vasu Nori         * and caller wants to have this download displayed in Downloads App.
481c0e5075739574e67c825e4841d5cccee55cbfd29Vasu Nori         */
482c0e5075739574e67c825e4841d5cccee55cbfd29Vasu Nori        public static final int DESTINATION_NON_DOWNLOADMANAGER_DOWNLOAD = 6;
483c0e5075739574e67c825e4841d5cccee55cbfd29Vasu Nori
484c0e5075739574e67c825e4841d5cccee55cbfd29Vasu Nori        /**
48532d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         * This download is allowed to run.
48632d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         */
48732d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru        public static final int CONTROL_RUN = 0;
48832d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru
48932d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru        /**
49032d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         * This download must pause at the first opportunity.
49132d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         */
49232d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru        public static final int CONTROL_PAUSED = 1;
49332d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru
49432d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru        /*
49532d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         * Lists the states that the download manager can set on a download
49632d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         * to notify applications of the download progress.
49732d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         * The codes follow the HTTP families:<br>
49832d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         * 1xx: informational<br>
49932d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         * 2xx: success<br>
50032d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         * 3xx: redirects (not used by the download manager)<br>
50132d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         * 4xx: client errors<br>
50232d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         * 5xx: server errors
50332d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         */
50432d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru
50532d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru        /**
50632d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         * Returns whether the status is informational (i.e. 1xx).
50732d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         */
50832d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru        public static boolean isStatusInformational(int status) {
50932d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru            return (status >= 100 && status < 200);
51032d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru        }
51132d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru
51232d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru        /**
51332d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         * Returns whether the status is a success (i.e. 2xx).
51432d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         */
51532d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru        public static boolean isStatusSuccess(int status) {
51632d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru            return (status >= 200 && status < 300);
51732d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru        }
51832d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru
51932d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru        /**
52032d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         * Returns whether the status is an error (i.e. 4xx or 5xx).
52132d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         */
52232d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru        public static boolean isStatusError(int status) {
52332d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru            return (status >= 400 && status < 600);
52432d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru        }
52532d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru
52632d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru        /**
52732d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         * Returns whether the status is a client error (i.e. 4xx).
52832d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         */
52932d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru        public static boolean isStatusClientError(int status) {
53032d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru            return (status >= 400 && status < 500);
53132d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru        }
53232d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru
53332d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru        /**
53432d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         * Returns whether the status is a server error (i.e. 5xx).
53532d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         */
53632d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru        public static boolean isStatusServerError(int status) {
53732d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru            return (status >= 500 && status < 600);
53832d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru        }
53932d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru
54032d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru        /**
541f9e8523e62fa391e85d393c23a3345887565d426Vasu Nori         * this method determines if a notification should be displayed for a
542f9e8523e62fa391e85d393c23a3345887565d426Vasu Nori         * given {@link #COLUMN_VISIBILITY} value
543f9e8523e62fa391e85d393c23a3345887565d426Vasu Nori         * @param visibility the value of {@link #COLUMN_VISIBILITY}.
544f9e8523e62fa391e85d393c23a3345887565d426Vasu Nori         * @return true if the notification should be displayed. false otherwise.
545f9e8523e62fa391e85d393c23a3345887565d426Vasu Nori         */
546f9e8523e62fa391e85d393c23a3345887565d426Vasu Nori        public static boolean isNotificationToBeDisplayed(int visibility) {
547f9e8523e62fa391e85d393c23a3345887565d426Vasu Nori            return visibility == DownloadManager.Request.VISIBILITY_VISIBLE_NOTIFY_COMPLETED ||
548f9e8523e62fa391e85d393c23a3345887565d426Vasu Nori                    visibility == DownloadManager.Request.VISIBILITY_VISIBLE_NOTIFY_ONLY_COMPLETION;
549f9e8523e62fa391e85d393c23a3345887565d426Vasu Nori        }
550f9e8523e62fa391e85d393c23a3345887565d426Vasu Nori
551f9e8523e62fa391e85d393c23a3345887565d426Vasu Nori        /**
55232d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         * Returns whether the download has completed (either with success or
55332d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         * error).
55432d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         */
55532d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru        public static boolean isStatusCompleted(int status) {
55632d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru            return (status >= 200 && status < 300) || (status >= 400 && status < 600);
55732d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru        }
55832d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru
55932d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru        /**
56032d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         * This download hasn't stated yet
56132d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         */
56232d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru        public static final int STATUS_PENDING = 190;
56332d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru
56432d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru        /**
5653e8c1d3a467bab889de7f92379be1f43d9c2d81eSteve Howard         * This download has started
56632d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         */
5673e8c1d3a467bab889de7f92379be1f43d9c2d81eSteve Howard        public static final int STATUS_RUNNING = 192;
56832d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru
56932d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru        /**
5703e8c1d3a467bab889de7f92379be1f43d9c2d81eSteve Howard         * This download has been paused by the owning app.
57132d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         */
5723e8c1d3a467bab889de7f92379be1f43d9c2d81eSteve Howard        public static final int STATUS_PAUSED_BY_APP = 193;
5733e8c1d3a467bab889de7f92379be1f43d9c2d81eSteve Howard
5743e8c1d3a467bab889de7f92379be1f43d9c2d81eSteve Howard        /**
5753e8c1d3a467bab889de7f92379be1f43d9c2d81eSteve Howard         * This download encountered some network error and is waiting before retrying the request.
5763e8c1d3a467bab889de7f92379be1f43d9c2d81eSteve Howard         */
5773e8c1d3a467bab889de7f92379be1f43d9c2d81eSteve Howard        public static final int STATUS_WAITING_TO_RETRY = 194;
5783e8c1d3a467bab889de7f92379be1f43d9c2d81eSteve Howard
5793e8c1d3a467bab889de7f92379be1f43d9c2d81eSteve Howard        /**
5803e8c1d3a467bab889de7f92379be1f43d9c2d81eSteve Howard         * This download is waiting for network connectivity to proceed.
5813e8c1d3a467bab889de7f92379be1f43d9c2d81eSteve Howard         */
5823e8c1d3a467bab889de7f92379be1f43d9c2d81eSteve Howard        public static final int STATUS_WAITING_FOR_NETWORK = 195;
58332d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru
58432d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru        /**
5853e8c1d3a467bab889de7f92379be1f43d9c2d81eSteve Howard         * This download exceeded a size limit for mobile networks and is waiting for a Wi-Fi
5863e8c1d3a467bab889de7f92379be1f43d9c2d81eSteve Howard         * connection to proceed.
58732d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         */
5883e8c1d3a467bab889de7f92379be1f43d9c2d81eSteve Howard        public static final int STATUS_QUEUED_FOR_WIFI = 196;
58932d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru
59032d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru        /**
5910ba3055b1e657b0948001d48b19345fb0cd626ffVasu Nori         * This download couldn't be completed due to insufficient storage
5920ba3055b1e657b0948001d48b19345fb0cd626ffVasu Nori         * space.  Typically, this is because the SD card is full.
5930ba3055b1e657b0948001d48b19345fb0cd626ffVasu Nori         */
5940ba3055b1e657b0948001d48b19345fb0cd626ffVasu Nori        public static final int STATUS_INSUFFICIENT_SPACE_ERROR = 198;
5950ba3055b1e657b0948001d48b19345fb0cd626ffVasu Nori
5960ba3055b1e657b0948001d48b19345fb0cd626ffVasu Nori        /**
5970ba3055b1e657b0948001d48b19345fb0cd626ffVasu Nori         * This download couldn't be completed because no external storage
5980ba3055b1e657b0948001d48b19345fb0cd626ffVasu Nori         * device was found.  Typically, this is because the SD card is not
5990ba3055b1e657b0948001d48b19345fb0cd626ffVasu Nori         * mounted.
6000ba3055b1e657b0948001d48b19345fb0cd626ffVasu Nori         */
6010ba3055b1e657b0948001d48b19345fb0cd626ffVasu Nori        public static final int STATUS_DEVICE_NOT_FOUND_ERROR = 199;
6020ba3055b1e657b0948001d48b19345fb0cd626ffVasu Nori
6030ba3055b1e657b0948001d48b19345fb0cd626ffVasu Nori        /**
60432d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         * This download has successfully completed.
60532d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         * Warning: there might be other status values that indicate success
60632d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         * in the future.
60732d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         * Use isSucccess() to capture the entire category.
60832d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         */
60932d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru        public static final int STATUS_SUCCESS = 200;
61032d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru
61132d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru        /**
61232d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         * This request couldn't be parsed. This is also used when processing
61332d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         * requests with unknown/unsupported URI schemes.
61432d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         */
61532d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru        public static final int STATUS_BAD_REQUEST = 400;
61632d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru
61732d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru        /**
61832d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         * This download can't be performed because the content type cannot be
61932d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         * handled.
62032d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         */
62132d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru        public static final int STATUS_NOT_ACCEPTABLE = 406;
62232d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru
62332d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru        /**
62432d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         * This download cannot be performed because the length cannot be
62532d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         * determined accurately. This is the code for the HTTP error "Length
62632d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         * Required", which is typically used when making requests that require
62732d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         * a content length but don't have one, and it is also used in the
62832d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         * client when a response is received whose length cannot be determined
62932d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         * accurately (therefore making it impossible to know when a download
63032d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         * completes).
63132d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         */
63232d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru        public static final int STATUS_LENGTH_REQUIRED = 411;
63332d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru
63432d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru        /**
63532d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         * This download was interrupted and cannot be resumed.
63632d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         * This is the code for the HTTP error "Precondition Failed", and it is
63732d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         * also used in situations where the client doesn't have an ETag at all.
63832d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         */
63932d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru        public static final int STATUS_PRECONDITION_FAILED = 412;
64032d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru
64132d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru        /**
64233bbd12a05005ac92a0ecf82695893148227bb22Steve Howard         * The lowest-valued error status that is not an actual HTTP status code.
64333bbd12a05005ac92a0ecf82695893148227bb22Steve Howard         */
644a9e87c9cc375b8be43a05ad641545db26eee0d46Steve Howard        public static final int MIN_ARTIFICIAL_ERROR_STATUS = 488;
645a9e87c9cc375b8be43a05ad641545db26eee0d46Steve Howard
646a9e87c9cc375b8be43a05ad641545db26eee0d46Steve Howard        /**
647a9e87c9cc375b8be43a05ad641545db26eee0d46Steve Howard         * The requested destination file already exists.
648a9e87c9cc375b8be43a05ad641545db26eee0d46Steve Howard         */
649a9e87c9cc375b8be43a05ad641545db26eee0d46Steve Howard        public static final int STATUS_FILE_ALREADY_EXISTS_ERROR = 488;
65033bbd12a05005ac92a0ecf82695893148227bb22Steve Howard
65133bbd12a05005ac92a0ecf82695893148227bb22Steve Howard        /**
65233bbd12a05005ac92a0ecf82695893148227bb22Steve Howard         * Some possibly transient error occurred, but we can't resume the download.
65333bbd12a05005ac92a0ecf82695893148227bb22Steve Howard         */
65433bbd12a05005ac92a0ecf82695893148227bb22Steve Howard        public static final int STATUS_CANNOT_RESUME = 489;
65533bbd12a05005ac92a0ecf82695893148227bb22Steve Howard
65633bbd12a05005ac92a0ecf82695893148227bb22Steve Howard        /**
65732d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         * This download was canceled
65832d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         */
65932d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru        public static final int STATUS_CANCELED = 490;
66032d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru
66132d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru        /**
66232d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         * This download has completed with an error.
66332d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         * Warning: there will be other status values that indicate errors in
66432d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         * the future. Use isStatusError() to capture the entire category.
66532d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         */
66632d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru        public static final int STATUS_UNKNOWN_ERROR = 491;
66732d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru
66832d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru        /**
66932d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         * This download couldn't be completed because of a storage issue.
67032d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         * Typically, that's because the filesystem is missing or full.
671f238ad7746d04d641f55bbed3461ba87a2ba4aebAttila Bodis         * Use the more specific {@link #STATUS_INSUFFICIENT_SPACE_ERROR}
672f238ad7746d04d641f55bbed3461ba87a2ba4aebAttila Bodis         * and {@link #STATUS_DEVICE_NOT_FOUND_ERROR} when appropriate.
67332d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         */
67432d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru        public static final int STATUS_FILE_ERROR = 492;
67532d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru
67632d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru        /**
67732d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         * This download couldn't be completed because of an HTTP
67832d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         * redirect response that the download manager couldn't
67932d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         * handle.
68032d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         */
68132d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru        public static final int STATUS_UNHANDLED_REDIRECT = 493;
68232d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru
68332d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru        /**
68432d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         * This download couldn't be completed because of an
68532d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         * unspecified unhandled HTTP code.
68632d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         */
68732d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru        public static final int STATUS_UNHANDLED_HTTP_CODE = 494;
68832d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru
68932d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru        /**
69032d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         * This download couldn't be completed because of an
69132d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         * error receiving or processing data at the HTTP level.
69232d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         */
69332d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru        public static final int STATUS_HTTP_DATA_ERROR = 495;
69432d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru
69532d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru        /**
69632d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         * This download couldn't be completed because of an
69732d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         * HttpException while setting up the request.
69832d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         */
69932d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru        public static final int STATUS_HTTP_EXCEPTION = 496;
70032d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru
70132d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru        /**
70232d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         * This download couldn't be completed because there were
70332d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         * too many redirects.
70432d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         */
70532d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru        public static final int STATUS_TOO_MANY_REDIRECTS = 497;
70632d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru
70732d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru        /**
708fdfef57f498e3021a34342538aef9f1c7ccbae78Jeff Sharkey         * This download has failed because requesting application has been
709fdfef57f498e3021a34342538aef9f1c7ccbae78Jeff Sharkey         * blocked by {@link NetworkPolicyManager}.
710fdfef57f498e3021a34342538aef9f1c7ccbae78Jeff Sharkey         *
711fdfef57f498e3021a34342538aef9f1c7ccbae78Jeff Sharkey         * @hide
71215ec7d6d7f23ec197a88619b5e03320cfebd2240Jeff Sharkey         * @deprecated since behavior now uses
71315ec7d6d7f23ec197a88619b5e03320cfebd2240Jeff Sharkey         *             {@link #STATUS_WAITING_FOR_NETWORK}
714fdfef57f498e3021a34342538aef9f1c7ccbae78Jeff Sharkey         */
71515ec7d6d7f23ec197a88619b5e03320cfebd2240Jeff Sharkey        @Deprecated
716fdfef57f498e3021a34342538aef9f1c7ccbae78Jeff Sharkey        public static final int STATUS_BLOCKED = 498;
717fdfef57f498e3021a34342538aef9f1c7ccbae78Jeff Sharkey
71858d9fb6220ea2070b0af5db3031e9cdaead6e36dJeff Sharkey        /** {@hide} */
71958d9fb6220ea2070b0af5db3031e9cdaead6e36dJeff Sharkey        public static String statusToString(int status) {
72058d9fb6220ea2070b0af5db3031e9cdaead6e36dJeff Sharkey            switch (status) {
72158d9fb6220ea2070b0af5db3031e9cdaead6e36dJeff Sharkey                case STATUS_PENDING: return "PENDING";
72258d9fb6220ea2070b0af5db3031e9cdaead6e36dJeff Sharkey                case STATUS_RUNNING: return "RUNNING";
72358d9fb6220ea2070b0af5db3031e9cdaead6e36dJeff Sharkey                case STATUS_PAUSED_BY_APP: return "PAUSED_BY_APP";
72458d9fb6220ea2070b0af5db3031e9cdaead6e36dJeff Sharkey                case STATUS_WAITING_TO_RETRY: return "WAITING_TO_RETRY";
72558d9fb6220ea2070b0af5db3031e9cdaead6e36dJeff Sharkey                case STATUS_WAITING_FOR_NETWORK: return "WAITING_FOR_NETWORK";
72658d9fb6220ea2070b0af5db3031e9cdaead6e36dJeff Sharkey                case STATUS_QUEUED_FOR_WIFI: return "QUEUED_FOR_WIFI";
72758d9fb6220ea2070b0af5db3031e9cdaead6e36dJeff Sharkey                case STATUS_INSUFFICIENT_SPACE_ERROR: return "INSUFFICIENT_SPACE_ERROR";
72858d9fb6220ea2070b0af5db3031e9cdaead6e36dJeff Sharkey                case STATUS_DEVICE_NOT_FOUND_ERROR: return "DEVICE_NOT_FOUND_ERROR";
72958d9fb6220ea2070b0af5db3031e9cdaead6e36dJeff Sharkey                case STATUS_SUCCESS: return "SUCCESS";
73058d9fb6220ea2070b0af5db3031e9cdaead6e36dJeff Sharkey                case STATUS_BAD_REQUEST: return "BAD_REQUEST";
73158d9fb6220ea2070b0af5db3031e9cdaead6e36dJeff Sharkey                case STATUS_NOT_ACCEPTABLE: return "NOT_ACCEPTABLE";
73258d9fb6220ea2070b0af5db3031e9cdaead6e36dJeff Sharkey                case STATUS_LENGTH_REQUIRED: return "LENGTH_REQUIRED";
73358d9fb6220ea2070b0af5db3031e9cdaead6e36dJeff Sharkey                case STATUS_PRECONDITION_FAILED: return "PRECONDITION_FAILED";
73458d9fb6220ea2070b0af5db3031e9cdaead6e36dJeff Sharkey                case STATUS_FILE_ALREADY_EXISTS_ERROR: return "FILE_ALREADY_EXISTS_ERROR";
73558d9fb6220ea2070b0af5db3031e9cdaead6e36dJeff Sharkey                case STATUS_CANNOT_RESUME: return "CANNOT_RESUME";
73658d9fb6220ea2070b0af5db3031e9cdaead6e36dJeff Sharkey                case STATUS_CANCELED: return "CANCELED";
73758d9fb6220ea2070b0af5db3031e9cdaead6e36dJeff Sharkey                case STATUS_UNKNOWN_ERROR: return "UNKNOWN_ERROR";
73858d9fb6220ea2070b0af5db3031e9cdaead6e36dJeff Sharkey                case STATUS_FILE_ERROR: return "FILE_ERROR";
73958d9fb6220ea2070b0af5db3031e9cdaead6e36dJeff Sharkey                case STATUS_UNHANDLED_REDIRECT: return "UNHANDLED_REDIRECT";
74058d9fb6220ea2070b0af5db3031e9cdaead6e36dJeff Sharkey                case STATUS_UNHANDLED_HTTP_CODE: return "UNHANDLED_HTTP_CODE";
74158d9fb6220ea2070b0af5db3031e9cdaead6e36dJeff Sharkey                case STATUS_HTTP_DATA_ERROR: return "HTTP_DATA_ERROR";
74258d9fb6220ea2070b0af5db3031e9cdaead6e36dJeff Sharkey                case STATUS_HTTP_EXCEPTION: return "HTTP_EXCEPTION";
74358d9fb6220ea2070b0af5db3031e9cdaead6e36dJeff Sharkey                case STATUS_TOO_MANY_REDIRECTS: return "TOO_MANY_REDIRECTS";
74458d9fb6220ea2070b0af5db3031e9cdaead6e36dJeff Sharkey                case STATUS_BLOCKED: return "BLOCKED";
74558d9fb6220ea2070b0af5db3031e9cdaead6e36dJeff Sharkey                default: return Integer.toString(status);
74658d9fb6220ea2070b0af5db3031e9cdaead6e36dJeff Sharkey            }
74758d9fb6220ea2070b0af5db3031e9cdaead6e36dJeff Sharkey        }
74858d9fb6220ea2070b0af5db3031e9cdaead6e36dJeff Sharkey
749fdfef57f498e3021a34342538aef9f1c7ccbae78Jeff Sharkey        /**
75032d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         * This download is visible but only shows in the notifications
75132d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         * while it's in progress.
75232d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         */
7534c6e5dfa1c38f32843d209258388b97d4e32314fVasu Nori        public static final int VISIBILITY_VISIBLE = DownloadManager.Request.VISIBILITY_VISIBLE;
75432d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru
75532d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru        /**
75632d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         * This download is visible and shows in the notifications while
75732d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         * in progress and after completion.
75832d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         */
7594c6e5dfa1c38f32843d209258388b97d4e32314fVasu Nori        public static final int VISIBILITY_VISIBLE_NOTIFY_COMPLETED =
7604c6e5dfa1c38f32843d209258388b97d4e32314fVasu Nori                DownloadManager.Request.VISIBILITY_VISIBLE_NOTIFY_COMPLETED;
76132d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru
76232d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru        /**
76332d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         * This download doesn't show in the UI or in the notifications.
76432d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru         */
7654c6e5dfa1c38f32843d209258388b97d4e32314fVasu Nori        public static final int VISIBILITY_HIDDEN = DownloadManager.Request.VISIBILITY_HIDDEN;
766ea9147df00ee6e098cd02d901424ae5a4fe0fafdSteve Howard
767ea9147df00ee6e098cd02d901424ae5a4fe0fafdSteve Howard        /**
768ea9147df00ee6e098cd02d901424ae5a4fe0fafdSteve Howard         * Constants related to HTTP request headers associated with each download.
769ea9147df00ee6e098cd02d901424ae5a4fe0fafdSteve Howard         */
770ea9147df00ee6e098cd02d901424ae5a4fe0fafdSteve Howard        public static class RequestHeaders {
771ea9147df00ee6e098cd02d901424ae5a4fe0fafdSteve Howard            public static final String HEADERS_DB_TABLE = "request_headers";
772ea9147df00ee6e098cd02d901424ae5a4fe0fafdSteve Howard            public static final String COLUMN_DOWNLOAD_ID = "download_id";
773ea9147df00ee6e098cd02d901424ae5a4fe0fafdSteve Howard            public static final String COLUMN_HEADER = "header";
774ea9147df00ee6e098cd02d901424ae5a4fe0fafdSteve Howard            public static final String COLUMN_VALUE = "value";
775ea9147df00ee6e098cd02d901424ae5a4fe0fafdSteve Howard
776ea9147df00ee6e098cd02d901424ae5a4fe0fafdSteve Howard            /**
777ea9147df00ee6e098cd02d901424ae5a4fe0fafdSteve Howard             * Path segment to add to a download URI to retrieve request headers
778ea9147df00ee6e098cd02d901424ae5a4fe0fafdSteve Howard             */
779ea9147df00ee6e098cd02d901424ae5a4fe0fafdSteve Howard            public static final String URI_SEGMENT = "headers";
780ea9147df00ee6e098cd02d901424ae5a4fe0fafdSteve Howard
781ea9147df00ee6e098cd02d901424ae5a4fe0fafdSteve Howard            /**
782ea9147df00ee6e098cd02d901424ae5a4fe0fafdSteve Howard             * Prefix for ContentValues keys that contain HTTP header lines, to be passed to
783ea9147df00ee6e098cd02d901424ae5a4fe0fafdSteve Howard             * DownloadProvider.insert().
784ea9147df00ee6e098cd02d901424ae5a4fe0fafdSteve Howard             */
785ea9147df00ee6e098cd02d901424ae5a4fe0fafdSteve Howard            public static final String INSERT_KEY_PREFIX = "http_header_";
786ea9147df00ee6e098cd02d901424ae5a4fe0fafdSteve Howard        }
78732d80bf3b0493cbb2539e1bae3d97c7f9eab4c5bJean-Baptiste Queru    }
788948eef82546c15086d0b78ce18ee874aa5c634f7Jeff Sharkey
789948eef82546c15086d0b78ce18ee874aa5c634f7Jeff Sharkey    /**
790948eef82546c15086d0b78ce18ee874aa5c634f7Jeff Sharkey     * Query where clause for general querying.
791948eef82546c15086d0b78ce18ee874aa5c634f7Jeff Sharkey     */
792948eef82546c15086d0b78ce18ee874aa5c634f7Jeff Sharkey    private static final String QUERY_WHERE_CLAUSE = Impl.COLUMN_NOTIFICATION_PACKAGE + "=? AND "
793948eef82546c15086d0b78ce18ee874aa5c634f7Jeff Sharkey            + Impl.COLUMN_NOTIFICATION_CLASS + "=?";
794948eef82546c15086d0b78ce18ee874aa5c634f7Jeff Sharkey
795948eef82546c15086d0b78ce18ee874aa5c634f7Jeff Sharkey    /**
796948eef82546c15086d0b78ce18ee874aa5c634f7Jeff Sharkey     * Delete all the downloads for a package/class pair.
797948eef82546c15086d0b78ce18ee874aa5c634f7Jeff Sharkey     */
798948eef82546c15086d0b78ce18ee874aa5c634f7Jeff Sharkey    public static final void removeAllDownloadsByPackage(
799948eef82546c15086d0b78ce18ee874aa5c634f7Jeff Sharkey            Context context, String notification_package, String notification_class) {
800948eef82546c15086d0b78ce18ee874aa5c634f7Jeff Sharkey        context.getContentResolver().delete(Impl.CONTENT_URI, QUERY_WHERE_CLAUSE,
801948eef82546c15086d0b78ce18ee874aa5c634f7Jeff Sharkey                new String[] { notification_package, notification_class });
802948eef82546c15086d0b78ce18ee874aa5c634f7Jeff Sharkey    }
80354b6cfa9a9e5b861a9930af873580d6dc20f773The Android Open Source Project}
804