summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorbsears <bsears@google.com>2019-08-01 00:15:54 (GMT)
committerAndroid (Google) Code Review <android-gerrit@google.com>2019-08-01 00:15:54 (GMT)
commit14a5b9171ae9817e03bfef4daf988ab1e9528e59 (patch)
tree32c77c372edc2cd42dfeea75bdee71f95dc13b6e
parentbb4439869f5fbc943a9b8159eadfc717d133983a (diff)
parent90de12ad0c76fa9e231b3864c4afb8f312b53dda (diff)
downloadandroid_packages_providers_DownloadProvider-14a5b9171ae9817e03bfef4daf988ab1e9528e59.zip
android_packages_providers_DownloadProvider-14a5b9171ae9817e03bfef4daf988ab1e9528e59.tar.gz
android_packages_providers_DownloadProvider-14a5b9171ae9817e03bfef4daf988ab1e9528e59.tar.bz2
Merge "Trigger mediascan after a download is completed." into qt-dev
-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();
}