[CONTEMPLATION] getExternalStorageDirectory - Galaxy S 4 Developer Discussion [Developers-Only]

So, I make apps for android, and if anyone is familiar with it, the proper way to write to the storage is using Evironment.getExternalStorageDirectory(); this will return with the internal sd card location on devices with internal sd card.
Well, i decompiled the system files and found the method that is "getExternalStorageDirectory" and found how it creates it.
So, i can change it to return with the path to the ACTUAL external sd card. This means that every app that uses getExternalStorageDirectory will place EVERYTHING onto the actual EXTERNAL sd card. Thus freeing up the internal sd card AND the data partition allowing for more apps to be installed.
What are your guy's thoughts about this? I feel like it might work. However, if one doesn't have an external sd card, things could go very hay wire.

Yep, it will work for apps relying to this function.
There is such mod for Xperia Z for quite some time. You can look to that mod to simplify modding process

Be great to have looking for a switch mount script like I had on S2 and S3.
Sent from my SGH-M919 using Tapatalk 2

Miami8906 said:
Be great to have looking for a switch mount script like I had on S2 and S3.
Sent from my SGH-M919 using Tapatalk 2
Click to expand...
Click to collapse
This isnt a script. This is a smali edit which is a lot better. I don't like scripts

elesbb said:
This isnt a script. This is a smali edit which is a lot better. I don't like scripts
Click to expand...
Click to collapse
Cool is it available yet or are you still working on it?

What path are you using to designate the external sdcard or how are you determining it?
The Thanks button is just to avoid "THANKS" posts in threads. Nothing more. Don't defeat the purpose of why it was introduced.

CNexus said:
What path are you using to designate the external sdcard or how are you determining it?
The Thanks button is just to avoid "THANKS" posts in threads. Nothing more. Don't defeat the purpose of why it was introduced.
Click to expand...
Click to collapse
The mount point for the external sd card is /mnt/extSdCard
And there is another method that I can use to test for if it's mounted or not, and if it's not mounted, then revert to internal sd card. I'm hoping it works lol. Still haven't had time to mess with it though.
Sent from my SGH-M919 using Tapatalk 2

Related

edit solved (Entropy Came Through Again!) $30 bounty for a fix for my issue!!

I am shocked that i cant seem to find any solution to this, even more so i am shocked that i haven't come across users that are even looking for a solution to this isssue. Anyways here is goes..
Our phones have an internal and external sd card. That great! actually it blows in my mind. I wish we didnt have internal sd because it just screws everything up when you are trying to do what i want to do. I have a 32gb external sd that i want to use as the main storage for nandroids, downloads, ti backups, and all or atleast most application external data. I have to keep deleting backups one after another because i my internal sd card is always full, and when it comes to my nandroids its a pain to have to move them from internal to external sd and then back when i want to restore (which it also causes issues for me and i get a md5 mismatch in cwm). There has got to be a way to use your exteral sd card as the main storage, CM7 has a solutions to this but it only works at boot so it doesnt mount the external as internal within recovery, which i can live with because cwmr 5.0.2.7 allows you to backup and restore to either the internal or external. The issue with this is no other rom does this so if i am on another rom besides cm7 then and i want to restore a backup that i did on my external sd with 5.0.2.7, i have to move the nandroid from external to internal to do so, and when you are moving it from one to the other on your phone it takes forever because it is usually 700+mb.
This whole internal sd and external sd is really pissing me off. This phone (which i truly love and is by far the best phone on my market) and my other phone, droid bionic are the only two phones that i have every owned that have had this issue. All other phones of mine (HTC) have never had an internal sd card.
If someone can come up with a fix or point me to a fix that will accomplish what i am looking for I would quickly pay (or donate) $30.00. Its not a lot of money but its enough to buy some accessories and for me, paying $30 is worth it. Again i need a fix that will work in recovery(cmr 5.0.2.7 does this) and at boot.
Edit. Nevermind, it seems the only way to fix this issue the way i need it is if we get the new cwm 5.0.2.7 recovery. Just waiting on entropy to try and get this in his kernal. Once he does that i will be donating again to him instead
Pretty simple, in recovery.fstab swap what internal and external point to, compile, flash, FIXED.
can you provide some instructions? What does this do exactly.
Thanks
Google "fstab" and "linux mounts" and you'll find an answer... but be careful because as there might be unexpected consequences...
Sent from my SAMSUNG-SGH-I777
I'm not an expert, but when I first ran CWM the entire phone storage was unmounted and just internal storage. I had to mount it SD. Couldn't you just go to cwm and reverse that?
Sent from my SAMSUNG-SGH-I777 using xda premium
Shammyh said:
Google "fstab" and "linux mounts" and you'll find an answer... but be careful because as there might be unexpected consequences...
Sent from my SAMSUNG-SGH-I777
Click to expand...
Click to collapse
Well I dont know nearly as much as you, so googling those terms does not help. I appreciate the gesture but i am going to need some more help than that unfortunately.
Does anyone know the block id for sd-external?
did you take a look into fstab? it should be pretty apparent from there. if not, then just issue mount command from console - it prints out all currently mounted devices, including sdcard.
don't forget to send DG $30 for the hint
vladm7 said:
did you take a look into fstab? it should be pretty apparent from there. if not, then just issue mount command from console - it prints out all currently mounted devices, including sdcard.
don't forget to send DG $30 for the hint
Click to expand...
Click to collapse
recovery.fstab? correct not vold.fstab, right? And what is the external sd mount id?
I just want to be clear that i want it to mount the external sd as internatal in recovery not just at boot so vold.fstab will not do that
Entropy just included a fix for this in his new kernel 111311. Just flash it and voila.
Sent from my SAMSUNG-SGH-I777 using XDA App
Romee74 said:
Entropy just included a fix for this in his new kernel 111311. Just flash it and voila.
Sent from my SAMSUNG-SGH-I777 using XDA App
Click to expand...
Click to collapse
Yes i know but thanks.

(Q) possible to use sd card with fspe?

Is it possible to use the sd card with fspe? Because when I try to load an iso I can't find it.
And if not what the hell am I supposed to do? Put my psx roms on my internal memory what a joke.
What's the point of a quad phone if it doesn't have enough storage to hold the big bad ass games it should be running.
I am now getting put off games because they require large downloads and that shouldn't be the case.
Is this something I could fix with a custom Rom?
Sent from my GT-I9300
First off - that's an app-related issues. Many developers seem to think the location of the external SD is universally the same just because their phone(s) have it that way. Many phones use /mnt/<FOLDER> for external SD and not the old cumbersome format (/mnt)/sdcard/external_sd
If you're rooted, it's easy to solve, just use the free APK "Directory Bind".
For it to work, create a folder named 'external_sd' on your internal SDcard, then bind-mount the /mnt/extSdCard on /mnt/sdcard/external_sd.
Thanks for your quick reply.
If I understand what your saying, will that make my external sd show up as a folder on my internal sd?
If so can I then install games and apps on my external sd?
Sorry I'm pretty dense lol
Sent from my GT-I9300
-josh- said:
Thanks for your quick reply.
If I understand what your saying, will that make my external sd show up as a folder on my internal sd?
If so can I then install games and apps on my external sd?
Sorry I'm pretty dense lol
Sent from my GT-I9300
Click to expand...
Click to collapse
Just keep pressing up until you see a list of USB drives and select extSdCard and click on there to find your Roms.
will that make my external sd show up as a folder on my internal sd?
Click to expand...
Click to collapse
Yes.
Just keep pressing up until you see a list of USB drives and select extSdCard and click on there to find your Roms.
Click to expand...
Click to collapse
I assumed the app wouldn't let him go higher up than /mnt/sdcard. Some do that which is quite stupid.
Maybe if he's running an older version but the last few versions at least can find external and any USB drive.
Well I only bought it yesterday off Google play so I am assuming I got the newest version. And no it doesn't let me go any higher.
I'm gonna check out what version it is.
Edit: version 0.11.29 and when I search for bios or iso it does start at system but only shows the internal sd card not the external one
Edit 2: yeah it's in the mnt folders lol, I was tired at the time
Sent from my GT-I9300

External SD card permission issue

Weird enough suddenly I found all my external SDCard files have all permissions like:
---rwxr-x
Why !?? This happens to every file I copy onto it.
I needed them like:
rwxrwxr-x
so far, the only rough and long way I found is through Aromafilemanager and PhilzTouch recovery.
Yet I have to change the permissions one file at a time.
Can anybody help?
Sounds like a problem unique to you, I've never heard of it.
Flash the official stock rom, format your sd card in your pc using the industry formatting tool and test.
If the problem disappears then it was probably some combination of your individual setup.
Yep. Also ensure you haven't got any scripts running at startup. Sd permissions are set on boot and cannot be changed afterwards
Sent from my GT-I9300 using Tapatalk 4
Thank you, I'll surely restart from the beginning and report back
Sent from my GT-I9300 using xda app-developers app
rootSU said:
Yep. Also ensure you haven't got any scripts running at startup. Sd permissions are set on boot and cannot be changed afterwards
Sent from my GT-I9300 using Tapatalk 4
Click to expand...
Click to collapse
Which script could do that?
Sent from my GT-I9300 using xda app-developers app
Any mods that mount folders or swap storage.
Otherwise, something built into the rom.
Sent from my GT-I9300 using Tapatalk 4
boomboomer said:
Sounds like a problem unique to you, I've never heard of it.
Flash the official stock rom, format your sd card in your pc using the industry formatting tool and test.
If the problem disappears then it was probably some combination of your individual setup.
Click to expand...
Click to collapse
@boomboomer
which filesystem do i have to use in formatting extsdcard 8gb via pc? exFAT / FAT32 / EXT4 / NTFS ?
moreover, in this post and following on dev rom thread, it seems it's a normal behaviour... am i missing sth?
https://www.sdcard.org/downloads/formatter_4
Fat32 is the normal filesytem.
If it's common to your rom then your chef is the best one to approach, he may have set a script or mod.
rootSU said:
Any mods that mount folders or swap storage.
Otherwise, something built into the rom.
Sent from my GT-I9300 using Tapatalk 4
Click to expand...
Click to collapse
I read through about 7 pages of sd card issues on the s3 and thought i cant read anymore, so i thought i would just ask. I've just bought an s3 and i got my 64gb sd card from my old phone to my new one. Problem is i have data from other games in the SD and titanium back up files in the externel sd card. Seems the S3 has its own built in SD card and only reads from that. I copied my TB files from externel to the internel. Now the games still require Extra files although they are in the externel SD. So how in the world do i get it to read my Externel sd instead of my internel? I thought of copying the files but i have 16 gb internel, 64 externel so its not gonna work considering i have 39 gb left in my 64 gb one,

[WORKING MOD] **UPDATE** Swap Internal and External Storage [STILL OPEN 2 DISCUSSION]

**UPDATE, Working MOD!**
Mattiadj has a working mod to make your S4's external sd card your internal storage while making your internal just a place for extra resources!
This is HUGE and it is working very well for me. This mod is not a "complete swap" where the two mounting points are just switched but it accomplishes the same goal! There are a few things you will have to get use to once you install this but nothing that can't be overlooked. Here a link to his thread: http://forum.xda-developers.com/showthread.php?t=2468596. I suggest everyone try this out and give him any helpful feedback.
For now, Mattiadj's mod is the closest thing to swapping your storage and will may be the closest we ever get on 4.2.2 (it works great). With Android 4.3 officially coming to our devices soon their may be more possibilities for a "complete swap" on 4.3. Until then, I suggest everyone use mattiadj's mod. Thanks mattiadj!
-----------------------------------------------------------------------
Hello S4 owners!
I know I'm not the only S4 user wanting more internal storage on their phone whether it be "16 GB" or "32GB". I've been doing a lot of research into swapping internal with external storage to use the micro sd card as device storage (e.g. 64GB sd card to replace 16GB internal storage vice-versa). I've done this technique on a previous device (http://forum.xda-developers.com/showpost.php?p=43024409) by modifying the vold.fstab file to swap storage mounting points. Since samsung released 4.2.2 on their devices the vold.fstab has been modified without anyone being able to figure out how to swap mounting points. The verizon release of android 4.3 may make modifying the vold.fstab more feasible but we will just have to wait and see.
For now, here are several routes I have looked into:
Modifying vold.fstab: There may be more code we can add but the current file only contains the mounting location for external storage and not internal storage. This makes it seemingly impossible to just swap lines of code. Someone trying to overcome the same road block: http://forum.xda-developers.com/showthread.php?t=2168489.
Modifying storage_list.xml within framework-res.apk: I have looked into how android mounts storage devices and it seems that 4.2.2 and earlier rely on the vold.fstab and storage_list.xml (http://source.android.com/devices/tech/storage/). I then began trying to look into the storage_list.xml located in the framework-res.apk and found these:
http://forum.xda-developers.com/showpost.php?p=27432510
http://forum.xda-developers.com/showpost.php?p=35792201
I tried modifying the storage_list.xml but when I swapped the "sdcard0" and "extSdCard" text in the file (after unpacking adn repacking the apk) my phone went into a bootloop. I understand that swapping two phrases in a file didn't have much evidence to support trying it but I had to find out what it did. Maybe someone can help with this. This example of a storage_list.xml file provided by google (https://android.googlesource.com/de...eworks/base/core/res/res/xml/storage_list.xml) looks much different from the extracted file I pulled which had a lot of random characters and null signs (using notepad++).
Using init.d script: I have found two people who have tried this for the S4:
http://forum.xda-developers.com/showthread.php?t=2363670 This mod results in a lack of access to the internal device storage. (According to the posts)
http://forum.xda-developers.com/showthread.php?t=1772234 This mod results in a successful swap (according to some posts) but is unstable and causes a lot of application crashes and glitches. The OP needs more testers, but the thread is still fairly active and could be a possible route. I have yet to test this.
I understand that there are applications such as forldermount and link2sd that provide options for freeing up internal memory but these options do not provide enough storage for me personally (and others I'm sure). ME7 gave us app2sd ability but that still doesn't relieve enough space. My goal here is to start more discussion to address this issue. Any ideas or comments on the feasibility for swapping storage mounts please post below. DON'T LET THIS THREAD DIE.
Thank You,
MetaMav
P.S. I uploaded my S4's (SCH-I545) vold.fstab if anyone would like to venture at modifying it for this purpose.
Cool
Sent from my GT-I9505G using XDA Premium 4 mobile app
Using external as internal would render lag spikes due to garbage collection.
Performance
previse said:
Using external as internal would render lag spikes due to garbage collection.
Click to expand...
Click to collapse
I understand the caveats to swapping storage devices. We do not however fully know how performance impeding the modification will be until we find a fully functioning solution to test. I'm optimistic . My previous device handled swapping very well with not a lot, if any, noticeable performance loss.
It's a good idea. Wouldn't using something like Link2SD and/or Foldermount help in getting more internal space?
Correct
maddog00 said:
It's a good idea. Wouldn't using something like Link2SD and/or Foldermount help in getting more internal space?
Click to expand...
Click to collapse
You're right, they are fantastic ways of saving space. They do not however provide the ease of having a larger internal storage that everything is installed on by default. Many people also do not want to deal with having to make a link or special exception for every application installed. If I am not mistaken there are also certain app functions that may not work if moved to the external SD card. My goal is that through some discussion and help we can figure out how to make storage swapping available for the S4 like it is for so many other devices.
MetaMav said:
You're right, they are fantastic ways of saving space. They do not however provide the ease of having a larger internal storage that everything is installed on by default. Many people also do not want to deal with having to make a link or special exception for every application installed. If I am not mistaken there are also certain app functions that may not work if moved to the external SD card. My goal is that through some discussion and help we can figure out how to make storage swapping available for the S4 like it is for so many other devices.
Click to expand...
Click to collapse
But with that slight increase on complexity you get rather significant increases in performance due to the much higher random R/W of the internal storage. Keeping system and most apps on the faster internal is preferable.
You're on XDA man. If the choice is between a slight increase in complexity and a big increase in performance... I'd put my money on performance.
Side: you are very wrong when you say certain app functions won't work. With folder mount there is no difference as far as the app is concerned. These are links not app2sd.
You also don't have to make a link for every app installed. I have it set up to link the entire /Android/OBB/ folder. Set it once and done.
Sent from my SCH-I545 using Tapatalk 4
Metallice said:
But with that slight increase on complexity you get rather significant increases in performance due to the much higher random R/W of the internal storage. Keeping system and most apps on the faster internal is preferable.
You're on XDA man. If the choice is between a slight increase in complexity and a big increase in performance... I'd put my money on performance.
Side: you are very wrong when you say certain app functions won't work. With folder mount there is no difference as far as the app is concerned. These are links not app2sd.
You also don't have to make a link for every app installed. I have it set up to link the entire /Android/OBB/ folder. Set it once and done.
Sent from my SCH-I545 using Tapatalk 4
Click to expand...
Click to collapse
Thank you for the corrections Metallice. In my previous reply I meant that moving apps via app2sd would prevent certain features from working such as widget functionality and listening for "boot completed" events. I did not mean that using applications such as Link2SD and Folder Mount would cause these complication. Those two apps are very viable solutions for saving space (I use them myself). Also, I understand the concern for performance but I haven't used a device with this mod where I noticed any noticeable performance loss when using applications.
At any rate, I want to use this discussion for making this swapping method work. Any input as far as what I compiled in the OP or possible modifications that could make this mod work on this device would be fantastic.
Bump
I really enjoyed this mod on my S3. I have tried several methods to accomplish this myself with no success so far. Thanks for starting the OP!!
I hope we can come up with a working solution soon!!!
Hello and thanks for inviting me to this thread.
I have tried all possibile things I think! I use folder mount now but is really bad as it make my phone slow, hot and battery eater but... Do the job.
Anyway... I have made the switch but I have the problem of duplicates in gallery.
The only way to mount in correct way the external sd card into data/media/0 is with mount -o bind.
I have tried to mount vold file or block file with mount -t vfat umask and all is OK but some media files are not recognized by gallery!!! I can't understand why media files of what's app and of go SMS for example are not seen in gallery!
The only way to fix it is to bind the storage/extSdCard directory but... After we have two mount point for external sd and so duplicates.
Then I have tried another trick which works... So i have changed in vold.fstab the mount point of external sd card in usbDriveA and... Yes all is OK! Bind is OK! Zero duplicates! But.... Always there is a but... Since it is mounted sd USB drive, i have the notification for unmount always visibile and unmounting this became dangerous!
The best way to this swapping is to mount external sd in another folder different from /storage/extSdCard so I can do all I need with init.d script but when I change the mount point in vold.fstab to /storage/extSdCard2 for example, I have bootloop.
Any idea?
From universe with my gs4 snapdragon powered!
Bump!!
Made it http://forum.xda-developers.com/showthread.php?t=2468596
mattiadj said:
Bump!!
Made it http://forum.xda-developers.com/showthread.php?t=2468596
Click to expand...
Click to collapse
This is AWESOME! I updated the OP.
* *
jr0324 said:
His thread is very clearly posted in the i9505 sub... has anyone tried this on vzw s4? Aosp/wiz results?
Click to expand...
Click to collapse
I have tried this on my VZW S4 SCH-I545 and it works on my device. I think this mod only works for Touchwiz ROMs with init.d support (universal init.d app on the play store may be an alternative) but the OP has yet to receive enough feedback. I do not know if this works for the ocotocore version of the S4 but it should work for any Snapdragon 600 S4 carrier (not confirmed yet). Here are the specs of my device running this mod:
Model: SCH-I545 (Verizon Wireless, Snapdragon 600)
ROM: BoneStock ROM v1.1.4 (http://forum.xda-developers.com/show....php?t=2384362)
Kernel: KTweaker 9/17 build (http://forum.xda-developers.com/show....php?t=2294083)
SD Card: 64GB SanDisk calss 10 (fat32) with a second 10GB fat32 partition for link2sd
Stay tuned for more information on the mod's main thread!
The init.d support factor would rule this out with ME7 and Safestrap - Rom slots, correct?
lazer9 said:
The init.d support factor would rule this out with ME7 and Safestrap - Rom slots, correct?
Click to expand...
Click to collapse
I'm not sure, but I'd recommend trying the universal init.d app on the store play and see if that works with safe strap.
Sent from my SCH-I545 using xda app-developers app
MetaMav said:
I'm not sure, but I'd recommend trying the universal init.d app on the store play and see if that works with safe strap.
Sent from my SCH-I545 using xda app-developers app
Click to expand...
Click to collapse
I ran the universal init.d app from play store - ran the test - rebooted... Said I already had init.d support. Proceeded with your mod install. But I don't think it's doing anything different. Don't really understand the steps in your OP to verify. I'm using the extfat one.
lazer9 said:
I ran the universal init.d app from play store - ran the test - rebooted... Said I already had init.d support. Proceeded with your mod install. But I don't think it's doing anything different. Don't really understand the steps in your OP to verify. I'm using the extfat one.
Click to expand...
Click to collapse
I've seen posts suggesting exfat may have some issues. I'd try formatting your SD card to fat32 and following the install guide very closely. Let me know if you get it to work or get stuck again. I got it to work with fat32.
Sent from my SCH-I545 using xda app-developers app
MetaMav said:
I've seen posts suggesting exfat may have some issues. I'd try formatting your SD card to fat32 and following the install guide very closely. Let me know if you get it to work or get stuck again. I got it to work with fat32.
Sent from my SCH-I545 using xda app-developers app
Click to expand...
Click to collapse
I may try that. I assume I could just copy everything to the PC from my ext card then format then copy everything back and give it another go? Is there something I should remove first since I have the extfat one installed now before resorting to flashing the FAT32 one if I go this route?
lazer9 said:
I may try that. I assume I could just copy everything to the PC from my ext card then format then copy everything back and give it another go? Is there something I should remove first since I have the extfat one installed now before resorting to flashing the FAT32 one if I go this route?
Click to expand...
Click to collapse
You should be able to just copy over to pc and reformat. You need to either remove the init.d script for this mod in your init.d folder before you flash the fat32 one or revert to a previous backup. Read the mod's main thread for details on this.
Sent from my SCH-I545 using xda app-developers app

Storage & camcorder issues on jb roms?

I've tried getting an answer on this before. How do I fix the internal and SD card storage problems? For some reason everything goes right to external and it never uses my sdcard. Ex; Titanium Backup goes right to internal, everything I download goes to internal, pictures too(pics go to int & sd) etc. I have a 64gb card and I'd like yo use it. Can some please explain what each folder means? There are so many paths to external and sd. Also, I went into "manage apps" and to the "on sdcard" tab. I checked each one. Does that mean every app that is checked marked is now using the sdcard for space? I'm just really confused with all this lol. I attached some screenshots of my external/scard. Any help is appreciated.
Thanks
Sent from my ADR6425LVW using Tapatalk 2
xXezmacXx said:
I've tried getting an answer on this before. How do I fix the internal and SD card storage problems? For some reason everything goes right to external and it never uses my sdcard. Ex; Titanium Backup goes right to internal, everything I download goes to internal, pictures too(pics go to int & sd) etc. I have a 64gb card and I'd like yo use it. Can some please explain what each folder means? There are so many paths to external and sd. Also, I went into "manage apps" and to the "on sdcard" tab. I checked each one. Does that mean every app that is checked marked is now using the sdcard for space? I'm just really confused with all this lol. I attached some screenshots of my external/scard. Any help is appreciated.
Thanks
Sent from my ADR6425LVW using Tapatalk 2
Click to expand...
Click to collapse
JB AOSP roms behave the same way Sense does, sd card is considered internal.
Check to see if you can change your storage location in the apps in question. People have gotten away with swapping the mount points to make external the sd card also.
mjones73 said:
JB AOSP roms behave the same way Sense does, sd card is considered internal.
Check to see if you can change your storage location in the apps in question. People have gotten away with swapping the mount points to make external the sd card also.
Click to expand...
Click to collapse
Is there a post on here about making the ext the SD card also?
Sent from my ADR6425LVW using Tapatalk 2
I forgot, does that camcorder not work on all jb roms atm? Is going back to sense my best bet? If so can I just go ahead and flash any sense rom coming from cm? Or do I need to follow other steps first?
Sent from my ADR6425LVW using Tapatalk 2
Camcorder works and has been fixed for awhile...as for making your external read as internal is darn near impossible....the 4.1 and 4.2 SD card layout was caused by a bug....I bricked my last rezound trying to make a mod for you guys...so be warned about trying...there is an app somewhere that merges the 2 SD cards together but causes errors for future flashing
Sent from my Rezound using xda app-developers app
xXezmacXx said:
Is there a post on here about making the ext the SD card also?
Sent from my ADR6425LVW using Tapatalk 2
Click to expand...
Click to collapse
The process changed in CM10.2, they did away with the vold.fstab file. It looks like the mounts are defined in fstab.vigor and/or fstab.goldfish now. I haven't tried modifying them personally.
It would be easier re pointing any apps you can, any changes you make to the above files would be lost every time you flash a new nightly.

Categories

Resources