Skip to content

Commit 79d7528

Browse files
zezeozueanisassigoogle
authored andcommitted
Block SAF directory access to /sdcard/Android
This works for target R+ apps, but need to come up with a better story for target <R. The enforcement in DocumentsUI is target SDK based and those apps bypass the block_tree flag. Bug: 157320644 Test: atest DocumentsTest Change-Id: I93aea7cd5d3b7befea1f78e1cf3f31f8250f1d33 (cherry picked from commit 9d508579aed406220c11022cfc983da46396bd07) Merged-In: I93aea7cd5d3b7befea1f78e1cf3f31f8250f1d33 (cherry picked from commit 1ea98d44490a2383a604b546a5671a783c1000dd)
1 parent 1d3fa3d commit 79d7528

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

packages/ExternalStorageProvider/src/com/android/externalstorage/ExternalStorageProvider.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -322,6 +322,11 @@ protected boolean shouldBlockFromTree(@NonNull String docId) {
322322
return true;
323323
}
324324

325+
if (TextUtils.equals(Environment.DIRECTORY_ANDROID.toLowerCase(),
326+
path.toLowerCase())) {
327+
return true;
328+
}
329+
325330
return false;
326331
} catch (IOException e) {
327332
throw new IllegalArgumentException(

0 commit comments

Comments
 (0)