Make sure testRenameAndReplaceFile is cleaning up created files

testRenameAndReplaceFile could leave stale files in the database after
it finishes execution if race condition happens between file on close
listener and file deletion. This could lead to create a DB record in the
MediaProvider DB but delete the file from FS. And when this happens it
fails testRenameFileNotOwned as it's not able to create the file again.

Added sleep time in testRenameAndReplaceFile before trying to delete the
created files to make sure that such race condition doesn't happen.

Bug: 360100744
Test: atest ScopedStorageDeviceTest
Flag: EXEMPT test fix
(cherry picked from https://googleplex-android-review.googlesource.com/q/commit:61be0fc360742d1d173fcb4b6800b0392a4c8d5f)
Merged-In: Ia55aab3a89a950cadfd7a8c932dfcdfa3ca76a45
Change-Id: Ia55aab3a89a950cadfd7a8c932dfcdfa3ca76a45
1 file changed