In the process of developing Android apps, you always have to debug your app, and you'll want to learn about the Android directory structure when you install it. Then a little material was found.
Original address: http://www.hiapk.com/viewthread.php?tid=465392&page=4
Google Android phone software for security and stability are installed by default in the phone memory, but the phone memory is limited, so we will do APP2SD operation, so that we install the software on the SD card, this operation is required ROM support.
Android 2.2 can install the mobile phone program on the external SD card, which is what we usually call APP2SD. However, the official APP2SD is very chicken, need the software itself to support installed on the memory card, that is, with the official APP2SD, to install the program on the memory card, not our users, but the software developers to decide. The test installs more than 60 software, of which only the poor 5 programs can be installed on the memory card using the official APP2SD. So, the official APP2SD is a bluff. Of course, many third-party ROMs now come with third-party APP2SD that can install any program on the SD card.
Before I formally introduce APP2SD, I would like to introduce some of the more important directories of the Android system, which is the basis for understanding the later content.
The/system stores the information of the ROM,/system/app the software that is included with the ROM itself, and/system/data the data file information of the core system software stored in the/system/app.
/data Store the user's software information (non-ROM installed software),/data/app Store user-installed software,/data/data store all software (including/system/app and/data/app and/mnt/ ASEC) Some lib and XML files and other data information;/data/dalvik-cache the cache file of the stored program, where the files can be deleted.
/mnt directory, people familiar with Linux are aware that the Linux default mount external devices will be suspended under this directory, such as the SD card mounted, will generate a/mnt/sdcard directory.
The/sdcard directory, which is a soft link (equivalent to a shortcut to a Windows folder), links to the/mnt/sdcard directory, where the contents of this directory are sdcard content.
The version after Android 2.2 allows the application to be installed on the SD card, each application installed on the SD card can be found in the/sdcard/.android_secure directory of the SD card with the name of the program in which it appears, And the file named ASEC is specially encrypted after processing. When the SD card is mounted on the phone, the/mnt/sdcard/.android_secure directory is mapped to the/mnt/asec directory and the/mnt/secure directory. Where the/mnt/asec directory is mainly the installation directory of the program, including its executable files and Lib files, and the/mnt/secure directory is stored in the program encrypted files. That is, the/MNT/ASEC directories and/mnt/secure directories that you see under the/mnt path are not really in the memory of the phone or the partition mount directory of the SD card, they are just an image of the/mnt/sdcard/.android_secure directory.
Therefore, when the user program is installed on the SD card, its contents may be dispersed to:/mnt/asec,/mnt/secure,/data/data.
To achieve APP2SD, at present there are two kinds of schemes, namely App2ext and Data2ext, respectively, the following 2 kinds of programs are described below.
In the Linux file system, there is a special kind of file called "soft link", similar to the shortcut under Windows, Soft link can map a file or folder to another place, an example of the/sdcard described above is/mnt/sdcard soft link.
The App2ext principle is to delete the app folder in the data area, then create an app file on the SD card's ext partition and map it to the data area via a soft link. So the system will think that the soft link is a real folder, the program will be installed in the inside, but in fact, these programs are installed on the card. But because the operating system does not know, so in this case, we still see the system shows that the program is installed in the "built-in space".
Data2ext is more thorough, it is not with the soft link, but directly with the "Mount" function, all the storage devices under Linux must be mounted as a folder for file operations (such as the SD card is mounted under the/mnt/sdcard directory). The data folder originally corresponds to a partition within the phone's internal flash (in order to keep the terminology accurate, the internal flash is different from the memory, internal Flash is ROM, memory is RAM). Data2ext, however, modifies the mount correspondence so that the data folder is not built-in flash, but the entire ext partition of the SD card. In this way, not only the app, data and cache Dalvik-cache stored in the program are stored in the SD card.
As you can see, the location of the two folders, Dalvik-cache and data, is a significant difference between these two approaches. Where Dalvik-cache is the virtual machine precompiled cache, data (unlike/data, which is/data/data) is where the program data is stored, such as the game's archived records, software configuration information, and so on. What is the difference, the difference is that if you re-brush the Rom,app2ext, all the programs can be preserved, but the configuration information of these programs and the game archive will be lost. Data2ext can be preserved with both configuration and archiving, but Dalvik-cache is also an easy place to accumulate rubbish, which is also preserved together.
Data2ext because the entire data partition is placed on the SD card, so, we need to wipe to brush ROM, the content of this data partition may not be wipe, which can save the user's personal data, but also can cause the system inexplicable failure.
On the directory structure in Android