Support update and replace on conflict

Apps sometimes insert a database row using ContentResolver#insert and
try to update this row to an existing file. The update results in
UNIQUE constraint error. Apps will not be aware of FuseDaemon
inserting/updating the database row, in this scenario, app is not aware
of FuseDaemon inserting a row for file create through file path. To be
backward compatible, we shouldn't fail the update operation.

Implemented update as updateAllowingReplace. On conflict, if app owns
the conflicting row, we delete the conflicting row, and retry update.

Test: MediaStore_Images_Test#testUpdateAndReplace
Bug: 155120435
Bug: 155320967
Change-Id: I7ebe3cf4237755f9df0d1bc2ba8cdc2e50e70309
1 file changed