summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorbsears <bsears@google.com>2019-08-01 01:37:04 (GMT)
committerandroid-build-merger <android-build-merger@google.com>2019-08-01 01:37:04 (GMT)
commit454cf9bf59c12f370e2c7bd6cebec417fa0b7a9f (patch)
tree7eca46e6ec40f26fa6154f5c093f020282b20c39
parentd799e0fe6c402d03160322977fdc3059a312d8ab (diff)
parent9541cdbd3b8374a1f54dc29a2c4bb9d6170f1e29 (diff)
downloadandroid_packages_providers_DownloadProvider-454cf9bf59c12f370e2c7bd6cebec417fa0b7a9f.zip
android_packages_providers_DownloadProvider-454cf9bf59c12f370e2c7bd6cebec417fa0b7a9f.tar.gz
android_packages_providers_DownloadProvider-454cf9bf59c12f370e2c7bd6cebec417fa0b7a9f.tar.bz2
Merge "Trigger mediascan after a download is completed." into qt-dev am: 14a5b9171a
am: 9541cdbd3b Change-Id: Ic9211bedb452bb60706ce76734bbdcdc4c7b639f
-rw-r--r--src/com/android/providers/downloads/DownloadProvider.java5
-rw-r--r--tests/src/com/android/providers/downloads/AbstractDownloadProviderFunctionalTest.java6
2 files changed, 11 insertions, 0 deletions
diff --git a/src/com/android/providers/downloads/DownloadProvider.java b/src/com/android/providers/downloads/DownloadProvider.java
index 550c8fb..eb0313c 100644
--- a/src/com/android/providers/downloads/DownloadProvider.java
+++ b/src/com/android/providers/downloads/DownloadProvider.java
@@ -851,6 +851,8 @@ public final class DownloadProvider extends ContentProvider {
mediaStoreUri.toString());
filteredValues.put(COLUMN_MEDIA_SCANNED, MEDIA_SCANNED);
}
+ MediaStore.scanFile(getContext(),
+ new File(filteredValues.getAsString(Downloads.Impl._DATA)));
} finally {
restoreCallingIdentity(token);
}
@@ -1551,6 +1553,9 @@ public final class DownloadProvider extends ContentProvider {
qb.update(db, updateValues, Downloads.Impl._ID + "=?",
new String[] { Long.toString(info.mId) });
}
+ if (Downloads.Impl.isStatusSuccess(info.mStatus)) {
+ MediaStore.scanFile(getContext(), new File(info.mFileName));
+ }
}
if (updateSchedule) {
Helpers.scheduleJob(context, info);
diff --git a/tests/src/com/android/providers/downloads/AbstractDownloadProviderFunctionalTest.java b/tests/src/com/android/providers/downloads/AbstractDownloadProviderFunctionalTest.java
index 38bf4d6..6acdfed 100644
--- a/tests/src/com/android/providers/downloads/AbstractDownloadProviderFunctionalTest.java
+++ b/tests/src/com/android/providers/downloads/AbstractDownloadProviderFunctionalTest.java
@@ -33,6 +33,7 @@ import android.database.DatabaseUtils;
import android.database.MatrixCursor;
import android.net.Uri;
import android.os.Binder;
+import android.os.Bundle;
import android.os.IBinder;
import android.provider.Downloads;
import android.provider.MediaStore;
@@ -123,6 +124,11 @@ public abstract class AbstractDownloadProviderFunctionalTest extends
}
@Override
+ public Bundle call(String method, String request, Bundle args) {
+ return new Bundle();
+ }
+
+ @Override
public IBinder getIContentProviderBinder() {
return new Binder();
}