Force scans when publishing.
If a clever app had already written the exact size and modified time
of a file before publishing, we'd skip scanning that item. To force
a scan, clear these columns when publishing to force a scan.
Bug: 134590552
Test: atest --test-mapping packages/providers/MediaProvider
Change-Id: Ibec29976fa2821e77f3b799c9e3a9be08e34bf6c
diff --git a/src/com/android/providers/media/MediaProvider.java b/src/com/android/providers/media/MediaProvider.java
index 081dcad..9a5e194 100644
--- a/src/com/android/providers/media/MediaProvider.java
+++ b/src/com/android/providers/media/MediaProvider.java
@@ -4700,6 +4700,11 @@
// make sure metadata is updated
if (MediaColumns.IS_PENDING.equals(column)) {
triggerScan = true;
+
+ // Explicitly clear columns used to ignore no-op scans,
+ // since we need to force a scan on publish
+ initialValues.putNull(MediaColumns.DATE_MODIFIED);
+ initialValues.putNull(MediaColumns.SIZE);
}
}