Android internals: Activity, Service, and System Server

Android internals: Activity, Service, and System Server

Activity

Lifecycle

Lifecycle of Activity

Activity.java

Imported classes

onCreate()

  • FragmentsController.restoreAllState():
  • FragmentController.dispatchCreate() == FragmentManager.dispatchCreate():
    • FragmentManager.moveToState(Fragment.CREATED, false);:
      • For all ArrayList<Fragment> mActive in  FragmentManagerImpl extends FragmentManager, apply  void Fragment.moveToState(Fragment f, int newState, int transit, int transitionStyle, boolean keepActive)
  • Application.dispatchActivityCreated(): Trigger registered ActivityLifecycleCallbacks.
    • Application.(un)registerActivityLifecycleCallbacks(): Used by only NfcActivityManager and PrintManager.

Service

Lifecycle

Lifecycle of Service

ContextThemeWrapper vs. Service

Method ContextThemeWrapper Service
attachBaseContext Implemented
getResources

System Servers

Source path: frameworks/base/services/core/java/com/android/server

Category Service  Note
UI WINDOW
LAYOUT_INFLATER
NOTIFICATION
AUDIO Audio output should be muffled.
Activity ACTIVITY
Etc. ALARM Slave apps should be scheduled only when the master app asks.
ACCESSIBILITY Is it okay if we skip talk-back service?
APPWIDGET We should not let slave apps control widgets, right?
POWER, ACCOUNT, CAPTIONING, KEYGUARD, LOCATION, SEARCH, SENSOR, STORAGE, WALLPAPER, VIBRATOR, CONNECTIVITY, NETWORK_STATS, WIFI, WIFI_PASSPOINT, WIFI_P2P, WIFI_SCANNING, WIFI_RTT, NSD, FINGERPRINT, MEDIA_ROUTER, TELEPHONY, TELEPHONY_SUBSCRIPTION, CARRIER_CONFIG, TELECOM, CLIPBOARD, INPUT_METHOD, TEXT_SERVICES_MANAGER, DROPBOX, DEVICE_POLICY, UI_MODE, DOWNLOAD, NFC, BLUETOOTH, USB, LAUNCHER_APPS, INPUT, DISPLAY, USER, RESTRICTIONS, APP_OPS, CAMERA, PRINT, CONSUMER_IR, TV_INPUT, USAGE_STATS, MEDIA_SESSION, BATTERY, JOB_SCHEDULER, MEDIA_PROJECTION, MIDI, RADIO

UI interaction and System Server

Drawing camera preview seems not require any assist from System Server.

TextView.setText()

 

 

 

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.