Temporary fix to support old URIs for Market
Steve Howard [Fri, 17 Sep 2010 23:55:25 +0000 (16:55 -0700)]
Market has its own copies of the download manager URIs.  This change
bring back support for those so Market will keep working until they
can properly update their code.

Change-Id: I283ea65931085c0f083a182842d362c113427537

AndroidManifest.xml
src/com/android/providers/downloads/DownloadProvider.java

index 9da6fc8..6108ac2 100644 (file)
@@ -61,6 +61,9 @@
                these URIs -->
           <path-permission android:pathPrefix="/my_downloads"
                            android:permission="android.permission.INTERNET"/>
+          <!-- Temporary, for backwards compatibility -->
+          <path-permission android:pathPrefix="/download"
+                           android:permission="android.permission.INTERNET"/>
           <!-- Apps with access to /all_downloads/... can grant permissions, allowing them to share
                downloaded files with other viewers -->
           <grant-uri-permission android:pathPrefix="/all_downloads/"/>
index 17f3d81..edbfb78 100644 (file)
@@ -39,7 +39,6 @@ import android.os.Environment;
 import android.os.ParcelFileDescriptor;
 import android.os.Process;
 import android.provider.Downloads;
-import android.util.Config;
 import android.util.Log;
 
 import com.google.common.annotations.VisibleForTesting;
@@ -90,6 +89,12 @@ public final class DownloadProvider extends ContentProvider {
         sURIMatcher.addURI("downloads",
                 "all_downloads/#/" + Downloads.Impl.RequestHeaders.URI_SEGMENT,
                 REQUEST_HEADERS_URI);
+        // temporary, for backwards compatibility
+        sURIMatcher.addURI("downloads", "download", MY_DOWNLOADS);
+        sURIMatcher.addURI("downloads", "download/#", MY_DOWNLOADS_ID);
+        sURIMatcher.addURI("downloads",
+                "download/#/" + Downloads.Impl.RequestHeaders.URI_SEGMENT,
+                REQUEST_HEADERS_URI);
     }
 
     /** Different base URIs that could be used to access an individual download */