By default, all components in the same application run in the same process, and most applications do, too. However, if we want to control that a particular component belongs to a process, we can configure it in the manifest file.
In the manifest entry for each component element (activity, service, receiver, provider), a “android:process” property is supported, which allows you to specify the process that a component is running. You can set this property so that each component runs in its own process, or you can have only certain components share a process. We want to be able to set the “Android: Process” property so that components in different applications, which share the same Linux user ID and have the same certificate, run in the same process.
< application> The element also has an “Android: Process” attribute that can be set to a default value that applies to all components.
When the amount of available memory is low and some processes that interact with the user in real time need memory, Android can terminate a process at any time. Components running in the terminated process are destroyed, but a second process is started when the components are needed to work again.
In deciding which processes to terminate, The Android system weighs their importance to the user. For example, it makes more sense to terminate a process running invisible activities than a process running visible ones. Whether or not to terminate a process depends on the state of the components that are running in the process.
If two activities cannot be placed in the same application, they can be forced to run in the same process by setting the following properties in their manifest, thus taking full advantage of the Shared resources within the process and reducing the memory footprint:
Java code:
(1) Set the same User Id:
2.< manifest android:sharedUserId=”aaa.bbb”
3. (2) The called activity sets the following properties:
4.< activity android:multiprocess=”true”
Or 5.
6.< activity android:process=”com.cienet.test”
For 3D OpenGL program, after modifying the above attributes, the memory footprint of the called activity will be significantly reduced, such as: 30MB-& gt; 2 MB.
You can do the following test: How do you share a process
Java code:
1. Join Android :sharedUserId=” AAA. BBB “no
2.android:process=”com.cienet.test”
3.07-12 15:42:34. 781: the ERROR/Dean (7615) : Binder. The getCallingPid (7615)
4.07-12 15:42:34. 785: the ERROR/Dean (7615) : runningappprocessinfo. Pid: 7615 runningappprocessinfo processNamecom. Cienet. Testa
5.07-12 15:42:34. 785: the ERROR/Dean (7615) : pkgname: 7615: com. Cienet. Testa
6.
7.
8.07-12 15:42:24. 722: the ERROR/Dean (7602) : Binder. The getCallingPid (7602)
9.07-12 15:42:24. 726: the ERROR/Dean (7602) : runningappprocessinfo. Pid: 7602 runningappprocessinfo processNamecom. Cienet. Testb
10.07-12 15:42:24. 726: the ERROR/Dean (7602) : pkgname: 7602: com. Cienet. Testb
11.
12. Add Android :process=”com.cienet.test” to B
13.
14.07-12 15:46:41. 933: the ERROR/Dean (7738) : Binder. The getCallingPid (7738)
15.07-12 15:46:41. 937: the ERROR/Dean (7738) : runningappprocessinfo. Pid: 7738 runningappprocessinfo processNamecom. Cienet. Test
16.07-12 15:46:41. 937: the ERROR/Dean (7738) : pkgname: 7738: com. Cienet. Testb
17.
18.07-12 15:47:13. 246: the ERROR/Dean (7761) : Binder. The getCallingPid (7761)
19.07-12 15:47:13. 246: the ERROR/Dean (7761) : runningappprocessinfo. Pid: 7761 runningappprocessinfo processNamecom. Cienet. Testa
20.07-12 15:47:13. 250: the ERROR/Dean (7761) : pkgname: 7761: com. Cienet. Testa
21.
22. Add Android :process=”com.cienet.test” to A
23.
24.07-12 15:50:24. 988: the ERROR/Dean (7878) : getApplicationInfo: publicSourceDir/data/app/com. Cienet. Testa – 1. The apk
25.07-12 15:50:24. 988: the ERROR/Dean (7878) : getApplicationInfo: descriptionRes0
26.07-12 15:50:24. 988: the ERROR/Dean (7878) : Binder. The getCallingPid (7878)
27.07-12 15:50:24. 992: the ERROR/Dean (7878) : runningappprocessinfo. Pid: 7878 runningappprocessinfo processNamecom. Cienet. Test
28.07-12 15:50:24. 992: the ERROR/Dean (7878) : pkgname: 7878: com. Cienet. Testa
29.
30.
31.07-12 15:50:46. 964: the ERROR/Dean (7878) : getApplicationInfo: publicSourceDir/data/app/com. Cienet. Testb – 1. The apk
32.07-12 15:50:46. 964: the ERROR/Dean (7878) : getApplicationInfo: descriptionRes0
33.07-12 15:50:46. 964: the ERROR/Dean (7878) : Binder. The getCallingPid (7878)
34.07-12 15:50:46. 968: the ERROR/Dean (7878) : runningappprocessinfo. Pid: 7878 runningappprocessinfo processNamecom. Cienet. Test
35.07-12 15:50:46. 972: the ERROR/Dean (7878) : pkgname: 7878: com. Cienet. Testa
36.
37.
38. Remove the android: sharedUserId = “aaa. BBB”
39.07-12 15:52:29. 574: the ERROR/Dean (7967) : getApplicationInfo: publicSourceDir/data/app/com. Cienet. Testb – 2. Apk
40.07-12 15:52:29. 578: the ERROR/Dean (7967) : getApplicationInfo: descriptionRes0
41.07-12 15:52:29. 578: the ERROR/Dean (7967) : Binder. The getCallingPid (7967)
42.07-12 15:52:29. 578: the ERROR/Dean (7967) : runningappprocessinfo. Pid: 7967 runningappprocessinfo processNamecom. Cienet. Test
43.07-12 15:52:29. 578: the ERROR/Dean (7967) : pkgname: 7967: com. Cienet. Testb
44.
45.
46.07-12 15:53:06. 730: the ERROR/Dean (7990) : getApplicationInfo: publicSourceDir/data/app/com. Cienet. Testa – 2. Apk
47.07-12 15:53:06. 730: the ERROR/Dean (7990) : getApplicationInfo: descriptionRes0
48.07-12 15:53:06. 730: the ERROR/Dean (7990) : Binder. The getCallingPid (7990)
49.07-12 15:53:06. 734: the ERROR/Dean (7990) : runningappprocessinfo. Pid: 7990 runningappprocessinfo processNamecom. Cienet. Test
50.07-12 15:53:06. 734: the ERROR/Dean (7990) : pkgname: 7990: com. Cienet. Testa
As shown above that APK Shared process requires two conditions (1) to set the same User Id:
(2) The called activity sets the following properties:
< activity android:multiprocess=”true”
or
< activity android:process=”com.cienet.test”
In the manifest entry for each component element (activity, service, receiver, provider), a “android:process” property is supported, which allows you to specify the process that a component is running. You can set this property so that each component runs in its own process, or you can have only certain components share a process. We want to be able to set the “Android: Process” property so that components in different applications, which share the same Linux user ID and have the same certificate, run in the same process.
< application> The element also has an “Android: Process” attribute that can be set to a default value that applies to all components.
When the amount of available memory is low and some processes that interact with the user in real time need memory, Android can terminate a process at any time. Components running in the terminated process are destroyed, but a second process is started when the components are needed to work again.
In deciding which processes to terminate, The Android system weighs their importance to the user. For example, it makes more sense to terminate a process running invisible activities than a process running visible ones. Whether or not to terminate a process depends on the state of the components that are running in the process.
If two activities cannot be placed in the same application, they can be forced to run in the same process by setting the following properties in their manifest, thus taking full advantage of the Shared resources within the process and reducing the memory footprint:
Java code:
(1) Set the same User Id:
2.< manifest android:sharedUserId=”aaa.bbb”
3. (2) The called activity sets the following properties:
4.< activity android:multiprocess=”true”
Or 5.
6.< activity android:process=”com.cienet.test”
For 3D OpenGL program, after modifying the above attributes, the memory footprint of the called activity will be significantly reduced, such as: 30MB-& gt; 2 MB.
You can do the following test: How do you share a process
Java code:
1. Join Android :sharedUserId=” AAA. BBB “no
2.android:process=”com.cienet.test”
3.07-12 15:42:34. 781: the ERROR/Dean (7615) : Binder. The getCallingPid (7615)
4.07-12 15:42:34. 785: the ERROR/Dean (7615) : runningappprocessinfo. Pid: 7615 runningappprocessinfo processNamecom. Cienet. Testa
5.07-12 15:42:34. 785: the ERROR/Dean (7615) : pkgname: 7615: com. Cienet. Testa
6.
7.
8.07-12 15:42:24. 722: the ERROR/Dean (7602) : Binder. The getCallingPid (7602)
9.07-12 15:42:24. 726: the ERROR/Dean (7602) : runningappprocessinfo. Pid: 7602 runningappprocessinfo processNamecom. Cienet. Testb
10.07-12 15:42:24. 726: the ERROR/Dean (7602) : pkgname: 7602: com. Cienet. Testb
11.
12. Add Android :process=”com.cienet.test” to B
13.
14.07-12 15:46:41. 933: the ERROR/Dean (7738) : Binder. The getCallingPid (7738)
15.07-12 15:46:41. 937: the ERROR/Dean (7738) : runningappprocessinfo. Pid: 7738 runningappprocessinfo processNamecom. Cienet. Test
16.07-12 15:46:41. 937: the ERROR/Dean (7738) : pkgname: 7738: com. Cienet. Testb
17.
18.07-12 15:47:13. 246: the ERROR/Dean (7761) : Binder. The getCallingPid (7761)
19.07-12 15:47:13. 246: the ERROR/Dean (7761) : runningappprocessinfo. Pid: 7761 runningappprocessinfo processNamecom. Cienet. Testa
20.07-12 15:47:13. 250: the ERROR/Dean (7761) : pkgname: 7761: com. Cienet. Testa
21.
22. Add Android :process=”com.cienet.test” to A
23.
24.07-12 15:50:24. 988: the ERROR/Dean (7878) : getApplicationInfo: publicSourceDir/data/app/com. Cienet. Testa – 1. The apk
25.07-12 15:50:24. 988: the ERROR/Dean (7878) : getApplicationInfo: descriptionRes0
26.07-12 15:50:24. 988: the ERROR/Dean (7878) : Binder. The getCallingPid (7878)
27.07-12 15:50:24. 992: the ERROR/Dean (7878) : runningappprocessinfo. Pid: 7878 runningappprocessinfo processNamecom. Cienet. Test
28.07-12 15:50:24. 992: the ERROR/Dean (7878) : pkgname: 7878: com. Cienet. Testa
29.
30.
31.07-12 15:50:46. 964: the ERROR/Dean (7878) : getApplicationInfo: publicSourceDir/data/app/com. Cienet. Testb – 1. The apk
32.07-12 15:50:46. 964: the ERROR/Dean (7878) : getApplicationInfo: descriptionRes0
33.07-12 15:50:46. 964: the ERROR/Dean (7878) : Binder. The getCallingPid (7878)
34.07-12 15:50:46. 968: the ERROR/Dean (7878) : runningappprocessinfo. Pid: 7878 runningappprocessinfo processNamecom. Cienet. Test
35.07-12 15:50:46. 972: the ERROR/Dean (7878) : pkgname: 7878: com. Cienet. Testa
36.
37.
38. Remove the android: sharedUserId = “aaa. BBB”
39.07-12 15:52:29. 574: the ERROR/Dean (7967) : getApplicationInfo: publicSourceDir/data/app/com. Cienet. Testb – 2. Apk
40.07-12 15:52:29. 578: the ERROR/Dean (7967) : getApplicationInfo: descriptionRes0
41.07-12 15:52:29. 578: the ERROR/Dean (7967) : Binder. The getCallingPid (7967)
42.07-12 15:52:29. 578: the ERROR/Dean (7967) : runningappprocessinfo. Pid: 7967 runningappprocessinfo processNamecom. Cienet. Test
43.07-12 15:52:29. 578: the ERROR/Dean (7967) : pkgname: 7967: com. Cienet. Testb
44.
45.
46.07-12 15:53:06. 730: the ERROR/Dean (7990) : getApplicationInfo: publicSourceDir/data/app/com. Cienet. Testa – 2. Apk
47.07-12 15:53:06. 730: the ERROR/Dean (7990) : getApplicationInfo: descriptionRes0
48.07-12 15:53:06. 730: the ERROR/Dean (7990) : Binder. The getCallingPid (7990)
49.07-12 15:53:06. 734: the ERROR/Dean (7990) : runningappprocessinfo. Pid: 7990 runningappprocessinfo processNamecom. Cienet. Test
50.07-12 15:53:06. 734: the ERROR/Dean (7990) : pkgname: 7990: com. Cienet. Testa
As shown above that APK Shared process requires two conditions (1) to set the same User Id:
(2) The called activity sets the following properties:
< activity android:multiprocess=”true”
or
< activity android:process=”com.cienet.test”
Read More:
- How to Solve Win 10 Kb5008212 can’t share printer Issue
- How to Configure DHCP for Multiple VLANs?
- Session ‘app’: Error Installing APKs
- How to fix process system isn’t responding on Android?
- HTTP Error 502.5 – Process Failure (How to Fix)
- Ubuntu reads the shared folder under windows Unable to mount location Failed to retrieve share list from server
- Unknown failure (at android.os.Binder.execTransact(Binder.java:565))Error while Installing APKs
- How to Solve Error: The emulator process for AVD was killed.
- Problems encountered by Android Studio: Session’app’: Error Installing APKs
- How to solve oserror: [errno 98] address already in use and kill the python3 process
- In vs2013, reshharper and team management plug-in git share a temporary solution to the “failed modify to document” error.
- RuntimeError: Default process group has not been initialized, please make sure to call init_process_
- How to select the jar package version for Maven package when the jar package versions referenced by multiple modules are inconsistent
- Ida batch processes virus share samples to obtain ASM files and bytes files
- Android debugging DELETE_FAILED_INTERNAL_ERROR, Error while Installing APKs
- Delete when debugging Android_ FAILED_ INTERNAL_ ERROR,Error while Installing APKs
- Error: Could not link: /usr/local/share/doc/homebrew
- Twitter share failed, HTTP 403 error
- Start rqt_ Graph, prompt / opt / ROS / melody / share / PR2_ motor_ diagnostic_ Under tool plugin.xml There is something wrong with the file
- Read multiple sheets of an excel file according to npoi