[Android] [vlc-devel] [PATCH] Android: fix external storage on Verizon Galaxy Note 3

Ronald Wright logiconcepts819 at gmail.com
Sun Mar 23 16:00:42 CET 2014


Commit 50c3e09043c4dfc8683eb1131fba3598f3f118e2 introduced a change that broke
detection of external storage on the Verizon Galaxy Note 3.  This is because
the new code expects to find a line in /proc/mounts that looks like the
following:

shell at hlte:/ $ mount | grep storage
/mnt/media_rw/extSdCard /storage/extSdCard sdcardfs rw,nosuid,nodev,relatime,uid=1023,gid=1023 0 0

However, on the Verizon Galaxy Note 3, the line looks like the following:

shell at hltevzw:/ $ mount | grep storage                                       
/dev/block/vold/179:65 /storage/extSdCard vfat rw,dirsync,nosuid,nodev,noexec,noatime,nodiratime,uid=1000,gid=1023,fmask=0002,dmask=0002,allow_utime=0020,codepage=cp437,iocharset=iso8859-1,shortname=mixed,utf8,errors=remount-ro 0 0
tmpfs /storage/extSdCard/.android_secure tmpfs ro,seclabel,relatime,size=0k,mode=000 0 0

This patch fixes the issue.

---
 vlc-android/src/org/videolan/vlc/Util.java | 27 +++++++++++++++++----------
 1 file changed, 17 insertions(+), 10 deletions(-)

diff --git a/vlc-android/src/org/videolan/vlc/Util.java b/vlc-android/src/org/videolan/vlc/Util.java
index b679fd6..4cdc361 100644
--- a/vlc-android/src/org/videolan/vlc/Util.java
+++ b/vlc-android/src/org/videolan/vlc/Util.java
@@ -429,6 +429,7 @@ public class Util {
             ArrayList<String> list = new ArrayList<String>();
             list.add(Environment.getExternalStorageDirectory().getPath());
             String line;
+            boolean addedExtSdCard = false;
             while((line = bufReader.readLine()) != null) {
                 if(line.contains("vfat") || line.contains("exfat") ||
                    line.contains("sdcardfs") || line.contains("/mnt") ||
@@ -440,17 +441,23 @@ public class Util {
                     if (list.contains(s))
                         continue;
 
-                    if (line.contains("extSdCard") && line.contains("sdcardfs"))
+                    if (line.contains("extSdCard") && line.contains("sdcardfs") && !addedExtSdCard) {
+                        addedExtSdCard = true;
                         list.add(s);
-                    else if (line.contains("/dev/block/vold") && !line.contains("extSdCard")) {
-                        if (!line.startsWith("tmpfs") &&
-                            !line.startsWith("/dev/mapper") &&
-                            !s.startsWith("/mnt/secure") &&
-                            !s.startsWith("/mnt/shell") &&
-                            !s.startsWith("/mnt/asec") &&
-                            !s.startsWith("/mnt/obb")
-                            ) {
-                            list.add(s);
+                    }
+                    else if (line.contains("/dev/block/vold")) {
+                        boolean isExtSdCardEntry = line.contains("extSdCard");
+                        if (!isExtSdCardEntry || !addedExtSdCard) {
+                            if (!line.startsWith("tmpfs") &&
+                                !line.startsWith("/dev/mapper") &&
+                                !s.startsWith("/mnt/secure") &&
+                                !s.startsWith("/mnt/shell") &&
+                                !s.startsWith("/mnt/asec") &&
+                                !s.startsWith("/mnt/obb")
+                                ) {
+                                addedExtSdCard = addedExtSdCard || isExtSdCardEntry;
+                                list.add(s);
+                            }
                         }
                     }
                 }
-- 
1.8.3.2

_______________________________________________
vlc-devel mailing list
To unsubscribe or modify your subscription options:
https://mailman.videolan.org/listinfo/vlc-devel


More information about the Android mailing list