Security and permissions

The permissions required by an application are declared statically in that application, so they can be known up-front at install time and will not change after that.

basic url

Each Android package (.apk) file installed on the device is given its own unique Linux user ID, creating a sandbox for it and preventing it from touching other applications (or other applications from touching it). This user ID is assigned to it when the application is installed on the device, and remains constant for the duration of its life on that device.

Any data stored by an application will be assigned that application's user ID, and not normally accessible to other packages. When creating a new file with getSharedPreferences(String, int), openFileOutput(String, int), or openOrCreateDatabase(String, int, SQLiteDatabase.CursorFactory), you can use the MODE_WORLD_READABLE and/or MODE_WORLD_WRITEABLE flags to allow any other package to read/write the file. When setting these flags, the file is still owned by your application, but its global read and/or write permissions have been set appropriately so any other application can see it.


<manifest xmlns:android="http://schemas.android.com/apk/res/android"    
        package="com.android.app.myapp" >    
       <uses-permission android:name="android.permission.RECEIVE_SMS" />
</manifest>

Here are various permissions

android apk file and linux userid

Search Google for: android apk file and linux userid

Search Android Developers Group for: android apk file and linux userid

Search Android Beginers Group for: android apk file and linux userid

Search Google Code for: android apk file and linux userid

Search Android Issues Database for: android apk file and linux userid

...from google docs

The name of a process where all components of the application should run. Each component can override this default by setting its own process attribute. By default, Android creates a process for an application when the first of its components needs to run. All components then run in that process. The name of the default process matches the package name set by the <manifest> element.

By setting this attribute to a process name that's shared with another application, you can arrange for components of both applications to run in the same process ? but only if the two applications also share a user ID and be signed with the same certificate.

If the name assigned to this attribute begins with a colon (':'), a new process, private to the application, is created when it's needed. If the process name begins with a lowercase character, a global process of that name is created. A global process can be shared with other applications, reducing resource usage

read this thread for understanding application object model

All code in your apk file run in a process by itself whose PID is the package name. It also gets its own linux user id (unless shared)

Being a single process, all code shares static variables as well

You can take a component however and use the process attribute to place it in a different process. (Not fully sure which globals it uses, and if it loads the whole apk file in the other process)

There is one main thread that handles the process. Content providers may satisfy requests on their own threads (I think I am not too sure) and services may be bound through their own threads...(to be verified)

Read the life cycle document again

Read about a service

Basically there are two things that control the lifecycle of a service: (1) clients bound to it, and (2) whether it has been started. Both of those will keep it running. Any started service will raise the importance of its process to a sufficient level that the process will remain running as long as the system isn't getting close to a paging state. In addition, clients bound to it will raise it further if their own process is at a higher level.

android local service binding example

Search for: android local service binding example

android service submitting batch jobs via intents

Search for: android service submitting batch jobs via intents

what does it mean for an android component to declare permission?

Search for: what does it mean for an android component to declare permission?