8 Services and IPC Part 17
8 Services and IPC Part 17
Douglas C. Schmidt
[email protected]
www.dre.vanderbilt.edu/~schmidt
Vanderbilt University
Nashville, Tennessee, USA
Android Services & Local IPC Douglas C. Schmidt
2
www.dre.vanderbilt.edu/~schmidt/PDF/Activator.pdf
Android Services & Local IPC Douglas C. Schmidt
3
Android Services & Local IPC Douglas C. Schmidt
4
Android Services & Local IPC Douglas C. Schmidt
5
developer.android.com/training/articles/memory.html has more info
Android Services & Local IPC Douglas C. Schmidt
mServicesByIntentPerUser
• If your app needs a Service
to perform work in the 2 Process.start()
background, don’t keep it
3
running unless it's actively someMethodCall()
performing a job
4 Service
6
Android Services & Local IPC Douglas C. Schmidt
mServicesByIntentPerUser
• If your app needs a Service
to perform work in the 2 Process.start()
background, don’t keep it
3
running unless it's actively someMethodCall()
performing a job
4 Service
• Be careful to never leak
your Service by failing to stop
it when its work is done
7
developer.android.com/training/articles/memory.html#Services has more info
Android Services & Local IPC Douglas C. Schmidt
8
www.dre.vanderbilt.edu/~schmidt/PDF/Activator.pdf has more info
Android Services & Local IPC Douglas C. Schmidt
9
Android Services & Local IPC Douglas C. Schmidt
10
Android Services & Local IPC Douglas C. Schmidt
Activity
11
Android Services & Local IPC Douglas C. Schmidt
Intent
12
Android Services & Local IPC Douglas C. Schmidt
Context
13
Android Services & Local IPC Douglas C. Schmidt
Activity
Manager
Service
14
Android Services & Local IPC Douglas C. Schmidt
15
Android Services & Local IPC Douglas C. Schmidt
Linux Process
16
Android Services & Local IPC Douglas C. Schmidt
IntentService
17
Android Services & Local IPC Douglas C. Schmidt
18
Android Services & Local IPC Douglas C. Schmidt
19
Android Services & Local IPC Douglas C. Schmidt
20
Android Services & Local IPC Douglas C. Schmidt
21
Android Services & Local IPC Douglas C. Schmidt
utilization Client 1
ServiceMap
• Servers can be spawned mServicesByNamePerUser
“on-demand,” thereby mServicesByIntentPerUser
minimizing resource
utilization until clients 2 Process.start()
actually require them 3
someMethodCall()
4 Service
23
Android Services & Local IPC Douglas C. Schmidt
utilization Client 1
ServiceMap
+ Coarse-grained concurrency mServicesByNamePerUser
3
someMethodCall()
4 Service
24
Android Services & Local IPC Douglas C. Schmidt
utilization Client 1
ServiceMap
+ Coarse-grained concurrency mServicesByNamePerUser
25
Android Services & Local IPC Douglas C. Schmidt
3
someMethodCall()
4 Service
26
Android Services & Local IPC Douglas C. Schmidt
an equivalent statically- 3
configured application
someMethodCall()
4 Service
27
Android Services & Local IPC Douglas C. Schmidt
28
Android Services & Local IPC Douglas C. Schmidt
29
Android Services & Local IPC Douglas C. Schmidt
30
See en.wikipedia.org/wiki/Inetd for more on Inetd
Android Services & Local IPC Douglas C. Schmidt
1. some_request
2. ping
3. is_running
2.1 start
31
Android Services & Local IPC Douglas C. Schmidt
ActivityManagerService
bindService()
Client 1
ServiceMap
mServicesByNamePerUser
mServicesByIntentPerUser
32
Android Services & Local IPC Douglas C. Schmidt
ActivityManagerService
bindService()
Client 1
ServiceMap
mServicesByNamePerUser
mServicesByIntentPerUser
2 Process.start()
Service
33
Android Services & Local IPC Douglas C. Schmidt
ActivityManagerService
bindService()
Client 1
ServiceMap
mServicesByNamePerUser
mServicesByIntentPerUser
2 Process.start()
3
someMethodCall()
Service
34
Android Services & Local IPC Douglas C. Schmidt
ActivityManagerService
bindService()
Client 1
ServiceMap
mServicesByNamePerUser
mServicesByIntentPerUser
2 Process.start()
3
someMethodCall()
4 Service
35
Android Services & Local IPC Douglas C. Schmidt
Summary
36
Android Services & Local IPC Douglas C. Schmidt
Summary
37
www.dre.vanderbilt.edu/~schmidt/PDF/Activator.pdf has more info