Thursday, June 14, 2018

file system - Why do Android create "Shell Folders" automatically? Can I change the shell folders?


Android automatically creates these folders in primary storage:


Alarms
DCIM
Documents

Download
Movie
Music
Notifications
Pictures
Podcasts
Ringtones

They are the default "User Shell Folders" of Android (USF is a concept from Windows). There's hardly any documents or discussions on the internet. Most discussions are about MediaProvider (and Media Scanner).


Is there something like a "registry key" that controls these folders? Can I change the default location and name of them?




Answer



Registry key is a windows concept in android these locations are handled as following


/**
* Standard directory in which to place files that have been downloaded by
* the user. Note that this is primarily a convention for the top-level
* public directory, you are free to download files anywhere in your own
* private directories. Also note that though the constant here is
* named DIRECTORY_DOWNLOADS (plural), the actual file name is non-plural for
* backwards compatibility reasons.
*/

public static String DIRECTORY_DOWNLOADS = "Download";

This code snippet is extracted from android / platform / frameworks / base / android- / . / core / java / android / os / Environment.java


So as you can see this returns a hard coded static string and I could not find any function to change it in AOSP code. So you can not change this location for all applications unless you modify the source code and build your own custom rom. For your application obviously, you can download it in its private folder also.


But some OEM had provided this capability in their rom. See this.


A work around to do so for Download folder is to download a 3rd party download manager like ES file manager. It will prompt you to choose download location for the file.


No comments:

Post a Comment

samsung galaxy s 2 - Cannot restore Kies backup after firmware upgrade

I backed up my Samsung Galaxy S2 on Kies before updating to Ice Cream Sandwich. After the upgrade I tried to restore, but the restore fails ...