Whoops, clear identity to get internal columns.
Jeff Sharkey [Wed, 6 Aug 2014 01:04:54 +0000 (18:04 -0700)]
Bug: 16822344
Change-Id: Ib90e171cbb7babc7a3eea59de5cb899c79fadf94

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

index 5b45c3f..4b23024 100644 (file)
@@ -821,6 +821,16 @@ public final class DownloadProvider extends ContentProvider {
         throw new SecurityException("Invalid value for " + column + ": " + value);
     }
 
+    private Cursor queryCleared(Uri uri, String[] projection, String selection,
+            String[] selectionArgs, String sort) {
+        final long token = Binder.clearCallingIdentity();
+        try {
+            return query(uri, projection, selection, selectionArgs, sort);
+        } finally {
+            Binder.restoreCallingIdentity(token);
+        }
+    }
+
     /**
      * Starts a database query
      */
@@ -1182,7 +1192,7 @@ public final class DownloadProvider extends ContentProvider {
             logVerboseOpenFileInfo(uri, mode);
         }
 
-        final Cursor cursor = query(uri, new String[] {
+        final Cursor cursor = queryCleared(uri, new String[] {
                 Downloads.Impl._DATA, Downloads.Impl.COLUMN_STATUS,
                 Downloads.Impl.COLUMN_DESTINATION, Downloads.Impl.COLUMN_MEDIA_SCANNED }, null,
                 null, null);