(Map<String, String> list, String rootPath, String[] pathsToExclude)
| 938 | |
| 939 | private static final String[] SYSTEM_ROOT_PATHS = {"/system", "/data", "/mnt"}; |
| 940 | private void autoAddRoots(Map<String, String> list, String rootPath, String[] pathsToExclude) |
| 941 | { |
| 942 | try { |
| 943 | File root = new File(rootPath); |
| 944 | File[] files = root.listFiles(); |
| 945 | if ( files!=null ) { |
| 946 | for ( File f : files ) { |
| 947 | if ( !f.isDirectory() ) |
| 948 | continue; |
| 949 | String fullPath = f.getAbsolutePath(); |
| 950 | if ( isLink(fullPath) ) { |
| 951 | L.d("skipping symlink " + fullPath); |
| 952 | continue; |
| 953 | } |
| 954 | boolean skip = false; |
| 955 | for ( String path : pathsToExclude ) { |
| 956 | if ( fullPath.startsWith(path) ) { |
| 957 | skip = true; |
| 958 | break; |
| 959 | } |
| 960 | } |
| 961 | if ( skip ) |
| 962 | continue; |
| 963 | if ( !f.canWrite() ) { |
| 964 | L.i("Path is readonly: " + f.getAbsolutePath()); |
| 965 | continue; |
| 966 | } |
| 967 | L.i("Found possible mount point " + f.getAbsolutePath()); |
| 968 | addMountRoot(list, f.getAbsolutePath(), f.getAbsolutePath()); |
| 969 | } |
| 970 | } |
| 971 | } catch ( Exception e ) { |
| 972 | L.w("Exception while trying to auto add roots"); |
| 973 | } |
| 974 | } |
| 975 | |
| 976 | private void initMountRoots() { |
| 977 | Map<String, String> map = new LinkedHashMap<String, String>(); |
no test coverage detected