@@ -507,7 +507,11 @@ private void setupVirtualStorage(ApplicationInfo info, int userId) {
507
507
whiteList .add (Environment .DIRECTORY_MOVIES );
508
508
whiteList .add (Environment .DIRECTORY_DOWNLOADS );
509
509
whiteList .add (Environment .DIRECTORY_DCIM );
510
- whiteList .add ("Android/obb" );
510
+ // Android 11, do not tryna fetch this directory directly or crash.
511
+ // See docs below...
512
+ if (Build .VERSION .SDK_INT < 30 ) {
513
+ whiteList .add ("Android/obb" );
514
+ }
511
515
if (Build .VERSION .SDK_INT >= 19 ) {
512
516
whiteList .add (Environment .DIRECTORY_DOCUMENTS );
513
517
}
@@ -535,8 +539,13 @@ private void setupVirtualStorage(ApplicationInfo info, int userId) {
535
539
NativeEngine .whitelist (whitePath , true );
536
540
}
537
541
542
+ // Android 11 -> see https://developer.android.com/training/data-storage#scoped-storage
543
+ // 安卓11 打开这个链接看看 https://developer.android.google.cn/training/data-storage#scoped-storage
544
+ // see https://android-opengrok.bangnimang.net/android-11.0.0_r8/xref/frameworks/base/core/java/android/os/Environment.java
538
545
// redirect xxx/Android/data/ -> /xxx/Android/data/<host>/virtual/<user>
539
546
NativeEngine .redirectDirectory (new File (storageRoot , "Android/data/" ).getAbsolutePath (), privatePath );
547
+ // redirect xxx/Android/obb/ -> /xxx/Android/data/<host>/virtual/<user>
548
+ NativeEngine .redirectDirectory (new File (storageRoot , "Android/obb/" ).getAbsolutePath (), privatePath );
540
549
// redirect /sdcard/ -> vsdcard
541
550
NativeEngine .redirectDirectory (storageRoot , vsPath );
542
551
}
@@ -547,6 +556,9 @@ private HashSet<String> getMountPoints() {
547
556
HashSet <String > mountPoints = new HashSet <>(3 );
548
557
mountPoints .add ("/mnt/sdcard/" );
549
558
mountPoints .add ("/sdcard/" );
559
+ // Redmi 10X Pro, Pixel 5... More mount points?
560
+
561
+ mountPoints .add ("/storage/self/primary/" );
550
562
String [] points = StorageManagerCompat .getAllPoints (VirtualCore .get ().getContext ());
551
563
if (points != null ) {
552
564
Collections .addAll (mountPoints , points );
0 commit comments