Update StorageOptions.java
forcemount if you have forcemount file
This commit is contained in:
@@ -25,10 +25,14 @@ public class StorageOptions
|
|||||||
public static void determineStorageOptions()
|
public static void determineStorageOptions()
|
||||||
{
|
{
|
||||||
initializeMountPoints();
|
initializeMountPoints();
|
||||||
readMountsFileTest();
|
if (findForcemount()){
|
||||||
|
readMountsFileTest();
|
||||||
|
}
|
||||||
readMountsFile();
|
readMountsFile();
|
||||||
readVoldFile();
|
readVoldFile();
|
||||||
removeDuplicates(mMounts);
|
if (findForcemount()){
|
||||||
|
removeDuplicates(mMounts);
|
||||||
|
}
|
||||||
compareMountsWithVold();
|
compareMountsWithVold();
|
||||||
testAndCleanMountsList();
|
testAndCleanMountsList();
|
||||||
setProperties();
|
setProperties();
|
||||||
@@ -201,7 +205,7 @@ public class StorageOptions
|
|||||||
mMounts.remove(i--);
|
mMounts.remove(i--);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (t == 0 && Build.VERSION.SDK_INT >= 16)
|
if (t == 0 && Build.VERSION.SDK_INT >= 16 && findForcemount())
|
||||||
{//if none is found lets force it for Jellybean and above...
|
{//if none is found lets force it for Jellybean and above...
|
||||||
if (System.getenv("EXTERNAL_STORAGE") != null)
|
if (System.getenv("EXTERNAL_STORAGE") != null)
|
||||||
{
|
{
|
||||||
@@ -210,7 +214,7 @@ public class StorageOptions
|
|||||||
{
|
{
|
||||||
if(!isRooted())
|
if(!isRooted())
|
||||||
{
|
{
|
||||||
File folder = new File(System.getenv("EXTERNAL_STORAGE")+"/Android/data/net.wagic.app/files");
|
File folder = new File(System.getenv("EXTERNAL_STORAGE")+"/Android/data/net.wagic.app");
|
||||||
folder.mkdirs();
|
folder.mkdirs();
|
||||||
mMounts.add(folder.toString());
|
mMounts.add(folder.toString());
|
||||||
}
|
}
|
||||||
@@ -228,7 +232,7 @@ public class StorageOptions
|
|||||||
{
|
{
|
||||||
if(!isRooted())
|
if(!isRooted())
|
||||||
{
|
{
|
||||||
File folder = new File(System.getenv("SECONDARY_STORAGE")+"/Android/data/net.wagic.app/files");
|
File folder = new File(System.getenv("SECONDARY_STORAGE")+"/Android/data/net.wagic.app");
|
||||||
folder.mkdirs();
|
folder.mkdirs();
|
||||||
mMounts.add(folder.toString());
|
mMounts.add(folder.toString());
|
||||||
}
|
}
|
||||||
@@ -250,16 +254,28 @@ public class StorageOptions
|
|||||||
ArrayList<String> mLabels = new ArrayList<String>();
|
ArrayList<String> mLabels = new ArrayList<String>();
|
||||||
|
|
||||||
int i = 1;
|
int i = 1;
|
||||||
for (String path : mMounts)
|
if(findForcemount()){
|
||||||
{ // TODO: /mnt/sdcard is assumed to always mean internal storage. Use this comparison until there is a better way to do this
|
for (String path : mMounts)
|
||||||
if ("/mnt/sdcard".equalsIgnoreCase(path) || "/storage/sdcard0".equalsIgnoreCase(path))
|
{//with forcemount menu
|
||||||
mLabels.add("Internal SD " + "[" + path + "]");
|
if ("/mnt/sdcard".equalsIgnoreCase(path) || "/storage/sdcard0".equalsIgnoreCase(path))
|
||||||
else if (path.contains("emulated"))
|
mLabels.add("Internal SD " + "[" + path + "]");
|
||||||
mLabels.add("Emulated SD " + " [" + path + "]");
|
else if (path.contains("emulated"))
|
||||||
else
|
mLabels.add("Emulated SD " + " [" + path + "]");
|
||||||
mLabels.add("External SD " + " [" + path + "]");
|
else
|
||||||
|
mLabels.add("External SD " + " [" + path + "]");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
for (String path : mMounts)
|
||||||
|
{ // TODO: /mnt/sdcard is assumed to always mean internal storage. Use this comparison until there is a better way to do this
|
||||||
|
if ("/mnt/sdcard".equalsIgnoreCase(path))
|
||||||
|
mLabels.add("Built-in Storage");
|
||||||
|
else
|
||||||
|
mLabels.add("External SD Card " + i++);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
labels = new String[mLabels.size()];
|
labels = new String[mLabels.size()];
|
||||||
mLabels.toArray(labels);
|
mLabels.toArray(labels);
|
||||||
|
|
||||||
@@ -358,4 +374,20 @@ public class StorageOptions
|
|||||||
|
|
||||||
return executedSuccesfully;
|
return executedSuccesfully;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static boolean findForcemount(){
|
||||||
|
try
|
||||||
|
{
|
||||||
|
File file = new File(System.getenv("EXTERNAL_STORAGE")+"/forcemount");
|
||||||
|
if (file.exists())
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception e1)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user