Just An Application

May 16, 2012

Adventures In Distributed Garbage Collection: Part Five – The Cast Of Characters Concluded: Proxies

1.0 ActivityManagerProxy

Process: Service

Process: Service Client

Package: android.app

Source: frameworks/base/core/java/android/app/ActivityManagerNative.java

Definition: 1320-2900

The ActivityManagerProxy class implements the IActivityManager interface.

In an Android Application process a singleton ActivityManagerProxy object is created during the first call to the ActivityManagerNative static method getDefault() and stored in a the gDefault class variable.

All subsequent calls to the getDefault() method return the singleton object.

The ActivityManagerProxy holds an IBinder object obtained by a call to the static method getService() in the hidden class android.os.ServiceManager. The method is passed the argument "activity". In an Android Application process this returns a BinderProxy object for the ActivityManagerService object in the System process.

The ActivityManagerProxy implementations of the IActivityManager methods simply marshall their arguments, dispatch to the ActivityManagerService via the BinderProxy object and unmarshall the result if necessary.

2.0 ApplicationThreadProxy

Process: System Server

Package: android.app

Source: frameworks/base/core/java/android/app/ApplicationThreadNative.java

Definition: 417-832

The ApplicationThreadProxy class implements the IApplicationThread interface.

ApplicationThreadProxy proxy objects are created by the ApplicationThreadNative static method asInterface().

This method is invoked by the ActivityManagerNative onTransact() method when it is unmarshalling arguments of type IApplicationThread.

An ApplicationThreadProxy object holds an IBinder object which in the System process is a BinderProxy object for the
ApplicationThread object in an Android Application process.

The ProcessRecord thread instance variable holds an ApplicationThreadProxy object which is created as a result of the call to the ActivityManagerService’s implementation of the attachApplication() method.

3.0 Relationships


Copyright (c) 2012 By Simon Lewis. All Rights Reserved.

Advertisements

5 Comments »

  1. […] then calls the IActivityManager method serviceDoneExecuting() on the ActivityManagerProxy instance returned by the static method […]

    Pingback by Adventures In Distributed Garbage Collection: Part Six – Service Creation « Just An Application — May 17, 2012 @ 12:14 am

  2. […] instance variable of the IntentBindRecord to false, and then calls scheduleUnbindService() on the ApplicationThreadProxy held by the ProcessRecord which is held by the […]

    Pingback by Adventures In Distributed Garbage Collection: Part Seven – Service Destruction « Just An Application — May 17, 2012 @ 8:50 am

  3. […] then cleans up the Service’s context before calling serviceDoneExecuting() on the ActivityManagerProxy instance returned by a call to the static method […]

    Pingback by Adventures In Distributed Garbage Collection: Part Seven – Service Destruction « Just An Application — May 17, 2012 @ 9:00 am

  4. […] ActivityManagerNative.getDefault() is called and the method publishService() is called on the ActivityManagerProxy object returned, with […]

    Pingback by Adventures In Distributed Garbage Collection: Part Eight – Binding To A Service « Just An Application — May 19, 2012 @ 6:28 am

  5. […] ActivityManagerNative.getDefault() is then called and the method unbindService() is called on the ActivityManagerProxy object returned, with the IServiceConnection object as the […]

    Pingback by Adventures In Distributed Garbage Collection: Part Twelve – Unbinding From A Service « Just An Application — May 23, 2012 @ 6:00 am


RSS feed for comments on this post. TrackBack URI

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Create a free website or blog at WordPress.com.

%d bloggers like this: