Change destination paths to comply with enforcement
Since the framework is now enforcing that destination paths be clear and
a specific source-uri format for multi-part downloads, change the
testapps to comply with that.
Change-Id: I5361d1b09c37c11546c050fd39c9c4eb6ace19a8
diff --git a/testapps/EmbmsTestDownloadApp/src/com/android/phone/testapps/embmsdownload/EmbmsTestDownloadApp.java b/testapps/EmbmsTestDownloadApp/src/com/android/phone/testapps/embmsdownload/EmbmsTestDownloadApp.java
index 3937bbd..9caa620 100644
--- a/testapps/EmbmsTestDownloadApp/src/com/android/phone/testapps/embmsdownload/EmbmsTestDownloadApp.java
+++ b/testapps/EmbmsTestDownloadApp/src/com/android/phone/testapps/embmsdownload/EmbmsTestDownloadApp.java
@@ -270,12 +270,17 @@
private void performDownload(FileServiceInfo info) {
File destination = null;
+ Uri.Builder sourceUriBuilder = new Uri.Builder()
+ .scheme(FILE_DOWNLOAD_SCHEME)
+ .authority(FILE_AUTHORITY);
try {
if (info.getFiles().size() > 1) {
- destination = new File(getFilesDir(), "images/").getCanonicalFile();
+ destination = new File(getFilesDir(), "images/animals/").getCanonicalFile();
destination.mkdirs();
+ sourceUriBuilder.path("/*");
} else {
destination = new File(getFilesDir(), "images/image.png").getCanonicalFile();
+ sourceUriBuilder.path("/image.png");
}
} catch (IOException e) {
// ignore
@@ -284,16 +289,10 @@
Intent completionIntent = new Intent(DOWNLOAD_DONE_ACTION);
completionIntent.setClass(this, DownloadCompletionReceiver.class);
- Uri sourceUri = new Uri.Builder()
- .scheme(FILE_DOWNLOAD_SCHEME)
- .authority(FILE_AUTHORITY)
- .path("/")
- .build();
-
DownloadRequest request = new DownloadRequest.Builder()
.setId(0)
.setServiceInfo(info)
- .setSource(sourceUri)
+ .setSource(sourceUriBuilder.build())
.setDest(Uri.fromFile(destination))
.setAppIntent(completionIntent)
.setSubscriptionId(SubscriptionManager.getDefaultSubscriptionId())