Add Downloads.Impl.COLUMN_MEDIASTORE_URI & DownloadColumns.Description.

Entries from DownloadProvider are added to MediaStore Downloads
collection. COLUMN_MEDIASTORE_URI will be used to track corresponding
entries in MediaProvider. We can't re-use COLUMN_MEDIAPROVIDER_URI
for this purpose because it is updateable by apps.

Bug: 120876251
Test: atest DownloadProviderTests
Test: atest cts/tests/app/src/android/app/cts/DownloadManagerTest.java
Test: atest MediaProviderTests
Test: atest cts/tests/tests/provider/src/android/provider/cts/MediaStore*
Change-Id: Ifd252c54f4ee739a31be2866896efac6696a088e
This commit is contained in:
Sudheer Shanka
2018-12-16 15:52:33 -08:00
parent 3b1b9f7c6d
commit fe7668ab4d
4 changed files with 30 additions and 1 deletions

View File

@@ -38047,6 +38047,7 @@ package android.provider {
}
public static abstract interface MediaStore.DownloadColumns implements android.provider.MediaStore.MediaColumns {
field public static final java.lang.String DESCRIPTION = "description";
field public static final java.lang.String DOWNLOAD_URI = "download_uri";
field public static final java.lang.String REFERER_URI = "referer_uri";
}

View File

@@ -408,6 +408,15 @@ public final class Downloads {
*/
public static final String COLUMN_MEDIAPROVIDER_URI = "mediaprovider_uri";
/**
* Similar to {@link #COLUMN_MEDIAPROVIDER_URI}, except this cannot be updated/queried
* by apps and will be the source of truth when updating/deleting download entries in
* MediaProvider database.
*
* <P>Type: TEXT</P>
*/
public static final String COLUMN_MEDIASTORE_URI = "mediastore_uri";
/**
* The column that is used to remember whether the media scanner was invoked.
* It can take the values: null or 0(not scanned), 1(scanned), 2 (not scannable).

View File

@@ -1025,6 +1025,11 @@ public final class MediaStore {
return AUTHORITY_URI.buildUpon().appendPath(volumeName).appendPath("dir").build();
}
/** @hide */
public static final Uri getContentUriForPath(String path) {
return getContentUri(getVolumeNameForPath(path));
}
/**
* Fields for master table for all media files.
* Table also contains MediaColumns._ID, DATA, SIZE and DATE_MODIFIED.
@@ -1131,6 +1136,13 @@ public final class MediaStore {
* Type: TEXT
*/
String REFERER_URI = "referer_uri";
/**
* The description of the download.
* <p>
* Type: Text
*/
String DESCRIPTION = "description";
}
/**

View File

@@ -119,7 +119,7 @@ public class MockContentProvider extends ContentProvider {
@Override
public IBinder asBinder() {
throw new UnsupportedOperationException();
return MockContentProvider.this.getIContentProviderBinder();
}
@Override
@@ -278,6 +278,13 @@ public class MockContentProvider extends ContentProvider {
return mIContentProvider;
}
/**
* @hide
*/
public IBinder getIContentProviderBinder() {
throw new UnsupportedOperationException("unimplemented mock method");
}
/**
* Like {@link #attachInfo(Context, android.content.pm.ProviderInfo)}, but for use
* when directly instantiating the provider for testing.