I'm trying to understand the android:process
attribute. Ref says:
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.
Will a process be created if the name doesn't begin with a colon? What if it begins with a capital letter? And what happens if I mix the two rules?
I need to have two components from two packages run in the same process to save resources (and to avoid having two "running apps" listed in the apps manager). What should be my process name? Do I need a global process?
EDIT:
I tried with a simple lower case name (first package's name) and it seems it's working like I want. Still I think I don't get the rules.
And what happens if I mix the two rules?
That's not possible. A colon is not a capital letter.
I need to have two components from two packages run in the same process to save resources (and to avoid having two "running apps" listed in the apps manager).
That's really not a good idea. Put them in the same package, or have them run independently.
Not only would you have to mess around with android:process
, but you also have to mess around with android:sharedUserId
. Neither of these are meant to be used by ordinary SDK developers, particularly android:sharedUserId
. In fact, if you have already distributed your application, you can't use android:sharedUserId
unless you're willing to break all your existing users' apps, since you will no longer be able to access your original data, since it'll be owned by some other user account.
Furthermore, unless you have evidence to the contrary, I would not assume that this will somehow "avoid having two 'running apps' listed in the apps manager".
Now, I am all for efficiency, and so creating extra processes for grins (e.g., misguided advice to make "remote services" run in custom processes) is a bad idea. And if you work for a device manufacturer or a firm with 20+ Android developers or something, and you want to mess around with this, you're going to need to find places where it is used in the AOSP and reverse-engineer the information you seek, since this stuff is seriously under-documented. And even there, I am not seeing it used between multiple packages, except for android.process.acore
and com.android.phone
, which are seriously low-level processes and are not going to be typical of non-firmware apps.
Hence, I really recommend that you leave these things alone.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With