Modern Operating Systems by Herbert Bos ...
Modern_Operating_Systems_by_Herbert_Bos_and_Andrew_S._Tanenbaum_4th_Ed.pdf-M ODERN O PERATING S YSTEMS
Showing 855-856 out of 1137
Modern Operating Systems by Herbert Bos and Andrew...
Modern_Operating_Systems_by_Herbert_Bos_and_Andrew_S._Tanenbaum_4th_Ed.pdf-M ODERN O PERATING S YSTEMS
Modern Operating Systems by Herbert...
Modern_Operating_Systems_by_Herbert_Bos_and_Andrew_S._Tanenbaum_4th_Ed.pdf-M ODERN O PERATING S YSTEMS
Page 855
824
CASE STUDY 1: UNIX, LINUX, AND ANDROID
CHAP. 10
4. The transaction is decoded back into a
Parcel
and
onTransact
called
on the appropriate local object, here
ExampleImpl
(which is a sub-
class of
IExample.Stub
).
5.
IExample.Stub
decodes the
Parcel
into the appropriate method and
arguments to call, here calling
print
.
6. The concrete implementation of
print
in
ExampleImpl
finally ex-
ecutes.
Process 1
Kernel
Process 2
Examplelmpl
IExample
print("hello")
print("hello")
IExample.Proxy
IExample.Stub
transact({print hello})
onTransact({print hello})
Binder
BinderProxy
ioctl()
ioctl()
binder_module
Figure 10-49.
Full path of an
AIDL
-based
Binder
IPC.
The bulk of Android’s IPC is written using this mechanism.
Most services in
Android are defined through AIDL and implemented as shown here.
Recall the
previous Fig. 10-40 showing how the implementation of the
package manager
in
the
system
server
process uses IPC to publish itself with the
service manager
for
other processes to make calls to it.
Two AIDL interfaces are involved here: one for
the
service manager
and one for the
package manager
.
For example, Fig. 10-50
shows the basic AIDL description for the
service manager
; it contains the
getSer-
vice
method, which other processes use to retrieve the
IBinder
of system service
interfaces like the
package manager
.
10.8.8 Android Applications
Android provides an application model that is very different from the normal
command-line environment in the Linux shell or even applications launched from a
graphical user interface. An application is not an executable file with a main entry
point; it is a container of everything that makes up that app: its code, graphical re-
sources, declarations about what it is to the system, and other data.


Page 856
SEC. 10.8
ANDROID
825
package android.os
interface IServiceManager {
IBinder getService(String name);
void addService(String name, IBinder binder);
}
Figure 10-50.
Basic service manager AIDL interface.
An Android application by convention is a file with the
apk
extension, for
Android Package
.
This file is actually a normal
zip
archive, containing everything
about the application.
The important contents of an
apk
are:
1.
A manifest describing what the application is, what it does, and how
to run it.
The manifest must provide a
package name
for the applica-
tion, a Java-style scoped string (such as
com.android.app.calculator
),
which uniquely identifies it.
2. Resources needed by the application, including strings it displays to
the user, XML data for layouts and other descriptions, graphical bit-
maps, etc.
3. The code itself, which may be Dalvik bytecode as well as native li-
brary code.
4.
Signing information, securely identifying the author.
The key part of the application for our purposes here is its manifest, which ap-
pears as a precompiled XML file named
AndroidManifest.xml
in the root of the
apk’s zip namespace.
A complete example manifest declaration for a hypothetical
email application is shown in Fig. 10-51: it allows you to view and compose emails
and also includes components needed for synchronizing its local email storage
with a server even when the user is not currently in the application.
Android applications do not have a simple
main
entry point which is executed
when the user launches them.
Instead, they publish under the manifest’s
<applica-
tion>
tag a variety of entry points describing the various things the application can
do. These entry points are expressed as four distinct types, defining the core types
of behavior that applications can provide: activity, receiver, service, and content
provider.
The example we have presented shows a few activities and one declara-
tion of the other component types, but an application may declare zero or more of
any of these.
Each of the different four component types an application can contain has dif-
ferent semantics and uses within the system.
In all cases, the
android:name
attrib-
ute supplies the Java class name of the application code implementing that compo-
nent, which will be instantiated by the system when needed.


Ace your assessments! Get Better Grades
Browse thousands of Study Materials & Solutions from your Favorite Schools
Concordia University
Concordia_University
School:
Operating_Systems
Course:
Great resource for chem class. Had all the past labs and assignments
Leland P.
Santa Clara University
Introducing Study Plan
Using AI Tools to Help you understand and remember your course concepts better and faster than any other resource.
Find the best videos to learn every concept in that course from Youtube and Tiktok without searching.
Save All Relavent Videos & Materials and access anytime and anywhere
Prepare Smart and Guarantee better grades

Students also viewed documents