Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions core/java/android/provider/Settings.java
Original file line number Diff line number Diff line change
Expand Up @@ -20365,6 +20365,12 @@ public static boolean putFloat(ContentResolver cr, String name, float value) {
*/
public static final String RESTRICTED_NETWORKING_MODE = "restricted_networking_mode";

/**
* Control whether to remove the restriction when selecting folders through SAF.
* @hide
*/
public static final String NO_STORAGE_RESTRICT = "no_storage_restrict";

/**
* Setting indicating whether Low Power Standby is enabled, if supported.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -386,6 +386,12 @@ private boolean isRestrictedPath(String rootId, String canonicalPath) {
@Override
protected boolean shouldBlockDirectoryFromTree(@NonNull String documentId)
throws FileNotFoundException {
// Remove the restriction if user really want it.
if (Settings.Secure.getInt(
getContext().getContentResolver(), Settings.Global.NO_STORAGE_RESTRICT, 0) == 1) {
return false;
}

final File dir = getFileForDocId(documentId, false);
// The file is null or it is not a directory
if (dir == null || !dir.isDirectory()) {
Expand Down