summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--AndroidManifest.xml1
-rw-r--r--res/values-af/strings.xml69
-rw-r--r--res/values-am/strings.xml54
-rw-r--r--res/values-da/strings.xml12
-rw-r--r--res/values-de/strings.xml2
-rw-r--r--res/values-ms/strings.xml67
-rw-r--r--res/values-sw/strings.xml54
-rw-r--r--res/values-zu/strings.xml54
-rw-r--r--src/com/android/providers/downloads/Constants.java4
-rw-r--r--src/com/android/providers/downloads/DownloadDrmHelper.java110
-rw-r--r--src/com/android/providers/downloads/DownloadHandler.java105
-rw-r--r--src/com/android/providers/downloads/DownloadInfo.java73
-rw-r--r--src/com/android/providers/downloads/DownloadProvider.java12
-rw-r--r--src/com/android/providers/downloads/DownloadReceiver.java1
-rw-r--r--src/com/android/providers/downloads/DownloadService.java10
-rw-r--r--src/com/android/providers/downloads/DownloadThread.java102
-rw-r--r--src/com/android/providers/downloads/DrmConvertSession.java171
-rw-r--r--src/com/android/providers/downloads/Helpers.java12
-rw-r--r--src/com/android/providers/downloads/StorageManager.java6
-rw-r--r--tests/src/com/android/providers/downloads/AbstractDownloadManagerFunctionalTest.java3
-rw-r--r--tests/src/com/android/providers/downloads/DownloadManagerFunctionalTest.java15
-rw-r--r--ui/res/values-am/strings.xml60
-rw-r--r--ui/res/values-sw/strings.xml60
-rw-r--r--ui/res/values-zu/strings.xml60
24 files changed, 999 insertions, 118 deletions
diff --git a/AndroidManifest.xml b/AndroidManifest.xml
index ad621af3..d41702dc 100644
--- a/AndroidManifest.xml
+++ b/AndroidManifest.xml
@@ -52,6 +52,7 @@
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.INSTALL_DRM" />
<uses-permission android:name="android.permission.ACCESS_ALL_DOWNLOADS" />
+ <uses-permission android:name="android.permission.UPDATE_DEVICE_STATS" />
<application android:process="android.process.media"
android:label="@string/app_label">
diff --git a/res/values-af/strings.xml b/res/values-af/strings.xml
new file mode 100644
index 00000000..cecf89a8
--- /dev/null
+++ b/res/values-af/strings.xml
@@ -0,0 +1,69 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- Copyright (C) 2007 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ -->
+
+<resources xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
+ <string name="app_label" msgid="3658948994665187911">"Aflaaibestuurder"</string>
+ <!-- no translation found for permlab_downloadManager (7779544811202855500) -->
+ <skip />
+ <string name="permdesc_downloadManager" msgid="4240298564918160337">"Stel die program in staat om die aflaaibestuurder oop te maak en lêers daarmee af te laai. Kwaadwillige programme kan dit gebruik om aflaaisels te ontwrig en private inligting te verkry."</string>
+ <string name="permlab_downloadManagerAdvanced" msgid="7103642833308809655">"Gevorderde aflaaibestuurder-funksies"</string>
+ <string name="permdesc_downloadManagerAdvanced" msgid="6985743912436565114">"Stel die program in staat om die aflaaibestuurder se gevorderde funksies te gebruik. Kwaadwillige programme kan dit gebruik om aflaaisels te ontwrig en private inligting te verkry."</string>
+ <string name="permlab_downloadCompletedIntent" msgid="945913803765675685">"Stuur aflaaikennisgewings."</string>
+ <string name="permdesc_downloadCompletedIntent" msgid="8672701687104399228">"Stel die program in staat om kennisgewings oor voltooide aflaaisels te stuur. Kwaadwillige programme kan dit gebruik om ander programme wat lêers aflaai, te verwar."</string>
+ <!-- no translation found for permlab_seeAllExternal (4084575448409212628) -->
+ <skip />
+ <!-- no translation found for permlab_seeAllExternal (140058400609165726) -->
+ <skip />
+ <!-- no translation found for permdesc_seeAllExternal (3298948060016417104) -->
+ <skip />
+ <!-- no translation found for permlab_downloadCacheNonPurgeable (3069534308882047412) -->
+ <skip />
+ <!-- no translation found for permdesc_downloadCacheNonPurgeable (1089583021652571424) -->
+ <skip />
+ <!-- no translation found for permlab_downloadWithoutNotification (8837971946078327262) -->
+ <skip />
+ <!-- no translation found for permdesc_downloadWithoutNotification (5174806530123417020) -->
+ <skip />
+ <!-- no translation found for permlab_accessAllDownloads (2436240495424393717) -->
+ <skip />
+ <!-- no translation found for permdesc_accessAllDownloads (4575801130424505112) -->
+ <skip />
+ <!-- no translation found for download_unknown_title (7015124071247271585) -->
+ <skip />
+ <string name="notification_filename_separator" msgid="7147189522857807618">", "</string>
+ <string name="notification_filename_extras" msgid="5549729917695688191">" en <xliff:g id="NUMBER">%d</xliff:g> meer"</string>
+ <!-- no translation found for notification_download_complete (840713937779273632) -->
+ <skip />
+ <!-- no translation found for notification_download_failed (5343637375905111462) -->
+ <skip />
+ <!-- no translation found for notification_need_wifi_for_size (5973127997598540499) -->
+ <skip />
+ <!-- no translation found for wifi_required_title (1995971416871498179) -->
+ <skip />
+ <!-- no translation found for wifi_required_body (1675692697446715831) -->
+ <skip />
+ <!-- no translation found for wifi_recommended_title (7441589306734687400) -->
+ <skip />
+ <!-- no translation found for wifi_recommended_body (7574517147645381271) -->
+ <skip />
+ <!-- no translation found for button_queue_for_wifi (422576726189179221) -->
+ <skip />
+ <!-- no translation found for button_cancel_download (2430166148737975604) -->
+ <skip />
+ <!-- no translation found for button_start_now (792123674007840864) -->
+ <skip />
+</resources>
diff --git a/res/values-am/strings.xml b/res/values-am/strings.xml
new file mode 100644
index 00000000..2ad27c9a
--- /dev/null
+++ b/res/values-am/strings.xml
@@ -0,0 +1,54 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- Copyright (C) 2007 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ -->
+
+<resources xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
+ <string name="app_label" msgid="3658948994665187911">"አውርድ አዸራጅ"</string>
+ <!-- no translation found for permlab_downloadManager (7779544811202855500) -->
+ <skip />
+ <string name="permdesc_downloadManager" msgid="4240298564918160337">"የአውርድ ፋይሎችንለመጠቀም እናየአውርዱንአዸራጅለመድረስመተግበሪያው ይፈቅዳል።ተንኮል አዘል ትግበራዎች አውርድን እና የግል መረጃ መድረስለማስተጓጎል ይህን ይጠቀማሉ።"</string>
+ <string name="permlab_downloadManagerAdvanced" msgid="7103642833308809655">"የላቀ አውረድ አዸራጅ ተግባሮች።"</string>
+ <string name="permdesc_downloadManagerAdvanced" msgid="6985743912436565114">"የአውርዱንአዸራጅየላቁ ተግባሮችለመድረስመተግበሪያው ይፈቅዳል።ተንኮል አዘል ትግበራዎች አውርድን እና የግል መረጃ መድረስለማስተጓጎል ይህን ይጠቀማሉ።"</string>
+ <string name="permlab_downloadCompletedIntent" msgid="945913803765675685">"አውርድ ማሳወቂያዎች ላክ።"</string>
+ <string name="permdesc_downloadCompletedIntent" msgid="8672701687104399228">"ስለተጠናቀቁ አውርዶች ማሳወቂያለመላክ መተግበሪያው ይፈቅዳል። ተንኮል አዘል ትግበራዎች ሌሎች ፋይሎች የሚያወርዱ ትግበራዎችንግራ ለማጋበት ይህን ሊጠቀሙ ይችላሉ።"</string>
+ <!-- outdated translation 140058400609165726 --> <string name="permlab_seeAllExternal" product="nosdcard" msgid="4084575448409212628">"ሁሉንም አውርዶች ለSD ካርድ አሳይ"</string>
+ <string name="permlab_seeAllExternal" product="default" msgid="140058400609165726">"ሁሉንም አውርዶች ለSD ካርድ አሳይ"</string>
+ <string name="permdesc_seeAllExternal" msgid="3298948060016417104">"ትግበራው የትኛው ትግበራ እንዳወረዳቸው ሳያውቅ ሁሉንም አውርዶች ወደ SD ካርድ ለማየት ይፈቅዳል።"</string>
+ <string name="permlab_downloadCacheNonPurgeable" msgid="3069534308882047412">"በአውርድ መሸጎጫ ባዶ ቦታ አስቀምጥ"</string>
+ <string name="permdesc_downloadCacheNonPurgeable" msgid="1089583021652571424">"ትግበራው የአውርድ አደራጅ ተጨማሪ ባዶ ቦታ ሲፈልግ በራስ ሰር መሰረዝ የማይችሉትን ወደ አውርድ መሸጎጫ ፋይሎች ለማውረድ ይፈቅዳል።"</string>
+ <string name="permlab_downloadWithoutNotification" msgid="8837971946078327262">"ያለማሳወቂያ ፋይሎች አውርድ"</string>
+ <string name="permdesc_downloadWithoutNotification" msgid="5174806530123417020">"ትግበራው ለተጠቃሚው ምንም ማሳወቂያ ሳያሳይ ፋይሎችን በአውርድ አደራጅ በኩል ለማውረድ ይፈቅዳል።"</string>
+ <string name="permlab_accessAllDownloads" msgid="2436240495424393717">"ሁሉንም የስርዓት ውርዶች ድረስ"</string>
+ <string name="permdesc_accessAllDownloads" msgid="4575801130424505112">"ትግበራው በማንኛውም ትግበራ የተነሳውን ስርዓት ለማየት እና ለመቀየር ይፈቅዳል።"</string>
+ <!-- no translation found for download_unknown_title (7015124071247271585) -->
+ <skip />
+ <string name="notification_filename_separator" msgid="7147189522857807618">", "</string>
+ <string name="notification_filename_extras" msgid="5549729917695688191">" እና <xliff:g id="NUMBER">%d</xliff:g> ተጨማሪ...."</string>
+ <!-- no translation found for notification_download_complete (840713937779273632) -->
+ <skip />
+ <!-- no translation found for notification_download_failed (5343637375905111462) -->
+ <skip />
+ <string name="notification_need_wifi_for_size" msgid="5973127997598540499">"የአውርድ መጠን Wi-Fi ይጠይቃል"</string>
+ <string name="wifi_required_title" msgid="1995971416871498179">"ለትእምርተ ከዋኝ አውታረ መረብ በጣም ብዙ አውርድ"</string>
+ <!-- no translation found for wifi_required_body (1675692697446715831) -->
+ <skip />
+ <string name="wifi_recommended_title" msgid="7441589306734687400">"ለኋላ አውርድ ወረፋ?"</string>
+ <!-- no translation found for wifi_recommended_body (7574517147645381271) -->
+ <skip />
+ <string name="button_queue_for_wifi" msgid="422576726189179221">"ወረፋ"</string>
+ <string name="button_cancel_download" msgid="2430166148737975604">"ይቅር"</string>
+ <string name="button_start_now" msgid="792123674007840864">"አሁን ጀምር"</string>
+</resources>
diff --git a/res/values-da/strings.xml b/res/values-da/strings.xml
index c2a9ed3f..9e159268 100644
--- a/res/values-da/strings.xml
+++ b/res/values-da/strings.xml
@@ -18,20 +18,20 @@
xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
<string name="app_label" msgid="3658948994665187911">"Downloadadministrator"</string>
<string name="permlab_downloadManager" msgid="7779544811202855500">"Få adgang til downloadadministrator."</string>
- <string name="permdesc_downloadManager" msgid="4240298564918160337">"Tillader, at applikationen får adgang til downloadadministratoren og bruger det til at få adgang til downloadede filer. Ondsindede applikationer kan bruge det til at afbryde downloads og få adgang til personlige oplysninger."</string>
+ <string name="permdesc_downloadManager" msgid="4240298564918160337">"Tillader, at programmet får adgang til downloadadministratoren og bruger det til at få adgang til downloadede filer. Ondsindede programmer kan bruge det til at afbryde downloads og få adgang til personlige oplysninger."</string>
<string name="permlab_downloadManagerAdvanced" msgid="7103642833308809655">"Avancerede funktioner for downloadadministrator."</string>
- <string name="permdesc_downloadManagerAdvanced" msgid="6985743912436565114">"Tillader, at applikationen får adgang til de avancerede funktioner i downloadadministratoren. Ondsindede applikationer kan bruge dette til at afbryde downloads og få adgang til personlige oplysninger."</string>
+ <string name="permdesc_downloadManagerAdvanced" msgid="6985743912436565114">"Tillader, at programmet får adgang til de avancerede funktioner i downloadadministratoren. Ondsindede programmer kan bruge dette til at afbryde downloads og få adgang til personlige oplysninger."</string>
<string name="permlab_downloadCompletedIntent" msgid="945913803765675685">"Send downloadmeddelelser."</string>
- <string name="permdesc_downloadCompletedIntent" msgid="8672701687104399228">"Tillader, at applikationen sender meddelelser om afsluttede downloads. Ondsindede applikationer kan bruge dette til at forvirre andre applikationer, der downloader filer."</string>
+ <string name="permdesc_downloadCompletedIntent" msgid="8672701687104399228">"Tillader, at programmet sender meddelelser om afsluttede downloads. Ondsindede programmer kan bruge dette til at forvirre andre programmer, der downloader filer."</string>
<string name="permlab_seeAllExternal" product="nosdcard" msgid="4084575448409212628">"Se alle downloads til USB-lagr."</string>
<string name="permlab_seeAllExternal" product="default" msgid="140058400609165726">"Se alle downloads til SD-kort"</string>
- <string name="permdesc_seeAllExternal" msgid="3298948060016417104">"Gør det muligt for applikationen at se alle downloads til SD-kortet, uanset hvilken applikation, der downloadede dem."</string>
+ <string name="permdesc_seeAllExternal" msgid="3298948060016417104">"Gør det muligt for programmet at se alle downloads til SD-kortet, uanset hvilket program, der downloadede dem."</string>
<string name="permlab_downloadCacheNonPurgeable" msgid="3069534308882047412">"Reserver plads i downloadcache"</string>
<string name="permdesc_downloadCacheNonPurgeable" msgid="1089583021652571424">"Programmet kan downloade filer til downloadcachen, som ikke automatisk kan slettes, når downloadmanageren har brug for mere plads."</string>
<string name="permlab_downloadWithoutNotification" msgid="8837971946078327262">"download filer uden meddelelse"</string>
- <string name="permdesc_downloadWithoutNotification" msgid="5174806530123417020">"Tillader, at applikationen kan downloade filer via downloadmanageren, uden at brugeren underrettes."</string>
+ <string name="permdesc_downloadWithoutNotification" msgid="5174806530123417020">"Tillader, at programmet kan downloade filer via downloadmanageren, uden at brugeren underrettes."</string>
<string name="permlab_accessAllDownloads" msgid="2436240495424393717">"Adgang til alle systemdownloads"</string>
- <string name="permdesc_accessAllDownloads" msgid="4575801130424505112">"Giver applikationen tilladelse til at få vist og ændre alt, der igangsættes af en anden applikation i systemet."</string>
+ <string name="permdesc_accessAllDownloads" msgid="4575801130424505112">"Giver programmet tilladelse til at få vist og ændre alt, der igangsættes af et andet program i systemet."</string>
<string name="download_unknown_title" msgid="7015124071247271585">"&lt;Uden titel&gt;"</string>
<string name="notification_filename_separator" msgid="7147189522857807618">", "</string>
<string name="notification_filename_extras" msgid="5549729917695688191">" og <xliff:g id="NUMBER">%d</xliff:g> mere"</string>
diff --git a/res/values-de/strings.xml b/res/values-de/strings.xml
index cfcae0a9..f129dc59 100644
--- a/res/values-de/strings.xml
+++ b/res/values-de/strings.xml
@@ -36,7 +36,7 @@
<string name="notification_filename_separator" msgid="7147189522857807618">", "</string>
<string name="notification_filename_extras" msgid="5549729917695688191">" und <xliff:g id="NUMBER">%d</xliff:g> weitere"</string>
<string name="notification_download_complete" msgid="840713937779273632">"Ladevorgang abgeschlossen"</string>
- <string name="notification_download_failed" msgid="5343637375905111462">"Download fehlgeschlagen"</string>
+ <string name="notification_download_failed" msgid="5343637375905111462">"Fehler beim Ladevorgang"</string>
<string name="notification_need_wifi_for_size" msgid="5973127997598540499">"Downloadgröße erfordert WLAN"</string>
<string name="wifi_required_title" msgid="1995971416871498179">"Download zu groß für Netzwerk dieses Betreibers."</string>
<string name="wifi_required_body" msgid="1675692697446715831">"Dieser Download (<xliff:g id="SIZE">%s </xliff:g>) ist nur über WLAN möglich. "\n\n"Klicken Sie auf <xliff:g id="QUEUE_TEXT">%s </xliff:g> und der Download wird bei Ihrer nächsten WLAN-Einwahl durchgeführt."</string>
diff --git a/res/values-ms/strings.xml b/res/values-ms/strings.xml
new file mode 100644
index 00000000..28111638
--- /dev/null
+++ b/res/values-ms/strings.xml
@@ -0,0 +1,67 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- Copyright (C) 2007 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ -->
+
+<resources xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
+ <string name="app_label" msgid="3658948994665187911">"Pengurus Muat Turun"</string>
+ <string name="permlab_downloadManager" msgid="7779544811202855500">"Akses pengurus muat turun."</string>
+ <string name="permdesc_downloadManager" msgid="4240298564918160337">"Membolehkan aplikasi mengakses pengurus muat turun dan menggunakannya untuk memuat turun fail. Aplikasi berniat jahat boleh menggunakannya untuk mengganggu muat turun dan mengakses maklumat peribadi."</string>
+ <string name="permlab_downloadManagerAdvanced" msgid="7103642833308809655">"Fungsi pengurus muat turun lanjutan."</string>
+ <!-- no translation found for permdesc_downloadManagerAdvanced (6985743912436565114) -->
+ <skip />
+ <string name="permlab_downloadCompletedIntent" msgid="945913803765675685">"Hantar pemberitahuan muat turun."</string>
+ <string name="permdesc_downloadCompletedIntent" msgid="8672701687104399228">"Membenarkan aplikasi menghantar pemberitahuan mengenai muat turun yang selesai. Aplikasi berniat jahat boleh menggunakannya untuk mengelirukan aplikasi lain yang memuat turun fail."</string>
+ <!-- no translation found for permlab_seeAllExternal (4084575448409212628) -->
+ <skip />
+ <!-- no translation found for permlab_seeAllExternal (140058400609165726) -->
+ <skip />
+ <!-- no translation found for permdesc_seeAllExternal (3298948060016417104) -->
+ <skip />
+ <!-- no translation found for permlab_downloadCacheNonPurgeable (3069534308882047412) -->
+ <skip />
+ <!-- no translation found for permdesc_downloadCacheNonPurgeable (1089583021652571424) -->
+ <skip />
+ <!-- no translation found for permlab_downloadWithoutNotification (8837971946078327262) -->
+ <skip />
+ <!-- no translation found for permdesc_downloadWithoutNotification (5174806530123417020) -->
+ <skip />
+ <!-- no translation found for permlab_accessAllDownloads (2436240495424393717) -->
+ <skip />
+ <!-- no translation found for permdesc_accessAllDownloads (4575801130424505112) -->
+ <skip />
+ <string name="download_unknown_title" msgid="7015124071247271585">"&lt;Tidak bertajuk&gt;"</string>
+ <string name="notification_filename_separator" msgid="7147189522857807618">", "</string>
+ <!-- no translation found for notification_filename_extras (5549729917695688191) -->
+ <skip />
+ <string name="notification_download_complete" msgid="840713937779273632">"Muat turun selesai"</string>
+ <string name="notification_download_failed" msgid="5343637375905111462">"Muat turun tidak berjaya"</string>
+ <!-- no translation found for notification_need_wifi_for_size (5973127997598540499) -->
+ <skip />
+ <!-- no translation found for wifi_required_title (1995971416871498179) -->
+ <skip />
+ <!-- no translation found for wifi_required_body (1675692697446715831) -->
+ <skip />
+ <!-- no translation found for wifi_recommended_title (7441589306734687400) -->
+ <skip />
+ <!-- no translation found for wifi_recommended_body (7574517147645381271) -->
+ <skip />
+ <!-- no translation found for button_queue_for_wifi (422576726189179221) -->
+ <skip />
+ <!-- no translation found for button_cancel_download (2430166148737975604) -->
+ <skip />
+ <!-- no translation found for button_start_now (792123674007840864) -->
+ <skip />
+</resources>
diff --git a/res/values-sw/strings.xml b/res/values-sw/strings.xml
new file mode 100644
index 00000000..74fada20
--- /dev/null
+++ b/res/values-sw/strings.xml
@@ -0,0 +1,54 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- Copyright (C) 2007 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ -->
+
+<resources xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
+ <string name="app_label" msgid="3658948994665187911">"Kidhibiti Vipakuzi"</string>
+ <!-- no translation found for permlab_downloadManager (7779544811202855500) -->
+ <skip />
+ <string name="permdesc_downloadManager" msgid="4240298564918160337">"Huruhusu programu kufikia kisimamizi vipakuzi na kukitumia ili kupakua faili. Programu mbaya za kompyuta zinaweza kutumia hii ili kutatiza vipakuzi na kufikia maelezo ya kibinafsi."</string>
+ <string name="permlab_downloadManagerAdvanced" msgid="7103642833308809655">"Vitendaji mahiri vya kisimamizi vipakuzi."</string>
+ <string name="permdesc_downloadManagerAdvanced" msgid="6985743912436565114">"Huruhusu programu kufikia vitendaji mahiri vya kisimamizi vipakuzi. Programu mbaya za kompyuta zinaweza kutumia hii ili kutatiza vipakuzi na kufikia maelezo ya kibinafsi."</string>
+ <string name="permlab_downloadCompletedIntent" msgid="945913803765675685">"Tuma arifa za vipakuzi."</string>
+ <string name="permdesc_downloadCompletedIntent" msgid="8672701687104399228">"Huruhusu programu kutuma arifa kuhusu vipakuzi vilivyokamilika. Programu hasidi zinaweza kutumia ili kuchanganya programu zingine za kupakua faili."</string>
+ <!-- outdated translation 140058400609165726 --> <string name="permlab_seeAllExternal" product="nosdcard" msgid="4084575448409212628">"Tazama vipakuzi vyote kwa kadi ya SD"</string>
+ <string name="permlab_seeAllExternal" product="default" msgid="140058400609165726">"Tazama vipakuzi vyote kwa kadi ya SD"</string>
+ <string name="permdesc_seeAllExternal" msgid="3298948060016417104">"Huruhusu programu kuona vipakuzi vyote kwa kadi ya SD, bila ya kuzingatia programu iliyovipakua."</string>
+ <string name="permlab_downloadCacheNonPurgeable" msgid="3069534308882047412">"Geuza nafasi katika kache ya kupakua"</string>
+ <string name="permdesc_downloadCacheNonPurgeable" msgid="1089583021652571424">"Huruhusu programu kupakua faili kwa kache ya kupakua ambayo haiwezi kufutwa kiotomatiki wakati kidhibiti cha vipakuzi kinahitaji nafasi zaidi."</string>
+ <string name="permlab_downloadWithoutNotification" msgid="8837971946078327262">"Pakua faili bila kutoa arifa"</string>
+ <string name="permdesc_downloadWithoutNotification" msgid="5174806530123417020">"Huruhusu programu kupakua faili kupitia kwa kidhibiti cha vipakuzi bila arifa yoyote kuonyeshwa kwa mtumiaji."</string>
+ <string name="permlab_accessAllDownloads" msgid="2436240495424393717">"Fikia vipakuzi vyote vya mfumo"</string>
+ <string name="permdesc_accessAllDownloads" msgid="4575801130424505112">"inaruhusu programu kuonyesha na kurekebisha uzinduzi wote kwa programu yoyote kwenye mfumo."</string>
+ <!-- no translation found for download_unknown_title (7015124071247271585) -->
+ <skip />
+ <string name="notification_filename_separator" msgid="7147189522857807618">", "</string>
+ <string name="notification_filename_extras" msgid="5549729917695688191">" na <xliff:g id="NUMBER">%d</xliff:g> zaidi"</string>
+ <!-- no translation found for notification_download_complete (840713937779273632) -->
+ <skip />
+ <!-- no translation found for notification_download_failed (5343637375905111462) -->
+ <skip />
+ <string name="notification_need_wifi_for_size" msgid="5973127997598540499">"Ukubwa wa kipakuzi unahitaji Wi-Fi"</string>
+ <string name="wifi_required_title" msgid="1995971416871498179">"Kipakuzi ni kikubwa zaidi kwa mtandao wa mtoa huduma"</string>
+ <!-- no translation found for wifi_required_body (1675692697446715831) -->
+ <skip />
+ <string name="wifi_recommended_title" msgid="7441589306734687400">"Weka katika foleni ya kupakulia baadaye?"</string>
+ <!-- no translation found for wifi_recommended_body (7574517147645381271) -->
+ <skip />
+ <string name="button_queue_for_wifi" msgid="422576726189179221">"Foleni"</string>
+ <string name="button_cancel_download" msgid="2430166148737975604">"Ghairi"</string>
+ <string name="button_start_now" msgid="792123674007840864">"Anza sasa"</string>
+</resources>
diff --git a/res/values-zu/strings.xml b/res/values-zu/strings.xml
new file mode 100644
index 00000000..87489edc
--- /dev/null
+++ b/res/values-zu/strings.xml
@@ -0,0 +1,54 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- Copyright (C) 2007 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ -->
+
+<resources xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
+ <string name="app_label" msgid="3658948994665187911">"Umphathi wokulayisha"</string>
+ <!-- no translation found for permlab_downloadManager (7779544811202855500) -->
+ <skip />
+ <string name="permdesc_downloadManager" msgid="4240298564918160337">"Ivumela uhlelo lokusebenza ukulayisha umphathi nokumsebenzisela ukulayisha amafayela. Izinhlelo zokusebenza ezinonya zingase zisebenzise lokhu ukuphazamisa ukulayisha kanye nokufinyelele ukwaziswa okuyimfihlo."</string>
+ <string name="permlab_downloadManagerAdvanced" msgid="7103642833308809655">"Izici zomphathi wokulayisha othuthukisiwe."</string>
+ <string name="permdesc_downloadManagerAdvanced" msgid="6985743912436565114">"Ivumela uhlelo lokusebenza ukufinyelela izici ezithuthukisiwe zomphathi wokulayisha. Izinhlelo zokusebenza ezinonya zingase zisebenzise lokhu ukuphazamisa ukulayisha kanye nokufinyelele ukwaziswa okuyimfihlo."</string>
+ <string name="permlab_downloadCompletedIntent" msgid="945913803765675685">"Thumela izaziso zokulayisha"</string>
+ <string name="permdesc_downloadCompletedIntent" msgid="8672701687104399228">"Ivumela izinhlelo ukuthumela izaziso mayelana nokulayisha okuqediwe. Izinhlelo zokusebenza ezininya zingase zisebenzise lokhu ukudida ezinye izinhlelo zokusebenza lezo ezilayisha amafayela."</string>
+ <!-- outdated translation 140058400609165726 --> <string name="permlab_seeAllExternal" product="nosdcard" msgid="4084575448409212628">"Bona konke ukulanda ekhadini le-SD"</string>
+ <string name="permlab_seeAllExternal" product="default" msgid="140058400609165726">"Bona konke ukulanda ekhadini le-SD"</string>
+ <string name="permdesc_seeAllExternal" msgid="3298948060016417104">"Ivumela uhlelo lokusebenza ukubona konke ukulanda ekhadini le-SD, ngaphandle kokuthi yiluphi uhlelo lokusebenza olulandile."</string>
+ <string name="permlab_downloadCacheNonPurgeable" msgid="3069534308882047412">"Igcina isikhala ekulondolozeni kwesikhashana kokulanda"</string>
+ <string name="permdesc_downloadCacheNonPurgeable" msgid="1089583021652571424">"Ivumela uhlelo lokusebenza ukulanda amafayela ekulondolozeni kwesikhashana kokulanda okungakwazi ukususwa ngokuzenzakalelayo lapho imeneja yokulanda idinga isikhala esanele."</string>
+ <string name="permlab_downloadWithoutNotification" msgid="8837971946078327262">"landa amafayela ngaphandle kwesaziso"</string>
+ <string name="permdesc_downloadWithoutNotification" msgid="5174806530123417020">"Ivumela uhlelo lokusebenza ukulanda amafayela ngomeneja wokulanda ngaphandle kokuba isaziso siboniswe umsebenzisi."</string>
+ <string name="permlab_accessAllDownloads" msgid="2436240495424393717">"Finyelela konke ukulanda kwesistimu"</string>
+ <string name="permdesc_accessAllDownloads" msgid="4575801130424505112">"Ivumela uhlelo lokusebenza ukubuka nokulungisa konke okuqaliswe yinoma yiluphi uhlelo lokusebenza kwisistimu."</string>
+ <!-- no translation found for download_unknown_title (7015124071247271585) -->
+ <skip />
+ <string name="notification_filename_separator" msgid="7147189522857807618">", "</string>
+ <string name="notification_filename_extras" msgid="5549729917695688191">" nokungu-<xliff:g id="NUMBER">%d</xliff:g> okungaphezulu"</string>
+ <!-- no translation found for notification_download_complete (840713937779273632) -->
+ <skip />
+ <!-- no translation found for notification_download_failed (5343637375905111462) -->
+ <skip />
+ <string name="notification_need_wifi_for_size" msgid="5973127997598540499">"Usayizi wokulanda udinga i-Wi-Fi"</string>
+ <string name="wifi_required_title" msgid="1995971416871498179">"Ukulanda kukhulu kakhulu"</string>
+ <!-- no translation found for wifi_required_body (1675692697446715831) -->
+ <skip />
+ <string name="wifi_recommended_title" msgid="7441589306734687400">"Linda ukulanda emva kwesikhathi?"</string>
+ <!-- no translation found for wifi_recommended_body (7574517147645381271) -->
+ <skip />
+ <string name="button_queue_for_wifi" msgid="422576726189179221">"Umugqa"</string>
+ <string name="button_cancel_download" msgid="2430166148737975604">"Khansela"</string>
+ <string name="button_start_now" msgid="792123674007840864">"Qala manje"</string>
+</resources>
diff --git a/src/com/android/providers/downloads/Constants.java b/src/com/android/providers/downloads/Constants.java
index ef0c6dbb..977f00b9 100644
--- a/src/com/android/providers/downloads/Constants.java
+++ b/src/com/android/providers/downloads/Constants.java
@@ -91,10 +91,6 @@ public class Constants {
/** The default user agent used for downloads */
public static final String DEFAULT_USER_AGENT = "AndroidDownloadManager";
- /** The MIME type of special DRM files */
- public static final String MIMETYPE_DRM_MESSAGE =
- android.drm.mobile1.DrmRawContent.DRM_MIMETYPE_MESSAGE_STRING;
-
/** The MIME type of APKs */
public static final String MIMETYPE_APK = "application/vnd.android.package";
diff --git a/src/com/android/providers/downloads/DownloadDrmHelper.java b/src/com/android/providers/downloads/DownloadDrmHelper.java
new file mode 100644
index 00000000..10cb792c
--- /dev/null
+++ b/src/com/android/providers/downloads/DownloadDrmHelper.java
@@ -0,0 +1,110 @@
+/*
+ * Copyright (C) 2011 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+package com.android.providers.downloads;
+
+import android.content.Context;
+import android.drm.DrmManagerClient;
+import android.util.Log;
+
+public class DownloadDrmHelper {
+
+ /** The MIME type of special DRM files */
+ public static final String MIMETYPE_DRM_MESSAGE = "application/vnd.oma.drm.message";
+
+ /** The extensions of special DRM files */
+ public static final String EXTENSION_DRM_MESSAGE = ".dm";
+
+ public static final String EXTENSION_INTERNAL_FWDL = ".fl";
+
+ /**
+ * Checks if the Media Type is a DRM Media Type
+ *
+ * @param drmManagerClient A DrmManagerClient
+ * @param mimetype Media Type to check
+ * @return True if the Media Type is DRM else false
+ */
+ public static boolean isDrmMimeType(Context context, String mimetype) {
+ boolean result = false;
+ if (context != null) {
+ try {
+ DrmManagerClient drmClient = new DrmManagerClient(context);
+ if (drmClient != null && mimetype != null && mimetype.length() > 0) {
+ result = drmClient.canHandle("", mimetype);
+ }
+ } catch (IllegalArgumentException e) {
+ Log.w(Constants.TAG,
+ "DrmManagerClient instance could not be created, context is Illegal.");
+ } catch (IllegalStateException e) {
+ Log.w(Constants.TAG, "DrmManagerClient didn't initialize properly.");
+ }
+ }
+ return result;
+ }
+
+ /**
+ * Checks if the Media Type needs to be DRM converted
+ *
+ * @param mimetype Media type of the content
+ * @return True if convert is needed else false
+ */
+ public static boolean isDrmConvertNeeded(String mimetype) {
+ return MIMETYPE_DRM_MESSAGE.equals(mimetype);
+ }
+
+ /**
+ * Modifies the file extension for a DRM Forward Lock file NOTE: This
+ * function shouldn't be called if the file shouldn't be DRM converted
+ */
+ public static String modifyDrmFwLockFileExtension(String filename) {
+ if (filename != null) {
+ int extensionIndex;
+ extensionIndex = filename.lastIndexOf(".");
+ if (extensionIndex != -1) {
+ filename = filename.substring(0, extensionIndex);
+ }
+ filename = filename.concat(EXTENSION_INTERNAL_FWDL);
+ }
+ return filename;
+ }
+
+ /**
+ * Gets the original mime type of DRM protected content.
+ *
+ * @param context The context
+ * @param path Path to the file
+ * @param containingMime The current mime type of of the file i.e. the
+ * containing mime type
+ * @return The original mime type of the file if DRM protected else the
+ * currentMime
+ */
+ public static String getOriginalMimeType(Context context, String path, String containingMime) {
+ String result = containingMime;
+ DrmManagerClient drmClient = new DrmManagerClient(context);
+ try {
+ if (drmClient.canHandle(path, null)) {
+ result = drmClient.getOriginalMimeType(path);
+ }
+ } catch (IllegalArgumentException ex) {
+ Log.w(Constants.TAG,
+ "Can't get original mime type since path is null or empty string.");
+ } catch (IllegalStateException ex) {
+ Log.w(Constants.TAG, "DrmManagerClient didn't initialize properly.");
+ }
+ return result;
+ }
+}
diff --git a/src/com/android/providers/downloads/DownloadHandler.java b/src/com/android/providers/downloads/DownloadHandler.java
new file mode 100644
index 00000000..29d34700
--- /dev/null
+++ b/src/com/android/providers/downloads/DownloadHandler.java
@@ -0,0 +1,105 @@
+/*
+ * Copyright (C) 2011 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.providers.downloads;
+
+import android.content.res.Resources;
+import android.util.Log;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.LinkedHashMap;
+
+public class DownloadHandler {
+
+ private static final String TAG = "DownloadHandler";
+ private final LinkedHashMap<Long, DownloadInfo> mDownloadsQueue =
+ new LinkedHashMap<Long, DownloadInfo>();
+ private final HashMap<Long, DownloadInfo> mDownloadsInProgress =
+ new HashMap<Long, DownloadInfo>();
+ private static final DownloadHandler mDownloadHandler = new DownloadHandler();
+ private final int mMaxConcurrentDownloadsAllowed = Resources.getSystem().getInteger(
+ com.android.internal.R.integer.config_MaxConcurrentDownloadsAllowed);
+
+ static DownloadHandler getInstance() {
+ return mDownloadHandler;
+ }
+
+ synchronized void enqueueDownload(DownloadInfo info) {
+ if (!mDownloadsQueue.containsKey(info.mId)) {
+ if (Constants.LOGV) {
+ Log.i(TAG, "enqueued download. id: " + info.mId + ", uri: " + info.mUri);
+ }
+ mDownloadsQueue.put(info.mId, info);
+ startDownloadThread();
+ }
+ }
+
+ private synchronized void startDownloadThread() {
+ Iterator<Long> keys = mDownloadsQueue.keySet().iterator();
+ ArrayList<Long> ids = new ArrayList<Long>();
+ while (mDownloadsInProgress.size() < mMaxConcurrentDownloadsAllowed && keys.hasNext()) {
+ Long id = keys.next();
+ DownloadInfo info = mDownloadsQueue.get(id);
+ info.startDownloadThread();
+ ids.add(id);
+ mDownloadsInProgress.put(id, mDownloadsQueue.get(id));
+ if (Constants.LOGV) {
+ Log.i(TAG, "started download for : " + id);
+ }
+ }
+ for (Long id : ids) {
+ mDownloadsQueue.remove(id);
+ }
+ }
+
+ synchronized boolean hasDownloadInQueue(long id) {
+ return mDownloadsQueue.containsKey(id) || mDownloadsInProgress.containsKey(id);
+ }
+
+ synchronized void dequeueDownload(long mId) {
+ mDownloadsInProgress.remove(mId);
+ startDownloadThread();
+ if (mDownloadsInProgress.size() == 0 && mDownloadsQueue.size() == 0) {
+ notifyAll();
+ }
+ }
+
+ // right now this is only used by tests. but there is no reason why it can't be used
+ // by any module using DownloadManager (TODO add API to DownloadManager.java)
+ public synchronized void WaitUntilDownloadsTerminate() throws InterruptedException {
+ if (mDownloadsInProgress.size() == 0 && mDownloadsQueue.size() == 0) {
+ if (Constants.LOGVV) {
+ Log.i(TAG, "nothing to wait on");
+ }
+ return;
+ }
+ if (Constants.LOGVV) {
+ for (DownloadInfo info : mDownloadsInProgress.values()) {
+ Log.i(TAG, "** progress: " + info.mId + ", " + info.mUri);
+ }
+ for (DownloadInfo info : mDownloadsQueue.values()) {
+ Log.i(TAG, "** in Q: " + info.mId + ", " + info.mUri);
+ }
+ }
+ if (Constants.LOGVV) {
+ Log.i(TAG, "waiting for 5 sec");
+ }
+ // wait upto 5 sec
+ wait(5 * 1000);
+ }
+}
diff --git a/src/com/android/providers/downloads/DownloadInfo.java b/src/com/android/providers/downloads/DownloadInfo.java
index 2973937e..313386fe 100644
--- a/src/com/android/providers/downloads/DownloadInfo.java
+++ b/src/com/android/providers/downloads/DownloadInfo.java
@@ -23,7 +23,6 @@ import android.content.ContentValues;
import android.content.Context;
import android.content.Intent;
import android.database.Cursor;
-import android.drm.mobile1.DrmRawContent;
import android.net.ConnectivityManager;
import android.net.Uri;
import android.os.Environment;
@@ -33,6 +32,7 @@ import android.text.TextUtils;
import android.util.Log;
import android.util.Pair;
+import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
@@ -81,6 +81,7 @@ public class DownloadInfo {
info.mTotalBytes = getLong(Downloads.Impl.COLUMN_TOTAL_BYTES);
info.mCurrentBytes = getLong(Downloads.Impl.COLUMN_CURRENT_BYTES);
info.mETag = getString(Constants.ETAG);
+ info.mUid = getInt(Constants.UID);
info.mMediaScanned = getInt(Constants.MEDIA_SCANNED);
info.mDeleted = getInt(Downloads.Impl.COLUMN_DELETED) == 1;
info.mMediaProviderUri = getString(Downloads.Impl.COLUMN_MEDIAPROVIDER_URI);
@@ -204,6 +205,7 @@ public class DownloadInfo {
public long mTotalBytes;
public long mCurrentBytes;
public String mETag;
+ public int mUid;
public int mMediaScanned;
public boolean mDeleted;
public String mMediaProviderUri;
@@ -216,8 +218,6 @@ public class DownloadInfo {
public int mFuzz;
- public volatile boolean mHasActiveThread;
-
private List<Pair<String, String>> mRequestHeaders = new ArrayList<Pair<String, String>>();
private SystemFacade mSystemFacade;
private Context mContext;
@@ -279,7 +279,7 @@ public class DownloadInfo {
* should be started.
*/
private boolean isReadyToStart(long now) {
- if (mHasActiveThread) {
+ if (DownloadHandler.getInstance().hasDownloadInQueue(mId)) {
// already running
return false;
}
@@ -442,19 +442,13 @@ public class DownloadInfo {
if (Constants.LOGV) {
Log.v(Constants.TAG, "Service spawning thread to handle download " + mId);
}
- if (mHasActiveThread) {
- throw new IllegalStateException("Multiple threads on same download");
- }
if (mStatus != Impl.STATUS_RUNNING) {
mStatus = Impl.STATUS_RUNNING;
ContentValues values = new ContentValues();
values.put(Impl.COLUMN_STATUS, mStatus);
mContext.getContentResolver().update(getAllDownloadsUri(), values, null, null);
}
- DownloadThread downloader = new DownloadThread(mContext, mSystemFacade, this,
- storageManager);
- mHasActiveThread = true;
- mSystemFacade.startThread(downloader);
+ DownloadHandler.getInstance().enqueueDownload(this);
}
public boolean isOnCache() {
@@ -472,33 +466,29 @@ public class DownloadInfo {
return ContentUris.withAppendedId(Downloads.Impl.ALL_DOWNLOADS_CONTENT_URI, mId);
}
+ public void dump(PrintWriter writer) {
+ writer.println("DownloadInfo:");
+
+ writer.print(" mId="); writer.print(mId);
+ writer.print(" mLastMod="); writer.print(mLastMod);
+ writer.print(" mPackage="); writer.print(mPackage);
+ writer.print(" mUid="); writer.println(mUid);
+
+ writer.print(" mUri="); writer.print(mUri);
+ writer.print(" mMimeType="); writer.print(mMimeType);
+ writer.print(" mCookies="); writer.print((mCookies != null) ? "yes" : "no");
+ writer.print(" mReferer="); writer.println((mReferer != null) ? "yes" : "no");
+
+ writer.print(" mUserAgent="); writer.println(mUserAgent);
- public void logVerboseInfo() {
- Log.v(Constants.TAG, "Service adding new entry");
- Log.v(Constants.TAG, "ID : " + mId);
- Log.v(Constants.TAG, "URI : " + ((mUri != null) ? "yes" : "no"));
- Log.v(Constants.TAG, "NO_INTEG: " + mNoIntegrity);
- Log.v(Constants.TAG, "HINT : " + mHint);
- Log.v(Constants.TAG, "FILENAME: " + mFileName);
- Log.v(Constants.TAG, "MIMETYPE: " + mMimeType);
- Log.v(Constants.TAG, "DESTINAT: " + mDestination);
- Log.v(Constants.TAG, "VISIBILI: " + mVisibility);
- Log.v(Constants.TAG, "CONTROL : " + mControl);
- Log.v(Constants.TAG, "STATUS : " + mStatus);
- Log.v(Constants.TAG, "FAILED_C: " + mNumFailed);
- Log.v(Constants.TAG, "RETRY_AF: " + mRetryAfter);
- Log.v(Constants.TAG, "LAST_MOD: " + mLastMod);
- Log.v(Constants.TAG, "PACKAGE : " + mPackage);
- Log.v(Constants.TAG, "CLASS : " + mClass);
- Log.v(Constants.TAG, "COOKIES : " + ((mCookies != null) ? "yes" : "no"));
- Log.v(Constants.TAG, "AGENT : " + mUserAgent);
- Log.v(Constants.TAG, "REFERER : " + ((mReferer != null) ? "yes" : "no"));
- Log.v(Constants.TAG, "TOTAL : " + mTotalBytes);
- Log.v(Constants.TAG, "CURRENT : " + mCurrentBytes);
- Log.v(Constants.TAG, "ETAG : " + mETag);
- Log.v(Constants.TAG, "SCANNED : " + mMediaScanned);
- Log.v(Constants.TAG, "DELETED : " + mDeleted);
- Log.v(Constants.TAG, "MEDIAPROVIDER_URI : " + mMediaProviderUri);
+ writer.print(" mFileName="); writer.println(mFileName);
+
+ writer.print(" mStatus="); writer.print(mStatus);
+ writer.print(" mCurrentBytes="); writer.print(mCurrentBytes);
+ writer.print(" mTotalBytes="); writer.println(mTotalBytes);
+
+ writer.print(" mNumFailed="); writer.print(mNumFailed);
+ writer.print(" mRetryAfter="); writer.println(mRetryAfter);
}
/**
@@ -530,8 +520,7 @@ public class DownloadInfo {
&& (mDestination == Downloads.Impl.DESTINATION_EXTERNAL ||
mDestination == Downloads.Impl.DESTINATION_FILE_URI ||
mDestination == Downloads.Impl.DESTINATION_NON_DOWNLOADMANAGER_DOWNLOAD)
- && Downloads.Impl.isStatusSuccess(mStatus)
- && !DrmRawContent.DRM_MIMETYPE_MESSAGE_STRING.equalsIgnoreCase(mMimeType);
+ && Downloads.Impl.isStatusSuccess(mStatus);
}
void notifyPauseDueToSize(boolean isWifiRequired) {
@@ -543,4 +532,10 @@ public class DownloadInfo {
intent.putExtra(EXTRA_IS_WIFI_REQUIRED, isWifiRequired);
mContext.startActivity(intent);
}
+
+ void startDownloadThread() {
+ DownloadThread downloader = new DownloadThread(mContext, mSystemFacade, this,
+ StorageManager.getInstance(mContext));
+ mSystemFacade.startThread(downloader);
+ }
}
diff --git a/src/com/android/providers/downloads/DownloadProvider.java b/src/com/android/providers/downloads/DownloadProvider.java
index 8a2634f7..2c6d362a 100644
--- a/src/com/android/providers/downloads/DownloadProvider.java
+++ b/src/com/android/providers/downloads/DownloadProvider.java
@@ -17,6 +17,7 @@
package com.android.providers.downloads;
import android.app.DownloadManager;
+import android.app.DownloadManager.Request;
import android.content.ContentProvider;
import android.content.ContentUris;
import android.content.ContentValues;
@@ -725,12 +726,15 @@ public final class DownloadProvider extends ContentProvider {
if (getContext().checkCallingOrSelfPermission(Downloads.Impl.PERMISSION_NO_NOTIFICATION)
== PackageManager.PERMISSION_GRANTED) {
enforceAllowedValues(values, Downloads.Impl.COLUMN_VISIBILITY,
- Downloads.Impl.VISIBILITY_HIDDEN, Downloads.Impl.VISIBILITY_VISIBLE,
- DownloadManager.Request.VISIBILITY_VISIBLE_NOTIFY_ONLY_COMPLETION);
+ Request.VISIBILITY_HIDDEN,
+ Request.VISIBILITY_VISIBLE,
+ Request.VISIBILITY_VISIBLE_NOTIFY_COMPLETED,
+ Request.VISIBILITY_VISIBLE_NOTIFY_ONLY_COMPLETION);
} else {
enforceAllowedValues(values, Downloads.Impl.COLUMN_VISIBILITY,
- Downloads.Impl.VISIBILITY_VISIBLE,
- DownloadManager.Request.VISIBILITY_VISIBLE_NOTIFY_ONLY_COMPLETION);
+ Request.VISIBILITY_VISIBLE,
+ Request.VISIBILITY_VISIBLE_NOTIFY_COMPLETED,
+ Request.VISIBILITY_VISIBLE_NOTIFY_ONLY_COMPLETION);
}
// remove the rest of the columns that are allowed (with any value)
diff --git a/src/com/android/providers/downloads/DownloadReceiver.java b/src/com/android/providers/downloads/DownloadReceiver.java
index 7372e4ac..b01384bb 100644
--- a/src/com/android/providers/downloads/DownloadReceiver.java
+++ b/src/com/android/providers/downloads/DownloadReceiver.java
@@ -150,6 +150,7 @@ public class DownloadReceiver extends BroadcastReceiver {
}
Intent activityIntent = new Intent(Intent.ACTION_VIEW);
+ mimetype = DownloadDrmHelper.getOriginalMimeType(context, filename, mimetype);
activityIntent.setDataAndType(path, mimetype);
activityIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
try {
diff --git a/src/com/android/providers/downloads/DownloadService.java b/src/com/android/providers/downloads/DownloadService.java
index d4e50f23..bdbd388b 100644
--- a/src/com/android/providers/downloads/DownloadService.java
+++ b/src/com/android/providers/downloads/DownloadService.java
@@ -23,7 +23,6 @@ import android.app.AlarmManager;
import android.app.PendingIntent;
import android.app.Service;
import android.content.ComponentName;
-import android.content.ContentResolver;
import android.content.ContentValues;
import android.content.Context;
import android.content.Intent;
@@ -42,6 +41,8 @@ import android.text.TextUtils;
import android.util.Log;
import java.io.File;
+import java.io.FileDescriptor;
+import java.io.PrintWriter;
import java.util.HashSet;
import java.util.Map;
import java.util.Set;
@@ -556,4 +557,11 @@ public class DownloadService extends Service {
Log.w(Constants.TAG, "file: '" + path + "' couldn't be deleted", e);
}
}
+
+ @Override
+ protected void dump(FileDescriptor fd, PrintWriter writer, String[] args) {
+ for (DownloadInfo info : mDownloads.values()) {
+ info.dump(writer);
+ }
+ }
}
diff --git a/src/com/android/providers/downloads/DownloadThread.java b/src/com/android/providers/downloads/DownloadThread.java
index 735946c9..7ddfe959 100644
--- a/src/com/android/providers/downloads/DownloadThread.java
+++ b/src/com/android/providers/downloads/DownloadThread.java
@@ -21,14 +21,13 @@ import org.apache.http.conn.params.ConnRouteParams;
import android.content.ContentValues;
import android.content.Context;
import android.content.Intent;
-import android.drm.mobile1.DrmRawContent;
import android.net.http.AndroidHttpClient;
import android.net.Proxy;
+import android.net.TrafficStats;
import android.os.FileUtils;
import android.os.PowerManager;
import android.os.Process;
import android.provider.Downloads;
-import android.provider.DrmStore;
import android.text.TextUtils;
import android.util.Log;
import android.util.Pair;
@@ -56,6 +55,7 @@ public class DownloadThread extends Thread {
private final DownloadInfo mInfo;
private final SystemFacade mSystemFacade;
private final StorageManager mStorageManager;
+ private DrmConvertSession mDrmConvertSession;
public DownloadThread(Context context, SystemFacade systemFacade, DownloadInfo info,
StorageManager storageManager) {
@@ -138,13 +138,17 @@ public class DownloadThread extends Thread {
wakeLock = pm.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, Constants.TAG);
wakeLock.acquire();
-
if (Constants.LOGV) {
Log.v(Constants.TAG, "initiating download for " + mInfo.mUri);
}
client = AndroidHttpClient.newInstance(userAgent(), mContext);
+ // network traffic on this thread should be counted against the
+ // requesting uid, and is tagged with well-known value.
+ TrafficStats.setThreadStatsTag("android:DownloadManager");
+ TrafficStats.setThreadStatsUid(mInfo.mUid);
+
boolean finished = false;
while(!finished) {
Log.i(Constants.TAG, "Initiating request for download " + mInfo.mId);
@@ -171,23 +175,24 @@ public class DownloadThread extends Thread {
finalStatus = Downloads.Impl.STATUS_SUCCESS;
} catch (StopRequestException error) {
// remove the cause before printing, in case it contains PII
- errorMsg = "Aborting request for download " + mInfo.mId + ": " + error.getMessage();
- Log.w(Constants.TAG, errorMsg);
+ errorMsg = error.getMessage();
+ String msg = "Aborting request for download " + mInfo.mId + ": " + errorMsg;
+ Log.w(Constants.TAG, msg);
if (Constants.LOGV) {
- Log.w(Constants.TAG, errorMsg, error);
+ Log.w(Constants.TAG, msg, error);
}
finalStatus = error.mFinalStatus;
// fall through to finally block
} catch (Throwable ex) { //sometimes the socket code throws unchecked exceptions
- errorMsg = "Exception for id " + mInfo.mId + ": " + ex.getMessage();
- Log.w(Constants.TAG, errorMsg, ex);
+ errorMsg = ex.getMessage();
+ String msg = "Exception for id " + mInfo.mId + ": " + errorMsg;
+ Log.w(Constants.TAG, msg, ex);
finalStatus = Downloads.Impl.STATUS_UNKNOWN_ERROR;
// falls through to the code that reports an error
} finally {
- if (wakeLock != null) {
- wakeLock.release();
- wakeLock = null;
- }
+ TrafficStats.clearThreadStatsTag();
+ TrafficStats.clearThreadStatsUid();
+
if (client != null) {
client.close();
client = null;
@@ -196,7 +201,12 @@ public class DownloadThread extends Thread {
notifyDownloadCompleted(finalStatus, state.mCountRetry, state.mRetryAfter,
state.mGotData, state.mFilename,
state.mNewUri, state.mMimeType, errorMsg);
- mInfo.mHasActiveThread = false;
+ DownloadHandler.getInstance().dequeueDownload(mInfo.mId);
+
+ if (wakeLock != null) {
+ wakeLock.release();
+ wakeLock = null;
+ }
}
mStorageManager.incrementNumDownloadsSoFar();
}
@@ -279,13 +289,9 @@ public class DownloadThread extends Thread {
* Called after a successful completion to take any necessary action on the downloaded file.
*/
private void finalizeDestinationFile(State state) throws StopRequestException {
- if (isDrmFile(state)) {
- transferToDrm(state);
- } else {
- // make sure the file is readable
- FileUtils.setPermissions(state.mFilename, 0644, -1, -1);
- syncDestination(state);
- }
+ // make sure the file is readable
+ FileUtils.setPermissions(state.mFilename, 0644, -1, -1);
+ syncDestination(state);
}
/**
@@ -293,6 +299,10 @@ public class DownloadThread extends Thread {
* the downloaded file.
*/
private void cleanupDestination(State state, int finalStatus) {
+ if (mDrmConvertSession != null) {
+ finalStatus = mDrmConvertSession.close(state.mFilename);
+ }
+
closeDestination(state);
if (state.mFilename != null && Downloads.Impl.isStatusError(finalStatus)) {
new File(state.mFilename).delete();
@@ -330,30 +340,6 @@ public class DownloadThread extends Thread {
}
/**
- * @return true if the current download is a DRM file
- */
- private boolean isDrmFile(State state) {
- return DrmRawContent.DRM_MIMETYPE_MESSAGE_STRING.equalsIgnoreCase(state.mMimeType);
- }
-
- /**
- * Transfer the downloaded destination file to the DRM store.
- */
- private void transferToDrm(State state) throws StopRequestException {
- File file = new File(state.mFilename);
- Intent item = DrmStore.addDrmFile(mContext.getContentResolver(), file, null);
- file.delete();
-
- if (item == null) {
- throw new StopRequestException(Downloads.Impl.STATUS_UNKNOWN_ERROR,
- "unable to add file to DrmProvider");
- } else {
- state.mFilename = item.getDataString();
- state.mMimeType = item.getType();
- }
- }
-
- /**
* Close the destination output stream.
*/
private void closeDestination(State state) {
@@ -418,10 +404,16 @@ public class DownloadThread extends Thread {
}
mStorageManager.verifySpaceBeforeWritingToFile(mInfo.mDestination, state.mFilename,
bytesRead);
- state.mStream.write(data, 0, bytesRead);
- if (mInfo.mDestination == Downloads.Impl.DESTINATION_EXTERNAL
- && !isDrmFile(state)) {
- closeDestination(state);
+ if (!DownloadDrmHelper.isDrmConvertNeeded(mInfo.mMimeType)) {
+ state.mStream.write(data, 0, bytesRead);
+ } else {
+ byte[] convertedData = mDrmConvertSession.convert(data, bytesRead);
+ if (convertedData != null) {
+ state.mStream.write(convertedData, 0, convertedData.length);
+ } else {
+ throw new StopRequestException(Downloads.Impl.STATUS_FILE_ERROR,
+ "Error converting drm data.");
+ }
}
return;
} catch (IOException ex) {
@@ -431,6 +423,10 @@ public class DownloadThread extends Thread {
if (state.mStream != null) {
mStorageManager.verifySpace(mInfo.mDestination, state.mFilename, bytesRead);
}
+ } finally {
+ if (mInfo.mDestination == Downloads.Impl.DESTINATION_EXTERNAL) {
+ closeDestination(state);
+ }
}
}
}
@@ -525,6 +521,13 @@ public class DownloadThread extends Thread {
}
readResponseHeaders(state, innerState, response);
+ if (DownloadDrmHelper.isDrmConvertNeeded(state.mMimeType)) {
+ mDrmConvertSession = DrmConvertSession.open(mContext, state.mMimeType);
+ if (mDrmConvertSession == null) {
+ throw new StopRequestException(Downloads.Impl.STATUS_NOT_ACCEPTABLE, "Mimetype "
+ + state.mMimeType + " can not be converted.");
+ }
+ }
state.mFilename = Helpers.generateSaveFile(
mContext,
@@ -850,8 +853,7 @@ public class DownloadThread extends Thread {
}
}
- if (state.mStream != null && mInfo.mDestination == Downloads.Impl.DESTINATION_EXTERNAL
- && !isDrmFile(state)) {
+ if (state.mStream != null && mInfo.mDestination == Downloads.Impl.DESTINATION_EXTERNAL) {
closeDestination(state);
}
}
diff --git a/src/com/android/providers/downloads/DrmConvertSession.java b/src/com/android/providers/downloads/DrmConvertSession.java
new file mode 100644
index 00000000..d10edf14
--- /dev/null
+++ b/src/com/android/providers/downloads/DrmConvertSession.java
@@ -0,0 +1,171 @@
+/*
+ * Copyright (C) 2011 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+package com.android.providers.downloads;
+
+import android.content.Context;
+import android.drm.DrmConvertedStatus;
+import android.drm.DrmManagerClient;
+import android.util.Log;
+import android.provider.Downloads;
+
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.io.RandomAccessFile;
+
+
+public class DrmConvertSession {
+ private DrmManagerClient mDrmClient;
+ private int mConvertSessionId;
+
+ private DrmConvertSession(DrmManagerClient drmClient, int convertSessionId) {
+ mDrmClient = drmClient;
+ mConvertSessionId = convertSessionId;
+ }
+
+ /**
+ * Start of converting a file.
+ *
+ * @param context The context of the application running the convert session.
+ * @param mimeType Mimetype of content that shall be converted.
+ * @return A convert session or null in case an error occurs.
+ */
+ public static DrmConvertSession open(Context context, String mimeType) {
+ DrmManagerClient drmClient = null;
+ int convertSessionId = -1;
+ if (context != null && mimeType != null && !mimeType.equals("")) {
+ try {
+ drmClient = new DrmManagerClient(context);
+ try {
+ convertSessionId = drmClient.openConvertSession(mimeType);
+ } catch (IllegalArgumentException e) {
+ Log.w(Constants.TAG, "Conversion of Mimetype: " + mimeType
+ + " is not supported.", e);
+ } catch (IllegalStateException e) {
+ Log.w(Constants.TAG, "Could not access Open DrmFramework.", e);
+ }
+ } catch (IllegalArgumentException e) {
+ Log.w(Constants.TAG,
+ "DrmManagerClient instance could not be created, context is Illegal.");
+ } catch (IllegalStateException e) {
+ Log.w(Constants.TAG, "DrmManagerClient didn't initialize properly.");
+ }
+ }
+
+ if (drmClient == null || convertSessionId < 0) {
+ return null;
+ } else {
+ return new DrmConvertSession(drmClient, convertSessionId);
+ }
+ }
+ /**
+ * Convert a buffer of data to protected format.
+ *
+ * @param buffer Buffer filled with data to convert.
+ * @param size The number of bytes that shall be converted.
+ * @return A Buffer filled with converted data, if execution is ok, in all
+ * other case null.
+ */
+ public byte [] convert(byte[] inBuffer, int size) {
+ byte[] result = null;
+ if (inBuffer != null) {
+ DrmConvertedStatus convertedStatus = null;
+ try {
+ if (size != inBuffer.length) {
+ byte[] buf = new byte[size];
+ System.arraycopy(inBuffer, 0, buf, 0, size);
+ convertedStatus = mDrmClient.convertData(mConvertSessionId, buf);
+ } else {
+ convertedStatus = mDrmClient.convertData(mConvertSessionId, inBuffer);
+ }
+
+ if (convertedStatus != null &&
+ convertedStatus.statusCode == DrmConvertedStatus.STATUS_OK &&
+ convertedStatus.convertedData != null) {
+ result = convertedStatus.convertedData;
+ }
+ } catch (IllegalArgumentException e) {
+ Log.w(Constants.TAG, "Buffer with data to convert is illegal. Convertsession: "
+ + mConvertSessionId, e);
+ } catch (IllegalStateException e) {
+ Log.w(Constants.TAG, "Could not convert data. Convertsession: " +
+ mConvertSessionId, e);
+ }
+ } else {
+ throw new IllegalArgumentException("Parameter inBuffer is null");
+ }
+ return result;
+ }
+
+ /**
+ * Ends a conversion session of a file.
+ *
+ * @param fileName The filename of the converted file.
+ * @return Downloads.Impl.STATUS_SUCCESS if execution is ok.
+ * Downloads.Impl.STATUS_FILE_ERROR in case converted file can not
+ * be accessed. Downloads.Impl.STATUS_NOT_ACCEPTABLE if a problem
+ * occurs when accessing drm framework.
+ * Downloads.Impl.STATUS_UNKNOWN_ERROR if a general error occurred.
+ */
+ public int close(String filename) {
+ DrmConvertedStatus convertedStatus = null;
+ int result = Downloads.Impl.STATUS_UNKNOWN_ERROR;
+ if (mDrmClient != null && mConvertSessionId >= 0) {
+ try {
+ convertedStatus = mDrmClient.closeConvertSession(mConvertSessionId);
+ if (convertedStatus == null ||
+ convertedStatus.statusCode != DrmConvertedStatus.STATUS_OK ||
+ convertedStatus.convertedData == null) {
+ result = Downloads.Impl.STATUS_NOT_ACCEPTABLE;
+ } else {
+ RandomAccessFile rndAccessFile = null;
+ try {
+ rndAccessFile = new RandomAccessFile(filename, "rw");
+ rndAccessFile.seek(convertedStatus.offset);
+ rndAccessFile.write(convertedStatus.convertedData);
+ result = Downloads.Impl.STATUS_SUCCESS;
+ } catch (FileNotFoundException e) {
+ result = Downloads.Impl.STATUS_FILE_ERROR;
+ Log.w(Constants.TAG, "File: " + filename + " could not be found.", e);
+ } catch (IOException e) {
+ result = Downloads.Impl.STATUS_FILE_ERROR;
+ Log.w(Constants.TAG, "Could not access File: " + filename + " .", e);
+ } catch (IllegalArgumentException e) {
+ result = Downloads.Impl.STATUS_FILE_ERROR;
+ Log.w(Constants.TAG, "Could not open file in mode: rw", e);
+ } catch (SecurityException e) {
+ Log.w(Constants.TAG, "Access to File: " + filename +
+ " was denied denied by SecurityManager.", e);
+ } finally {
+ if (rndAccessFile != null) {
+ try {
+ rndAccessFile.close();
+ } catch (IOException e) {
+ result = Downloads.Impl.STATUS_FILE_ERROR;
+ Log.w(Constants.TAG, "Failed to close File:" + filename
+ + ".", e);
+ }
+ }
+ }
+ }
+ } catch (IllegalStateException e) {
+ Log.w(Constants.TAG, "Could not close convertsession. Convertsession: " +
+ mConvertSessionId, e);
+ }
+ }
+ return result;
+ }
+}
diff --git a/src/com/android/providers/downloads/Helpers.java b/src/com/android/providers/downloads/Helpers.java
index 359738aa..543b652d 100644
--- a/src/com/android/providers/downloads/Helpers.java
+++ b/src/com/android/providers/downloads/Helpers.java
@@ -20,12 +20,10 @@ import android.content.Context;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.content.pm.ResolveInfo;
-import android.drm.mobile1.DrmRawContent;
import android.net.Uri;
import android.os.Environment;
import android.os.SystemClock;
import android.provider.Downloads;
-import android.util.Config;
import android.util.Log;
import android.webkit.MimeTypeMap;
@@ -91,7 +89,11 @@ public class Helpers {
destination);
}
storageManager.verifySpace(destination, path, contentLength);
- return getFullPath(path, mimeType, destination, base);
+ path = getFullPath(path, mimeType, destination, base);
+ if (DownloadDrmHelper.isDrmConvertNeeded(mimeType)) {
+ path = DownloadDrmHelper.modifyDrmFwLockFileExtension(path);
+ }
+ return path;
}
static String getFullPath(String filename, String mimeType, int destination,
@@ -132,7 +134,7 @@ public class Helpers {
throw new StopRequestException(Downloads.Impl.STATUS_NOT_ACCEPTABLE,
"external download with no mime type not allowed");
}
- if (!DrmRawContent.DRM_MIMETYPE_MESSAGE_STRING.equalsIgnoreCase(mimeType)) {
+ if (!DownloadDrmHelper.isDrmMimeType(context, mimeType)) {
// Check to see if we are allowed to download this file. Only files
// that can be handled by the platform can be downloaded.
// special case DRM files, which we should always allow downloading.
@@ -384,7 +386,7 @@ public class Helpers {
} catch (RuntimeException ex) {
if (Constants.LOGV) {
Log.d(Constants.TAG, "invalid selection [" + selection + "] triggered " + ex);
- } else if (Config.LOGD) {
+ } else if (false) {
Log.d(Constants.TAG, "invalid selection triggered " + ex);
}
throw ex;
diff --git a/src/com/android/providers/downloads/StorageManager.java b/src/com/android/providers/downloads/StorageManager.java
index ed241794..228f6681 100644
--- a/src/com/android/providers/downloads/StorageManager.java
+++ b/src/com/android/providers/downloads/StorageManager.java
@@ -21,7 +21,6 @@ import android.content.Context;
import android.content.res.Resources;
import android.database.Cursor;
import android.database.sqlite.SQLiteException;
-import android.drm.mobile1.DrmRawContent;
import android.net.Uri;
import android.os.Environment;
import android.os.StatFs;
@@ -293,11 +292,6 @@ class StorageManager {
}
return base;
default:
- // DRM messages should be temporarily stored internally and then passed to
- // the DRM content provider
- if (DrmRawContent.DRM_MIMETYPE_MESSAGE_STRING.equalsIgnoreCase(mimeType)) {
- return mDownloadDataDir;
- }
throw new IllegalStateException("unexpected value for destination: " + destination);
}
}
diff --git a/tests/src/com/android/providers/downloads/AbstractDownloadManagerFunctionalTest.java b/tests/src/com/android/providers/downloads/AbstractDownloadManagerFunctionalTest.java
index 5283d425..d2ecf3e6 100644
--- a/tests/src/com/android/providers/downloads/AbstractDownloadManagerFunctionalTest.java
+++ b/tests/src/com/android/providers/downloads/AbstractDownloadManagerFunctionalTest.java
@@ -155,13 +155,12 @@ public abstract class AbstractDownloadManagerFunctionalTest extends
Context realContext = getContext();
mTestContext = new TestContext(realContext);
setupProviderAndResolver();
- assert isDatabaseEmpty(); // ensure we're not messing with real data
mTestContext.setResolver(mResolver);
setContext(mTestContext);
setupService();
getService().mSystemFacade = mSystemFacade;
-
+ assertTrue(isDatabaseEmpty()); // ensure we're not messing with real data
mServer = new MockWebServer();
mServer.play();
}
diff --git a/tests/src/com/android/providers/downloads/DownloadManagerFunctionalTest.java b/tests/src/com/android/providers/downloads/DownloadManagerFunctionalTest.java
index c3ac8904..e01b617f 100644
--- a/tests/src/com/android/providers/downloads/DownloadManagerFunctionalTest.java
+++ b/tests/src/com/android/providers/downloads/DownloadManagerFunctionalTest.java
@@ -23,6 +23,8 @@ import android.net.Uri;
import android.os.Environment;
import android.provider.Downloads;
import android.test.suitebuilder.annotation.LargeTest;
+import android.util.Log;
+
import tests.http.MockWebServer;
import tests.http.RecordedRequest;
@@ -37,6 +39,8 @@ import java.net.MalformedURLException;
*/
@LargeTest
public class DownloadManagerFunctionalTest extends AbstractDownloadManagerFunctionalTest {
+ private static final String TAG = "DownloadManagerFunctionalTest";
+
public DownloadManagerFunctionalTest() {
super(new FakeSystemFacade());
}
@@ -104,6 +108,17 @@ public class DownloadManagerFunctionalTest extends AbstractDownloadManagerFuncti
private void runUntilStatus(Uri downloadUri, int status) throws Exception {
runService();
+ boolean done = false;
+ while (!done) {
+ int rslt = getDownloadStatus(downloadUri);
+ if (rslt == Downloads.Impl.STATUS_RUNNING || rslt == Downloads.Impl.STATUS_PENDING) {
+ Log.i(TAG, "status is: " + rslt + ", for: " + downloadUri);
+ DownloadHandler.getInstance().WaitUntilDownloadsTerminate();
+ Thread.sleep(100);
+ } else {
+ done = true;
+ }
+ }
assertEquals(status, getDownloadStatus(downloadUri));
}
diff --git a/ui/res/values-am/strings.xml b/ui/res/values-am/strings.xml
new file mode 100644
index 00000000..3d549394
--- /dev/null
+++ b/ui/res/values-am/strings.xml
@@ -0,0 +1,60 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- Copyright (C) 2010 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ -->
+
+<resources xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
+ <string name="app_label" msgid="3070921713463294774">"የወረዱ"</string>
+ <!-- no translation found for download_title_sorted_by_date (5898014492155434221) -->
+ <skip />
+ <!-- no translation found for download_title_sorted_by_size (1417193166677094813) -->
+ <skip />
+ <string name="no_downloads" msgid="1029667411186146836">"ምንም አውርዶች የለም።"</string>
+ <string name="missing_title" msgid="830115697868833773">"&lt;ያልታወቀ&gt;"</string>
+ <!-- no translation found for button_sort_by_size (7331549713691146251) -->
+ <skip />
+ <!-- no translation found for button_sort_by_date (8800842892684101528) -->
+ <skip />
+ <string name="download_queued" msgid="104973307780629904">"ተሰልፏል"</string>
+ <string name="download_running" msgid="4656462962155580641">"በሂደት ላይ"</string>
+ <string name="download_success" msgid="7006048006543495236">"ተጠናቋል"</string>
+ <string name="download_error" msgid="3107369653921738690">"አልተሳካም"</string>
+ <!-- no translation found for dialog_title_not_available (4479021195995400471) -->
+ <skip />
+ <!-- no translation found for dialog_failed_body (587545111677064427) -->
+ <skip />
+ <!-- no translation found for dialog_title_queued_body (3062862079904954824) -->
+ <skip />
+ <string name="dialog_queued_body" msgid="2506935748423351902">"ፋይሉ ለወደፊት አውርድ ተሰልፏል።"</string>
+ <string name="dialog_file_missing_body" msgid="2783781332668129395">"የአውርዱን ፋይል ማግኘት አልተቻለም።"</string>
+ <string name="dialog_insufficient_space_on_external" msgid="7534108515812329821">"ማውረድ አይችልም። በውጪ ማህደረመረጃ ማከማቻ ላይ በቂ ቦታ የለም።"</string>
+ <string name="dialog_insufficient_space_on_cache" msgid="8387210487235302129">"ማውረድ አይችልም። በውጪ ማህደረመረጃ ማከማቻ ላይ በቂ ቦታ የለም።"</string>
+ <string name="dialog_cannot_resume" msgid="7704082031608361756">"አውርድ ተስተጓጉሏል። መቀጠል አይችልም።"</string>
+ <string name="dialog_file_already_exists" msgid="2663737850617642888">"ማውረድ አይችልም። መድረሻ ፋይል አስቀድሞ አለ።"</string>
+ <string name="dialog_media_not_found" msgid="5308602145105720991">"ማውረድ አይችልም። የውጪ ማህደረመረጃ የለም።"</string>
+ <string name="download_no_application_title" msgid="3501359021635168387">"ፋይል መክፈት አልተቻለም"</string>
+ <string name="remove_download" msgid="6372920256257247857">"አስወግድ"</string>
+ <string name="delete_download" msgid="76629022653866471">"ሰርዝ"</string>
+ <string name="keep_queued_download" msgid="5144882786014818569">"ጠብቅ"</string>
+ <string name="cancel_running_download" msgid="5232704030969221112">"ይቅር"</string>
+ <string name="retry_download" msgid="7617100787922717912">"እንደገና ሞክር"</string>
+ <!-- outdated translation 5638030443515705047 --> <string name="deselect_all" msgid="7986832738563338661">"ምርጫን አጥራ"</string>
+ <!-- no translation found for select_all (5854385570247421586) -->
+ <skip />
+ <!-- no translation found for selected_count (2101564570019753277) -->
+ <skip />
+ <!-- no translation found for download_share_dialog (3355867339806448955) -->
+ <skip />
+</resources>
diff --git a/ui/res/values-sw/strings.xml b/ui/res/values-sw/strings.xml
new file mode 100644
index 00000000..49c3135d
--- /dev/null
+++ b/ui/res/values-sw/strings.xml
@@ -0,0 +1,60 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- Copyright (C) 2010 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ -->
+
+<resources xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
+ <string name="app_label" msgid="3070921713463294774">"Vipakuzi"</string>
+ <!-- no translation found for download_title_sorted_by_date (5898014492155434221) -->
+ <skip />
+ <!-- no translation found for download_title_sorted_by_size (1417193166677094813) -->
+ <skip />
+ <string name="no_downloads" msgid="1029667411186146836">"Hakuna vipakuzi"</string>
+ <string name="missing_title" msgid="830115697868833773">"&lt;Haijulikani&gt;"</string>
+ <!-- no translation found for button_sort_by_size (7331549713691146251) -->
+ <skip />
+ <!-- no translation found for button_sort_by_date (8800842892684101528) -->
+ <skip />
+ <string name="download_queued" msgid="104973307780629904">"Zilizowekwa kwenye foleni"</string>
+ <string name="download_running" msgid="4656462962155580641">"Inaendelea"</string>
+ <string name="download_success" msgid="7006048006543495236">"Imekamilika"</string>
+ <string name="download_error" msgid="3107369653921738690">"Imeshindwa"</string>
+ <!-- no translation found for dialog_title_not_available (4479021195995400471) -->
+ <skip />
+ <!-- no translation found for dialog_failed_body (587545111677064427) -->
+ <skip />
+ <!-- no translation found for dialog_title_queued_body (3062862079904954824) -->
+ <skip />
+ <string name="dialog_queued_body" msgid="2506935748423351902">"Faili hii imewekwa kwenye foleni ya kupakuliwa hapo baadaye."</string>
+ <string name="dialog_file_missing_body" msgid="2783781332668129395">"Faili iliyopakuliwa haipatikani."</string>
+ <string name="dialog_insufficient_space_on_external" msgid="7534108515812329821">"Haiwezi kumaliza kupakua. Hakuna nafasi ya kutosha katika hifadhi ya nje."</string>
+ <string name="dialog_insufficient_space_on_cache" msgid="8387210487235302129">"Haiwezi kukamilisha kupakua. Hakuna nafasi ya kutosha kwenye hifadhi ya kupakua kwa ndani."</string>
+ <string name="dialog_cannot_resume" msgid="7704082031608361756">"Kupakua kumekatizwa. Hakuwezi kurudiwa."</string>
+ <string name="dialog_file_already_exists" msgid="2663737850617642888">"Haiwezi kupakua. Faili ya mwisho tayari ipo."</string>
+ <string name="dialog_media_not_found" msgid="5308602145105720991">"Haiwezi kupakua. Midia ya nje haipatikani."</string>
+ <string name="download_no_application_title" msgid="3501359021635168387">"Haiwezi kufungua faili"</string>
+ <string name="remove_download" msgid="6372920256257247857">"Ondoa"</string>
+ <string name="delete_download" msgid="76629022653866471">"Futa"</string>
+ <string name="keep_queued_download" msgid="5144882786014818569">"Weka"</string>
+ <string name="cancel_running_download" msgid="5232704030969221112">"Ghairi"</string>
+ <string name="retry_download" msgid="7617100787922717912">"Jaribu tena"</string>
+ <!-- outdated translation 5638030443515705047 --> <string name="deselect_all" msgid="7986832738563338661">"Ondoa uchaguzi"</string>
+ <!-- no translation found for select_all (5854385570247421586) -->
+ <skip />
+ <!-- no translation found for selected_count (2101564570019753277) -->
+ <skip />
+ <!-- no translation found for download_share_dialog (3355867339806448955) -->
+ <skip />
+</resources>
diff --git a/ui/res/values-zu/strings.xml b/ui/res/values-zu/strings.xml
new file mode 100644
index 00000000..01d1d33a
--- /dev/null
+++ b/ui/res/values-zu/strings.xml
@@ -0,0 +1,60 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- Copyright (C) 2010 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ -->
+
+<resources xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
+ <string name="app_label" msgid="3070921713463294774">"Okulayishiwe"</string>
+ <!-- no translation found for download_title_sorted_by_date (5898014492155434221) -->
+ <skip />
+ <!-- no translation found for download_title_sorted_by_size (1417193166677094813) -->
+ <skip />
+ <string name="no_downloads" msgid="1029667411186146836">"Akukho okulandiwe."</string>
+ <string name="missing_title" msgid="830115697868833773">"&lt;Akwaziwa&gt;"</string>
+ <!-- no translation found for button_sort_by_size (7331549713691146251) -->
+ <skip />
+ <!-- no translation found for button_sort_by_date (8800842892684101528) -->
+ <skip />
+ <string name="download_queued" msgid="104973307780629904">"Kusemugqeni"</string>
+ <string name="download_running" msgid="4656462962155580641">"Kuyaqhubeka"</string>
+ <string name="download_success" msgid="7006048006543495236">"Qedile"</string>
+ <string name="download_error" msgid="3107369653921738690">"Kwehlulekile"</string>
+ <!-- no translation found for dialog_title_not_available (4479021195995400471) -->
+ <skip />
+ <!-- no translation found for dialog_failed_body (587545111677064427) -->
+ <skip />
+ <!-- no translation found for dialog_title_queued_body (3062862079904954824) -->
+ <skip />
+ <string name="dialog_queued_body" msgid="2506935748423351902">"Ifayela ilinde ukulanda kwesikhathi esizayo"</string>
+ <string name="dialog_file_missing_body" msgid="2783781332668129395">"Ifayela elandiwe ayitholakali"</string>
+ <string name="dialog_insufficient_space_on_external" msgid="7534108515812329821">"Ayikwazi ukuqeda ukulanda. Asikho isikhala esanele ekulondolozeni kwangaphandle."</string>
+ <string name="dialog_insufficient_space_on_cache" msgid="8387210487235302129">"Ayikwazi ukuqedela ukulanda. Asikho isikhala esanele ekulondolozeni ukulanda kwangaphakathi."</string>
+ <string name="dialog_cannot_resume" msgid="7704082031608361756">"Ukulayisha kuphazanyisiwe. Ngeke kuqaliswe futhi."</string>
+ <string name="dialog_file_already_exists" msgid="2663737850617642888">"Ayikwazi ukulanda. Ifayela yendawo ivele ikhona."</string>
+ <string name="dialog_media_not_found" msgid="5308602145105720991">"Ayikwazi ukulanda. Imidiya yangaphakathi ayitholakali."</string>
+ <string name="download_no_application_title" msgid="3501359021635168387">"Ayikwazi ukuvula ifayela"</string>
+ <string name="remove_download" msgid="6372920256257247857">"Khipha"</string>
+ <string name="delete_download" msgid="76629022653866471">"Susa"</string>
+ <string name="keep_queued_download" msgid="5144882786014818569">"Gcina"</string>
+ <string name="cancel_running_download" msgid="5232704030969221112">"Khansela"</string>
+ <string name="retry_download" msgid="7617100787922717912">"Zama futhi"</string>
+ <!-- outdated translation 5638030443515705047 --> <string name="deselect_all" msgid="7986832738563338661">"Sula ukhetho"</string>
+ <!-- no translation found for select_all (5854385570247421586) -->
+ <skip />
+ <!-- no translation found for selected_count (2101564570019753277) -->
+ <skip />
+ <!-- no translation found for download_share_dialog (3355867339806448955) -->
+ <skip />
+</resources>