mirror of
https://github.com/syncthing/syncthing-android.git
synced 2024-11-29 15:51:17 +00:00
if no external sdcard has been found.
This commit is contained in:
parent
bde917d244
commit
fa030319ff
2 changed files with 14 additions and 0 deletions
|
@ -327,6 +327,11 @@ public class FolderActivity extends SyncthingActivity {
|
|||
Intent intent = new Intent(Intent.ACTION_OPEN_DOCUMENT_TREE);
|
||||
if (externalFilesDirUri != null) {
|
||||
intent.putExtra("android.provider.extra.INITIAL_URI", externalFilesDirUri);
|
||||
} else {
|
||||
android.net.Uri internalFilesDirUri = FileUtils.getInternalStorageRootUri();
|
||||
if (internalFilesDirUri != null) {
|
||||
intent.putExtra("android.provider.extra.INITIAL_URI", internalFilesDirUri);
|
||||
}
|
||||
}
|
||||
intent.putExtra(Intent.EXTRA_LOCAL_ONLY, true);
|
||||
intent.putExtra("android.content.extra.SHOW_ADVANCED", true);
|
||||
|
|
|
@ -217,6 +217,15 @@ public class FileUtils {
|
|||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* FileProvider does not support converting absolute paths
|
||||
* to a "content://" Uri. As "file://" Uri has been blocked
|
||||
* since Android 7+, we need to build the Uri manually.
|
||||
*/
|
||||
public static android.net.Uri getInternalStorageRootUri() {
|
||||
return android.net.Uri.parse("content://com.android.externalstorage.documents/document/primary%3A");
|
||||
}
|
||||
|
||||
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
|
||||
private static String getVolumeIdFromTreeUri(final Uri treeUri) {
|
||||
final String docId = DocumentsContract.getTreeDocumentId(treeUri);
|
||||
|
|
Loading…
Reference in a new issue