[Android] Android: fix external storage on Verizon Galaxy Note 3

Ron Wright git at videolan.org
Mon Mar 24 11:22:32 CET 2014


vlc-ports/android | branch: master | Ron Wright <logiconcepts819 at gmail.com> | Sun Mar 23 14:00:42 2014 +0000| [4e125ccfa54ef060f098f8e7f5218f4175a30bc0] | committer: Jean-Baptiste Kempf

Android: fix external storage on Verizon Galaxy Note 3

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

Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>

> http://git.videolan.org/gitweb.cgi/vlc-ports/android.git/?a=commit;h=4e125ccfa54ef060f098f8e7f5218f4175a30bc0
---

 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);
+                            }
                         }
                     }
                 }



More information about the Android mailing list