Skip to main content

Posts

Showing posts from October, 2018

ActivityManager: Configuration Management

Configuration describes all device configuration information that can impact the resources the application retrieves.  This includes both user-specified configuration options (locale and scaling) as well as device configurations (such as input modes, screen size and screen orientation). Configuration is defined in: frameworks/base/core/java/android/content/res/Configuration.java You can get the value for an activity by - Configuration config = getResources().getConfiguration(); These include values like: MCC MNC Locale Orientation colormode densitydpi fontscale keyboard hardkeyboardHidden keyboard keyboardHidden navigation navigatioHidden screenHeightDp screenLayout screenwidthDp touchscreen uimode android:configChanges:  flag that lists configuration changes that the activity will handle itself. When a configuration change occurs at runtime, the activity is shut down and restarted by default, but declaring a configuration with this attribute...

ActivityManager: How an Activity Starts

How activity starts User calls startActivity defined in Context class startActivity - ContextImpl.java execstartActivity - Instrumentation.java startActivity - ActivityMnagerNative.java START_ACTIVITY_TRANSACTION Start an activity in this task.  Brings the task to the foreground.  If this task is not currently active (that is, its id < 0), then a new activity for the given Intent will be launched as the root of the task and the task brought to the foreground.  Otherwise, if this task is currently active and the Intent does not specify an activity to launch in a new task, then a new activity for the given Intent will be launched on top of the task and the task brought to the foreground.  If this task is currently active and the Intent specifies FLAG_ACTIVITY_NEW_TASK or would otherwise be launched in to a new task, then the activity not launched but this task be brought to the foreground and a new intent delivered to the top activity if appropri...

ActivityManagerService: Basics

ActivityManagerService: Is a rockstar of a systemservice.  It has multiple responsibilities: PROCESS MANAGEMENT ACTIVITY MANAGEMENT PERMISSIONS TASK MANAGEMENT CONTENT PROVIDERS GLOBAL MANAGEMENT SERVICES BACKUP AND RESTORE BROADCASTS INSTRUMENTATION CONFIGURATION LIFETIME MANAGEMENT Source Code: ActivityManager: ActivityManagerNative ActivityManagerService Other files in /frameworks/base/services/core/java/com/android/server/am/ Creation: Starts from SystemServer.         LifeCycle class which extends SystemService is used to star and initialize          ActivityManagerService..We do a Lifecycle.startService to start ActivityManagerService. AMS Tasks in systemserver (initialization): mActivityManagerService = mSystemServiceManager.startService(); mActivityManagerService.setSystemServiceManager(mSystemServiceManager); mActivityManagerService.setInstaller(installer); mActivityManagerSer...