Exclude database rows with pending metadata update in default query

MediaStore.QUERY_ARG_DEFER_SCAN allows apps to defer the scan triggered
as part of ContentResolver#update() operation. A deferred scan on
recently published file may leave database rows with partial/incorrect
metadata. Partial or incorrect metadata can confuse a lot of apps.
This Cl adds logic to exclude database rows with potentially unreliable
pre-scan metadata int default query with MATCH_EXCLUDE.

Note that, we only mark the database rows as pending for metadata
when the file is published, i.e., when IS_PENDING is cleared.

Bug: 180326732
Test: atest
ScopedStorageDeviceTest#eDeviceTest#testDeferredScanHidesPartialDatabaseRows

Change-Id: I22c42f61c7be9a637fcbbd614ecf81a731e57681
3 files changed