OpenIntentswww.OpenIntents.org
OpenIntents
● Founded in 2009● Open Source based Company● Two times winners of Google Android Developer Challenge● Over 15 Apps in the Market (Free + Paid )● Services:
● Reusable components ● Intents Registry● Developer Support● Consulting● App Development
● Mentoring organization in Summer of Code 2011
OpenIntentswww.OpenIntents.org Topics
● Activity Lifecycle
● Activity Manager
● Concepts
● Components
● Why there is no App
● Permissions
● Gingerbread
OpenIntentswww.OpenIntents.org Who you're gonna call ?
OpenIntentswww.OpenIntents.org Activities
ActivityManagerService
OpenIntentswww.OpenIntents.org ActivityManagerService
● Project: frameworks/base.git
● Package: com.android.server.am
● Pure Java
● Started by SystemServer, running as system process
● Creates the System Context
● Keeps a reference of the Home Screen / Launcher App
OpenIntentswww.OpenIntents.org What does ActivityManagerService do ?
● Start, stop, pause,... Activities
● Start, stop, pause,... Services
● Start, stop, pause,... ContentProviders
● Check Permission
● Broadcast Intents
● Start, stop, pause,... Animations
● Decide window focus
● Deliver Hardware Events
● Crash Activities
OpenIntentswww.OpenIntents.org What does ActivityManagerService do ?
EVERYTHING
OpenIntentswww.OpenIntents.org What does ActivityManagerService do ?
EVERYTHING
the window manager doesn't
OpenIntentswww.OpenIntents.org What does ActivityManagerService do ?
EVERYTHING
the window manager doesn't
(ok, almost)
OpenIntentswww.OpenIntents.org Starting an Activity
● startActivity is called (calls startActivity(Intent, -1)
● ActivityManagerNative.startActivity(..)
● Call gets dispatched via AIDL Binder to ActivityManagerService
● Call is queued in a Handler Message Queue
● startActivityXX is called
● startActivityLocked is called
OpenIntentswww.OpenIntents.org Starting an Activity
● Class is resolved
● Permission check
● Inform Watchers
● Create HistoryRecord
● Check launch Flags
● Create Task or add to existing
● Grant Permissions
OpenIntentswww.OpenIntents.org Starting an Activity
● Add to History Stack
● Prepare Animations
● Add to WindowManager (creates window)
● Pause currently running Activities
● Switch Visibility
● Calculate & update Configuration (may trigger reset)
● Resume (make call across Binder into Activity Thread)
● Set Focus
● Ensure visibility
OpenIntentswww.OpenIntents.org Application ?
OpenIntentswww.OpenIntents.org HistoryRecord
OpenIntentswww.OpenIntents.org Application ?
OpenIntentswww.OpenIntents.org Permissions
OpenIntentswww.OpenIntents.org Permissions
OpenIntentswww.OpenIntents.org Permissions
OpenIntentswww.OpenIntents.org Changes in Gingerbread
● HistoryRecord renamed to ActivityRecord
● Introduction of Heavyweight Process
● Only one at any given time
● Parts of lifecycle management moved to ActivityStack
● Hardware Event / Key input was re-written
● WindowManager now has an extra “secure” layer
● ...
● Beautified comments :)
Top Related