Merge "Trigger a mediascan when downloads get renamed." into qt-dev am: 5af9bed265

am: b50bd70426

Change-Id: I59ac57a69c601af63c854c98c2b6900e7f166c9d
This commit is contained in:
Sudheer Shanka
2019-05-23 19:36:03 -07:00
committed by android-build-merger

View File

@@ -41,6 +41,7 @@ import android.os.FileUtils;
import android.os.ParcelFileDescriptor;
import android.os.RemoteException;
import android.provider.Downloads;
import android.provider.MediaStore;
import android.provider.Settings;
import android.provider.Settings.SettingNotFoundException;
import android.text.TextUtils;
@@ -1309,6 +1310,11 @@ public class DownloadManager {
"Failed to rename file from " + before + " to " + after);
}
// TODO: DownloadProvider.update() should take care of updating corresponding
// MediaProvider entries.
MediaStore.scanFile(context, before);
MediaStore.scanFile(context, after);
final ContentValues values = new ContentValues();
values.put(Downloads.Impl.COLUMN_TITLE, displayName);
values.put(Downloads.Impl._DATA, after.toString());