Http://justanapplication.wordpress.com/2009/08/22/a-standalone-android-runtime-application-installation/
It turns out that an application can be installed, such that it can
Subsequently be run, simply by placing the package containing it inData app
Directory. On a device this wowould usually be the Directory
/data/app
When it is started by the systemserver the packagemanagerservice will
Scan this directory and find the package containing the application. It
Will then ask the installer to install the application.
The installer in the systemserver is simply a proxy forinstalld
Process which can be found here
$(ANDROID_SRC)/frameworks/base/cmds/installd
It is responsible for creating the directories for the application being
Installed and for changing their ownership to that of the application.
This requires root privilege or something like it which is why it is
Being done by a standlone process rather than in the context of
Systemserver process.
The proxy in the systemserver communicatesinstalld
Using local sockets. Neither local sockets nor some of the functionality requiredinstalld
Are available in standard Java but we can mimic enough that the installation of the application succeeds.