Interview AOSP 2
1. Activity Internals
Activity Launch: From startActivity() to onResume()
startActivity() to onResume()// frameworks/base/core/java/android/app/Instrumentation.java
public ActivityResult execStartActivity(
Context who, IBinder contextThread, IBinder token, Activity target,
Intent intent, int requestCode, Bundle options) {
IApplicationThread whoThread = (IApplicationThread) contextThread;
// Cross-process call into system_server
int result = ActivityTaskManager.getService()
.startActivity(whoThread, who.getBasePackageName(), intent, ...);
}// frameworks/base/services/core/java/com/android/server/wm/ActivityStarter.java
private int startActivityUnchecked(final ActivityRecord r, ActivityRecord sourceRecord,
IVoiceInteractionSession voiceSession, ...) {
// Compute launch flags
computeLaunchingTaskFlags();
// Find or create Task
mTargetTask = mPreferredTaskDisplayArea.getOrCreateRootTask(...);
// Place activity in task
mTargetStack.startActivityLocked(mStartActivity, ...);
}2. Zygote Internals
The Fork Model & USAP (Unspecialized App Process)
3. Broadcast Internals
Broadcast Resolution, Scheduling, and ANR
4. Service Internals
startService() vs bindService()
startService() vs bindService()5. Creating a System Service
Step 1: Define the AIDL Interface
Step 2: Implement the Service
Step 3: Register in SystemServer
Step 4: Add to Context and SystemServiceRegistry
Step 5: Create the Manager Wrapper
Step 6: SELinux & Permissions
6. Creating a Vendor Service
Option A: HIDL HAL (Legacy but still common)
Option B: Stable AIDL HAL (Modern, Android 11+)
Option C: Vendor Native Service (vndservicemanager)
Last updated