Don't upsert a db row for FUSE create
Apps sometimes insert the file to MediaStore database and then create
the same file in lower file system. When legacy app creates a file in
the lower file system, if file already exists in the database and is
owned by the app, we upsert the db row. This upsert will also set
IS_PENDING to 1. Since the app has already inserted the row, it doesn't
scan/update the row after the write is complete. Which makes IS_PENDING
sticky, and hides the file until the next scan. So for these scenarios,
we shouldn't set IS_PENDING=1 or we shouldn't try to upsert as the db
row already exists.
Changed insertFileIfNecessary to insert a db row for legacy apps only
when file doesn't exist in the database.
Bug: 158637603
Test: atest CtsScopedStorageHostTest#testCreateDoesntUpsert_hasRW
Change-Id: Ib4d6bed775027128a458b1a30660f2b56f6121f7
1 file changed