Loading core/java/com/android/internal/content/FileSystemProvider.java +54 −35 Original line number Diff line number Diff line Loading @@ -27,6 +27,7 @@ import android.database.MatrixCursor; import android.database.MatrixCursor.RowBuilder; import android.graphics.Point; import android.net.Uri; import android.os.Binder; import android.os.CancellationSignal; import android.os.FileObserver; import android.os.FileUtils; Loading Loading @@ -156,11 +157,17 @@ public abstract class FileSystemProvider extends DocumentsProvider { if (visibleFolder != null) { assert (visibleFolder.isDirectory()); final long token = Binder.clearCallingIdentity(); try { final ContentResolver resolver = getContext().getContentResolver(); final Uri uri = MediaStore.Files.getDirectoryUri("external"); ContentValues values = new ContentValues(); values.put(MediaStore.Files.FileColumns.DATA, visibleFolder.getAbsolutePath()); resolver.insert(uri, values); } finally { Binder.restoreCallingIdentity(token); } } } Loading Loading @@ -214,6 +221,9 @@ public abstract class FileSystemProvider extends DocumentsProvider { // They should be all null or not null at the same time. File#renameTo() doesn't work across // volumes so an exception will be thrown before calling this method. if (oldVisibleFile != null && newVisibleFile != null) { final long token = Binder.clearCallingIdentity(); try { final ContentResolver resolver = getContext().getContentResolver(); final Uri externalUri = newVisibleFile.isDirectory() ? MediaStore.Files.getDirectoryUri("external") Loading @@ -230,6 +240,9 @@ public abstract class FileSystemProvider extends DocumentsProvider { values, "_data LIKE ? AND lower(_data)=lower(?)", new String[]{path, path}); } finally { Binder.restoreCallingIdentity(token); } } } Loading @@ -253,6 +266,9 @@ public abstract class FileSystemProvider extends DocumentsProvider { throws FileNotFoundException { // visibleFolder is null if we're removing a document from external thumb drive or SD card. if (visibleFile != null) { final long token = Binder.clearCallingIdentity(); try { final ContentResolver resolver = getContext().getContentResolver(); final Uri externalUri = MediaStore.Files.getContentUri("external"); Loading @@ -270,6 +286,9 @@ public abstract class FileSystemProvider extends DocumentsProvider { resolver.delete(externalUri, "_data LIKE ?1 AND lower(_data)=lower(?2)", new String[]{path, path}); } finally { Binder.restoreCallingIdentity(token); } } } Loading Loading
core/java/com/android/internal/content/FileSystemProvider.java +54 −35 Original line number Diff line number Diff line Loading @@ -27,6 +27,7 @@ import android.database.MatrixCursor; import android.database.MatrixCursor.RowBuilder; import android.graphics.Point; import android.net.Uri; import android.os.Binder; import android.os.CancellationSignal; import android.os.FileObserver; import android.os.FileUtils; Loading Loading @@ -156,11 +157,17 @@ public abstract class FileSystemProvider extends DocumentsProvider { if (visibleFolder != null) { assert (visibleFolder.isDirectory()); final long token = Binder.clearCallingIdentity(); try { final ContentResolver resolver = getContext().getContentResolver(); final Uri uri = MediaStore.Files.getDirectoryUri("external"); ContentValues values = new ContentValues(); values.put(MediaStore.Files.FileColumns.DATA, visibleFolder.getAbsolutePath()); resolver.insert(uri, values); } finally { Binder.restoreCallingIdentity(token); } } } Loading Loading @@ -214,6 +221,9 @@ public abstract class FileSystemProvider extends DocumentsProvider { // They should be all null or not null at the same time. File#renameTo() doesn't work across // volumes so an exception will be thrown before calling this method. if (oldVisibleFile != null && newVisibleFile != null) { final long token = Binder.clearCallingIdentity(); try { final ContentResolver resolver = getContext().getContentResolver(); final Uri externalUri = newVisibleFile.isDirectory() ? MediaStore.Files.getDirectoryUri("external") Loading @@ -230,6 +240,9 @@ public abstract class FileSystemProvider extends DocumentsProvider { values, "_data LIKE ? AND lower(_data)=lower(?)", new String[]{path, path}); } finally { Binder.restoreCallingIdentity(token); } } } Loading @@ -253,6 +266,9 @@ public abstract class FileSystemProvider extends DocumentsProvider { throws FileNotFoundException { // visibleFolder is null if we're removing a document from external thumb drive or SD card. if (visibleFile != null) { final long token = Binder.clearCallingIdentity(); try { final ContentResolver resolver = getContext().getContentResolver(); final Uri externalUri = MediaStore.Files.getContentUri("external"); Loading @@ -270,6 +286,9 @@ public abstract class FileSystemProvider extends DocumentsProvider { resolver.delete(externalUri, "_data LIKE ?1 AND lower(_data)=lower(?2)", new String[]{path, path}); } finally { Binder.restoreCallingIdentity(token); } } } Loading