SlideShare une entreprise Scribd logo
1  sur  61
Introduction to
   Android and its Subsystem


                                                       © Copyright 2013, Zeelogic.com.

                                                       Latest update: Janl 30, 2013,
                                                       http://www.zeelogic.com/
                                                       Call us on : 91-9535072845
                                                       E-Mail : info@zeelogic.com


E-mail: info@zeelogic.com; http://www.zeelogic.com Phone : 91-9535072845
Android
Android can best be described as a complete solution
stack, incorporating the OS, middle wear components, and
applications. In Android, the modified Linux 2.6 kernel acts as the
hardware abstraction layer (HAL).


To summarize, the Android operating environment can be labeled as:
 An open platform for mobile development
 A hardware reference design for mobile devices
 A system powered by a modified Linux 2.6 kernel
 A run time environment
 An application and user interface (UI) framework

Android utilize a modified Linux 2.6 kernel that is incorporated into the
Android operating environment.


          E-mail: info@zeelogic.com; http://www.zeelogic.com Phone : 91-9535072845
Android Versions
2 Version history by API level
2.1 Android 1.0 (API level 1)
2.2 Android 1.1 (API level 2)
2.3 Android 1.5 Cupcake (API level 3)
2.4 Android 1.6 Donut (API level 4)
2.5 Android 2.0 Eclair (API level 5)
2.6 Android 2.0.1 Eclair (API level 6)
2.7 Android 2.1 Eclair (API level 7)
2.8 Android 2.2–2.2.3 Froyo (API level 8)
2.9 Android 2.3–2.3.2 Gingerbread (API level 9)
2.10 Android 2.3.3–2.3.7 Gingerbread
(API level 10)
2.11 Android 3.0 Honeycomb (API level 11)
2.12 Android 3.1 Honeycomb (API level 12)
2.13 Android 3.2 Honeycomb (API level 13)
2.14 Android 4.0–4.0.2 Ice Cream Sandwich
(API level 14)
2.15 Android 4.0.3–4.0.4 Ice Cream Sandwich
(API level 15)
2.16 Android 4.1 Jelly Bean (API level 16)
2.17 Android 4.2 Jelly Bean (API level 17)

                E-mail: info@zeelogic.com; http://www.zeelogic.com Phone : 91-9535072845
Linux Kernel

Android is built on the Linux kernel, but Android is not Linux
 No native windowing system
 No glibc support
 Does not include the full set of standard Linux utilities
 Patch of “kernel enhancements” to support Android
 Great memory and process management
 Permissions-based security model
 Proven driver model
 Support for shared libraries




           E-mail: info@zeelogic.com; http://www.zeelogic.com Phone : 91-9535072845
Kernel Enhancements

Used as the foundation of the Android system
 Numerous additions from the stock                                        Ashmem
Linux, including new IPC (Inter-Process                                    Binder
Communication) mechanisms, alternative power                               Alarm
management mechanism, new drivers and various                              Power Management
additions across the kernel                                                Low Memory Killer
 These changes are beginning to go into the staging/                      Kernel Debugger
area of the kernel, as of 3.3, after being a complete                      Logger
fork for a long time




             E-mail: info@zeelogic.com; http://www.zeelogic.com Phone : 91-9535072845
Changes
      introduced in the
      Android Kernel




E-mail: info@zeelogic.com; http://www.zeelogic.com Phone : 91-9535072845
Android Linux Kernel Modifications

Android is built on the Linux kernel, but Android is not Linux             Kernel Enhancements
 No native windowing system
 No glibc support                                                              Alarm
 Does not include the full set of standard Linux utilities                     Ashmem
 Standard Linux 2.6.24 Kernel                                                  Binder
 Patch of “kernel enhancements” to support Android                             Power Management
 Great memory and process management                                           Low Memory Killer
 Permissions-based security model                                              Kernel Debugger
 Proven driver model                                                           Logger
 Support for shared libraries
 It‟s a open source!




              E-mail: info@zeelogic.com; http://www.zeelogic.com Phone : 91-9535072845
Android Linux Kernel Modifications




E-mail: info@zeelogic.com; http://www.zeelogic.com Phone : 91-9535072845
A split view of the kernel




E-mail: info@zeelogic.com; http://www.zeelogic.com Phone : 91-9535072845
Android Libraries




E-mail: info@zeelogic.com; http://www.zeelogic.com Phone : 91-9535072845
Android Libraries

 Gather a lot of Android-specifc libraries to interact at a low-level with the
system, but third-parties libraries as well
 Bionic is the C library, SurfaceManager is used for drawing surfaces on the
screen, etc.
 But also WebKit, SQLite, OpenSSL coming from the free software world


                          Android Runtime
Handles the execution of Android applications
 Almost entirely written from scratch by Google
 Contains Dalvik, the virtual machine that executes every application that you
 run on Android, and the core library for the Java runtime, coming from Apache
Harmony project
Also contains system daemons, init executable, basic binaries, etc.




            E-mail: info@zeelogic.com; http://www.zeelogic.com Phone : 91-9535072845
• Bionic Libc :- Custom libc implementation, optimized for embedded use.
• Function Libraries
• Native Servers
• Hardware Abstraction Libraries
WebKit
 Based on open source WebKit browser: http://webkit.org
 Renders pages in full (desktop) view
 Full CSS, Javascript, DOM, AJAX support
 Support for single-column and adaptive view rendering
Media Framework
Based on PacketVideo OpenCORE platform
Supports standard video, audio, still-frame formats
Support for hardware / software codec plug-ins




        E-mail: info@zeelogic.com; http://www.zeelogic.com Phone : 91-9535072845
Android Source code organization
  Bionic/         Android's standard C library is stored
                  contains code samples regarding the boot of an Android device. In this
                  folder, protocol used by all Android bootloaders and a recovery image
 Bootable/        holds the core components of the build system.
  Build/          Holds the core components of the build system
   CTS/           The Compatibility Test Suite
  Dalvik/         Contains the source code of the Dalvik virtual machine.
Development/      Holds the development tools, debug applications, API samples, etc
   device/        Contains the device-specifc components
                  One of the largest folders in the source code, it contains all the external
 External/        projects used in the Android code
Frameworks/       Holds the source code of the various parts of the framework
 Hardware/        contains all the hardware abstraction layers




            E-mail: info@zeelogic.com; http://www.zeelogic.com Phone : 91-9535072845
Android HAL




E-mail: info@zeelogic.com; http://www.zeelogic.com Phone : 91-9535072845
Android HAL




E-mail: info@zeelogic.com; http://www.zeelogic.com Phone : 91-9535072845
Android HAL
Hardware Abstraction Layer which provides a layer to protect proprietary software
from licensing point of view.
Android applications communicate with the underlying hardware through Java API‟s
not by system calls.
The Hardware Abstraction Layer or HAL is the glue between any device (part of the
kernel) and the corresponding JNI interface.

HAL source code reside under the hardware folder
/** Base path of the hal modules */
#define HAL_LIBRARY_PATH1 "/system/lib/hw“
#define HAL_LIBRARY_PATH2 "/vendor/lib/hw"

User space C/C++ library layer
 Defines the interface that Android requires hardware “drivers” to implement
 Separates the Android platform logic from the hardware interface
 Libraries are loaded dynamically at runtime as needed




            E-mail: info@zeelogic.com; http://www.zeelogic.com Phone : 91-9535072845
Audio Flinger
 Manages all audio output devices
 Processes multiple audio streams into PCM audio out paths
 Handles audio routing to various outputs




           E-mail: info@zeelogic.com; http://www.zeelogic.com Phone : 91-9535072845
Android HAL




Above figure provide a clear view on connections between the Kernel, HAL
 ( libhxxx.so ) , C++ headers, JNI binding and finally the JAVA API. Consider the
complete audio subsystem in Android and in particular the OMAP 35xx applications
processor.
           E-mail: info@zeelogic.com; http://www.zeelogic.com Phone : 91-9535072845
Android Audio Native Services




E-mail: info@zeelogic.com; http://www.zeelogic.com Phone : 91-9535072845
Android's Camera Sub System




E-mail: info@zeelogic.com; http://www.zeelogic.com Phone : 91-9535072845
Android's Camera Sub System

Android's camera
application connect with
android HAL through
camera binding interface.
HAL in turns connect
physical camera sensor and
provides control & data
interface between
application and camera
sensor.

The diagram illustrates the
structure of the camera
subsystem. In the diagram
proprietary camera libraries
are nothing but camera
HAL


               E-mail: info@zeelogic.com; http://www.zeelogic.com Phone : 91-9535072845
Android Camera HAL brief

To implement a camera HAL ( also consider as driver between android
camera subsystem and V4L2 kernel driver) ; one need to create a shared
library (named as libcamera.so) that implements the interface defined at
“android/frameworks/base/include/camera/CameraHardwareInterface.h”.

Location of the shared library should be at
“android/hardware/<vendor>/<boardname>/camera”



Create source files and implement interface defined at
'CameraHardwareInterface.h'.

android/hardware/ti/omap3/camera/CameraHardware.cpp
android/hardware/ti/omap3/camera/CameraHardware.h


          E-mail: info@zeelogic.com; http://www.zeelogic.com Phone : 91-9535072845
Interface‟s defined under camera HAL
/* constructor */ CameraHardware::CameraHardware(){}
/* destructor */ CameraHardware::~CameraHardware(){}
sp<IMemoryHeap> CameraHardware::getPreviewHeap() const{}

void CameraHardware::setCallbacks(notify_callback notify_cb, data_callback
data_cb, data_callback_timestamp data_cb_timestamp, void* user){/* store callback to local
pointers, need to callback at the time of preview/image capture */}

void CameraHardware::enableMsgType(int32_t msgType) {/* set local message flag.
Application will give this notification to perform certain action while previewing. ex.start
video, image caputure etc. */}
void CameraHardware::disableMsgType(int32_t msgType){}

bool CameraHardware::msgTypeEnabled(int32_t msgType){}
                                                                                                Create and configure
void CameraHardware::stopPreview() { /* stop preview */ }                                       android.mk file
status_t CameraHardware::startRecording() { /* configure device & start record thread */        Compile android system
/* record thread - check message type - if message type contains -                              Go to module directory $cd /projects/my-
CAMERA_MSG_VIDEO_FRAME then call 'mDataCbTimestamp' with video frame                            android/hardware/ti/omap3/camera
captured */ }                                                                                    $source
void CameraHardware::stopRecording() { /* stop recording */ }                                   <ANDROID_ROOT>/build/envsetup.sh
status_t CameraHardware::takePicture()                                                           $mm TARGET_PRODUCT=
{ /* - configure camera device - take a current frame - check message type - call callback */   <TARGET PRODUCT NAME>
}                                                                                               e.g.$ mm
status_t CameraHardware::setParameters(const CameraParameters& params) { /* -                   TARGET_PRODUCT=beagleboard
configure device as per parameters */ }                                                         copy libcamera.so to
                                                                                                out/target/product/<boardname>/system/l
 CameraParameters CameraHardware::getParameters() const                                         ib
{ /* - return current value of parameter set */ }



                      E-mail: info@zeelogic.com; http://www.zeelogic.com Phone : 91-9535072845
Android Runtime




E-mail: info@zeelogic.com; http://www.zeelogic.com Phone : 91-9535072845
Android Runtime




E-mail: info@zeelogic.com; http://www.zeelogic.com Phone : 91-9535072845
Dalvik Virtual Machine
Android‟s custom clean-room implementation virtual machine
 Provides application portability and runtime consistency
 Runs optimized file format (.dex) and Dalvik bytecode
 Java .class / .jar files converted to .dex at build time
Supports multiple virtual machine processes per device
 Highly CPU-optimized bytecode interpreter
 Uses runtime memory very efficiently




          E-mail: info@zeelogic.com; http://www.zeelogic.com Phone : 91-9535072845
Core Libraries

Core APIs for Java language provide a
powerful, yet
simple and familiar development platform
• Data structures
• Utilities
• File access
• Network Access
• Graphics
•…




             E-mail: info@zeelogic.com; http://www.zeelogic.com Phone : 91-9535072845
Android Power Management




E-mail: info@zeelogic.com; http://www.zeelogic.com Phone : 91-9535072845
Android Power Management

   Linux Power Management
   Android Power Management Design
   Wake Locks
   System Sleep (Suspend)
   Battery Service
                                                                • Home Entertainment .
                                                                • Security devices
Designed for mobile devices                                    • Multimedia Devices,
Goal is to prolong battery life
 Build on top of Linux Power Management
                                                         • Handheld Devices
 Not directly suitable for a mobile device
                                                         • Tablets
 Designed for devices which have a 'default-off' behavior
 The phone is not supposed to be on when we do not want to use it.
 Powered on only when requested to be run, off by default.
                                                         • Multimedia Streaming
 Unlike PC, which has a default on behavior.            • Connected Navigation
                                                                • In-car Wi-Fi



           E-mail: info@zeelogic.com; http://www.zeelogic.com Phone : 91-9535072845
Linux Power Management


Power mode interface is on sysfs
 /sys/power/state

 sysfs is a virtual file system provided by Linux. •sysfs exports
                                                      Home Entertainment .
                                                    • Security devices
information about devices and drivers from the kernel device model to
                                                    • Multimedia Devices,
user space, and is also used for configuration
                                                              • Handheld Devices
   Changing state done by                                    • Tablets
#   echo mem > /sys/power/state
#   echo disk > /sys/power/state
#   echo standby > /sys/power/state                           • Multimedia Streaming
                                                              • Connected Navigation
                                                              • In-car Wi-Fi



         E-mail: info@zeelogic.com; http://www.zeelogic.com Phone : 91-9535072845
Linux Power Management




                                                     • Home Entertainment .
                                                     • Security devices
                                                     • Multimedia Devices,


                                                     • Handheld Devices
                                                     • Tablets


                                                     • Multimedia Streaming
                                                     • Connected Navigation
                                                     • In-car Wi-Fi



E-mail: info@zeelogic.com; http://www.zeelogic.com Phone : 91-9535072845
Android Power Management
Built as a wrapper to Linux Power Management

 In the Kernel
 Added 'on' state in the power state
 Added Early Suspend framework
 Added Partial Wake Lock mechanism
                                                   • Home Entertainment .
                                                   • Security devices
 Apps and services must request CPU resource with • Multimedia Devices, the
                                                   „wake locks‟ through
Android application framework and native Linux libraries in order to keep power
on, otherwise Android will shut down the CPU.
                                                 • Handheld Devices
 Android PM uses wake locks and time out mechanism to switch state of system
                                                 • Tablets
power, so that system power consumption decreases

                                                        • Multimedia Streaming
Android demands that applications and services request CPU resources via
                                                        • and native Linux
wake locks through the Android application frameworkConnected Navigation
                                                        • shutdown the
libraries. If there are no active wake locks, Android willIn-car Wi-Fi processor.


       E-mail: info@zeelogic.com; http://www.zeelogic.com Phone : 91-9535072845
Wake Locks
 By default, Android tries to put the system into a sleep or better a suspend mode as
 soon as possible
  Applications running in the Dalvik VM can prevent the system from entering a sleep
 or suspend state, i.e. applications can assure that the screen stays on or the CPU stays
 awake to react quickly to interrupts
  The means Android provides for this task is wake locks
  If there are no active wake locks, CPU will be turned off Home Entertainment .
                                                               •
  If there are partial wake locks, screen and keyboard will• be turneddevices
                                                                 Security off
                                                                    • Multimedia Devices,
Types of Wake Locks
 PARTIAL_WAKE_LOCK
 Ensures that the CPU is running                                     • Handheld Devices
 The screen might not be on                                          • Tablets
 SCREEN_DIM_WAKE_LOCK
 Wake lock that ensures that the screen is on, but the keyboard backlight will be allowed to go
off, and the screen backlight will be allowed to go dim
 SCREEN_BRIGHT_WAKE_LOCK
 Wake lock that ensures that the screen is on at full brightness; the keyboard backlight will be
allowed to go off
 FULL_WAKE_LOCK
 Full device ON, including backlight and screen
               E-mail: info@zeelogic.com; http://www.zeelogic.com Phone : 91-9535072845
Android PM Design
Android implements an application framework on top of the kernel called Android
Power Management Applications Framework
 The Android PM Framework is like a driver. It is written in Java which connects
to Android power driver through JNI
 Currently Android only supports screen, keyboard, buttons backlight, and the
brightness of screen

  Through the framework, user
 space applications can use
 „PowerManger‟ class to control
 the power state of the device




             E-mail: info@zeelogic.com; http://www.zeelogic.com Phone : 91-9535072845
Android PM Implementation
Android PM Framework provides a service for user space applications through the
class PowerManger to achieve power saving
The flow of exploring Wake locks are :
Acquire handle to the PowerManager service by calling Context.getSystemService()
Create a wake lock and specify the power management flags for screen, timeout, etc.
Acquire wake lock
                                                       • Home Entertainment .
Perform operation such as play MP3
                                                       • Security devices
Release wake lock                                     • Multimedia Devices,


How are Wake Locks Managed                             • Handheld Devices
 Wake Locks are mainly managed in Java layer          • Tablets
 When an android application takes a wake lock, a new instance of wake lock is
registered in the PowerManagerService
 PowerManagerService is running in the java layer     • Multimedia Streaming
 Registered wake locks are put in a list              • Connected Navigation
                                                       • In-car Wi-Fi



           E-mail: info@zeelogic.com; http://www.zeelogic.com Phone : 91-9535072845
Acquiring a Wake lock

The flow when a Wake Lock is acquired
Request sent to PowerManager to acquire a wake lock
PowerManagerService to take a wake lock
Add wake lock to the list
Set the power state                                    • Home Entertainment .
                                                        • Security devices
 For a FULL_WAKE_LOCK, PowerState would be set to ON   • Multimedia Devices,
For taking Partial wake lock, if it is the first partial wake lock, a kernel
wake lock is taken. This will protect all the partial wake locks. For
                                                        • Handheld Devices
subsequent requests, kernel wake lock is not taken, but just added to the
                                                        • Tablets
list

                                                               • Multimedia Streaming
                                                               • Connected Navigation
                                                               • In-car Wi-Fi



          E-mail: info@zeelogic.com; http://www.zeelogic.com Phone : 91-9535072845
Android power management architecture.




E-mail: info@zeelogic.com; http://www.zeelogic.com Phone : 91-9535072845
Battery Service
 The BatteryService monitors the battery status, level, temperature etc.
 A Battery Driver in the kernel interacts with the physical battery via ADC [to read
battery voltage] and I²C ( Inter-Integrated Circuit: a multi-master serial single-ended
computer bus used to attach low-speed peripherals to an electronic device)
 Whenever BatteryService receives information from the BatteryDriver, it will act
accordingly                                                  • Home Entertainment .
E.g. if battery level is low, it will ask system to shutdown • Security devices
                                                                 • Multimedia Devices,

Using power supply class in Linux Kernel
/sys/class/power_supply                                    • Handheld Devices
 Utilize uevent mechanism to update battery status        • Tablets
 uevent : An asynchronous communication channel for kernel
 Battery Service will monitor the battery status based on received uevent from the
kernel                                                     • Multimedia Streaming
                                                           • Connected Navigation
                                                           • In-car Wi-Fi



            E-mail: info@zeelogic.com; http://www.zeelogic.com Phone : 91-9535072845
Android Power Management




                                                     • Home Entertainment .
                                                     • Security devices
                                                     • Multimedia Devices,


                                                     • Handheld Devices
                                                     • Tablets


                                                     • Multimedia Streaming
                                                     • Connected Navigation
                                                     • In-car Wi-Fi



E-mail: info@zeelogic.com; http://www.zeelogic.com Phone : 91-9535072845
• Home Entertainment .
            Sensors on Android                       • Security devices
                                                     • Multimedia Devices,


                                                     • Handheld Devices
                                                     • Tablets


                                                     • Multimedia Streaming
                                                     • Connected Navigation
                                                     • In-car Wi-Fi



E-mail: info@zeelogic.com; http://www.zeelogic.com Phone : 91-9535072845
Sensors on Android
A sensor(also called detector) is a device that measures a physical quantity
and converts it into a signal which can be read by an observer or by an
instrument.




                                                             • Handheld Devices
                                                             • Tablets


                                                             • Multimedia Streaming
                                                             • Connected Navigation
                                                             • In-car Wi-Fi



        E-mail: info@zeelogic.com; http://www.zeelogic.com Phone : 91-9535072845
Android Sensor Framework Overview




E-mail: info@zeelogic.com; http://www.zeelogic.com Phone : 91-9535072845
Android sensor sub system overview

Application Framework
    Sensor Applications uses the Sensor application
    framework to get the sensor data. It communicates
    with C++ layer through sensor Java native interface
    (JNI)
Sensor Libraries
    Sensor middle layer mainly consists of Sensor
    Manager, Sensor service and Sensor hardware                        • Home Entertainment .
    abstraction layer.                                                 • Security devices
Input Subsystem                                                        • Multimedia Devices,
    This is a generic Linux framework for all input
    devices like keyboard, mouse, touchscreen and
    defines a standard set of events. It interfaces to user
    space through /sys/class/input interface.                          • Handheld Devices
Evdev                                                                  • Tablets
    Evdev provides a generic way for input device
    events to be accessible under /dev/input/eventX .
     LIS331DLH Accelerometer Driver                                    • Multimedia Streaming
    This driver communicates with LIS331DLH                            • Connected Navigation
    accelerometer chip via GPIO and I2C bus. GPIO
    line is used for generating interrupts while I2C bus               • In-car Wi-Fi
    for accessing and configuring accelerometer
    registers.
                                                                Fig: Android subsystem overview
                  E-mail: info@zeelogic.com; http://www.zeelogic.com Phone : 91-9535072845
Android input event process
Enable Accelerometer sensor.                             Testing Android Input TS and Keypad Driver
#cat 1 > /sys/bus/i2c/drivers/lis331dlh/1-018/enable
                                                         # cat /proc/bus/input/devices
                                                         I: Bus=0000 Vendor=0000 Product=0000
                                                         Version=0000
Use getevent command to see
                                                         N: Name="MVT7 KEYPAD"
accelerometer events
                                                         P: Phys=
#getevent add device 2: /dev/input/event2
                                                         S: Sysfs=/class/input/input0
name:                                                                  • Home Entertainment .
                                                         U: Uniq=
 "Acceleromter" /dev/input/event2: 0001                                • Security devices
                                                         H: Handlers=kbd event0 evbug
014a 00000001 /dev/input/event2: 0003                                  • Multimedia Devices,
                                                         B: EV=f
0000 0000089e /dev/input/event2: 0003
                                                         ...
0001 000005fe
                                                         I: Bus=0000 Vendor=0000 Product=0000
                                                         Version=0000
# cat /proc/bus/input/handlers                           N: Name="TSC2007 Touchscreen"
N: Number=0 Name=kbd                                     P: Phys=0-0090/input0
N: Number=1 Name=evdev Minor=64                          S: Sysfs=/class/input/input1
N: Number=2 Name=evbug                                   U: Uniq= • Multimedia Streaming
                                                                       • Connected
                                                         H: Handlers=event1 evbug Navigation
                                                         B: EV=b       • In-car Wi-Fi
                                                         B: KEY=400 0 0 0 0 0 0 0 0 0 0
                                                         B: ABS=1000003

                 E-mail: info@zeelogic.com; http://www.zeelogic.com Phone : 91-9535072845
Porting a sensor onto Android

Kernel
Device-driver
Board File

Userspace
Adding New HAL -OR- Modifying existing HAL


Device-driver
Poll/Interrupt? Hybrid-approach = Workqueues
Early-suspend hook
input_report_abs() / input_report_rel()

Board File
Interrupt, GPIO, SPI/I2C-lines
Axes-remap to device axes platform_data




         E-mail: info@zeelogic.com; http://www.zeelogic.com Phone : 91-9535072845
Kernel Handling of Sensor Events




E-mail: info@zeelogic.com; http://www.zeelogic.com Phone : 91-9535072845
Kernel Handling of Sensor Events
Early-Suspend hook




InputEvents




          E-mail: info@zeelogic.com; http://www.zeelogic.com Phone : 91-9535072845
Android Boot Sequence




E-mail: info@zeelogic.com; http://www.zeelogic.com Phone : 91-9535072845
Android Boot Sequence




E-mail: info@zeelogic.com; http://www.zeelogic.com Phone : 91-9535072845
Android Boot Sequence




E-mail: info@zeelogic.com; http://www.zeelogic.com Phone : 91-9535072845
Linux boot process




E-mail: info@zeelogic.com; http://www.zeelogic.com Phone : 91-9535072845
Android Boot Sequence
Init it very first process, we can say it is root
process or grandmother of all processes. init
process has two responsibilities.
1. mount directories like /sys, /dev, /proc and
2. run init.rc script.

  Android has specific format and rules
  for init.rc files. In Android we call it as
  “Android Init Language”

  The Android Init Language consists of
  four broad classes of statements,
  which are
  1. Actions,
  2. Commands,
  3. Services,
  4. Options.


                E-mail: info@zeelogic.com; http://www.zeelogic.com Phone : 91-9535072845
Action : Actions are named sequences of commands. Actions have a trigger
which is used to determine when the action should occur.
Syntax
on <trigger>
 <command>
 <command>
 <command>

Service : Services are programs which init launches and (optionally) restarts
when they exit. Syntax
service <name> <pathname> [ <argument> ]*
 <option>
 <option>
 ...
Options : Options are modifiers to services. They affect how and when init runs
the service.

Let‟s take a look of default init.rc file. Here I have listed only major events and
services.

         E-mail: info@zeelogic.com; http://www.zeelogic.com Phone : 91-9535072845
Zygote Process
 Zygote is a VM process            Action / Service        Description
that starts at system boot          on early-init           Set init and its forked children's oom_adj.
time.                                                       Set the security context for the init process.
 Zygote preloads and               on init                 setup the global environment
initialize core library                                     Create cgroup mount point for cpu
classes. Normally there                                     accounting
core classes are read-only                                  and many
and part of Android SDK or          on fs                   mount mtd partitions
Core frameworks. In Java                                    change permissions of system directories
                                    on post-fs
VM each instance has it‟s
own copy of core library            on post-fs-data         change permission of /data folders and sub
                                                            folders
class files and heap objects.
                                    on boot                 basic network init ,Memory Management
                                                            ,etc
                                    service                 start system manager to manage all native
                                    servicemanager          services like location, audio, shared
                                                            preference etc..
                                    service zygote          start zygote as app_process


               E-mail: info@zeelogic.com; http://www.zeelogic.com Phone : 91-9535072845
Zygote Process Startup




E-mail: info@zeelogic.com; http://www.zeelogic.com Phone : 91-9535072845
Zygote loading process

1. Load ZygoteInit class,
Source Code :<Android Source>
/frameworks/base/core/java/com/android/internal/os/ZygoteInit.java
2. registerZygoteSocket() - Registers a server socket for zygote command
connections
3. preloadClasses() - “preloaded-classes” is simple text file contains list of
classes that need to be preloaded, you cna find “preloaded-classes” file at
<Android Source>/frameworks/base
4. preloadResources() - preloadReaources means native themes and
layouts, everything that include android.R file will be load using this
method.

At this time you can see bootanimation




       E-mail: info@zeelogic.com; http://www.zeelogic.com Phone : 91-9535072845
Android System Service or Services
System Service or Services                                   Core Services:
                                                             1. Starting Power Manager
After complete above steps, runtime request                  2. Creating Activity Manager
Zygote to launch system servers. System                      3. Starting Telephony Registry
Servers are written in native and java                       4. Starting Package Manager
both, System servers we can consider as                      5. Set Activity Manager Service as
process, The same system server is available as                  System Process
System Services in Android SDK. System                       6. Starting Context Manager
server contain all system services.                          7. Starting System Context Providers
                                                             8. Starting Battery Service
                                                             9. Starting Alarm Manager
Zygote fork new process to launch system                     10. Starting Sensor Service
services. You can find source code in                        11. Starting Window Manager
ZygoteInit class and “startSystemServer”                     12. Starting Bluetooth Service
method.                                                      13. Starting Mount Service


Boot Completed
Once System Services up and running in memory, Android has completed
booting process, At this time “ACTION_BOOT_COMPLETED” standard
broadcast action will fire.
              E-mail: info@zeelogic.com; http://www.zeelogic.com Phone : 91-9535072845
Corporate And Custom Training
For IT Professionals and Graduates




         http://www.zeelogic.com
Placement and Training Module



            http://www.zeelogic.com


                               • Fully customized content and
                               instruction to meet your specific needs

                               • Qualified, experienced, industry
                               experts and faculty as instructors

                               • Proven track record with the area’s
                               top organizations

                               • Instructional materials, case studies
                               and activities related to your
                               company and industry

                               • Cost savings for your training budget


Copyright © 2012 Zeelogic (P) Ltd. All rights reserved.
Zeelogic will work individually with your company to
    understand your vision and identify your learning needs and objectives.




          Training Areas                                            Services Offered

 Training in Programming Languages
 Programming Languages ( C, C++, JAVA)                Classroom, Instructor Lead Programs
 Linux/Unix                                           Personal and Professional Development,
 Microcontrollers and Processors                      Professional Trainers for Mentoring
 RTOS ( Vxworks, QNX )                                Instructional Design
 Android                                              Embedded Training Kits
 Embedded Systems                                     Hands on experience on Live Projects
 Linux Internals and Device Drivers                   Video Courses and Tutorials
 Networking/Wireless
 SDLC



   We are specialize in designing programs to meet the specific content.
   We Provide comprehensive training in Embedded systems and different area of
   Programming .

                     Copyright © 2012 Zeelogic (P) Ltd. All rights reserved.
UNC Charlotte will work individually with your company to
understand your vision and identify your learning needs and objectives.
We specialize in designing programs to meet the specific content,
location and scheduling requirements of your organization.




                       For more information contact:

                       Director of Corporate Training
                         E-Mail: info@zeelogic.com

                        #4247,14th Main , 19th Cross,
                   Subramanian Nagar , Bangalore 560021.
                         Phone : +91-80-23376639,

                                web link:
                              www.zeelogic.com




              Copyright © 2012 Zeelogic (P) Ltd. All rights reserved.

Contenu connexe

Tendances

Setting up a vscode development environment for mbed 5 application using the ...
Setting up a vscode development environment for mbed 5 application using the ...Setting up a vscode development environment for mbed 5 application using the ...
Setting up a vscode development environment for mbed 5 application using the ...Steve Mylroie
 
Android graphic system (SurfaceFlinger) : Design Pattern's perspective
Android graphic system (SurfaceFlinger) : Design Pattern's perspectiveAndroid graphic system (SurfaceFlinger) : Design Pattern's perspective
Android graphic system (SurfaceFlinger) : Design Pattern's perspectiveBin Chen
 
Headless Android Strikes Back!
Headless Android Strikes Back!Headless Android Strikes Back!
Headless Android Strikes Back!Gary Bisson
 
Jollen's Presentation: Introducing Android low-level
Jollen's Presentation: Introducing Android low-levelJollen's Presentation: Introducing Android low-level
Jollen's Presentation: Introducing Android low-levelJollen Chen
 
Linux Kernel , BSP, Boot Loader, ARM Engineer - Satish profile
Linux Kernel , BSP, Boot Loader, ARM Engineer - Satish profileLinux Kernel , BSP, Boot Loader, ARM Engineer - Satish profile
Linux Kernel , BSP, Boot Loader, ARM Engineer - Satish profileSatish Kumar
 
ABS 2012 - Android Device Porting Walkthrough
ABS 2012 - Android Device Porting WalkthroughABS 2012 - Android Device Porting Walkthrough
ABS 2012 - Android Device Porting WalkthroughBenjamin Zores
 
Manage kernel vulnerabilities in the software development lifecycle
Manage kernel vulnerabilities in the software development lifecycleManage kernel vulnerabilities in the software development lifecycle
Manage kernel vulnerabilities in the software development lifecycleSZ Lin
 
Permission in Android Security: Threats and solution
Permission in Android Security: Threats and solutionPermission in Android Security: Threats and solution
Permission in Android Security: Threats and solutionTandhy Simanjuntak
 
Defeating x64: The Evolution of the TDL Rootkit
Defeating x64: The Evolution of the TDL RootkitDefeating x64: The Evolution of the TDL Rootkit
Defeating x64: The Evolution of the TDL RootkitAlex Matrosov
 
Learning AOSP - Android Linux Device Driver
Learning AOSP - Android Linux Device DriverLearning AOSP - Android Linux Device Driver
Learning AOSP - Android Linux Device DriverNanik Tolaram
 
Android Bluetooth Introduction
Android Bluetooth IntroductionAndroid Bluetooth Introduction
Android Bluetooth IntroductionErin Yueh
 
Android crash debugging
Android crash debuggingAndroid crash debugging
Android crash debuggingAshish Agrawal
 
Android Radio Layer Interface
Android Radio Layer InterfaceAndroid Radio Layer Interface
Android Radio Layer InterfaceChun-Yu Wang
 
windows CE
windows CEwindows CE
windows CEbretorio
 

Tendances (20)

Improve Android System Component Performance
Improve Android System Component PerformanceImprove Android System Component Performance
Improve Android System Component Performance
 
What & How to Customize Android?
What & How to Customize Android?What & How to Customize Android?
What & How to Customize Android?
 
Introduction to Android Window System
Introduction to Android Window SystemIntroduction to Android Window System
Introduction to Android Window System
 
Setting up a vscode development environment for mbed 5 application using the ...
Setting up a vscode development environment for mbed 5 application using the ...Setting up a vscode development environment for mbed 5 application using the ...
Setting up a vscode development environment for mbed 5 application using the ...
 
Android graphic system (SurfaceFlinger) : Design Pattern's perspective
Android graphic system (SurfaceFlinger) : Design Pattern's perspectiveAndroid graphic system (SurfaceFlinger) : Design Pattern's perspective
Android graphic system (SurfaceFlinger) : Design Pattern's perspective
 
Headless Android Strikes Back!
Headless Android Strikes Back!Headless Android Strikes Back!
Headless Android Strikes Back!
 
Jollen's Presentation: Introducing Android low-level
Jollen's Presentation: Introducing Android low-levelJollen's Presentation: Introducing Android low-level
Jollen's Presentation: Introducing Android low-level
 
Linux Kernel , BSP, Boot Loader, ARM Engineer - Satish profile
Linux Kernel , BSP, Boot Loader, ARM Engineer - Satish profileLinux Kernel , BSP, Boot Loader, ARM Engineer - Satish profile
Linux Kernel , BSP, Boot Loader, ARM Engineer - Satish profile
 
ABS 2012 - Android Device Porting Walkthrough
ABS 2012 - Android Device Porting WalkthroughABS 2012 - Android Device Porting Walkthrough
ABS 2012 - Android Device Porting Walkthrough
 
Manage kernel vulnerabilities in the software development lifecycle
Manage kernel vulnerabilities in the software development lifecycleManage kernel vulnerabilities in the software development lifecycle
Manage kernel vulnerabilities in the software development lifecycle
 
Permission in Android Security: Threats and solution
Permission in Android Security: Threats and solutionPermission in Android Security: Threats and solution
Permission in Android Security: Threats and solution
 
Defeating x64: The Evolution of the TDL Rootkit
Defeating x64: The Evolution of the TDL RootkitDefeating x64: The Evolution of the TDL Rootkit
Defeating x64: The Evolution of the TDL Rootkit
 
Learning AOSP - Android Linux Device Driver
Learning AOSP - Android Linux Device DriverLearning AOSP - Android Linux Device Driver
Learning AOSP - Android Linux Device Driver
 
Android Bluetooth Introduction
Android Bluetooth IntroductionAndroid Bluetooth Introduction
Android Bluetooth Introduction
 
Android crash debugging
Android crash debuggingAndroid crash debugging
Android crash debugging
 
Android Radio Layer Interface
Android Radio Layer InterfaceAndroid Radio Layer Interface
Android Radio Layer Interface
 
Accelerated Android Development with Linaro
Accelerated Android Development with LinaroAccelerated Android Development with Linaro
Accelerated Android Development with Linaro
 
windows CE
windows CEwindows CE
windows CE
 
Hacking Android OS
Hacking Android OSHacking Android OS
Hacking Android OS
 
Guides To Analyzing WebKit Performance
Guides To Analyzing WebKit PerformanceGuides To Analyzing WebKit Performance
Guides To Analyzing WebKit Performance
 

En vedette

Device for Android
Device for AndroidDevice for Android
Device for Androiddynamis
 
"Learning AOSP" - Android Hardware Abstraction Layer (HAL)
"Learning AOSP" - Android Hardware Abstraction Layer (HAL)"Learning AOSP" - Android Hardware Abstraction Layer (HAL)
"Learning AOSP" - Android Hardware Abstraction Layer (HAL)Nanik Tolaram
 
Android device driver structure introduction
Android device driver structure introductionAndroid device driver structure introduction
Android device driver structure introductionWilliam Liang
 
Accessing Hardware on Android
Accessing Hardware on AndroidAccessing Hardware on Android
Accessing Hardware on AndroidGary Bisson
 
Android power management
Android power managementAndroid power management
Android power managementJerrin George
 
An introduction to the linux kernel and device drivers (NTU CSIE 2016.03)
An introduction to the linux kernel and device drivers (NTU CSIE 2016.03)An introduction to the linux kernel and device drivers (NTU CSIE 2016.03)
An introduction to the linux kernel and device drivers (NTU CSIE 2016.03)William Liang
 
ICT+UD 융합작품 개발문서(스마트디바이스지능통신)
ICT+UD 융합작품 개발문서(스마트디바이스지능통신)ICT+UD 융합작품 개발문서(스마트디바이스지능통신)
ICT+UD 융합작품 개발문서(스마트디바이스지능통신)Yong Heui Cho
 

En vedette (19)

Power Management from Linux Kernel to Android
Power Management from Linux Kernel to AndroidPower Management from Linux Kernel to Android
Power Management from Linux Kernel to Android
 
Device for Android
Device for AndroidDevice for Android
Device for Android
 
Power management android
Power management androidPower management android
Power management android
 
"Learning AOSP" - Android Hardware Abstraction Layer (HAL)
"Learning AOSP" - Android Hardware Abstraction Layer (HAL)"Learning AOSP" - Android Hardware Abstraction Layer (HAL)
"Learning AOSP" - Android Hardware Abstraction Layer (HAL)
 
Android device driver structure introduction
Android device driver structure introductionAndroid device driver structure introduction
Android device driver structure introduction
 
Accessing Hardware on Android
Accessing Hardware on AndroidAccessing Hardware on Android
Accessing Hardware on Android
 
Android power management
Android power managementAndroid power management
Android power management
 
An introduction to the linux kernel and device drivers (NTU CSIE 2016.03)
An introduction to the linux kernel and device drivers (NTU CSIE 2016.03)An introduction to the linux kernel and device drivers (NTU CSIE 2016.03)
An introduction to the linux kernel and device drivers (NTU CSIE 2016.03)
 
Embedded Android : System Development - Part III
Embedded Android : System Development - Part IIIEmbedded Android : System Development - Part III
Embedded Android : System Development - Part III
 
Embedded Android : System Development - Part IV
Embedded Android : System Development - Part IVEmbedded Android : System Development - Part IV
Embedded Android : System Development - Part IV
 
Data Structures & Algorithm design using C
Data Structures & Algorithm design using C Data Structures & Algorithm design using C
Data Structures & Algorithm design using C
 
Embedded Android : System Development - Part I
Embedded Android : System Development - Part IEmbedded Android : System Development - Part I
Embedded Android : System Development - Part I
 
Embedded C - Optimization techniques
Embedded C - Optimization techniquesEmbedded C - Optimization techniques
Embedded C - Optimization techniques
 
ICT+UD 융합작품 개발문서(스마트디바이스지능통신)
ICT+UD 융합작품 개발문서(스마트디바이스지능통신)ICT+UD 융합작품 개발문서(스마트디바이스지능통신)
ICT+UD 융합작품 개발문서(스마트디바이스지능통신)
 
Embedded Linux on ARM
Embedded Linux on ARMEmbedded Linux on ARM
Embedded Linux on ARM
 
Embedded C
Embedded CEmbedded C
Embedded C
 
Communication Protocols (UART, SPI,I2C)
Communication Protocols (UART, SPI,I2C)Communication Protocols (UART, SPI,I2C)
Communication Protocols (UART, SPI,I2C)
 
Embedded Android : System Development - Part II (Linux device drivers)
Embedded Android : System Development - Part II (Linux device drivers)Embedded Android : System Development - Part II (Linux device drivers)
Embedded Android : System Development - Part II (Linux device drivers)
 
Linux device drivers
Linux device drivers Linux device drivers
Linux device drivers
 

Similaire à Zeelogic android-training-2013

Portinig Application, Drivers And Os
Portinig Application, Drivers And OsPortinig Application, Drivers And Os
Portinig Application, Drivers And Osmomobangalore
 
Android internals
Android internalsAndroid internals
Android internalsrabah3
 
Android development tutorial
Android development tutorialAndroid development tutorial
Android development tutorialMohammad Taj
 
Android development tutorial
Android development tutorialAndroid development tutorial
Android development tutorialnazzf
 
Android and its feature
Android and its featureAndroid and its feature
Android and its featureShubham Kumar
 
Wifi Direct Based Chat And File Transfer Android Application
Wifi Direct Based Chat And File Transfer Android ApplicationWifi Direct Based Chat And File Transfer Android Application
Wifi Direct Based Chat And File Transfer Android ApplicationNitin Bhasin
 
Introduction to Android
Introduction to Android Introduction to Android
Introduction to Android Ranjith Kumar
 
Android and windows os
Android and windows osAndroid and windows os
Android and windows osMehakVithal
 
lecture-2-android-dev.pdf
lecture-2-android-dev.pdflecture-2-android-dev.pdf
lecture-2-android-dev.pdfjakjak36
 
Android understanding
Android understandingAndroid understanding
Android understandingRamesh Rao
 
Android Overview
Android OverviewAndroid Overview
Android OverviewRaju Kadam
 
Android 110521210945-phpapp01
Android 110521210945-phpapp01Android 110521210945-phpapp01
Android 110521210945-phpapp01Mona AlRekabi
 
Introduction to android
Introduction to androidIntroduction to android
Introduction to androidzeelpatel0504
 
Android platform overview
Android platform overviewAndroid platform overview
Android platform overviewtamilmani1020
 

Similaire à Zeelogic android-training-2013 (20)

01 02 - introduction - adroid stack
01  02 - introduction - adroid stack01  02 - introduction - adroid stack
01 02 - introduction - adroid stack
 
Portinig Application, Drivers And Os
Portinig Application, Drivers And OsPortinig Application, Drivers And Os
Portinig Application, Drivers And Os
 
Android internals
Android internalsAndroid internals
Android internals
 
Android development tutorial
Android development tutorialAndroid development tutorial
Android development tutorial
 
Android development tutorial
Android development tutorialAndroid development tutorial
Android development tutorial
 
Android development tutorial
Android development tutorialAndroid development tutorial
Android development tutorial
 
Android and its feature
Android and its featureAndroid and its feature
Android and its feature
 
Android
Android Android
Android
 
Wifi Direct Based Chat And File Transfer Android Application
Wifi Direct Based Chat And File Transfer Android ApplicationWifi Direct Based Chat And File Transfer Android Application
Wifi Direct Based Chat And File Transfer Android Application
 
Introduction to Android
Introduction to Android Introduction to Android
Introduction to Android
 
Android and windows os
Android and windows osAndroid and windows os
Android and windows os
 
lecture-2-android-dev.pdf
lecture-2-android-dev.pdflecture-2-android-dev.pdf
lecture-2-android-dev.pdf
 
Android understanding
Android understandingAndroid understanding
Android understanding
 
01 03 - introduction to android
01  03 - introduction to android01  03 - introduction to android
01 03 - introduction to android
 
Android Architecture
Android ArchitectureAndroid Architecture
Android Architecture
 
Android My Seminar
Android My SeminarAndroid My Seminar
Android My Seminar
 
Android Overview
Android OverviewAndroid Overview
Android Overview
 
Android 110521210945-phpapp01
Android 110521210945-phpapp01Android 110521210945-phpapp01
Android 110521210945-phpapp01
 
Introduction to android
Introduction to androidIntroduction to android
Introduction to android
 
Android platform overview
Android platform overviewAndroid platform overview
Android platform overview
 

Dernier

Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machinePadma Pradeep
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyAlfredo García Lavilla
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr BaganFwdays
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticscarlostorres15106
 
The Future of Software Development - Devin AI Innovative Approach.pdf
The Future of Software Development - Devin AI Innovative Approach.pdfThe Future of Software Development - Devin AI Innovative Approach.pdf
The Future of Software Development - Devin AI Innovative Approach.pdfSeasiaInfotech2
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Scott Keck-Warren
 
Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Manik S Magar
 
Artificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxArtificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxhariprasad279825
 
Vector Databases 101 - An introduction to the world of Vector Databases
Vector Databases 101 - An introduction to the world of Vector DatabasesVector Databases 101 - An introduction to the world of Vector Databases
Vector Databases 101 - An introduction to the world of Vector DatabasesZilliz
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupFlorian Wilhelm
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubKalema Edgar
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationRidwan Fadjar
 
My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024The Digital Insurer
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Mattias Andersson
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek SchlawackFwdays
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024Lorenzo Miniero
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationSlibray Presentation
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLScyllaDB
 
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr LapshynFwdays
 

Dernier (20)

Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machine
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easy
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
 
The Future of Software Development - Devin AI Innovative Approach.pdf
The Future of Software Development - Devin AI Innovative Approach.pdfThe Future of Software Development - Devin AI Innovative Approach.pdf
The Future of Software Development - Devin AI Innovative Approach.pdf
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024
 
Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!
 
Artificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxArtificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptx
 
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptxE-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
 
Vector Databases 101 - An introduction to the world of Vector Databases
Vector Databases 101 - An introduction to the world of Vector DatabasesVector Databases 101 - An introduction to the world of Vector Databases
Vector Databases 101 - An introduction to the world of Vector Databases
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project Setup
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding Club
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 Presentation
 
My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck Presentation
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQL
 
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
 

Zeelogic android-training-2013

  • 1. Introduction to Android and its Subsystem © Copyright 2013, Zeelogic.com. Latest update: Janl 30, 2013, http://www.zeelogic.com/ Call us on : 91-9535072845 E-Mail : info@zeelogic.com E-mail: info@zeelogic.com; http://www.zeelogic.com Phone : 91-9535072845
  • 2. Android Android can best be described as a complete solution stack, incorporating the OS, middle wear components, and applications. In Android, the modified Linux 2.6 kernel acts as the hardware abstraction layer (HAL). To summarize, the Android operating environment can be labeled as:  An open platform for mobile development  A hardware reference design for mobile devices  A system powered by a modified Linux 2.6 kernel  A run time environment  An application and user interface (UI) framework Android utilize a modified Linux 2.6 kernel that is incorporated into the Android operating environment. E-mail: info@zeelogic.com; http://www.zeelogic.com Phone : 91-9535072845
  • 3. Android Versions 2 Version history by API level 2.1 Android 1.0 (API level 1) 2.2 Android 1.1 (API level 2) 2.3 Android 1.5 Cupcake (API level 3) 2.4 Android 1.6 Donut (API level 4) 2.5 Android 2.0 Eclair (API level 5) 2.6 Android 2.0.1 Eclair (API level 6) 2.7 Android 2.1 Eclair (API level 7) 2.8 Android 2.2–2.2.3 Froyo (API level 8) 2.9 Android 2.3–2.3.2 Gingerbread (API level 9) 2.10 Android 2.3.3–2.3.7 Gingerbread (API level 10) 2.11 Android 3.0 Honeycomb (API level 11) 2.12 Android 3.1 Honeycomb (API level 12) 2.13 Android 3.2 Honeycomb (API level 13) 2.14 Android 4.0–4.0.2 Ice Cream Sandwich (API level 14) 2.15 Android 4.0.3–4.0.4 Ice Cream Sandwich (API level 15) 2.16 Android 4.1 Jelly Bean (API level 16) 2.17 Android 4.2 Jelly Bean (API level 17) E-mail: info@zeelogic.com; http://www.zeelogic.com Phone : 91-9535072845
  • 4. Linux Kernel Android is built on the Linux kernel, but Android is not Linux  No native windowing system  No glibc support  Does not include the full set of standard Linux utilities  Patch of “kernel enhancements” to support Android  Great memory and process management  Permissions-based security model  Proven driver model  Support for shared libraries E-mail: info@zeelogic.com; http://www.zeelogic.com Phone : 91-9535072845
  • 5. Kernel Enhancements Used as the foundation of the Android system  Numerous additions from the stock  Ashmem Linux, including new IPC (Inter-Process  Binder Communication) mechanisms, alternative power  Alarm management mechanism, new drivers and various  Power Management additions across the kernel  Low Memory Killer  These changes are beginning to go into the staging/  Kernel Debugger area of the kernel, as of 3.3, after being a complete  Logger fork for a long time E-mail: info@zeelogic.com; http://www.zeelogic.com Phone : 91-9535072845
  • 6. Changes introduced in the Android Kernel E-mail: info@zeelogic.com; http://www.zeelogic.com Phone : 91-9535072845
  • 7. Android Linux Kernel Modifications Android is built on the Linux kernel, but Android is not Linux Kernel Enhancements  No native windowing system  No glibc support  Alarm  Does not include the full set of standard Linux utilities  Ashmem  Standard Linux 2.6.24 Kernel  Binder  Patch of “kernel enhancements” to support Android  Power Management  Great memory and process management  Low Memory Killer  Permissions-based security model  Kernel Debugger  Proven driver model  Logger  Support for shared libraries  It‟s a open source! E-mail: info@zeelogic.com; http://www.zeelogic.com Phone : 91-9535072845
  • 8. Android Linux Kernel Modifications E-mail: info@zeelogic.com; http://www.zeelogic.com Phone : 91-9535072845
  • 9. A split view of the kernel E-mail: info@zeelogic.com; http://www.zeelogic.com Phone : 91-9535072845
  • 10. Android Libraries E-mail: info@zeelogic.com; http://www.zeelogic.com Phone : 91-9535072845
  • 11. Android Libraries  Gather a lot of Android-specifc libraries to interact at a low-level with the system, but third-parties libraries as well  Bionic is the C library, SurfaceManager is used for drawing surfaces on the screen, etc.  But also WebKit, SQLite, OpenSSL coming from the free software world Android Runtime Handles the execution of Android applications  Almost entirely written from scratch by Google  Contains Dalvik, the virtual machine that executes every application that you run on Android, and the core library for the Java runtime, coming from Apache Harmony project Also contains system daemons, init executable, basic binaries, etc. E-mail: info@zeelogic.com; http://www.zeelogic.com Phone : 91-9535072845
  • 12. • Bionic Libc :- Custom libc implementation, optimized for embedded use. • Function Libraries • Native Servers • Hardware Abstraction Libraries WebKit  Based on open source WebKit browser: http://webkit.org  Renders pages in full (desktop) view  Full CSS, Javascript, DOM, AJAX support  Support for single-column and adaptive view rendering Media Framework Based on PacketVideo OpenCORE platform Supports standard video, audio, still-frame formats Support for hardware / software codec plug-ins E-mail: info@zeelogic.com; http://www.zeelogic.com Phone : 91-9535072845
  • 13. Android Source code organization Bionic/ Android's standard C library is stored contains code samples regarding the boot of an Android device. In this folder, protocol used by all Android bootloaders and a recovery image Bootable/ holds the core components of the build system. Build/ Holds the core components of the build system CTS/ The Compatibility Test Suite Dalvik/ Contains the source code of the Dalvik virtual machine. Development/ Holds the development tools, debug applications, API samples, etc device/ Contains the device-specifc components One of the largest folders in the source code, it contains all the external External/ projects used in the Android code Frameworks/ Holds the source code of the various parts of the framework Hardware/ contains all the hardware abstraction layers E-mail: info@zeelogic.com; http://www.zeelogic.com Phone : 91-9535072845
  • 14. Android HAL E-mail: info@zeelogic.com; http://www.zeelogic.com Phone : 91-9535072845
  • 15. Android HAL E-mail: info@zeelogic.com; http://www.zeelogic.com Phone : 91-9535072845
  • 16. Android HAL Hardware Abstraction Layer which provides a layer to protect proprietary software from licensing point of view. Android applications communicate with the underlying hardware through Java API‟s not by system calls. The Hardware Abstraction Layer or HAL is the glue between any device (part of the kernel) and the corresponding JNI interface. HAL source code reside under the hardware folder /** Base path of the hal modules */ #define HAL_LIBRARY_PATH1 "/system/lib/hw“ #define HAL_LIBRARY_PATH2 "/vendor/lib/hw" User space C/C++ library layer  Defines the interface that Android requires hardware “drivers” to implement  Separates the Android platform logic from the hardware interface  Libraries are loaded dynamically at runtime as needed E-mail: info@zeelogic.com; http://www.zeelogic.com Phone : 91-9535072845
  • 17. Audio Flinger  Manages all audio output devices  Processes multiple audio streams into PCM audio out paths  Handles audio routing to various outputs E-mail: info@zeelogic.com; http://www.zeelogic.com Phone : 91-9535072845
  • 18. Android HAL Above figure provide a clear view on connections between the Kernel, HAL ( libhxxx.so ) , C++ headers, JNI binding and finally the JAVA API. Consider the complete audio subsystem in Android and in particular the OMAP 35xx applications processor. E-mail: info@zeelogic.com; http://www.zeelogic.com Phone : 91-9535072845
  • 19. Android Audio Native Services E-mail: info@zeelogic.com; http://www.zeelogic.com Phone : 91-9535072845
  • 20. Android's Camera Sub System E-mail: info@zeelogic.com; http://www.zeelogic.com Phone : 91-9535072845
  • 21. Android's Camera Sub System Android's camera application connect with android HAL through camera binding interface. HAL in turns connect physical camera sensor and provides control & data interface between application and camera sensor. The diagram illustrates the structure of the camera subsystem. In the diagram proprietary camera libraries are nothing but camera HAL E-mail: info@zeelogic.com; http://www.zeelogic.com Phone : 91-9535072845
  • 22. Android Camera HAL brief To implement a camera HAL ( also consider as driver between android camera subsystem and V4L2 kernel driver) ; one need to create a shared library (named as libcamera.so) that implements the interface defined at “android/frameworks/base/include/camera/CameraHardwareInterface.h”. Location of the shared library should be at “android/hardware/<vendor>/<boardname>/camera” Create source files and implement interface defined at 'CameraHardwareInterface.h'. android/hardware/ti/omap3/camera/CameraHardware.cpp android/hardware/ti/omap3/camera/CameraHardware.h E-mail: info@zeelogic.com; http://www.zeelogic.com Phone : 91-9535072845
  • 23. Interface‟s defined under camera HAL /* constructor */ CameraHardware::CameraHardware(){} /* destructor */ CameraHardware::~CameraHardware(){} sp<IMemoryHeap> CameraHardware::getPreviewHeap() const{} void CameraHardware::setCallbacks(notify_callback notify_cb, data_callback data_cb, data_callback_timestamp data_cb_timestamp, void* user){/* store callback to local pointers, need to callback at the time of preview/image capture */} void CameraHardware::enableMsgType(int32_t msgType) {/* set local message flag. Application will give this notification to perform certain action while previewing. ex.start video, image caputure etc. */} void CameraHardware::disableMsgType(int32_t msgType){} bool CameraHardware::msgTypeEnabled(int32_t msgType){} Create and configure void CameraHardware::stopPreview() { /* stop preview */ } android.mk file status_t CameraHardware::startRecording() { /* configure device & start record thread */ Compile android system /* record thread - check message type - if message type contains - Go to module directory $cd /projects/my- CAMERA_MSG_VIDEO_FRAME then call 'mDataCbTimestamp' with video frame android/hardware/ti/omap3/camera captured */ } $source void CameraHardware::stopRecording() { /* stop recording */ } <ANDROID_ROOT>/build/envsetup.sh status_t CameraHardware::takePicture() $mm TARGET_PRODUCT= { /* - configure camera device - take a current frame - check message type - call callback */ <TARGET PRODUCT NAME> } e.g.$ mm status_t CameraHardware::setParameters(const CameraParameters& params) { /* - TARGET_PRODUCT=beagleboard configure device as per parameters */ } copy libcamera.so to out/target/product/<boardname>/system/l CameraParameters CameraHardware::getParameters() const ib { /* - return current value of parameter set */ } E-mail: info@zeelogic.com; http://www.zeelogic.com Phone : 91-9535072845
  • 24. Android Runtime E-mail: info@zeelogic.com; http://www.zeelogic.com Phone : 91-9535072845
  • 25. Android Runtime E-mail: info@zeelogic.com; http://www.zeelogic.com Phone : 91-9535072845
  • 26. Dalvik Virtual Machine Android‟s custom clean-room implementation virtual machine  Provides application portability and runtime consistency  Runs optimized file format (.dex) and Dalvik bytecode  Java .class / .jar files converted to .dex at build time Supports multiple virtual machine processes per device  Highly CPU-optimized bytecode interpreter  Uses runtime memory very efficiently E-mail: info@zeelogic.com; http://www.zeelogic.com Phone : 91-9535072845
  • 27. Core Libraries Core APIs for Java language provide a powerful, yet simple and familiar development platform • Data structures • Utilities • File access • Network Access • Graphics •… E-mail: info@zeelogic.com; http://www.zeelogic.com Phone : 91-9535072845
  • 28. Android Power Management E-mail: info@zeelogic.com; http://www.zeelogic.com Phone : 91-9535072845
  • 29. Android Power Management  Linux Power Management  Android Power Management Design  Wake Locks  System Sleep (Suspend)  Battery Service • Home Entertainment . • Security devices Designed for mobile devices • Multimedia Devices, Goal is to prolong battery life  Build on top of Linux Power Management • Handheld Devices  Not directly suitable for a mobile device • Tablets  Designed for devices which have a 'default-off' behavior  The phone is not supposed to be on when we do not want to use it.  Powered on only when requested to be run, off by default. • Multimedia Streaming  Unlike PC, which has a default on behavior. • Connected Navigation • In-car Wi-Fi E-mail: info@zeelogic.com; http://www.zeelogic.com Phone : 91-9535072845
  • 30. Linux Power Management Power mode interface is on sysfs  /sys/power/state  sysfs is a virtual file system provided by Linux. •sysfs exports Home Entertainment . • Security devices information about devices and drivers from the kernel device model to • Multimedia Devices, user space, and is also used for configuration • Handheld Devices  Changing state done by • Tablets # echo mem > /sys/power/state # echo disk > /sys/power/state # echo standby > /sys/power/state • Multimedia Streaming • Connected Navigation • In-car Wi-Fi E-mail: info@zeelogic.com; http://www.zeelogic.com Phone : 91-9535072845
  • 31. Linux Power Management • Home Entertainment . • Security devices • Multimedia Devices, • Handheld Devices • Tablets • Multimedia Streaming • Connected Navigation • In-car Wi-Fi E-mail: info@zeelogic.com; http://www.zeelogic.com Phone : 91-9535072845
  • 32. Android Power Management Built as a wrapper to Linux Power Management  In the Kernel  Added 'on' state in the power state  Added Early Suspend framework  Added Partial Wake Lock mechanism • Home Entertainment . • Security devices  Apps and services must request CPU resource with • Multimedia Devices, the „wake locks‟ through Android application framework and native Linux libraries in order to keep power on, otherwise Android will shut down the CPU. • Handheld Devices  Android PM uses wake locks and time out mechanism to switch state of system • Tablets power, so that system power consumption decreases • Multimedia Streaming Android demands that applications and services request CPU resources via • and native Linux wake locks through the Android application frameworkConnected Navigation • shutdown the libraries. If there are no active wake locks, Android willIn-car Wi-Fi processor. E-mail: info@zeelogic.com; http://www.zeelogic.com Phone : 91-9535072845
  • 33. Wake Locks By default, Android tries to put the system into a sleep or better a suspend mode as soon as possible  Applications running in the Dalvik VM can prevent the system from entering a sleep or suspend state, i.e. applications can assure that the screen stays on or the CPU stays awake to react quickly to interrupts  The means Android provides for this task is wake locks  If there are no active wake locks, CPU will be turned off Home Entertainment . •  If there are partial wake locks, screen and keyboard will• be turneddevices Security off • Multimedia Devices, Types of Wake Locks  PARTIAL_WAKE_LOCK  Ensures that the CPU is running • Handheld Devices  The screen might not be on • Tablets  SCREEN_DIM_WAKE_LOCK  Wake lock that ensures that the screen is on, but the keyboard backlight will be allowed to go off, and the screen backlight will be allowed to go dim  SCREEN_BRIGHT_WAKE_LOCK  Wake lock that ensures that the screen is on at full brightness; the keyboard backlight will be allowed to go off  FULL_WAKE_LOCK  Full device ON, including backlight and screen E-mail: info@zeelogic.com; http://www.zeelogic.com Phone : 91-9535072845
  • 34. Android PM Design Android implements an application framework on top of the kernel called Android Power Management Applications Framework  The Android PM Framework is like a driver. It is written in Java which connects to Android power driver through JNI  Currently Android only supports screen, keyboard, buttons backlight, and the brightness of screen  Through the framework, user space applications can use „PowerManger‟ class to control the power state of the device E-mail: info@zeelogic.com; http://www.zeelogic.com Phone : 91-9535072845
  • 35. Android PM Implementation Android PM Framework provides a service for user space applications through the class PowerManger to achieve power saving The flow of exploring Wake locks are : Acquire handle to the PowerManager service by calling Context.getSystemService() Create a wake lock and specify the power management flags for screen, timeout, etc. Acquire wake lock • Home Entertainment . Perform operation such as play MP3 • Security devices Release wake lock • Multimedia Devices, How are Wake Locks Managed • Handheld Devices  Wake Locks are mainly managed in Java layer • Tablets  When an android application takes a wake lock, a new instance of wake lock is registered in the PowerManagerService  PowerManagerService is running in the java layer • Multimedia Streaming  Registered wake locks are put in a list • Connected Navigation • In-car Wi-Fi E-mail: info@zeelogic.com; http://www.zeelogic.com Phone : 91-9535072845
  • 36. Acquiring a Wake lock The flow when a Wake Lock is acquired Request sent to PowerManager to acquire a wake lock PowerManagerService to take a wake lock Add wake lock to the list Set the power state • Home Entertainment . • Security devices  For a FULL_WAKE_LOCK, PowerState would be set to ON • Multimedia Devices, For taking Partial wake lock, if it is the first partial wake lock, a kernel wake lock is taken. This will protect all the partial wake locks. For • Handheld Devices subsequent requests, kernel wake lock is not taken, but just added to the • Tablets list • Multimedia Streaming • Connected Navigation • In-car Wi-Fi E-mail: info@zeelogic.com; http://www.zeelogic.com Phone : 91-9535072845
  • 37. Android power management architecture. E-mail: info@zeelogic.com; http://www.zeelogic.com Phone : 91-9535072845
  • 38. Battery Service  The BatteryService monitors the battery status, level, temperature etc.  A Battery Driver in the kernel interacts with the physical battery via ADC [to read battery voltage] and I²C ( Inter-Integrated Circuit: a multi-master serial single-ended computer bus used to attach low-speed peripherals to an electronic device)  Whenever BatteryService receives information from the BatteryDriver, it will act accordingly • Home Entertainment . E.g. if battery level is low, it will ask system to shutdown • Security devices • Multimedia Devices, Using power supply class in Linux Kernel /sys/class/power_supply • Handheld Devices  Utilize uevent mechanism to update battery status • Tablets  uevent : An asynchronous communication channel for kernel  Battery Service will monitor the battery status based on received uevent from the kernel • Multimedia Streaming • Connected Navigation • In-car Wi-Fi E-mail: info@zeelogic.com; http://www.zeelogic.com Phone : 91-9535072845
  • 39. Android Power Management • Home Entertainment . • Security devices • Multimedia Devices, • Handheld Devices • Tablets • Multimedia Streaming • Connected Navigation • In-car Wi-Fi E-mail: info@zeelogic.com; http://www.zeelogic.com Phone : 91-9535072845
  • 40. • Home Entertainment . Sensors on Android • Security devices • Multimedia Devices, • Handheld Devices • Tablets • Multimedia Streaming • Connected Navigation • In-car Wi-Fi E-mail: info@zeelogic.com; http://www.zeelogic.com Phone : 91-9535072845
  • 41. Sensors on Android A sensor(also called detector) is a device that measures a physical quantity and converts it into a signal which can be read by an observer or by an instrument. • Handheld Devices • Tablets • Multimedia Streaming • Connected Navigation • In-car Wi-Fi E-mail: info@zeelogic.com; http://www.zeelogic.com Phone : 91-9535072845
  • 42. Android Sensor Framework Overview E-mail: info@zeelogic.com; http://www.zeelogic.com Phone : 91-9535072845
  • 43. Android sensor sub system overview Application Framework Sensor Applications uses the Sensor application framework to get the sensor data. It communicates with C++ layer through sensor Java native interface (JNI) Sensor Libraries Sensor middle layer mainly consists of Sensor Manager, Sensor service and Sensor hardware • Home Entertainment . abstraction layer. • Security devices Input Subsystem • Multimedia Devices, This is a generic Linux framework for all input devices like keyboard, mouse, touchscreen and defines a standard set of events. It interfaces to user space through /sys/class/input interface. • Handheld Devices Evdev • Tablets Evdev provides a generic way for input device events to be accessible under /dev/input/eventX . LIS331DLH Accelerometer Driver • Multimedia Streaming This driver communicates with LIS331DLH • Connected Navigation accelerometer chip via GPIO and I2C bus. GPIO line is used for generating interrupts while I2C bus • In-car Wi-Fi for accessing and configuring accelerometer registers. Fig: Android subsystem overview E-mail: info@zeelogic.com; http://www.zeelogic.com Phone : 91-9535072845
  • 44. Android input event process Enable Accelerometer sensor. Testing Android Input TS and Keypad Driver #cat 1 > /sys/bus/i2c/drivers/lis331dlh/1-018/enable # cat /proc/bus/input/devices I: Bus=0000 Vendor=0000 Product=0000 Version=0000 Use getevent command to see N: Name="MVT7 KEYPAD" accelerometer events P: Phys= #getevent add device 2: /dev/input/event2 S: Sysfs=/class/input/input0 name: • Home Entertainment . U: Uniq= "Acceleromter" /dev/input/event2: 0001 • Security devices H: Handlers=kbd event0 evbug 014a 00000001 /dev/input/event2: 0003 • Multimedia Devices, B: EV=f 0000 0000089e /dev/input/event2: 0003 ... 0001 000005fe I: Bus=0000 Vendor=0000 Product=0000 Version=0000 # cat /proc/bus/input/handlers N: Name="TSC2007 Touchscreen" N: Number=0 Name=kbd P: Phys=0-0090/input0 N: Number=1 Name=evdev Minor=64 S: Sysfs=/class/input/input1 N: Number=2 Name=evbug U: Uniq= • Multimedia Streaming • Connected H: Handlers=event1 evbug Navigation B: EV=b • In-car Wi-Fi B: KEY=400 0 0 0 0 0 0 0 0 0 0 B: ABS=1000003 E-mail: info@zeelogic.com; http://www.zeelogic.com Phone : 91-9535072845
  • 45. Porting a sensor onto Android Kernel Device-driver Board File Userspace Adding New HAL -OR- Modifying existing HAL Device-driver Poll/Interrupt? Hybrid-approach = Workqueues Early-suspend hook input_report_abs() / input_report_rel() Board File Interrupt, GPIO, SPI/I2C-lines Axes-remap to device axes platform_data E-mail: info@zeelogic.com; http://www.zeelogic.com Phone : 91-9535072845
  • 46. Kernel Handling of Sensor Events E-mail: info@zeelogic.com; http://www.zeelogic.com Phone : 91-9535072845
  • 47. Kernel Handling of Sensor Events Early-Suspend hook InputEvents E-mail: info@zeelogic.com; http://www.zeelogic.com Phone : 91-9535072845
  • 48. Android Boot Sequence E-mail: info@zeelogic.com; http://www.zeelogic.com Phone : 91-9535072845
  • 49. Android Boot Sequence E-mail: info@zeelogic.com; http://www.zeelogic.com Phone : 91-9535072845
  • 50. Android Boot Sequence E-mail: info@zeelogic.com; http://www.zeelogic.com Phone : 91-9535072845
  • 51. Linux boot process E-mail: info@zeelogic.com; http://www.zeelogic.com Phone : 91-9535072845
  • 52. Android Boot Sequence Init it very first process, we can say it is root process or grandmother of all processes. init process has two responsibilities. 1. mount directories like /sys, /dev, /proc and 2. run init.rc script. Android has specific format and rules for init.rc files. In Android we call it as “Android Init Language” The Android Init Language consists of four broad classes of statements, which are 1. Actions, 2. Commands, 3. Services, 4. Options. E-mail: info@zeelogic.com; http://www.zeelogic.com Phone : 91-9535072845
  • 53. Action : Actions are named sequences of commands. Actions have a trigger which is used to determine when the action should occur. Syntax on <trigger> <command> <command> <command> Service : Services are programs which init launches and (optionally) restarts when they exit. Syntax service <name> <pathname> [ <argument> ]* <option> <option> ... Options : Options are modifiers to services. They affect how and when init runs the service. Let‟s take a look of default init.rc file. Here I have listed only major events and services. E-mail: info@zeelogic.com; http://www.zeelogic.com Phone : 91-9535072845
  • 54. Zygote Process  Zygote is a VM process Action / Service Description that starts at system boot on early-init Set init and its forked children's oom_adj. time. Set the security context for the init process.  Zygote preloads and on init setup the global environment initialize core library Create cgroup mount point for cpu classes. Normally there accounting core classes are read-only and many and part of Android SDK or on fs mount mtd partitions Core frameworks. In Java change permissions of system directories on post-fs VM each instance has it‟s own copy of core library on post-fs-data change permission of /data folders and sub folders class files and heap objects. on boot basic network init ,Memory Management ,etc service start system manager to manage all native servicemanager services like location, audio, shared preference etc.. service zygote start zygote as app_process E-mail: info@zeelogic.com; http://www.zeelogic.com Phone : 91-9535072845
  • 55. Zygote Process Startup E-mail: info@zeelogic.com; http://www.zeelogic.com Phone : 91-9535072845
  • 56. Zygote loading process 1. Load ZygoteInit class, Source Code :<Android Source> /frameworks/base/core/java/com/android/internal/os/ZygoteInit.java 2. registerZygoteSocket() - Registers a server socket for zygote command connections 3. preloadClasses() - “preloaded-classes” is simple text file contains list of classes that need to be preloaded, you cna find “preloaded-classes” file at <Android Source>/frameworks/base 4. preloadResources() - preloadReaources means native themes and layouts, everything that include android.R file will be load using this method. At this time you can see bootanimation E-mail: info@zeelogic.com; http://www.zeelogic.com Phone : 91-9535072845
  • 57. Android System Service or Services System Service or Services Core Services: 1. Starting Power Manager After complete above steps, runtime request 2. Creating Activity Manager Zygote to launch system servers. System 3. Starting Telephony Registry Servers are written in native and java 4. Starting Package Manager both, System servers we can consider as 5. Set Activity Manager Service as process, The same system server is available as System Process System Services in Android SDK. System 6. Starting Context Manager server contain all system services. 7. Starting System Context Providers 8. Starting Battery Service 9. Starting Alarm Manager Zygote fork new process to launch system 10. Starting Sensor Service services. You can find source code in 11. Starting Window Manager ZygoteInit class and “startSystemServer” 12. Starting Bluetooth Service method. 13. Starting Mount Service Boot Completed Once System Services up and running in memory, Android has completed booting process, At this time “ACTION_BOOT_COMPLETED” standard broadcast action will fire. E-mail: info@zeelogic.com; http://www.zeelogic.com Phone : 91-9535072845
  • 58. Corporate And Custom Training For IT Professionals and Graduates http://www.zeelogic.com
  • 59. Placement and Training Module http://www.zeelogic.com • Fully customized content and instruction to meet your specific needs • Qualified, experienced, industry experts and faculty as instructors • Proven track record with the area’s top organizations • Instructional materials, case studies and activities related to your company and industry • Cost savings for your training budget Copyright © 2012 Zeelogic (P) Ltd. All rights reserved.
  • 60. Zeelogic will work individually with your company to understand your vision and identify your learning needs and objectives. Training Areas Services Offered  Training in Programming Languages  Programming Languages ( C, C++, JAVA)  Classroom, Instructor Lead Programs  Linux/Unix  Personal and Professional Development,  Microcontrollers and Processors  Professional Trainers for Mentoring  RTOS ( Vxworks, QNX )  Instructional Design  Android  Embedded Training Kits  Embedded Systems  Hands on experience on Live Projects  Linux Internals and Device Drivers  Video Courses and Tutorials  Networking/Wireless  SDLC We are specialize in designing programs to meet the specific content. We Provide comprehensive training in Embedded systems and different area of Programming . Copyright © 2012 Zeelogic (P) Ltd. All rights reserved.
  • 61. UNC Charlotte will work individually with your company to understand your vision and identify your learning needs and objectives. We specialize in designing programs to meet the specific content, location and scheduling requirements of your organization. For more information contact: Director of Corporate Training E-Mail: info@zeelogic.com #4247,14th Main , 19th Cross, Subramanian Nagar , Bangalore 560021. Phone : +91-80-23376639, web link: www.zeelogic.com Copyright © 2012 Zeelogic (P) Ltd. All rights reserved.