Tracing From Activity.java to ActivityManagerServices

194 views Asked by At

I'm trying to trace registerReceiver() from Activity class to understand the process flow.

I'll believe the call will end up in ActivityManagerService.registerReceiver().

From my understanding, it should be involve a request to SystemService, since ActivityManagerService live in the SystemService. The problem, I cannot trace the code execution flow from Activity.java to ActivityManagerService.

From developer.android.com:

java.lang.Object
    ↳    android.content.Context
        ↳    android.content.ContextWrapper
            ↳    android.view.ContextThemeWrapper
                ↳    android.app.Activity

I've been looking all class above to trace the implementation of registerReceiver(), but can not locate the code that request the systemservice of ActivityManagerService.

Hope someone can explain how the ActivityManagerService is triggered.

Thank you.

1

There are 1 answers

0
cperdana On

Found the answer from google groups.

Since Activity and ContextThemeWrapper not implement registerReceiver(), it will reach ContextWrapper:

ContextWrapper.registerReceiver() [mBase in ContextWrapper is ContextImpl]
    ContextImpl.registerReceiver()
        ActivityManagerNative.registerReceiver()
             >> go through binder to 
             ActivityManagerService.registerReceiver()