SlideShare a Scribd company logo
1 of 82
Download to read offline
Android IPC Mechanism




Jim Huang ( 黃敬群 )
Developer, 0xlab
                           jserv@0xlab.org

                    March 19, 2012 / 南台科大
Rights to copy
                                                               © Copyright 2012 0xlab
                                                                      http://0xlab.org/
                                                                      contact@0xlab.org
Attribution – ShareAlike 3.0
You are free                                          Corrections, suggestions, contributions and
                                                                        translations are welcome!
   to copy, distribute, display, and perform the work
   to make derivative works                                           Latest update: Mar 21, 2012
   to make commercial use of the work
Under the following conditions
      Attribution. You must give the original author credit.
      Share Alike. If you alter, transform, or build upon this work, you may distribute the
      resulting work only under a license identical to this one.
   For any reuse or distribution, you must make clear to others the license terms of this
   work.
   Any of these conditions can be waived if you get permission from the copyright holder.
Your fair use and other rights are in no way affected by the above.
License text: http://creativecommons.org/licenses/by-sa/3.0/legalcode
Agenda   (0) IPC: The heart of Android
         (1) Design Patterns
         (2) Binder IPC Internals
         (3) Use case: Graphics
Binder IPC: The heart of Android
Android Tasks

       Process A        Process B



Task      Activity         Activity



                           Content
          Activity
                           Provider


                          .apk package
          Service



         .apk package


                                               5
• Different component types   Component View
  –   Activity
  –   Service
  –   Content Provider
  –   Broadcast Receiver
Application Components System
IPC = Inter-Process Communication




                Activity
     Activity              Window     Alarm
     Manager               Manager   Manager




Kernel
Why IPC?

• Each process has its own address space
• Provides data isolation
• Prevents harmful direct interaction between two
  different processes
   – Sometimes, communication between processes is
     required for modularization
IPC Mechanisms

• In GNU/Linux
   – Signal
  – Pipe
  – Socket
  – Semaphore
  – Message queue
  – Shared memory
• In Android
   – Binder: lightweight RPC (Remote Procedure
     Communication) mechanism

                                                 10
Binder History
• Developed under the name OpenBinder by Palm Inc.
  under the leadership of Dianne Hackborn
• Android Binder is the customized re-implementation
  of OpenBinder, which provides bindings to functions
  and data from one execution environment to another
Background Problems

• Applications and Services may run in separate
  processes but must communicate and share data
• IPC can introduce significant processing overhead
  andsecurity holes




                                                 12
Binder: Android's Solution

• Driver to facilitate inter-process communication
• High performance through shared memory
• Per-process thread pool for processing requests
• Reference counting, and mapping of object
  references across processes
• Synchronous calls between processes
“In the Android platform, the binder is used for
nearly everything that happens across processes
in the core platform. " – Dianne Hackborn
https://lkml.org/lkml/2009/6/25/3
IPC Abstraction

                  More abstract
Intent                            • Intent
                                     – The highest level abstraction
    AIDL                          • Inter process method invocation
                                     – AIDL: Android Interface
         Binder                       Definition Language
                                  • binder: kernel driver
                                  • ashmem: shared memory
Method invocation




      caller




      callee


In the same process
Inter-process method invocation


                        caller
                                   interface



caller

            interface
                            How?
callee

                                   interface


                        callee
Inter-process method invocation


                           caller
                                            interface


                           Proxy
caller

            interface    Binder in kernel


                        Binder Thread
callee
                             Stub
                                            interface


                           callee
Design Patterns
Pattern
• Abstracts and names a recurring                              AbstractService
  design structure                                              service

• Comprises class and/or object            Client

   – Dependencies
                                                    Proxy                        Service
   – Structures                                service
                                                                  1       1
                                                                              service
                                                         The Proxy Pattern
   – Interactions
   – Conventions
• Specifies the design structure
  explicitly
• is distilled from actual design
  experience
• Android itself follows object oriented
  design
Design Patterns used in Binder
                                (incomplete)

• Proxy Pattern
• Mediator Pattern
• Bridge Pattern
Proxy Pattern

• The proxy could interface to anything: a network
  connection, a large object in memory, a file, or some
  other resource that is expensive or impossible to
  duplicate.




                                                    21
Proxy Pattern in Android
• Binder decomposes the method call and all its corresponding data to
  a level that Linux can understand, transmitting it from the local
  process and address space to the remote process and address
  space, and reassembling and reenacting the call there.




                                                                 22
Mediator Pattern

• With the mediator pattern, communication between
  objects is encapsulated with a mediator object.




                                               23
Bridge Pattern

• decouple an abstraction from its implementation so
  that the two can vary independently




                                                   24
Bridge and Mediator Pattern in Android

                       Bridge patterns in linking
                          Java and C++




Mediator pattern

                                              25
UML Representation



        <<interface>>

                   implements


Proxy                   Stub
UML Representation

                                 caller



        <<interface>>              calls


                   implements


Proxy                   Stub

                               extends

                        callee
AIDL

Auto generated from .aidl file                      caller



                           <<interface>>




                   Proxy                   Stub



                                           callee
Use Case:
             Who calls onPause() in Activity?
                  2
                      Send message
                       by Handler         Activity

                                                     3
                                                         OnPause() is
                      queue               Looper     called in main thread

  Activity
  Manager                                   Main
                        Binder             Thread
                       Thread #1




Kernel        1

                  Call ”schedulePauseActivity”
                         across process
IPC Interaction in Android
                                         (Application View)

                                            3 parts:
                                          • BnXXX: native
2    call interface   1   getService      • BpXXX: proxy
                                          • Client
                                            Invoke BpXXX




    Framework
Binder in Action

Process A            Process B
Binder Internals
Binder Terminology

• Binder
• Binder Object
  – an instance of a class that implements the Binder interface.
  – One Binder object can implement multiple Binders

• Binder Protocol
• IBinder Interface
  – is a well-defined set of methods, properties and events that
    a Binder can implement.

• Binder Token
  – A numeric value that uniquely identifies a Binder
Facilities

•   Simple inter process messaging system
•   Managing
•   Identifying
•   Calls
•   Notification
•   Binder as a security access token
• Binder framework provides more than a simple
  interprocess messaging system.
• Methods on remote objects can be called as if they
  where local object methods.
Communication protocol




If one process sends data to another process, it is called transaction.
The data is called transaction data.
Service Manager (SM)
• Special Binder node with known Binder address
• Client does not know the address of remote Binder
   – only Binder interface knows its own address
• Binder submits a name and its Binder token to SM
   – Client retrieves Binder address with service name from
     SM
Get Service list from SM
$ adb shell service list
Found 71 services:
0 stub_isms: [com.android.internal.telephony.ISms]
1 stub_phone: [com.android.internal.telephony.ITelephony]
2 stub_iphonesubinfo:
               [com.android.internal.telephony.IPhoneSubInfo]
..
5 stub_telephony.registry:
           [com.android.internal.telephony.ITelephonyRegistry]
...
7 stub_activity: [android.app.IActivityManager]
...
9 phone: [com.android.internal.telephony.ITelephony]
…
56 activity: [android.app.IActivityManager]
...
64 SurfaceFlinger: [android.ui.ISurfaceComposer]
...
Call remote method in ActivityManager
$ adb shell service list
...
56 activity: [android.app.IActivityManager]
...
$ adb service call activity 1598968902
Result: Parcel(
  0x00000000: 0000001c 006e0061 00720064 0069006f '....a.n.d.r.o.i.'
  0x00000010: 002e0064 00700061 002e0070 00410049 'd...a.p.p...I.A.'
  0x00000020: 00740063 00760069 00740069 004d0079 'c.t.i.v.i.t.y.M.'
  0x00000030: 006e0061 00670061 00720065 00000000 'a.n.a.g.e.r.....')




      public abstract interface IBinder {
          ...
          field public static final int INTERFACE_TRANSACTION
              = 1598968902; // 0x5f4e5446
          …
      }                          Source: frameworks/base/api/current.txt
Interact with Android Service
$ adb service call phone 1 s16 "123"
Result: Parcel(00000000 '....')


interface ITelephony {
    /* Dial a number. This doesn't place the call. It displays
     * the Dialer screen. */                                     Source: frameworks/base/
    void dial(String number); telephony/java/com/android/internal/telephony/ITelephony.aidl
service call SERVICE CODE [i32 INT | s16 STR] …

Options:

   i32: Write the integer INT into the send parcel.

   s16: Write the UTF-16 string STR into the send parcel.



$ adb shell service list        Phone Application appears in foreground.
Found 71 services:              parameter “1” → dial()
                                s16 "123" → String("123")
...
9 phone: [com.android.internal.telephony.ITelephony]
Implementation Layers of Binder



            Implemented in Java




              Implemented in C++




            Implemented in C
API Layer
• AIDL (Android Interface Definition
  Language)
   – Ease the implementation of
     Android remote services
   – Defines an interface with method
     of remote services
   – AIDL parser generates Java class
      • Proxy class for Client
      • Stub class for Service
• Java API Wrapper
     Introduce facilities to the binder
   – Wraps the middleware layer
AIDL

• Data Types
  – Java Primitives
   – Containers
      • String, List, Map, CharSequence
      • List<>
      • Multidimensional Array
   – Parcelable
   – Interface Reference
• Direction - in, out, inout
• oneway
   – android.os.IBinder.FLAG_ONEWAY
                                          43
AIDL Compiler
• Full-fledged Java(-only) Support
• Stub and Proxy Generator
  // Interface
  interface IRemoteService {
      void ping();
  }


               IRemoteService mService =           Client
                   IRemoteService.Stub.asInterface(service);



 public class RemoteService extends Service {
     public IBinder onBind(Intent intent) { return mBinder; }
     private final IRemoteService.Stub mBinder =
         new IRemoteService.Stub() {
             public void ping() { // Nothing }
     };
 }                                                 Server
                                                        44
Android IPC Mechanism
Parcels and Marshalling

• Simple inter process messaging system
• In an object oriented view, the transaction data is
  called parcel.
• The procedure of building a parcel is called
  marshalling an object.
• The procedure of rebuilding a object from a parcel is
  called unmarshalling an object.
Parcel

• Marshalling – The transferring of data across
  process boundaries
   – Represented in native binary encoding
• Mostly handled by AIDL-generated code
• Extensible – Parcelable




                                                  47
android.os.Parcel



            Delivering arguments of method




”flatten”                                    ”unflatten”


                     transmit
Parcel Definition
• Container for a message (data and object references) that
  can be sent through an IBinder.
                               • A Parcel can contain both
                                 flattened data that will be
                                 unflattened on the other side of
                                 the IPC (using the various
                                 methods here for writing specific
                                 types, or the general Parcelable
                                 interface), and references to live
                                 IBinder objects that will result in
                                 the other side receiving a proxy
                                 IBinder connected with the
                                 original IBinder in the Parcel.
Representation of Parcel

• Parcel is not for general-purpose serialization
   – This class (and the corresponding Parcelable API
     for placing arbitrary objects into a Parcel) is
     designed as a high-performance IPC transport.
   – Not appropriate to place any Parcel data into
     persistent storage
• Functions for writing/reading primitive data types:
   – writeByte(byte) / readByte()
   – writeDouble(double) / readDouble()
   – writeFloat(float) / readFloat()
   – writeInt(int) / readInt()
   – writeLong(long) / readLong()
   – writeString(String) / readString()
Parcelable

• The Parcelable protocol provides an extremely
  efficient (but low-level) protocol for objects to write
  and read themselves from Parcels.
• Use the direct methods to write/read
   – writeParcelable(Parcelable, int)
     readParcelable(ClassLoader)
   – writeParcelableArray(T[],int)
     readParcelableArray(ClassLoader)

• These methods write both the class type and its data
  to the Parcel, allowing that class to be reconstructed
  from the appropriate class loader when later reading.
Bundles

• A special type-safe container, called Bundle, is
  available for key/value maps of heterogeneous
  values.
• This has many optimizations for improved
  performance when reading and writing data, and its
  type-safe API avoids difficult to debug type errors
  when finally marshalling the data contents into a
  Parcel.




                                                 52
Middleware Layer



• Implements the user space facilities
  of the Binder framework in C++
• Implements structures and methods
  to spawn and manage new threads
• Marshalling and unmarshalling of
  specific data
• Provides interaction with the Binder
  kernel driver
• frameworks/base/include/binder/IServiceManager.h
     sp<IServiceManager> defaultServiceManager()
• frameworks/base/include/binder/IInterface.h
     template BpInterface
Kernel Driver Layer
 • Binder Driver supports the file
   operations open, mmap, release, poll
   and the system call ioctl
 • ioctl arguments
    – Binder driver command code
   – Data buffer

• Command codes
  – BINDER_WRITE_READ
  – BINDER_SET_MAX_THREADS
  – BINDER_SET_CONTEXT_MGR
  – BINDER_THREAD_EXIT
  – BINDER_VERSION
                                  55
Binder Driver

• Multi-thread aware
  – Have internal status per thead
  – Compare to UNIX socket: sockets have internal
    status per file descriptor (FD)
Binder Driver




• A pool of threads is associated to each service application to process
  incoming IPC
• Binder performs mapping of object between two processes.
• Binder uses an object reference as an address in a process’s
  memory space.
• Synchronous call, reference counting
Binder is different from UNIX socket

                  socket             binder
internal status   associated to FD   associated to PID
                                     (FD can be shared among
                                     threads in the same
                                     process)


read & write      stream I/O         done at once by
operation                            ioctl

network           Yes                No
transparency                         expected local only
$ adb cat /sys/devices/virtual/misc/binder/uevent
MAJOR=10                                            Binder
MINOR=47
DEVNAME=binder
from SM to Binder Driver

Client               Service Manager
                     service list         1
                                                   Server
      IXXX
                         Name:Handle               onTransact(…)
  2                      Name:Handle                   thread pool
      Handle=0           Name:Handle

transact(…)


                 3            4                5             User Space

                                                            Kernel Space

                      Binder Driver: /dev/binder

                                              memory mapping

                                                               60
Transaction
                                BR → BinderDriverReturnProtocol
                                BC → BinderDriverCommandProtocol



                      binder_write_read
         write_size                                 write buffer
    write_consumed
       write_buffer
        read_size
    read_consumed                                   read buffer
       read_buffer




if (ioctl(fd, BINDER_WRITE_READ, &bwt ) >= 0)
     err = NO_ERROR;
else
     err = -errno;
Transaction of Binder
                                           Process A and B have different memory space.
                                           They can not see each other.
             Kernel                             Process B
                                             Process A
                       Binder



                                 Copy memory by copy_from _user
                                 Then, wake up process B

             Kernel
                                                  Process B
                       Binder



                                             Process A
                                 Copy memory by copy_to_user



Internally, Android uses Binder for graphics data transaction across processes.
                               It is fairly efficient.
Limitation of Binder IPC

• Binders are used to to communicate over process
  boundaries since different processes don't share a
  common VM context
   – no more direct access to each others Objects
     (memory).
• Binders are not ideal for transferring large data
  streams (like audio/video) since every object has to
  be converted to (and back from) a Parcel.




                                                  63
Binder Performance

• Good
  – Compact method index
  – Native binary marshalling
  – Support of ashmem shortcut
  – No GUID
• Bad
   – Dalvik Parcel overhead
  – ioctl() path is not optimal
  – Interface name overhead
  – Global lock
                                          64
Binder Security

• Binder’s Security Features
   – Securely Determined Client Identity
     • Binder.getCallingUid(), Binder.getCallingPid()
     • Similar to Unix Domain Socket
       getsockopt(..., SO_PEERCRED, ...)
  – Interface Reference Security
     • Client cannot guess Interface Reference
• Service Manager
   – Directory Service for System Services
• Server should check client permission
  Context.checkPermission(permission, pid, uid)

                                                        65
Binder sample program

• Build binder benchmark program
  cd system/extras/tests/binder/benchmarks
  mm
  adb push 
   ../../../../out/target/product/crespo/data/nativebenchmark/binderAddInts   
    /data/local/
• Execute
  adb shell
  su
  /data/local/binderAddInts -d 5 -n 5 &
  ps
  ...
  root      17133 16754 4568          860     ffffffff 400e6284 S
  /data/local/binderAddInts
  root      17135 17133 2520          616     00000000 400e5cb0 R
  /data/local/binderAddInts
Binder sample program

• Execute
  /data/local/binderAddInts -d 5 -n 5 &
  ps
  ...
  root      17133 16754 4568   860   ffffffff 400e6284 S
  /data/local/binderAddInts
  root      17135 17133 2520   616   00000000 400e5cb0 R
  /data/local/binderAddInts
  cat /sys/kernel/debug/binder/transaction_log
  transaction_log:3439847: call from 17133:17133 to 72:0 node
  1 handle 0 size 124:4
  transaction_log:3439850: reply from 72:72 to 17133:17133 node
  0 handle 0 size 4:0
  transaction_log:3439855: call from 17135:17135 to 17133:0
  node 3439848 handle 1 size 8:0
  ...
Binder sysfs entries

• adb shell ls /sys/kernel/debug/binder
  failed_transaction_log
  proc
  state
  stats
  transaction_log
  transactions
Remote Procedure Call
BINDER_WRITE_READ
• Target Method
   – handle : Remote Interface       Binder Transaction
  – ptr & cookie : Local Interface
  – code : Method ID
• Parcel - Input/Output Parameters
   – data.ptr.buffer
  – data_size
• Object Reference Management
  – data.ptr.offsets
  – offsets_size
• Security
  – sender_pid
  – sender_euid
• No Transaction GUID
  – Transparent Recursion
Object Reference Management
Service Registration and Discovery
• System service is executed by IServiceManager::addService() calls.
   – Parameter: handle to Binder Driver
• Look up the name of specific service in Binder Driver Map
   – IServiceManager::getService() returns the handle of the found registered
     services
• android.os.IBinder.INTERFACE_TRANSACTION: the actual name
Binder use case: Android Graphics
Real Case




Binder IPC is used for communicating between Graphics client and server.
Taken from http://www.cnblogs.com/xl19862005/archive/2011/11/17/2215363.html
Surface

  Source: frameworks/base/core/java/android/view/Surface.java
• /* Handle on to a raw buffer that is being
  managed by the screen compositor */
  public class Surface implements Parcelable {
     public Surface() {
        mCanvas = new CompatibleCanvas();
      }
      private class CompatibleCanvas
               extends Canvas { /* ... */ }
  }
 Surface instances can be written to and restored from a Parcel.
 Surface instances can be written to and restored from a Parcel.
Delivering arguments of method



”flatten”                                    ”unflatten”


                     transmit
   Properties
                                   Android SurfaceFlinger
        Can combine 2D/3D surfaces and surfaces from multiple applications
        Surfaces passed as buffers via Binder IPC calls
        Can use OpenGL ES and 2D hardware accelerator for its compositions
             Double-buffering using page-flip
Everything is
 Everything is
around Binder
around Binder
Camera + SurfaceFlinger + Binder
Reference

• Inter-process communication of Android, Tetsuyuki
  Kobayashi
• 淺談 Android 系統進程間通信( IPC )機制 Binder 中
  的 Server 和 Client 獲得 Service Manager 接口之路
  http://blog.goggb.com/?post=1580
• Android Binder – Android Interprocess
  Communication, Thorsten Schreiber
• Design Patterns in the Android Framework, Prof.
  Sheng-De Wang
http://0xlab.org

More Related Content

What's hot

Learning AOSP - Android Linux Device Driver
Learning AOSP - Android Linux Device DriverLearning AOSP - Android Linux Device Driver
Learning AOSP - Android Linux Device DriverNanik Tolaram
 
Native Android Userspace part of the Embedded Android Workshop at Linaro Conn...
Native Android Userspace part of the Embedded Android Workshop at Linaro Conn...Native Android Userspace part of the Embedded Android Workshop at Linaro Conn...
Native Android Userspace part of the Embedded Android Workshop at Linaro Conn...Opersys inc.
 
Android graphic system (SurfaceFlinger) : Design Pattern's perspective
Android graphic system (SurfaceFlinger) : Design Pattern's perspectiveAndroid graphic system (SurfaceFlinger) : Design Pattern's perspective
Android graphic system (SurfaceFlinger) : Design Pattern's perspectiveBin Chen
 
Android's HIDL: Treble in the HAL
Android's HIDL: Treble in the HALAndroid's HIDL: Treble in the HAL
Android's HIDL: Treble in the HALOpersys inc.
 
Booting Android: bootloaders, fastboot and boot images
Booting Android: bootloaders, fastboot and boot imagesBooting Android: bootloaders, fastboot and boot images
Booting Android: bootloaders, fastboot and boot imagesChris Simmonds
 
Android Boot Time Optimization
Android Boot Time OptimizationAndroid Boot Time Optimization
Android Boot Time OptimizationKan-Ru Chen
 
Using and Customizing the Android Framework / part 4 of Embedded Android Work...
Using and Customizing the Android Framework / part 4 of Embedded Android Work...Using and Customizing the Android Framework / part 4 of Embedded Android Work...
Using and Customizing the Android Framework / part 4 of Embedded Android Work...Opersys inc.
 
Q4.11: Porting Android to new Platforms
Q4.11: Porting Android to new PlatformsQ4.11: Porting Android to new Platforms
Q4.11: Porting Android to new PlatformsLinaro
 
Learning AOSP - Android Booting Process
Learning AOSP - Android Booting ProcessLearning AOSP - Android Booting Process
Learning AOSP - Android Booting ProcessNanik Tolaram
 
"Learning AOSP" - Android Hardware Abstraction Layer (HAL)
"Learning AOSP" - Android Hardware Abstraction Layer (HAL)"Learning AOSP" - Android Hardware Abstraction Layer (HAL)
"Learning AOSP" - Android Hardware Abstraction Layer (HAL)Nanik Tolaram
 
Understanding binder in android
Understanding binder in androidUnderstanding binder in android
Understanding binder in androidHaifeng Li
 
Android booting sequece and setup and debugging
Android booting sequece and setup and debuggingAndroid booting sequece and setup and debugging
Android booting sequece and setup and debuggingUtkarsh Mankad
 

What's hot (20)

Embedded Android : System Development - Part II (HAL)
Embedded Android : System Development - Part II (HAL)Embedded Android : System Development - Part II (HAL)
Embedded Android : System Development - Part II (HAL)
 
Embedded Android : System Development - Part II (Linux device drivers)
Embedded Android : System Development - Part II (Linux device drivers)Embedded Android : System Development - Part II (Linux device drivers)
Embedded Android : System Development - Part II (Linux device drivers)
 
Learning AOSP - Android Linux Device Driver
Learning AOSP - Android Linux Device DriverLearning AOSP - Android Linux Device Driver
Learning AOSP - Android Linux Device Driver
 
Native Android Userspace part of the Embedded Android Workshop at Linaro Conn...
Native Android Userspace part of the Embedded Android Workshop at Linaro Conn...Native Android Userspace part of the Embedded Android Workshop at Linaro Conn...
Native Android Userspace part of the Embedded Android Workshop at Linaro Conn...
 
Android graphic system (SurfaceFlinger) : Design Pattern's perspective
Android graphic system (SurfaceFlinger) : Design Pattern's perspectiveAndroid graphic system (SurfaceFlinger) : Design Pattern's perspective
Android graphic system (SurfaceFlinger) : Design Pattern's perspective
 
Android ipm 20110409
Android ipm 20110409Android ipm 20110409
Android ipm 20110409
 
Embedded Android : System Development - Part IV (Android System Services)
Embedded Android : System Development - Part IV (Android System Services)Embedded Android : System Development - Part IV (Android System Services)
Embedded Android : System Development - Part IV (Android System Services)
 
Embedded Android : System Development - Part IV
Embedded Android : System Development - Part IVEmbedded Android : System Development - Part IV
Embedded Android : System Development - Part IV
 
Android's HIDL: Treble in the HAL
Android's HIDL: Treble in the HALAndroid's HIDL: Treble in the HAL
Android's HIDL: Treble in the HAL
 
Booting Android: bootloaders, fastboot and boot images
Booting Android: bootloaders, fastboot and boot imagesBooting Android: bootloaders, fastboot and boot images
Booting Android: bootloaders, fastboot and boot images
 
Embedded Android : System Development - Part I
Embedded Android : System Development - Part IEmbedded Android : System Development - Part I
Embedded Android : System Development - Part I
 
Embedded Android : System Development - Part III
Embedded Android : System Development - Part IIIEmbedded Android : System Development - Part III
Embedded Android : System Development - Part III
 
Android Boot Time Optimization
Android Boot Time OptimizationAndroid Boot Time Optimization
Android Boot Time Optimization
 
Applied Computer Science Concepts in Android
Applied Computer Science Concepts in AndroidApplied Computer Science Concepts in Android
Applied Computer Science Concepts in Android
 
Using and Customizing the Android Framework / part 4 of Embedded Android Work...
Using and Customizing the Android Framework / part 4 of Embedded Android Work...Using and Customizing the Android Framework / part 4 of Embedded Android Work...
Using and Customizing the Android Framework / part 4 of Embedded Android Work...
 
Q4.11: Porting Android to new Platforms
Q4.11: Porting Android to new PlatformsQ4.11: Porting Android to new Platforms
Q4.11: Porting Android to new Platforms
 
Learning AOSP - Android Booting Process
Learning AOSP - Android Booting ProcessLearning AOSP - Android Booting Process
Learning AOSP - Android Booting Process
 
"Learning AOSP" - Android Hardware Abstraction Layer (HAL)
"Learning AOSP" - Android Hardware Abstraction Layer (HAL)"Learning AOSP" - Android Hardware Abstraction Layer (HAL)
"Learning AOSP" - Android Hardware Abstraction Layer (HAL)
 
Understanding binder in android
Understanding binder in androidUnderstanding binder in android
Understanding binder in android
 
Android booting sequece and setup and debugging
Android booting sequece and setup and debuggingAndroid booting sequece and setup and debugging
Android booting sequece and setup and debugging
 

Viewers also liked

Inter-process communication of Android
Inter-process communication of AndroidInter-process communication of Android
Inter-process communication of AndroidTetsuyuki Kobayashi
 
Binderのはじめの一歩とAndroid
Binderのはじめの一歩とAndroidBinderのはじめの一歩とAndroid
Binderのはじめの一歩とAndroidl_b__
 
Understanding the Android System Server
Understanding the Android System ServerUnderstanding the Android System Server
Understanding the Android System ServerOpersys inc.
 
Develop Community-based Android Distribution and Upstreaming Experience
Develop Community-based Android Distribution and Upstreaming Experience Develop Community-based Android Distribution and Upstreaming Experience
Develop Community-based Android Distribution and Upstreaming Experience National Cheng Kung University
 
Android crash debugging
Android crash debuggingAndroid crash debugging
Android crash debuggingAshish Agrawal
 
The Android graphics path, in depth
The Android graphics path, in depthThe Android graphics path, in depth
The Android graphics path, in depthChris Simmonds
 
Android seminar-presentation
Android seminar-presentationAndroid seminar-presentation
Android seminar-presentationconnectshilpa
 
Android Multimedia Framework
Android Multimedia FrameworkAndroid Multimedia Framework
Android Multimedia FrameworkPicker Weng
 
Presentation on Android operating system
Presentation on Android operating systemPresentation on Android operating system
Presentation on Android operating systemSalma Begum
 

Viewers also liked (20)

Inter-process communication of Android
Inter-process communication of AndroidInter-process communication of Android
Inter-process communication of Android
 
Android binder-ipc
Android binder-ipcAndroid binder-ipc
Android binder-ipc
 
Binderのはじめの一歩とAndroid
Binderのはじめの一歩とAndroidBinderのはじめの一歩とAndroid
Binderのはじめの一歩とAndroid
 
Discover System Facilities inside Your Android Phone
Discover System Facilities inside Your Android Phone Discover System Facilities inside Your Android Phone
Discover System Facilities inside Your Android Phone
 
Understanding the Android System Server
Understanding the Android System ServerUnderstanding the Android System Server
Understanding the Android System Server
 
Efficient Android Threading
Efficient Android ThreadingEfficient Android Threading
Efficient Android Threading
 
Implement Checkpointing for Android
Implement Checkpointing for AndroidImplement Checkpointing for Android
Implement Checkpointing for Android
 
Develop Community-based Android Distribution and Upstreaming Experience
Develop Community-based Android Distribution and Upstreaming Experience Develop Community-based Android Distribution and Upstreaming Experience
Develop Community-based Android Distribution and Upstreaming Experience
 
Android Basic Components
Android Basic ComponentsAndroid Basic Components
Android Basic Components
 
Android crash debugging
Android crash debuggingAndroid crash debugging
Android crash debugging
 
The Android graphics path, in depth
The Android graphics path, in depthThe Android graphics path, in depth
The Android graphics path, in depth
 
Power Management from Linux Kernel to Android
Power Management from Linux Kernel to AndroidPower Management from Linux Kernel to Android
Power Management from Linux Kernel to Android
 
Making Linux do Hard Real-time
Making Linux do Hard Real-timeMaking Linux do Hard Real-time
Making Linux do Hard Real-time
 
Software Design patterns on Android English
Software Design patterns on Android EnglishSoftware Design patterns on Android English
Software Design patterns on Android English
 
Inter Process Communication
Inter Process CommunicationInter Process Communication
Inter Process Communication
 
Android seminar-presentation
Android seminar-presentationAndroid seminar-presentation
Android seminar-presentation
 
Android ppt
Android pptAndroid ppt
Android ppt
 
Android Multimedia Framework
Android Multimedia FrameworkAndroid Multimedia Framework
Android Multimedia Framework
 
Presentation on Android operating system
Presentation on Android operating systemPresentation on Android operating system
Presentation on Android operating system
 
Android ppt
Android ppt Android ppt
Android ppt
 

Similar to Android IPC Mechanism

Android application development
Android application developmentAndroid application development
Android application developmentLinh Vi Tường
 
10 - Architetture Software - More architectural styles
10 - Architetture Software - More architectural styles10 - Architetture Software - More architectural styles
10 - Architetture Software - More architectural stylesMajong DevJfu
 
I'll See You On the Write Side of the Web
I'll See You On the Write Side of the WebI'll See You On the Write Side of the Web
I'll See You On the Write Side of the WebStuart Charlton
 
Software Factories in the Real World: How an IBM® WebSphere® Integration Fact...
Software Factories in the Real World: How an IBM® WebSphere® Integration Fact...Software Factories in the Real World: How an IBM® WebSphere® Integration Fact...
Software Factories in the Real World: How an IBM® WebSphere® Integration Fact...Prolifics
 
Industrial and Academic Experiences with a User Interaction Modeling Language...
Industrial and Academic Experiences with a User Interaction Modeling Language...Industrial and Academic Experiences with a User Interaction Modeling Language...
Industrial and Academic Experiences with a User Interaction Modeling Language...Marco Brambilla
 
A Software Factory Integrating Rational Team Concert and WebSphere tools
A Software Factory Integrating Rational Team Concert and WebSphere toolsA Software Factory Integrating Rational Team Concert and WebSphere tools
A Software Factory Integrating Rational Team Concert and WebSphere toolsProlifics
 
Open Cloud Interop Public
Open Cloud Interop PublicOpen Cloud Interop Public
Open Cloud Interop Publicrvanhoe
 
Innovations in Grid Computing with Oracle Coherence
Innovations in Grid Computing with Oracle CoherenceInnovations in Grid Computing with Oracle Coherence
Innovations in Grid Computing with Oracle CoherenceBob Rhubart
 
Code Reuse Made Easy: Uncovering the Hidden Gems of Corporate and Open Source...
Code Reuse Made Easy: Uncovering the Hidden Gems of Corporate and Open Source...Code Reuse Made Easy: Uncovering the Hidden Gems of Corporate and Open Source...
Code Reuse Made Easy: Uncovering the Hidden Gems of Corporate and Open Source...Perforce
 
GWT Jug Stuttgart
GWT Jug StuttgartGWT Jug Stuttgart
GWT Jug Stuttgarthbraun
 
4 - Architetture Software - Architecture Portfolio
4 - Architetture Software - Architecture Portfolio4 - Architetture Software - Architecture Portfolio
4 - Architetture Software - Architecture PortfolioMajong DevJfu
 
Brief about Windows Azure Platform
Brief about Windows Azure Platform Brief about Windows Azure Platform
Brief about Windows Azure Platform K.Mohamed Faizal
 
Build Applications on the Microsoft Platform Using Eclipse, Java, Ruby and PHP!
Build Applications on the Microsoft Platform Using Eclipse, Java, Ruby and PHP!Build Applications on the Microsoft Platform Using Eclipse, Java, Ruby and PHP!
Build Applications on the Microsoft Platform Using Eclipse, Java, Ruby and PHP!goodfriday
 
Framework Engineering
Framework EngineeringFramework Engineering
Framework EngineeringYoungSu Son
 
Best practices for effective doors implementation-Ashwini Patil
Best practices for effective doors implementation-Ashwini PatilBest practices for effective doors implementation-Ashwini Patil
Best practices for effective doors implementation-Ashwini PatilRoopa Nadkarni
 
Collab net overview_june 30 slide show
Collab net overview_june 30 slide showCollab net overview_june 30 slide show
Collab net overview_june 30 slide showsfelsenthal
 
Distributing computing.pptx
Distributing computing.pptxDistributing computing.pptx
Distributing computing.pptxKaviya452563
 

Similar to Android IPC Mechanism (20)

Improve Android System Component Performance
Improve Android System Component PerformanceImprove Android System Component Performance
Improve Android System Component Performance
 
Android application development
Android application developmentAndroid application development
Android application development
 
10 - Architetture Software - More architectural styles
10 - Architetture Software - More architectural styles10 - Architetture Software - More architectural styles
10 - Architetture Software - More architectural styles
 
I'll See You On the Write Side of the Web
I'll See You On the Write Side of the WebI'll See You On the Write Side of the Web
I'll See You On the Write Side of the Web
 
Software Factories in the Real World: How an IBM® WebSphere® Integration Fact...
Software Factories in the Real World: How an IBM® WebSphere® Integration Fact...Software Factories in the Real World: How an IBM® WebSphere® Integration Fact...
Software Factories in the Real World: How an IBM® WebSphere® Integration Fact...
 
Industrial and Academic Experiences with a User Interaction Modeling Language...
Industrial and Academic Experiences with a User Interaction Modeling Language...Industrial and Academic Experiences with a User Interaction Modeling Language...
Industrial and Academic Experiences with a User Interaction Modeling Language...
 
Microservices
MicroservicesMicroservices
Microservices
 
A Software Factory Integrating Rational Team Concert and WebSphere tools
A Software Factory Integrating Rational Team Concert and WebSphere toolsA Software Factory Integrating Rational Team Concert and WebSphere tools
A Software Factory Integrating Rational Team Concert and WebSphere tools
 
Open Cloud Interop Public
Open Cloud Interop PublicOpen Cloud Interop Public
Open Cloud Interop Public
 
PIM4Cloud
PIM4CloudPIM4Cloud
PIM4Cloud
 
Innovations in Grid Computing with Oracle Coherence
Innovations in Grid Computing with Oracle CoherenceInnovations in Grid Computing with Oracle Coherence
Innovations in Grid Computing with Oracle Coherence
 
Code Reuse Made Easy: Uncovering the Hidden Gems of Corporate and Open Source...
Code Reuse Made Easy: Uncovering the Hidden Gems of Corporate and Open Source...Code Reuse Made Easy: Uncovering the Hidden Gems of Corporate and Open Source...
Code Reuse Made Easy: Uncovering the Hidden Gems of Corporate and Open Source...
 
GWT Jug Stuttgart
GWT Jug StuttgartGWT Jug Stuttgart
GWT Jug Stuttgart
 
4 - Architetture Software - Architecture Portfolio
4 - Architetture Software - Architecture Portfolio4 - Architetture Software - Architecture Portfolio
4 - Architetture Software - Architecture Portfolio
 
Brief about Windows Azure Platform
Brief about Windows Azure Platform Brief about Windows Azure Platform
Brief about Windows Azure Platform
 
Build Applications on the Microsoft Platform Using Eclipse, Java, Ruby and PHP!
Build Applications on the Microsoft Platform Using Eclipse, Java, Ruby and PHP!Build Applications on the Microsoft Platform Using Eclipse, Java, Ruby and PHP!
Build Applications on the Microsoft Platform Using Eclipse, Java, Ruby and PHP!
 
Framework Engineering
Framework EngineeringFramework Engineering
Framework Engineering
 
Best practices for effective doors implementation-Ashwini Patil
Best practices for effective doors implementation-Ashwini PatilBest practices for effective doors implementation-Ashwini Patil
Best practices for effective doors implementation-Ashwini Patil
 
Collab net overview_june 30 slide show
Collab net overview_june 30 slide showCollab net overview_june 30 slide show
Collab net overview_june 30 slide show
 
Distributing computing.pptx
Distributing computing.pptxDistributing computing.pptx
Distributing computing.pptx
 

More from National Cheng Kung University

PyPy's approach to construct domain-specific language runtime
PyPy's approach to construct domain-specific language runtimePyPy's approach to construct domain-specific language runtime
PyPy's approach to construct domain-specific language runtimeNational Cheng Kung University
 
進階嵌入式作業系統設計與實做 (2015 年秋季 ) 課程說明
進階嵌入式作業系統設計與實做 (2015 年秋季 ) 課程說明進階嵌入式作業系統設計與實做 (2015 年秋季 ) 課程說明
進階嵌入式作業系統設計與實做 (2015 年秋季 ) 課程說明National Cheng Kung University
 
給自己更好未來的 3 個練習:嵌入式作業系統設計、實做,與移植 (2015 年春季 ) 課程說明
給自己更好未來的 3 個練習:嵌入式作業系統設計、實做,與移植 (2015 年春季 ) 課程說明給自己更好未來的 3 個練習:嵌入式作業系統設計、實做,與移植 (2015 年春季 ) 課程說明
給自己更好未來的 3 個練習:嵌入式作業系統設計、實做,與移植 (2015 年春季 ) 課程說明National Cheng Kung University
 
進階嵌入式系統開發與實做 (2014 年秋季 ) 課程說明
進階嵌入式系統開發與實做 (2014 年秋季 ) 課程說明進階嵌入式系統開發與實做 (2014 年秋季 ) 課程說明
進階嵌入式系統開發與實做 (2014 年秋季 ) 課程說明National Cheng Kung University
 
Develop Your Own Operating Systems using Cheap ARM Boards
Develop Your Own Operating Systems using Cheap ARM BoardsDevelop Your Own Operating Systems using Cheap ARM Boards
Develop Your Own Operating Systems using Cheap ARM BoardsNational Cheng Kung University
 
Lecture notice about Embedded Operating System Design and Implementation
Lecture notice about Embedded Operating System Design and ImplementationLecture notice about Embedded Operating System Design and Implementation
Lecture notice about Embedded Operating System Design and ImplementationNational Cheng Kung University
 
中輟生談教育: 完全用開放原始碼軟體進行 嵌入式系統教學
中輟生談教育: 完全用開放原始碼軟體進行 嵌入式系統教學中輟生談教育: 完全用開放原始碼軟體進行 嵌入式系統教學
中輟生談教育: 完全用開放原始碼軟體進行 嵌入式系統教學National Cheng Kung University
 
F9: A Secure and Efficient Microkernel Built for Deeply Embedded Systems
F9: A Secure and Efficient Microkernel Built for Deeply Embedded SystemsF9: A Secure and Efficient Microkernel Built for Deeply Embedded Systems
F9: A Secure and Efficient Microkernel Built for Deeply Embedded SystemsNational Cheng Kung University
 

More from National Cheng Kung University (20)

PyPy's approach to construct domain-specific language runtime
PyPy's approach to construct domain-specific language runtimePyPy's approach to construct domain-specific language runtime
PyPy's approach to construct domain-specific language runtime
 
2016 年春季嵌入式作業系統課程說明
2016 年春季嵌入式作業系統課程說明2016 年春季嵌入式作業系統課程說明
2016 年春季嵌入式作業系統課程說明
 
Interpreter, Compiler, JIT from scratch
Interpreter, Compiler, JIT from scratchInterpreter, Compiler, JIT from scratch
Interpreter, Compiler, JIT from scratch
 
進階嵌入式作業系統設計與實做 (2015 年秋季 ) 課程說明
進階嵌入式作業系統設計與實做 (2015 年秋季 ) 課程說明進階嵌入式作業系統設計與實做 (2015 年秋季 ) 課程說明
進階嵌入式作業系統設計與實做 (2015 年秋季 ) 課程說明
 
Construct an Efficient and Secure Microkernel for IoT
Construct an Efficient and Secure Microkernel for IoTConstruct an Efficient and Secure Microkernel for IoT
Construct an Efficient and Secure Microkernel for IoT
 
The Internals of "Hello World" Program
The Internals of "Hello World" ProgramThe Internals of "Hello World" Program
The Internals of "Hello World" Program
 
How A Compiler Works: GNU Toolchain
How A Compiler Works: GNU ToolchainHow A Compiler Works: GNU Toolchain
How A Compiler Works: GNU Toolchain
 
Virtual Machine Constructions for Dummies
Virtual Machine Constructions for DummiesVirtual Machine Constructions for Dummies
Virtual Machine Constructions for Dummies
 
給自己更好未來的 3 個練習:嵌入式作業系統設計、實做,與移植 (2015 年春季 ) 課程說明
給自己更好未來的 3 個練習:嵌入式作業系統設計、實做,與移植 (2015 年春季 ) 課程說明給自己更好未來的 3 個練習:嵌入式作業系統設計、實做,與移植 (2015 年春季 ) 課程說明
給自己更好未來的 3 個練習:嵌入式作業系統設計、實做,與移植 (2015 年春季 ) 課程說明
 
從線上售票看作業系統設計議題
從線上售票看作業系統設計議題從線上售票看作業系統設計議題
從線上售票看作業系統設計議題
 
進階嵌入式系統開發與實做 (2014 年秋季 ) 課程說明
進階嵌入式系統開發與實做 (2014 年秋季 ) 課程說明進階嵌入式系統開發與實做 (2014 年秋季 ) 課程說明
進階嵌入式系統開發與實做 (2014 年秋季 ) 課程說明
 
Xvisor: embedded and lightweight hypervisor
Xvisor: embedded and lightweight hypervisorXvisor: embedded and lightweight hypervisor
Xvisor: embedded and lightweight hypervisor
 
Making Linux do Hard Real-time
Making Linux do Hard Real-timeMaking Linux do Hard Real-time
Making Linux do Hard Real-time
 
Implement Runtime Environments for HSA using LLVM
Implement Runtime Environments for HSA using LLVMImplement Runtime Environments for HSA using LLVM
Implement Runtime Environments for HSA using LLVM
 
Priority Inversion on Mars
Priority Inversion on MarsPriority Inversion on Mars
Priority Inversion on Mars
 
Develop Your Own Operating Systems using Cheap ARM Boards
Develop Your Own Operating Systems using Cheap ARM BoardsDevelop Your Own Operating Systems using Cheap ARM Boards
Develop Your Own Operating Systems using Cheap ARM Boards
 
Lecture notice about Embedded Operating System Design and Implementation
Lecture notice about Embedded Operating System Design and ImplementationLecture notice about Embedded Operating System Design and Implementation
Lecture notice about Embedded Operating System Design and Implementation
 
中輟生談教育: 完全用開放原始碼軟體進行 嵌入式系統教學
中輟生談教育: 完全用開放原始碼軟體進行 嵌入式系統教學中輟生談教育: 完全用開放原始碼軟體進行 嵌入式系統教學
中輟生談教育: 完全用開放原始碼軟體進行 嵌入式系統教學
 
F9: A Secure and Efficient Microkernel Built for Deeply Embedded Systems
F9: A Secure and Efficient Microkernel Built for Deeply Embedded SystemsF9: A Secure and Efficient Microkernel Built for Deeply Embedded Systems
F9: A Secure and Efficient Microkernel Built for Deeply Embedded Systems
 
Open Source from Legend, Business, to Ecosystem
Open Source from Legend, Business, to EcosystemOpen Source from Legend, Business, to Ecosystem
Open Source from Legend, Business, to Ecosystem
 

Recently uploaded

GraphSummit Copenhagen 2024 - Neo4j Vision and Roadmap.pptx
GraphSummit Copenhagen 2024 - Neo4j Vision and Roadmap.pptxGraphSummit Copenhagen 2024 - Neo4j Vision and Roadmap.pptx
GraphSummit Copenhagen 2024 - Neo4j Vision and Roadmap.pptxNeo4j
 
20140402 - Smart house demo kit
20140402 - Smart house demo kit20140402 - Smart house demo kit
20140402 - Smart house demo kitJamie (Taka) Wang
 
Technical SEO for Improved Accessibility WTS FEST
Technical SEO for Improved Accessibility  WTS FESTTechnical SEO for Improved Accessibility  WTS FEST
Technical SEO for Improved Accessibility WTS FESTBillieHyde
 
Emil Eifrem at GraphSummit Copenhagen 2024 - The Art of the Possible.pptx
Emil Eifrem at GraphSummit Copenhagen 2024 - The Art of the Possible.pptxEmil Eifrem at GraphSummit Copenhagen 2024 - The Art of the Possible.pptx
Emil Eifrem at GraphSummit Copenhagen 2024 - The Art of the Possible.pptxNeo4j
 
UiPath Studio Web workshop series - Day 1
UiPath Studio Web workshop series  - Day 1UiPath Studio Web workshop series  - Day 1
UiPath Studio Web workshop series - Day 1DianaGray10
 
UiPath Studio Web workshop series - Day 2
UiPath Studio Web workshop series - Day 2UiPath Studio Web workshop series - Day 2
UiPath Studio Web workshop series - Day 2DianaGray10
 
How to release an Open Source Dataweave Library
How to release an Open Source Dataweave LibraryHow to release an Open Source Dataweave Library
How to release an Open Source Dataweave Libraryshyamraj55
 
Stobox 4: Revolutionizing Investment in Real-World Assets Through Tokenization
Stobox 4: Revolutionizing Investment in Real-World Assets Through TokenizationStobox 4: Revolutionizing Investment in Real-World Assets Through Tokenization
Stobox 4: Revolutionizing Investment in Real-World Assets Through TokenizationStobox
 
.NET 8 ChatBot with Azure OpenAI Services.pptx
.NET 8 ChatBot with Azure OpenAI Services.pptx.NET 8 ChatBot with Azure OpenAI Services.pptx
.NET 8 ChatBot with Azure OpenAI Services.pptxHansamali Gamage
 
3 Pitfalls Everyone Should Avoid with Cloud Data
3 Pitfalls Everyone Should Avoid with Cloud Data3 Pitfalls Everyone Should Avoid with Cloud Data
3 Pitfalls Everyone Should Avoid with Cloud DataEric D. Schabell
 
The New Cloud World Order Is FinOps (Slideshow)
The New Cloud World Order Is FinOps (Slideshow)The New Cloud World Order Is FinOps (Slideshow)
The New Cloud World Order Is FinOps (Slideshow)codyslingerland1
 
Oracle Database 23c Security New Features.pptx
Oracle Database 23c Security New Features.pptxOracle Database 23c Security New Features.pptx
Oracle Database 23c Security New Features.pptxSatishbabu Gunukula
 
Introduction - IPLOOK NETWORKS CO., LTD.
Introduction - IPLOOK NETWORKS CO., LTD.Introduction - IPLOOK NETWORKS CO., LTD.
Introduction - IPLOOK NETWORKS CO., LTD.IPLOOK Networks
 
Q4 2023 Quarterly Investor Presentation - FINAL - v1.pdf
Q4 2023 Quarterly Investor Presentation - FINAL - v1.pdfQ4 2023 Quarterly Investor Presentation - FINAL - v1.pdf
Q4 2023 Quarterly Investor Presentation - FINAL - v1.pdfTejal81
 
My key hands-on projects in Quantum, and QAI
My key hands-on projects in Quantum, and QAIMy key hands-on projects in Quantum, and QAI
My key hands-on projects in Quantum, and QAIVijayananda Mohire
 
How to become a GDSC Lead GDSC MI AOE.pptx
How to become a GDSC Lead GDSC MI AOE.pptxHow to become a GDSC Lead GDSC MI AOE.pptx
How to become a GDSC Lead GDSC MI AOE.pptxKaustubhBhavsar6
 
Explore the UiPath Community and ways you can benefit on your journey to auto...
Explore the UiPath Community and ways you can benefit on your journey to auto...Explore the UiPath Community and ways you can benefit on your journey to auto...
Explore the UiPath Community and ways you can benefit on your journey to auto...DianaGray10
 
Automation Ops Series: Session 2 - Governance for UiPath projects
Automation Ops Series: Session 2 - Governance for UiPath projectsAutomation Ops Series: Session 2 - Governance for UiPath projects
Automation Ops Series: Session 2 - Governance for UiPath projectsDianaGray10
 
Flow Control | Block Size | ST Min | First Frame
Flow Control | Block Size | ST Min | First FrameFlow Control | Block Size | ST Min | First Frame
Flow Control | Block Size | ST Min | First FrameKapil Thakar
 
Key Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdfKey Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdfCheryl Hung
 

Recently uploaded (20)

GraphSummit Copenhagen 2024 - Neo4j Vision and Roadmap.pptx
GraphSummit Copenhagen 2024 - Neo4j Vision and Roadmap.pptxGraphSummit Copenhagen 2024 - Neo4j Vision and Roadmap.pptx
GraphSummit Copenhagen 2024 - Neo4j Vision and Roadmap.pptx
 
20140402 - Smart house demo kit
20140402 - Smart house demo kit20140402 - Smart house demo kit
20140402 - Smart house demo kit
 
Technical SEO for Improved Accessibility WTS FEST
Technical SEO for Improved Accessibility  WTS FESTTechnical SEO for Improved Accessibility  WTS FEST
Technical SEO for Improved Accessibility WTS FEST
 
Emil Eifrem at GraphSummit Copenhagen 2024 - The Art of the Possible.pptx
Emil Eifrem at GraphSummit Copenhagen 2024 - The Art of the Possible.pptxEmil Eifrem at GraphSummit Copenhagen 2024 - The Art of the Possible.pptx
Emil Eifrem at GraphSummit Copenhagen 2024 - The Art of the Possible.pptx
 
UiPath Studio Web workshop series - Day 1
UiPath Studio Web workshop series  - Day 1UiPath Studio Web workshop series  - Day 1
UiPath Studio Web workshop series - Day 1
 
UiPath Studio Web workshop series - Day 2
UiPath Studio Web workshop series - Day 2UiPath Studio Web workshop series - Day 2
UiPath Studio Web workshop series - Day 2
 
How to release an Open Source Dataweave Library
How to release an Open Source Dataweave LibraryHow to release an Open Source Dataweave Library
How to release an Open Source Dataweave Library
 
Stobox 4: Revolutionizing Investment in Real-World Assets Through Tokenization
Stobox 4: Revolutionizing Investment in Real-World Assets Through TokenizationStobox 4: Revolutionizing Investment in Real-World Assets Through Tokenization
Stobox 4: Revolutionizing Investment in Real-World Assets Through Tokenization
 
.NET 8 ChatBot with Azure OpenAI Services.pptx
.NET 8 ChatBot with Azure OpenAI Services.pptx.NET 8 ChatBot with Azure OpenAI Services.pptx
.NET 8 ChatBot with Azure OpenAI Services.pptx
 
3 Pitfalls Everyone Should Avoid with Cloud Data
3 Pitfalls Everyone Should Avoid with Cloud Data3 Pitfalls Everyone Should Avoid with Cloud Data
3 Pitfalls Everyone Should Avoid with Cloud Data
 
The New Cloud World Order Is FinOps (Slideshow)
The New Cloud World Order Is FinOps (Slideshow)The New Cloud World Order Is FinOps (Slideshow)
The New Cloud World Order Is FinOps (Slideshow)
 
Oracle Database 23c Security New Features.pptx
Oracle Database 23c Security New Features.pptxOracle Database 23c Security New Features.pptx
Oracle Database 23c Security New Features.pptx
 
Introduction - IPLOOK NETWORKS CO., LTD.
Introduction - IPLOOK NETWORKS CO., LTD.Introduction - IPLOOK NETWORKS CO., LTD.
Introduction - IPLOOK NETWORKS CO., LTD.
 
Q4 2023 Quarterly Investor Presentation - FINAL - v1.pdf
Q4 2023 Quarterly Investor Presentation - FINAL - v1.pdfQ4 2023 Quarterly Investor Presentation - FINAL - v1.pdf
Q4 2023 Quarterly Investor Presentation - FINAL - v1.pdf
 
My key hands-on projects in Quantum, and QAI
My key hands-on projects in Quantum, and QAIMy key hands-on projects in Quantum, and QAI
My key hands-on projects in Quantum, and QAI
 
How to become a GDSC Lead GDSC MI AOE.pptx
How to become a GDSC Lead GDSC MI AOE.pptxHow to become a GDSC Lead GDSC MI AOE.pptx
How to become a GDSC Lead GDSC MI AOE.pptx
 
Explore the UiPath Community and ways you can benefit on your journey to auto...
Explore the UiPath Community and ways you can benefit on your journey to auto...Explore the UiPath Community and ways you can benefit on your journey to auto...
Explore the UiPath Community and ways you can benefit on your journey to auto...
 
Automation Ops Series: Session 2 - Governance for UiPath projects
Automation Ops Series: Session 2 - Governance for UiPath projectsAutomation Ops Series: Session 2 - Governance for UiPath projects
Automation Ops Series: Session 2 - Governance for UiPath projects
 
Flow Control | Block Size | ST Min | First Frame
Flow Control | Block Size | ST Min | First FrameFlow Control | Block Size | ST Min | First Frame
Flow Control | Block Size | ST Min | First Frame
 
Key Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdfKey Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdf
 

Android IPC Mechanism

  • 1. Android IPC Mechanism Jim Huang ( 黃敬群 ) Developer, 0xlab jserv@0xlab.org March 19, 2012 / 南台科大
  • 2. Rights to copy © Copyright 2012 0xlab http://0xlab.org/ contact@0xlab.org Attribution – ShareAlike 3.0 You are free Corrections, suggestions, contributions and translations are welcome! to copy, distribute, display, and perform the work to make derivative works Latest update: Mar 21, 2012 to make commercial use of the work Under the following conditions Attribution. You must give the original author credit. Share Alike. If you alter, transform, or build upon this work, you may distribute the resulting work only under a license identical to this one. For any reuse or distribution, you must make clear to others the license terms of this work. Any of these conditions can be waived if you get permission from the copyright holder. Your fair use and other rights are in no way affected by the above. License text: http://creativecommons.org/licenses/by-sa/3.0/legalcode
  • 3. Agenda (0) IPC: The heart of Android (1) Design Patterns (2) Binder IPC Internals (3) Use case: Graphics
  • 4. Binder IPC: The heart of Android
  • 5. Android Tasks Process A Process B Task Activity Activity Content Activity Provider .apk package Service .apk package 5
  • 6. • Different component types Component View – Activity – Service – Content Provider – Broadcast Receiver
  • 8. IPC = Inter-Process Communication Activity Activity Window Alarm Manager Manager Manager Kernel
  • 9. Why IPC? • Each process has its own address space • Provides data isolation • Prevents harmful direct interaction between two different processes – Sometimes, communication between processes is required for modularization
  • 10. IPC Mechanisms • In GNU/Linux – Signal – Pipe – Socket – Semaphore – Message queue – Shared memory • In Android – Binder: lightweight RPC (Remote Procedure Communication) mechanism 10
  • 11. Binder History • Developed under the name OpenBinder by Palm Inc. under the leadership of Dianne Hackborn • Android Binder is the customized re-implementation of OpenBinder, which provides bindings to functions and data from one execution environment to another
  • 12. Background Problems • Applications and Services may run in separate processes but must communicate and share data • IPC can introduce significant processing overhead andsecurity holes 12
  • 13. Binder: Android's Solution • Driver to facilitate inter-process communication • High performance through shared memory • Per-process thread pool for processing requests • Reference counting, and mapping of object references across processes • Synchronous calls between processes “In the Android platform, the binder is used for nearly everything that happens across processes in the core platform. " – Dianne Hackborn https://lkml.org/lkml/2009/6/25/3
  • 14. IPC Abstraction More abstract Intent • Intent – The highest level abstraction AIDL • Inter process method invocation – AIDL: Android Interface Binder Definition Language • binder: kernel driver • ashmem: shared memory
  • 15. Method invocation caller callee In the same process
  • 16. Inter-process method invocation caller interface caller interface How? callee interface callee
  • 17. Inter-process method invocation caller interface Proxy caller interface Binder in kernel Binder Thread callee Stub interface callee
  • 19. Pattern • Abstracts and names a recurring AbstractService design structure service • Comprises class and/or object Client – Dependencies Proxy Service – Structures service 1 1 service The Proxy Pattern – Interactions – Conventions • Specifies the design structure explicitly • is distilled from actual design experience • Android itself follows object oriented design
  • 20. Design Patterns used in Binder (incomplete) • Proxy Pattern • Mediator Pattern • Bridge Pattern
  • 21. Proxy Pattern • The proxy could interface to anything: a network connection, a large object in memory, a file, or some other resource that is expensive or impossible to duplicate. 21
  • 22. Proxy Pattern in Android • Binder decomposes the method call and all its corresponding data to a level that Linux can understand, transmitting it from the local process and address space to the remote process and address space, and reassembling and reenacting the call there. 22
  • 23. Mediator Pattern • With the mediator pattern, communication between objects is encapsulated with a mediator object. 23
  • 24. Bridge Pattern • decouple an abstraction from its implementation so that the two can vary independently 24
  • 25. Bridge and Mediator Pattern in Android Bridge patterns in linking Java and C++ Mediator pattern 25
  • 26. UML Representation <<interface>> implements Proxy Stub
  • 27. UML Representation caller <<interface>> calls implements Proxy Stub extends callee
  • 28. AIDL Auto generated from .aidl file caller <<interface>> Proxy Stub callee
  • 29. Use Case: Who calls onPause() in Activity? 2 Send message by Handler Activity 3 OnPause() is queue Looper called in main thread Activity Manager Main Binder Thread Thread #1 Kernel 1 Call ”schedulePauseActivity” across process
  • 30. IPC Interaction in Android (Application View) 3 parts: • BnXXX: native 2 call interface 1 getService • BpXXX: proxy • Client Invoke BpXXX Framework
  • 33. Binder Terminology • Binder • Binder Object – an instance of a class that implements the Binder interface. – One Binder object can implement multiple Binders • Binder Protocol • IBinder Interface – is a well-defined set of methods, properties and events that a Binder can implement. • Binder Token – A numeric value that uniquely identifies a Binder
  • 34. Facilities • Simple inter process messaging system • Managing • Identifying • Calls • Notification • Binder as a security access token
  • 35. • Binder framework provides more than a simple interprocess messaging system. • Methods on remote objects can be called as if they where local object methods.
  • 36. Communication protocol If one process sends data to another process, it is called transaction. The data is called transaction data.
  • 37. Service Manager (SM) • Special Binder node with known Binder address • Client does not know the address of remote Binder – only Binder interface knows its own address • Binder submits a name and its Binder token to SM – Client retrieves Binder address with service name from SM
  • 38. Get Service list from SM $ adb shell service list Found 71 services: 0 stub_isms: [com.android.internal.telephony.ISms] 1 stub_phone: [com.android.internal.telephony.ITelephony] 2 stub_iphonesubinfo: [com.android.internal.telephony.IPhoneSubInfo] .. 5 stub_telephony.registry: [com.android.internal.telephony.ITelephonyRegistry] ... 7 stub_activity: [android.app.IActivityManager] ... 9 phone: [com.android.internal.telephony.ITelephony] … 56 activity: [android.app.IActivityManager] ... 64 SurfaceFlinger: [android.ui.ISurfaceComposer] ...
  • 39. Call remote method in ActivityManager $ adb shell service list ... 56 activity: [android.app.IActivityManager] ... $ adb service call activity 1598968902 Result: Parcel( 0x00000000: 0000001c 006e0061 00720064 0069006f '....a.n.d.r.o.i.' 0x00000010: 002e0064 00700061 002e0070 00410049 'd...a.p.p...I.A.' 0x00000020: 00740063 00760069 00740069 004d0079 'c.t.i.v.i.t.y.M.' 0x00000030: 006e0061 00670061 00720065 00000000 'a.n.a.g.e.r.....') public abstract interface IBinder { ... field public static final int INTERFACE_TRANSACTION = 1598968902; // 0x5f4e5446 … } Source: frameworks/base/api/current.txt
  • 40. Interact with Android Service $ adb service call phone 1 s16 "123" Result: Parcel(00000000 '....') interface ITelephony { /* Dial a number. This doesn't place the call. It displays * the Dialer screen. */ Source: frameworks/base/ void dial(String number); telephony/java/com/android/internal/telephony/ITelephony.aidl service call SERVICE CODE [i32 INT | s16 STR] … Options: i32: Write the integer INT into the send parcel. s16: Write the UTF-16 string STR into the send parcel. $ adb shell service list Phone Application appears in foreground. Found 71 services: parameter “1” → dial() s16 "123" → String("123") ... 9 phone: [com.android.internal.telephony.ITelephony]
  • 41. Implementation Layers of Binder Implemented in Java Implemented in C++ Implemented in C
  • 42. API Layer • AIDL (Android Interface Definition Language) – Ease the implementation of Android remote services – Defines an interface with method of remote services – AIDL parser generates Java class • Proxy class for Client • Stub class for Service • Java API Wrapper Introduce facilities to the binder – Wraps the middleware layer
  • 43. AIDL • Data Types – Java Primitives – Containers • String, List, Map, CharSequence • List<> • Multidimensional Array – Parcelable – Interface Reference • Direction - in, out, inout • oneway – android.os.IBinder.FLAG_ONEWAY 43
  • 44. AIDL Compiler • Full-fledged Java(-only) Support • Stub and Proxy Generator // Interface interface IRemoteService { void ping(); } IRemoteService mService = Client IRemoteService.Stub.asInterface(service); public class RemoteService extends Service { public IBinder onBind(Intent intent) { return mBinder; } private final IRemoteService.Stub mBinder = new IRemoteService.Stub() { public void ping() { // Nothing } }; } Server 44
  • 46. Parcels and Marshalling • Simple inter process messaging system • In an object oriented view, the transaction data is called parcel. • The procedure of building a parcel is called marshalling an object. • The procedure of rebuilding a object from a parcel is called unmarshalling an object.
  • 47. Parcel • Marshalling – The transferring of data across process boundaries – Represented in native binary encoding • Mostly handled by AIDL-generated code • Extensible – Parcelable 47
  • 48. android.os.Parcel Delivering arguments of method ”flatten” ”unflatten” transmit
  • 49. Parcel Definition • Container for a message (data and object references) that can be sent through an IBinder. • A Parcel can contain both flattened data that will be unflattened on the other side of the IPC (using the various methods here for writing specific types, or the general Parcelable interface), and references to live IBinder objects that will result in the other side receiving a proxy IBinder connected with the original IBinder in the Parcel.
  • 50. Representation of Parcel • Parcel is not for general-purpose serialization – This class (and the corresponding Parcelable API for placing arbitrary objects into a Parcel) is designed as a high-performance IPC transport. – Not appropriate to place any Parcel data into persistent storage • Functions for writing/reading primitive data types: – writeByte(byte) / readByte() – writeDouble(double) / readDouble() – writeFloat(float) / readFloat() – writeInt(int) / readInt() – writeLong(long) / readLong() – writeString(String) / readString()
  • 51. Parcelable • The Parcelable protocol provides an extremely efficient (but low-level) protocol for objects to write and read themselves from Parcels. • Use the direct methods to write/read – writeParcelable(Parcelable, int) readParcelable(ClassLoader) – writeParcelableArray(T[],int) readParcelableArray(ClassLoader) • These methods write both the class type and its data to the Parcel, allowing that class to be reconstructed from the appropriate class loader when later reading.
  • 52. Bundles • A special type-safe container, called Bundle, is available for key/value maps of heterogeneous values. • This has many optimizations for improved performance when reading and writing data, and its type-safe API avoids difficult to debug type errors when finally marshalling the data contents into a Parcel. 52
  • 53. Middleware Layer • Implements the user space facilities of the Binder framework in C++ • Implements structures and methods to spawn and manage new threads • Marshalling and unmarshalling of specific data • Provides interaction with the Binder kernel driver
  • 54. • frameworks/base/include/binder/IServiceManager.h sp<IServiceManager> defaultServiceManager() • frameworks/base/include/binder/IInterface.h template BpInterface
  • 55. Kernel Driver Layer • Binder Driver supports the file operations open, mmap, release, poll and the system call ioctl • ioctl arguments – Binder driver command code – Data buffer • Command codes – BINDER_WRITE_READ – BINDER_SET_MAX_THREADS – BINDER_SET_CONTEXT_MGR – BINDER_THREAD_EXIT – BINDER_VERSION 55
  • 56. Binder Driver • Multi-thread aware – Have internal status per thead – Compare to UNIX socket: sockets have internal status per file descriptor (FD)
  • 57. Binder Driver • A pool of threads is associated to each service application to process incoming IPC • Binder performs mapping of object between two processes. • Binder uses an object reference as an address in a process’s memory space. • Synchronous call, reference counting
  • 58. Binder is different from UNIX socket socket binder internal status associated to FD associated to PID (FD can be shared among threads in the same process) read & write stream I/O done at once by operation ioctl network Yes No transparency expected local only
  • 59. $ adb cat /sys/devices/virtual/misc/binder/uevent MAJOR=10 Binder MINOR=47 DEVNAME=binder
  • 60. from SM to Binder Driver Client Service Manager service list 1 Server IXXX Name:Handle onTransact(…) 2 Name:Handle thread pool Handle=0 Name:Handle transact(…) 3 4 5 User Space Kernel Space Binder Driver: /dev/binder memory mapping 60
  • 61. Transaction BR → BinderDriverReturnProtocol BC → BinderDriverCommandProtocol binder_write_read write_size write buffer write_consumed write_buffer read_size read_consumed read buffer read_buffer if (ioctl(fd, BINDER_WRITE_READ, &bwt ) >= 0) err = NO_ERROR; else err = -errno;
  • 62. Transaction of Binder Process A and B have different memory space. They can not see each other. Kernel Process B Process A Binder Copy memory by copy_from _user Then, wake up process B Kernel Process B Binder Process A Copy memory by copy_to_user Internally, Android uses Binder for graphics data transaction across processes. It is fairly efficient.
  • 63. Limitation of Binder IPC • Binders are used to to communicate over process boundaries since different processes don't share a common VM context – no more direct access to each others Objects (memory). • Binders are not ideal for transferring large data streams (like audio/video) since every object has to be converted to (and back from) a Parcel. 63
  • 64. Binder Performance • Good – Compact method index – Native binary marshalling – Support of ashmem shortcut – No GUID • Bad – Dalvik Parcel overhead – ioctl() path is not optimal – Interface name overhead – Global lock 64
  • 65. Binder Security • Binder’s Security Features – Securely Determined Client Identity • Binder.getCallingUid(), Binder.getCallingPid() • Similar to Unix Domain Socket getsockopt(..., SO_PEERCRED, ...) – Interface Reference Security • Client cannot guess Interface Reference • Service Manager – Directory Service for System Services • Server should check client permission Context.checkPermission(permission, pid, uid) 65
  • 66. Binder sample program • Build binder benchmark program cd system/extras/tests/binder/benchmarks mm adb push ../../../../out/target/product/crespo/data/nativebenchmark/binderAddInts /data/local/ • Execute adb shell su /data/local/binderAddInts -d 5 -n 5 & ps ... root 17133 16754 4568 860 ffffffff 400e6284 S /data/local/binderAddInts root 17135 17133 2520 616 00000000 400e5cb0 R /data/local/binderAddInts
  • 67. Binder sample program • Execute /data/local/binderAddInts -d 5 -n 5 & ps ... root 17133 16754 4568 860 ffffffff 400e6284 S /data/local/binderAddInts root 17135 17133 2520 616 00000000 400e5cb0 R /data/local/binderAddInts cat /sys/kernel/debug/binder/transaction_log transaction_log:3439847: call from 17133:17133 to 72:0 node 1 handle 0 size 124:4 transaction_log:3439850: reply from 72:72 to 17133:17133 node 0 handle 0 size 4:0 transaction_log:3439855: call from 17135:17135 to 17133:0 node 3439848 handle 1 size 8:0 ...
  • 68. Binder sysfs entries • adb shell ls /sys/kernel/debug/binder failed_transaction_log proc state stats transaction_log transactions
  • 71. • Target Method – handle : Remote Interface Binder Transaction – ptr & cookie : Local Interface – code : Method ID • Parcel - Input/Output Parameters – data.ptr.buffer – data_size • Object Reference Management – data.ptr.offsets – offsets_size • Security – sender_pid – sender_euid • No Transaction GUID – Transparent Recursion
  • 73. Service Registration and Discovery • System service is executed by IServiceManager::addService() calls. – Parameter: handle to Binder Driver • Look up the name of specific service in Binder Driver Map – IServiceManager::getService() returns the handle of the found registered services • android.os.IBinder.INTERFACE_TRANSACTION: the actual name
  • 74. Binder use case: Android Graphics
  • 75. Real Case Binder IPC is used for communicating between Graphics client and server. Taken from http://www.cnblogs.com/xl19862005/archive/2011/11/17/2215363.html
  • 76. Surface Source: frameworks/base/core/java/android/view/Surface.java • /* Handle on to a raw buffer that is being managed by the screen compositor */ public class Surface implements Parcelable { public Surface() { mCanvas = new CompatibleCanvas(); } private class CompatibleCanvas extends Canvas { /* ... */ } } Surface instances can be written to and restored from a Parcel. Surface instances can be written to and restored from a Parcel.
  • 77. Delivering arguments of method ”flatten” ”unflatten” transmit
  • 78. Properties Android SurfaceFlinger  Can combine 2D/3D surfaces and surfaces from multiple applications  Surfaces passed as buffers via Binder IPC calls  Can use OpenGL ES and 2D hardware accelerator for its compositions  Double-buffering using page-flip
  • 79. Everything is Everything is around Binder around Binder
  • 81. Reference • Inter-process communication of Android, Tetsuyuki Kobayashi • 淺談 Android 系統進程間通信( IPC )機制 Binder 中 的 Server 和 Client 獲得 Service Manager 接口之路 http://blog.goggb.com/?post=1580 • Android Binder – Android Interprocess Communication, Thorsten Schreiber • Design Patterns in the Android Framework, Prof. Sheng-De Wang