Build both filename views before deleting.

Otherwise we'll throw when trying to create the second (visible)
filename because we just deleted it.

Bug: 30087518
Change-Id: I940a8f81c264fc17d477fadf46fd48eae29f2f6f
This commit is contained in:
Jeff Sharkey
2016-07-15 15:34:41 -06:00
parent 965a706282
commit c50875e42e

View File

@@ -484,6 +484,8 @@ public class ExternalStorageProvider extends DocumentsProvider {
@Override
public void deleteDocument(String docId) throws FileNotFoundException {
final File file = getFileForDocId(docId);
final File visibleFile = getFileForDocId(docId, true);
final boolean isDirectory = file.isDirectory();
if (isDirectory) {
FileUtils.deleteContents(file);
@@ -492,7 +494,6 @@ public class ExternalStorageProvider extends DocumentsProvider {
throw new IllegalStateException("Failed to delete " + file);
}
final File visibleFile = getFileForDocId(docId, true);
if (visibleFile != null) {
final ContentResolver resolver = getContext().getContentResolver();
final Uri externalUri = MediaStore.Files.getContentUri("external");