I have some very basic questions, Great to get answer.
Q 1. Whenever anyone creates android application which generates *.apk file and installed this apk on device, can we surely say that android has created new process for this apk ?
Q 2. If Android app manifest file has tag for application and inside it has service only. and If it installed on device as apk.
Now this service remotely going to be access by another android application using aidl which has application tag and inside that there is Activity. which access above remote service.
can we say that service accessing App and remote service both are different process ? I think Yes.
My assumption
Any app which has tag inside manifest file and which generates apk and get installed on android device then on launch by any other App remotely or starts its own on some event intent then android framework will launch new process to start for this apk. Please correct ?
android:process can be set if any components of same application want to run in another process or different applications component want to run in the same process.
Please read carefully and then only reply, let me know if need more explanation.
R1. The apk is just a package. When you start your application, low level, the linux machine on which Android is based will fork a process called Zygote. Then the copy of the Zygote (that already has either an instance of the Dalvik Machine mapped in its address space, or the ART libraries and Ahead Of Time compiled application code), will load all application specific java classes, and all core dependencies (native libraries), plus all application specific native code.
So it does create a new process only when you start the application.And hypothetically, you could create any number of processes for the same apk, which is just a container.
R2. If in the AndroidManifest you have a service declared as "exported", it will run in a separate process. Your application will then communicate with this process using an IPC mechanism called Binder, which is a specific implementation of shared memory at kernel level. AIDL is a meta-language interpreted at build time and used to auto-generate Java stubs that will work deep down with native binder code.