[G1 Android Development] lbcoder:
The *current* mechanism to install applications on SD is an EXTREMELY hacky piece of junk.

Though it will work, it will only do so under the following conditions;

1) the user is fully aware of the limitations of the system and doesn't do anything that will stress it out,

2) the sdcard is *always* in the device, never removed.

3) it is impossible to use multiple sdcards in the same device.

Let me pose this question to everyone;

WHAT HAPPENS if you are using hack-apps2sd and you remove the sdcard? You know, just PULL IT OUT... This is something that "regular" users do *all the time*.

This is only one of many conditions that need to be managed by an apps2sd system before it can be considered for inclusion in a consumer device.

Needs to be done;

1) The user needs to be able to chose whether or not to enable apps-to-sd and must set itself up on the phone itself by just the click of a button.

2) The user must be able to SWAP SDCARDS at will. This includes the case where they just rip the card out without unmounting it.

3) When an sdcard is inserted containing apps, the system must automatically set it up and add those applications to the package manager.

4) UID collisions must NEVER happen.

5) External apps must be able to be sanely removed from the package manager upon unmount (planned or unplanned).

6) Processes with open file handles must be politely shut down upon a planned unmount.

7) Processes with open file handled must be CLEANLY killed off upon an UNPLANNED unmount.

8) PROTECTED-APPS must be copy protected when stored on the sdcard to at least equal security to that used internally, i.e. they should be encrypted using a randomly generated key stored in a root-only location within /data.

9) The user must be able to chose where to install a new application.

10) Application home directory and dalvik-cache must be stored on the same media as the application is installed to, i.e. internally installed apps should have their home directory and dalvik-cache stored internally, externally installed apps should have their home directory and dalvik-cache stored externally.

11) Optional: Ability to grow/shrink the amount of storage on the sdcard devoted to applications.

In other words, the user experience should be like this;

1) With a regular sdcard inserted (or no sdcard inserted), the user experience must not be any different than it is currently.

2) User can go to Settings-->SD card & phone storage-->(SD card) Enable application install to SD card. This prompts the user for how much space to devote to applications (default, say equal to internal), and then sets it up.

2B) optional -- user can go to Settings-->SD card & phone storage-->(SD card) "Change SD card space reserved for applications". Prompts for new size (min size = current space used, max size = current available + total sdcard available).

3) User goes to install a new app, if the card has application storage enabled, the installer asks where to install the application to (internal or sdcard).

4) User safely unmounts sdcard -- if applications are running, prompt "There are applications running on the sdcard (list them), these will be terminated. Continue?", terminates applications, removes them from package manager, unmounts.

5) User unsafely pulls sdcard -- if applications were running, message "These applications were running on the sdcard. They have been terminated and any unsaved data has been lost."

6) User inserts or mounts sdcard, system scans if application install is enabled on the card, if it is, the applications are added to package manager.