SlideShare une entreprise Scribd logo
1  sur  46
Télécharger pour lire hors ligne
Inside Android's UI
 Android Builders Summit 2013

       Karim Yaghmour
       @karimyaghmour

  karim.yaghmour@opersys.com


                           1
These slides are made available to you under a Creative Commons Share-              Delivered and/or customized by
Alike 3.0 license. The full terms of this license are here:
https://creativecommons.org/licenses/by-sa/3.0/


Attribution requirements and misc., PLEASE READ:
●   This slide must remain as-is in this specific location (slide #2), everything
    else you are free to change; including the logo :-)
●   Use of figures in other documents must feature the below “Originals at”
    URL immediately under that figure and the below copyright notice where
    appropriate.
●   You are free to fill in the “Delivered and/or customized by” space on the
    right as you see fit.
●   You are FORBIDEN from using the default “About” slide as-is or any of its
    contents.
●
    You are FORBIDEN from using any content provided by 3rd parties without
    the EXPLICIT consent from those parties.


(C) Copyright 2013, Opersys inc.
These slides created by: Karim Yaghmour
Originals at: www.opersys.com/community/docs

                                                                                             2
About
●   Author of:




●   Introduced Linux Trace Toolkit in 1999
●   Originated Adeos and relayfs (kernel/relay.c)
●   Training, Custom Dev, Consulting, ...
                                              3
Agenda
●   Android's UI, what's that?
●   Architecture Basics
●   Display Core
●   OpenGL
●   Input Layer
●   Relevant Apps and Services
●   System Startup
●   References and Pointers
                                 4
1. Android's UI, what's that?



                       ●SoC / GPU
                ???    ●Touch input

                       ●LCD

                       ●Keyboard




                           5
1.1. What I'm NOT covering
●   Media layer
●   StageFright
●   Video playback
●   Camera
●   DRM
●   Etc.



                              6
2. Architecture Basics
●   Hardware used to run Android
●   AOSP
●   Binder
●   System Services
●   HAL




                                      7
8
9
10
11
12
/frameworks/base/core/...


                  /frameworks/base/services/java/...
AOSP-provided
    ASL
                  /frameworks/base/services/jni/


                  /hardware/libhardware/

                  /device/[MANUF.]/[DEVICE]
Manuf.-provided   /sdk/emulator/
Manuf. license
                  Kernel or module
Manuf.-provided
 GPL-license




                            13
3. Display Core
●   Display Hardware
●   Classic Linux display stack
●   Display stack in Android
●   Kernel driver
●   HAL definition
●   HAL module
●   Surface Flinger
●   Window Manager
●   Walkthrough
                                       14
3.1. Display Hardware


 MMU




IOMMU




                    15
3.2. Classic Linux display stack




                          16
3.3. Display stack in Android




                         17
18
3.4. Kernel driver
●
    Video memory management
●
    Mode setting
●   Checking of parameters
●   Motorola Xoom:
    ●
        /dev/nvhdcp1
    ●   /dev/nvhost-ctrl
    ●   /dev/nvhost-display
    ●   /dev/nvhost-dsi
    ●
        /dev/nvhost-gr2d
    ●   /dev/nvhost-gr3d
    ●
        /dev/nvhost-isp
    ●
        /dev/nvhost-mpe
    ●   /dev/nvhost-vi
    ●   /dev/nvmap
    ●   /dev/tegra-crypto
    ●
        /dev/tegra_avp
    ●
        /dev/tegra_camera
    ●
        /dev/tegra_fuse
    ●   /dev/tegra_rpc
    ●   /dev/tegra_sema
●   ... whatever hides in hwcomposer HAL module    19
3.5. HAL Definition
●   /hardware/libhardware/include/hardware/hwcomposer.h
●   struct hwc_procs:
    ●   invalidate()
    ●   vsync()
●   struct hwc_composer_device:
    ●   prepare()
    ●   set()
    ●   dump()
    ●   registerProcs()
    ●   query()
    ●   *()
                                                      20
3.6. HAL module
●   Skeleton /hardware/libhardware/modules/hwcomposer.cpp
●   /system/lib/hw/hwcomposer.BOARD.so
●   /system/lib/hw/gralloc.BOARD.so
●   Ex. - Mot Xoom:
    ●   hwcomposer.tegra.so
    ●   gralloc.tegra.so
●   Surface Flinger hook:
    ●   /frameworks/native/services/surfaceflinger/DisplayHardware
        –   HWComposer.cpp
        –   Provides fake vsync if none is provided in HW



                                                            21
3.7. Surface Flinger
●   Actual server:
    ●   /frameworks/native/services/surfaceflinger
●   Client side:
    ●   /frameworks/native/libs/gui
●   Client / Server interface:
    ●   ISurfaceComposerClient.cpp
    ●   ISurfaceComposer.cpp
●   This is NOT an aidl'ed service
●   All communication is manually
    marshalled/unmarshalled
                                                     22
3.8. Window Manager
●   Server side:
    ●   /frameworks/base/services/java/com/android/server/wm/
         –   WindowManagerService.java
         –   Session.java
●   Client side:
    ●   /frameworks/base/core/java/android/view/
         –   WindowManager.java
         –   WindowManagerImpl.java
         –   ViewRootImpl.java
●   Interfaces:
    ●   IWindowManager.aidl
    ●   IWindowSession.aidl
●   Parameters (incl. z-order):
    ●   See WindowManager.java

                                                                23
3.9. Walkthrough
●   Activity Manager relies on Activity Thread
●   AT calls on attach() and makeVisible()
●   makeVisible does wm.addView()
●   wm.addView() - this also called by StatusBar to display itself
    ●   Creates a new ViewRootImpl
    ●   Call on its setView()
●   setView() calls on mWindowSession.addToDisplay(...)
●   This results in call to WM's addWindow()
●   ViewRootImpl's performTraversals()
    ●   Calls on relayoutWindow()
    ●   Calls to WM session's relayout()
    ●   Call to WM's relayoutWindow()
    ●   Call to createSurfaceLocked()
    ●   new Surface(...)

                                                                     24
frameworks/base/core/java/android/*/*
LocalActivityManager.java: startActivity()
- moveToState()
  - startActivityNow()
ActivityThread.java: startActivityNow()
- performLaunchActivity()
  - attach() -- gets AM handle and ties to it
- handleResumeActivity()
  - makeVisible()
Activity.java: makeVisible()
  - wm.addView()
WindowManagerGlobal.java: addView()
  - root = new ViewRootImpl()
  - root.setView()
ViewRootImpl.java: setView()
  - mWindowSession.addToDisplay()
IWindowSession.aidl: addToDisplay()
                                                25
frameworks/base/services/java/com/android/server/wm/*
Session.java: addToDisplay()
- mService.addWindow()
WindowManagerService.java: addWindow()
...

frameworks/base/core/java/android/*/*
ViewRootImpl.java: performTraversals()
- relayoutWindow()
  - mWindowSession.relayout()

frameworks/base/services/java/com/android/server/wm/*
Session.java: relayoutWindow()
- mService.relayoutWindow()
WindowManagerService.java: relayoutWindow()
- surface = winAnimator.createSurfaceLocked();
WindowStateAnimator.java: createSurfaceLocked()
- new Surface();

                                                        26
4. OpenGL
●   What's OpenGL?
●   What's in a modern-day GPU?
●   Software layers involved
●   Kernel driver
●   EGL libs
●   Native interface
●   Java interface
●   Software GL implementation

                                   27
4.1. What's OpenGL?
●   It's just an API ... nothing but an API ...
●   Check out Wikipedia
●   Multiple versions out
●   “ES” versions for embedded use
●   Up to ES 3.0
●   Android support up to ES 2.0



                                             28
4.2. What's in a modern-day GPU?
●   A tremendous amount of parallel processing units
●   “SIMD”-like instruction set
●   Video decoding/encoding capabilities
●   ...




                                           29
4.3. Software layers involved
●   Kernel driver
●   GL libraries
●   Native GL API
●   Java GL API




                                30
4.4. Kernel driver




            Y
         AR
      ET
    RI
  OP
PR



                       31
4.5. EGL libs
●   /frameworks/base/native/opengl/libs
●   Entry point: /system/lib/libEGL.so
●
    Looks for /system/lib/egl/egl.cfg
●   /system/lib/egl - Mot Xoom:
    ●   egl.cfg
    ●   libEGL_perfhud.so
    ●   libEGL_tegra.so
    ●   libGLES_android.so
    ●   libGLESv1_CM_perfhud.so
    ●   libGLESv1_CM_tegra.so
    ●   libGLESv2_perfhud.so
    ●   libGLESv2_tegra.so
●
    elg.cfg:
               0 0 tegra



                                                32
4.6. Native interface
●   /frameworks/native/opengl/include
    ●   EGL
    ●   ETC1
    ●   GLES
    ●   GLES2
    ●   KHR




                                        33
4.7. Java interface
●   GL libs required by libandroid_runtime.so
●   /frameworks/base/opengl/java/android/opengl:
    ●   ...




                                         34
4.8. Software GL implementation
●   /frameworks/native/opengl/libagl




                                       35
5. Input Layer
●   Kernel side - “std” Linux input layer:
    ●   /dev/input/*
●   No HAL use
●   Native lib:
    ●   libinput
    ●   /frameworks/base/services/input
●   Input Manager Service:
    ●   /frameworks/base/services/java/com/android/server/input
    ●   Started and directly tied to Window Manager
●   Specific config files (see source.android.com)
●   Soft keyboard:
    ●   /frameworks/base/core/java/android/inputmethodservice
●   Input methods:
    ●   /packages/inputmehods
    ●   http://developer.android.com/guide/topics/text/creating-input-method.html

                                                                                    36
6. Relevant Apps and Services
●   Launcher
●   StatusBar
●   Wallpaper Manager Service
●   Notification Service
●   App Widgets




                                37
6.1. Launcher
●   An app like any other
●   See /packages/app/Launcher2




                                  38
6.2. StatusBar
●   A unique app
●   See /frameworks/base/packages/SystemUI
●   Connects to Status Bar Manager and gives an
    interface it can use to call back into Status Bar
●   Can use setIcon() to display icons on the right
●   Provides a CPU usage add-on that renders
    straight on rest of display using higher z-order


                                           39
6.3. Wallpaper Manager Service
●   See
    /frameworks/base/services/java/com/android/se
    rver/WallpaperManagerService.java




                                       40
6.4. Notification Service
●   Toasts
●   Status bar notifications
●   Gets handle to Status Bar Service at
    instantiation
●   Uses handle to communicate with Status Bar




                                           41
6.5. App Widgets
●   See
    /frameworks/base/services/java/com/android/se
    rver/AppWidgetService.java




                                       42
7. System Startup
●   Kernel
●   Init
●   Boot animation
●   Launcher




                                   43
7.1. Boot animation
●   Started by Surface Flinger
●   “bootanim” binary
●   /frameworks/base/cmds/bootanimation
●   Relies on bootanimation.zip w/ PNGs (nothing but)
●   See
    https://github.com/CyanogenMod/android_vendor_cm/tree/jellybean/pre
    built/common/bootanimatino
●   Must contain a desc.txt:
           <width> <height> <fps>
           p <count> <pause> <path>
           p <count> <pause> <path>


                                                        44
8. References and Pointers
●   “Use the source, Luke”
●   Jim Huang's “Android Graphics”
●   Benjamin Zores' “Linux Magazine / France” articles
●   MIPS article on graphics internals:
     http://developer.mips.com/2012/04/11/learning-about-
     android-graphics-subsystem/
●   Stéphane Marchesin's “Linux Graphics Drivers: an
    Introduction”
     http://source.android.com/tech/input/index.html


                                                45
Thank you ...

karim.yaghmour@opersys.com




                         46

Contenu connexe

Tendances

Android Variants, Hacks, Tricks and Resources
Android Variants, Hacks, Tricks and ResourcesAndroid Variants, Hacks, Tricks and Resources
Android Variants, Hacks, Tricks and ResourcesOpersys inc.
 
Android Platform Debugging and Development
Android Platform Debugging and DevelopmentAndroid Platform Debugging and Development
Android Platform Debugging and DevelopmentKarim Yaghmour
 
Android Internals at Linaro Connect Asia 2013
Android Internals at Linaro Connect Asia 2013Android Internals at Linaro Connect Asia 2013
Android Internals at Linaro Connect Asia 2013Opersys inc.
 
Leveraging Android's Linux Heritage at AnDevCon VI
Leveraging Android's Linux Heritage at AnDevCon VILeveraging Android's Linux Heritage at AnDevCon VI
Leveraging Android's Linux Heritage at AnDevCon VIOpersys inc.
 
Memory Management in Android
Memory Management in AndroidMemory Management in Android
Memory Management in AndroidOpersys inc.
 
Android Platform Debugging and Development
Android Platform Debugging and DevelopmentAndroid Platform Debugging and Development
Android Platform Debugging and DevelopmentOpersys inc.
 
Using and Customizing the Android Framework / part 4 of Embedded Android Work...
Using and Customizing the Android Framework / part 4 of Embedded Android Work...Using and Customizing the Android Framework / part 4 of Embedded Android Work...
Using and Customizing the Android Framework / part 4 of Embedded Android Work...Opersys inc.
 
Android Security, From the Ground Up
Android Security, From the Ground UpAndroid Security, From the Ground Up
Android Security, From the Ground UpOpersys inc.
 
Leveraging Android's Linux Heritage at AnDevCon3
Leveraging Android's Linux Heritage at AnDevCon3Leveraging Android's Linux Heritage at AnDevCon3
Leveraging Android's Linux Heritage at AnDevCon3Opersys inc.
 
Android Jumpstart ESC SV 2012 Part I
Android Jumpstart ESC SV 2012 Part IAndroid Jumpstart ESC SV 2012 Part I
Android Jumpstart ESC SV 2012 Part IOpersys inc.
 
Memory Management in Android
Memory Management in AndroidMemory Management in Android
Memory Management in AndroidOpersys inc.
 
Native Android Userspace part of the Embedded Android Workshop at Linaro Conn...
Native Android Userspace part of the Embedded Android Workshop at Linaro Conn...Native Android Userspace part of the Embedded Android Workshop at Linaro Conn...
Native Android Userspace part of the Embedded Android Workshop at Linaro Conn...Opersys inc.
 
Android Platform Debugging and Development
Android Platform Debugging and DevelopmentAndroid Platform Debugging and Development
Android Platform Debugging and DevelopmentOpersys inc.
 
Leveraging Android's Linux Heritage
Leveraging Android's Linux HeritageLeveraging Android's Linux Heritage
Leveraging Android's Linux HeritageOpersys inc.
 
Embedded Android Workshop at ELC Europe
Embedded Android Workshop at ELC EuropeEmbedded Android Workshop at ELC Europe
Embedded Android Workshop at ELC EuropeOpersys inc.
 
BeagleBoard Workshop ESC Boston 2011
BeagleBoard Workshop ESC Boston 2011BeagleBoard Workshop ESC Boston 2011
BeagleBoard Workshop ESC Boston 2011Opersys inc.
 
Android Hacks, Variants, Tricks and Resources ESC SV 2012
Android Hacks, Variants, Tricks and Resources ESC SV 2012Android Hacks, Variants, Tricks and Resources ESC SV 2012
Android Hacks, Variants, Tricks and Resources ESC SV 2012Opersys inc.
 
Enhancing and modifying_the_core_android_os
Enhancing and modifying_the_core_android_osEnhancing and modifying_the_core_android_os
Enhancing and modifying_the_core_android_osArnav Gupta
 

Tendances (20)

Android Variants, Hacks, Tricks and Resources
Android Variants, Hacks, Tricks and ResourcesAndroid Variants, Hacks, Tricks and Resources
Android Variants, Hacks, Tricks and Resources
 
Android Platform Debugging and Development
Android Platform Debugging and DevelopmentAndroid Platform Debugging and Development
Android Platform Debugging and Development
 
Android Internals at Linaro Connect Asia 2013
Android Internals at Linaro Connect Asia 2013Android Internals at Linaro Connect Asia 2013
Android Internals at Linaro Connect Asia 2013
 
Leveraging Android's Linux Heritage at AnDevCon VI
Leveraging Android's Linux Heritage at AnDevCon VILeveraging Android's Linux Heritage at AnDevCon VI
Leveraging Android's Linux Heritage at AnDevCon VI
 
Memory Management in Android
Memory Management in AndroidMemory Management in Android
Memory Management in Android
 
Android Platform Debugging and Development
Android Platform Debugging and DevelopmentAndroid Platform Debugging and Development
Android Platform Debugging and Development
 
Android Platform Debugging & Development
Android Platform Debugging & Development Android Platform Debugging & Development
Android Platform Debugging & Development
 
Using and Customizing the Android Framework / part 4 of Embedded Android Work...
Using and Customizing the Android Framework / part 4 of Embedded Android Work...Using and Customizing the Android Framework / part 4 of Embedded Android Work...
Using and Customizing the Android Framework / part 4 of Embedded Android Work...
 
Android Security, From the Ground Up
Android Security, From the Ground UpAndroid Security, From the Ground Up
Android Security, From the Ground Up
 
Leveraging Android's Linux Heritage at AnDevCon3
Leveraging Android's Linux Heritage at AnDevCon3Leveraging Android's Linux Heritage at AnDevCon3
Leveraging Android's Linux Heritage at AnDevCon3
 
Android Jumpstart ESC SV 2012 Part I
Android Jumpstart ESC SV 2012 Part IAndroid Jumpstart ESC SV 2012 Part I
Android Jumpstart ESC SV 2012 Part I
 
Memory Management in Android
Memory Management in AndroidMemory Management in Android
Memory Management in Android
 
Native Android Userspace part of the Embedded Android Workshop at Linaro Conn...
Native Android Userspace part of the Embedded Android Workshop at Linaro Conn...Native Android Userspace part of the Embedded Android Workshop at Linaro Conn...
Native Android Userspace part of the Embedded Android Workshop at Linaro Conn...
 
Android Platform Debugging and Development
Android Platform Debugging and DevelopmentAndroid Platform Debugging and Development
Android Platform Debugging and Development
 
Leveraging Android's Linux Heritage
Leveraging Android's Linux HeritageLeveraging Android's Linux Heritage
Leveraging Android's Linux Heritage
 
Embedded Android Workshop at ELC Europe
Embedded Android Workshop at ELC EuropeEmbedded Android Workshop at ELC Europe
Embedded Android Workshop at ELC Europe
 
BeagleBoard Workshop ESC Boston 2011
BeagleBoard Workshop ESC Boston 2011BeagleBoard Workshop ESC Boston 2011
BeagleBoard Workshop ESC Boston 2011
 
Android Hacks, Variants, Tricks and Resources ESC SV 2012
Android Hacks, Variants, Tricks and Resources ESC SV 2012Android Hacks, Variants, Tricks and Resources ESC SV 2012
Android Hacks, Variants, Tricks and Resources ESC SV 2012
 
Enhancing and modifying_the_core_android_os
Enhancing and modifying_the_core_android_osEnhancing and modifying_the_core_android_os
Enhancing and modifying_the_core_android_os
 
Android Internals
Android InternalsAndroid Internals
Android Internals
 

En vedette

Embedded Android Workshop at Embedded World Conference 2013
Embedded Android Workshop at Embedded World Conference 2013Embedded Android Workshop at Embedded World Conference 2013
Embedded Android Workshop at Embedded World Conference 2013Opersys inc.
 
Open, But Not As Usual.
Open, But Not As Usual.Open, But Not As Usual.
Open, But Not As Usual.John Lee
 
0xlab’s Perspectives on Android System Development
0xlab’s Perspectives on Android System Development0xlab’s Perspectives on Android System Development
0xlab’s Perspectives on Android System DevelopmentKan-Ru Chen
 
Android Boot Time Optimization
Android Boot Time OptimizationAndroid Boot Time Optimization
Android Boot Time OptimizationKan-Ru Chen
 
Scheduling in Android
Scheduling in AndroidScheduling in Android
Scheduling in AndroidOpersys inc.
 

En vedette (7)

Embedded Android Workshop at Embedded World Conference 2013
Embedded Android Workshop at Embedded World Conference 2013Embedded Android Workshop at Embedded World Conference 2013
Embedded Android Workshop at Embedded World Conference 2013
 
Open, But Not As Usual.
Open, But Not As Usual.Open, But Not As Usual.
Open, But Not As Usual.
 
0xlab’s Perspectives on Android System Development
0xlab’s Perspectives on Android System Development0xlab’s Perspectives on Android System Development
0xlab’s Perspectives on Android System Development
 
Android Boot Time Optimization
Android Boot Time OptimizationAndroid Boot Time Optimization
Android Boot Time Optimization
 
Implement Checkpointing for Android (ELCE2012)
Implement Checkpointing for Android (ELCE2012)Implement Checkpointing for Android (ELCE2012)
Implement Checkpointing for Android (ELCE2012)
 
Improve Android System Component Performance
Improve Android System Component PerformanceImprove Android System Component Performance
Improve Android System Component Performance
 
Scheduling in Android
Scheduling in AndroidScheduling in Android
Scheduling in Android
 

Similaire à Inside Android's UI / ABS 2013

Android for Embedded Linux Developers
Android for Embedded Linux DevelopersAndroid for Embedded Linux Developers
Android for Embedded Linux DevelopersOpersys inc.
 
Customizing Android's UI
Customizing Android's UICustomizing Android's UI
Customizing Android's UIOpersys inc.
 
Customizing Android's UI
Customizing Android's UICustomizing Android's UI
Customizing Android's UIOpersys inc.
 
Android Platform Debugging and Development
Android Platform Debugging and DevelopmentAndroid Platform Debugging and Development
Android Platform Debugging and DevelopmentOpersys inc.
 
Android Platform Debugging and Development
Android Platform Debugging and DevelopmentAndroid Platform Debugging and Development
Android Platform Debugging and DevelopmentOpersys inc.
 
Customizing Android's UI
Customizing Android's UICustomizing Android's UI
Customizing Android's UIOpersys inc.
 
Android Variants, Hacks, Tricks and Resources presented at AnDevConII
Android Variants, Hacks, Tricks and Resources presented at AnDevConIIAndroid Variants, Hacks, Tricks and Resources presented at AnDevConII
Android Variants, Hacks, Tricks and Resources presented at AnDevConIIOpersys inc.
 
Android Platform Debugging and Development
Android Platform Debugging and DevelopmentAndroid Platform Debugging and Development
Android Platform Debugging and DevelopmentOpersys inc.
 
Leveraging Android's Linux Heritage at AnDevCon IV
Leveraging Android's Linux Heritage at AnDevCon IVLeveraging Android's Linux Heritage at AnDevCon IV
Leveraging Android's Linux Heritage at AnDevCon IVOpersys inc.
 
Android Platform Debugging and Development
Android Platform Debugging and DevelopmentAndroid Platform Debugging and Development
Android Platform Debugging and DevelopmentOpersys inc.
 
Android's Multimedia Framework
Android's Multimedia FrameworkAndroid's Multimedia Framework
Android's Multimedia FrameworkOpersys inc.
 
Android Platform Debugging and Development
Android Platform Debugging and DevelopmentAndroid Platform Debugging and Development
Android Platform Debugging and DevelopmentOpersys inc.
 
Android Platform Debugging and Development
Android Platform Debugging and DevelopmentAndroid Platform Debugging and Development
Android Platform Debugging and DevelopmentOpersys inc.
 
Extending Android's Platform Toolsuite
Extending Android's Platform ToolsuiteExtending Android's Platform Toolsuite
Extending Android's Platform ToolsuiteOpersys inc.
 
Leveraging Android's Linux Heritage at AnDevCon V
Leveraging Android's Linux Heritage at AnDevCon VLeveraging Android's Linux Heritage at AnDevCon V
Leveraging Android's Linux Heritage at AnDevCon VOpersys inc.
 
Unmanned Aerial Vehicles: Exploit Automation with the Metasploit Framework
Unmanned Aerial Vehicles: Exploit Automation with the Metasploit FrameworkUnmanned Aerial Vehicles: Exploit Automation with the Metasploit Framework
Unmanned Aerial Vehicles: Exploit Automation with the Metasploit Frameworkegypt
 
Developing Android Platform Tools
Developing Android Platform ToolsDeveloping Android Platform Tools
Developing Android Platform ToolsOpersys inc.
 
Leveraging Android's Linux Heritage at ELC-E 2011
Leveraging Android's Linux Heritage at ELC-E 2011Leveraging Android's Linux Heritage at ELC-E 2011
Leveraging Android's Linux Heritage at ELC-E 2011Opersys inc.
 

Similaire à Inside Android's UI / ABS 2013 (20)

Android for Embedded Linux Developers
Android for Embedded Linux DevelopersAndroid for Embedded Linux Developers
Android for Embedded Linux Developers
 
Customizing Android's UI
Customizing Android's UICustomizing Android's UI
Customizing Android's UI
 
Customizing Android's UI
Customizing Android's UICustomizing Android's UI
Customizing Android's UI
 
Android Platform Debugging and Development
Android Platform Debugging and DevelopmentAndroid Platform Debugging and Development
Android Platform Debugging and Development
 
Android Platform Debugging and Development
Android Platform Debugging and DevelopmentAndroid Platform Debugging and Development
Android Platform Debugging and Development
 
Customizing Android's UI
Customizing Android's UICustomizing Android's UI
Customizing Android's UI
 
Android Internals
Android InternalsAndroid Internals
Android Internals
 
Android Variants, Hacks, Tricks and Resources presented at AnDevConII
Android Variants, Hacks, Tricks and Resources presented at AnDevConIIAndroid Variants, Hacks, Tricks and Resources presented at AnDevConII
Android Variants, Hacks, Tricks and Resources presented at AnDevConII
 
Android Platform Debugging and Development
Android Platform Debugging and DevelopmentAndroid Platform Debugging and Development
Android Platform Debugging and Development
 
Leveraging Android's Linux Heritage at AnDevCon IV
Leveraging Android's Linux Heritage at AnDevCon IVLeveraging Android's Linux Heritage at AnDevCon IV
Leveraging Android's Linux Heritage at AnDevCon IV
 
Android Platform Debugging and Development
Android Platform Debugging and DevelopmentAndroid Platform Debugging and Development
Android Platform Debugging and Development
 
Android's Multimedia Framework
Android's Multimedia FrameworkAndroid's Multimedia Framework
Android's Multimedia Framework
 
Android Platform Debugging and Development
Android Platform Debugging and DevelopmentAndroid Platform Debugging and Development
Android Platform Debugging and Development
 
Android Platform Debugging and Development
Android Platform Debugging and DevelopmentAndroid Platform Debugging and Development
Android Platform Debugging and Development
 
Android Attacks
Android AttacksAndroid Attacks
Android Attacks
 
Extending Android's Platform Toolsuite
Extending Android's Platform ToolsuiteExtending Android's Platform Toolsuite
Extending Android's Platform Toolsuite
 
Leveraging Android's Linux Heritage at AnDevCon V
Leveraging Android's Linux Heritage at AnDevCon VLeveraging Android's Linux Heritage at AnDevCon V
Leveraging Android's Linux Heritage at AnDevCon V
 
Unmanned Aerial Vehicles: Exploit Automation with the Metasploit Framework
Unmanned Aerial Vehicles: Exploit Automation with the Metasploit FrameworkUnmanned Aerial Vehicles: Exploit Automation with the Metasploit Framework
Unmanned Aerial Vehicles: Exploit Automation with the Metasploit Framework
 
Developing Android Platform Tools
Developing Android Platform ToolsDeveloping Android Platform Tools
Developing Android Platform Tools
 
Leveraging Android's Linux Heritage at ELC-E 2011
Leveraging Android's Linux Heritage at ELC-E 2011Leveraging Android's Linux Heritage at ELC-E 2011
Leveraging Android's Linux Heritage at ELC-E 2011
 

Plus de Opersys inc.

Android Automotive
Android AutomotiveAndroid Automotive
Android AutomotiveOpersys inc.
 
Android 10 Internals Update
Android 10 Internals UpdateAndroid 10 Internals Update
Android 10 Internals UpdateOpersys inc.
 
Android Security Internals
Android Security InternalsAndroid Security Internals
Android Security InternalsOpersys inc.
 
Embedded Android Workshop with Pie
Embedded Android Workshop with PieEmbedded Android Workshop with Pie
Embedded Android Workshop with PieOpersys inc.
 
Android's HIDL: Treble in the HAL
Android's HIDL: Treble in the HALAndroid's HIDL: Treble in the HAL
Android's HIDL: Treble in the HALOpersys inc.
 
Android Treble: Blessing or Trouble?
Android Treble: Blessing or Trouble?Android Treble: Blessing or Trouble?
Android Treble: Blessing or Trouble?Opersys inc.
 
Embedded Android Workshop with Oreo
Embedded Android Workshop with OreoEmbedded Android Workshop with Oreo
Embedded Android Workshop with OreoOpersys inc.
 
Scheduling in Android
Scheduling in AndroidScheduling in Android
Scheduling in AndroidOpersys inc.
 
Android Things Internals
Android Things InternalsAndroid Things Internals
Android Things InternalsOpersys inc.
 
Embedded Android Workshop with Nougat
Embedded Android Workshop with NougatEmbedded Android Workshop with Nougat
Embedded Android Workshop with NougatOpersys inc.
 
Embedded Android Workshop with Nougat
Embedded Android Workshop with NougatEmbedded Android Workshop with Nougat
Embedded Android Workshop with NougatOpersys inc.
 
Android Things: Android for IoT
Android Things: Android for IoTAndroid Things: Android for IoT
Android Things: Android for IoTOpersys inc.
 
Android Things Internals
Android Things InternalsAndroid Things Internals
Android Things InternalsOpersys inc.
 
Brillo / Weave Internals
Brillo / Weave InternalsBrillo / Weave Internals
Brillo / Weave InternalsOpersys inc.
 
Embedded Android Workshop with Nougat
Embedded Android Workshop with NougatEmbedded Android Workshop with Nougat
Embedded Android Workshop with NougatOpersys inc.
 
Brillo / Weave Internals
Brillo / Weave InternalsBrillo / Weave Internals
Brillo / Weave InternalsOpersys inc.
 
Brillo/Weave Internals
Brillo/Weave InternalsBrillo/Weave Internals
Brillo/Weave InternalsOpersys inc.
 
Embedded Android Workshop with Marshmallow
Embedded Android Workshop with MarshmallowEmbedded Android Workshop with Marshmallow
Embedded Android Workshop with MarshmallowOpersys inc.
 
Embedded Android Workshop with Marshmallow
Embedded Android Workshop with MarshmallowEmbedded Android Workshop with Marshmallow
Embedded Android Workshop with MarshmallowOpersys inc.
 

Plus de Opersys inc. (20)

Android Automotive
Android AutomotiveAndroid Automotive
Android Automotive
 
Android 10 Internals Update
Android 10 Internals UpdateAndroid 10 Internals Update
Android 10 Internals Update
 
Android Security Internals
Android Security InternalsAndroid Security Internals
Android Security Internals
 
Embedded Android Workshop with Pie
Embedded Android Workshop with PieEmbedded Android Workshop with Pie
Embedded Android Workshop with Pie
 
Android's HIDL: Treble in the HAL
Android's HIDL: Treble in the HALAndroid's HIDL: Treble in the HAL
Android's HIDL: Treble in the HAL
 
Android Treble: Blessing or Trouble?
Android Treble: Blessing or Trouble?Android Treble: Blessing or Trouble?
Android Treble: Blessing or Trouble?
 
Embedded Android Workshop with Oreo
Embedded Android Workshop with OreoEmbedded Android Workshop with Oreo
Embedded Android Workshop with Oreo
 
Scheduling in Android
Scheduling in AndroidScheduling in Android
Scheduling in Android
 
Android Things Internals
Android Things InternalsAndroid Things Internals
Android Things Internals
 
Embedded Android Workshop with Nougat
Embedded Android Workshop with NougatEmbedded Android Workshop with Nougat
Embedded Android Workshop with Nougat
 
Embedded Android Workshop with Nougat
Embedded Android Workshop with NougatEmbedded Android Workshop with Nougat
Embedded Android Workshop with Nougat
 
Android Things: Android for IoT
Android Things: Android for IoTAndroid Things: Android for IoT
Android Things: Android for IoT
 
Android Things Internals
Android Things InternalsAndroid Things Internals
Android Things Internals
 
Brillo / Weave Internals
Brillo / Weave InternalsBrillo / Weave Internals
Brillo / Weave Internals
 
Embedded Android Workshop with Nougat
Embedded Android Workshop with NougatEmbedded Android Workshop with Nougat
Embedded Android Workshop with Nougat
 
Brillo / Weave Internals
Brillo / Weave InternalsBrillo / Weave Internals
Brillo / Weave Internals
 
Project Ara
Project AraProject Ara
Project Ara
 
Brillo/Weave Internals
Brillo/Weave InternalsBrillo/Weave Internals
Brillo/Weave Internals
 
Embedded Android Workshop with Marshmallow
Embedded Android Workshop with MarshmallowEmbedded Android Workshop with Marshmallow
Embedded Android Workshop with Marshmallow
 
Embedded Android Workshop with Marshmallow
Embedded Android Workshop with MarshmallowEmbedded Android Workshop with Marshmallow
Embedded Android Workshop with Marshmallow
 

Dernier

Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Igalia
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure servicePooja Nehwal
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Servicegiselly40
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitecturePixlogix Infotech
 
Maximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxMaximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxOnBoard
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Drew Madelung
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfEnterprise Knowledge
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesSinan KOZAK
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptxHampshireHUG
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking MenDelhi Call girls
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024The Digital Insurer
 
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Alan Dix
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsEnterprise Knowledge
 
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024BookNet Canada
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountPuma Security, LLC
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...shyamraj55
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsMaria Levchenko
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationRidwan Fadjar
 

Dernier (20)

Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC Architecture
 
Maximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxMaximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptx
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen Frames
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 Presentation
 

Inside Android's UI / ABS 2013

  • 1. Inside Android's UI Android Builders Summit 2013 Karim Yaghmour @karimyaghmour karim.yaghmour@opersys.com 1
  • 2. These slides are made available to you under a Creative Commons Share- Delivered and/or customized by Alike 3.0 license. The full terms of this license are here: https://creativecommons.org/licenses/by-sa/3.0/ Attribution requirements and misc., PLEASE READ: ● This slide must remain as-is in this specific location (slide #2), everything else you are free to change; including the logo :-) ● Use of figures in other documents must feature the below “Originals at” URL immediately under that figure and the below copyright notice where appropriate. ● You are free to fill in the “Delivered and/or customized by” space on the right as you see fit. ● You are FORBIDEN from using the default “About” slide as-is or any of its contents. ● You are FORBIDEN from using any content provided by 3rd parties without the EXPLICIT consent from those parties. (C) Copyright 2013, Opersys inc. These slides created by: Karim Yaghmour Originals at: www.opersys.com/community/docs 2
  • 3. About ● Author of: ● Introduced Linux Trace Toolkit in 1999 ● Originated Adeos and relayfs (kernel/relay.c) ● Training, Custom Dev, Consulting, ... 3
  • 4. Agenda ● Android's UI, what's that? ● Architecture Basics ● Display Core ● OpenGL ● Input Layer ● Relevant Apps and Services ● System Startup ● References and Pointers 4
  • 5. 1. Android's UI, what's that? ●SoC / GPU ??? ●Touch input ●LCD ●Keyboard 5
  • 6. 1.1. What I'm NOT covering ● Media layer ● StageFright ● Video playback ● Camera ● DRM ● Etc. 6
  • 7. 2. Architecture Basics ● Hardware used to run Android ● AOSP ● Binder ● System Services ● HAL 7
  • 8. 8
  • 9. 9
  • 10. 10
  • 11. 11
  • 12. 12
  • 13. /frameworks/base/core/... /frameworks/base/services/java/... AOSP-provided ASL /frameworks/base/services/jni/ /hardware/libhardware/ /device/[MANUF.]/[DEVICE] Manuf.-provided /sdk/emulator/ Manuf. license Kernel or module Manuf.-provided GPL-license 13
  • 14. 3. Display Core ● Display Hardware ● Classic Linux display stack ● Display stack in Android ● Kernel driver ● HAL definition ● HAL module ● Surface Flinger ● Window Manager ● Walkthrough 14
  • 15. 3.1. Display Hardware MMU IOMMU 15
  • 16. 3.2. Classic Linux display stack 16
  • 17. 3.3. Display stack in Android 17
  • 18. 18
  • 19. 3.4. Kernel driver ● Video memory management ● Mode setting ● Checking of parameters ● Motorola Xoom: ● /dev/nvhdcp1 ● /dev/nvhost-ctrl ● /dev/nvhost-display ● /dev/nvhost-dsi ● /dev/nvhost-gr2d ● /dev/nvhost-gr3d ● /dev/nvhost-isp ● /dev/nvhost-mpe ● /dev/nvhost-vi ● /dev/nvmap ● /dev/tegra-crypto ● /dev/tegra_avp ● /dev/tegra_camera ● /dev/tegra_fuse ● /dev/tegra_rpc ● /dev/tegra_sema ● ... whatever hides in hwcomposer HAL module 19
  • 20. 3.5. HAL Definition ● /hardware/libhardware/include/hardware/hwcomposer.h ● struct hwc_procs: ● invalidate() ● vsync() ● struct hwc_composer_device: ● prepare() ● set() ● dump() ● registerProcs() ● query() ● *() 20
  • 21. 3.6. HAL module ● Skeleton /hardware/libhardware/modules/hwcomposer.cpp ● /system/lib/hw/hwcomposer.BOARD.so ● /system/lib/hw/gralloc.BOARD.so ● Ex. - Mot Xoom: ● hwcomposer.tegra.so ● gralloc.tegra.so ● Surface Flinger hook: ● /frameworks/native/services/surfaceflinger/DisplayHardware – HWComposer.cpp – Provides fake vsync if none is provided in HW 21
  • 22. 3.7. Surface Flinger ● Actual server: ● /frameworks/native/services/surfaceflinger ● Client side: ● /frameworks/native/libs/gui ● Client / Server interface: ● ISurfaceComposerClient.cpp ● ISurfaceComposer.cpp ● This is NOT an aidl'ed service ● All communication is manually marshalled/unmarshalled 22
  • 23. 3.8. Window Manager ● Server side: ● /frameworks/base/services/java/com/android/server/wm/ – WindowManagerService.java – Session.java ● Client side: ● /frameworks/base/core/java/android/view/ – WindowManager.java – WindowManagerImpl.java – ViewRootImpl.java ● Interfaces: ● IWindowManager.aidl ● IWindowSession.aidl ● Parameters (incl. z-order): ● See WindowManager.java 23
  • 24. 3.9. Walkthrough ● Activity Manager relies on Activity Thread ● AT calls on attach() and makeVisible() ● makeVisible does wm.addView() ● wm.addView() - this also called by StatusBar to display itself ● Creates a new ViewRootImpl ● Call on its setView() ● setView() calls on mWindowSession.addToDisplay(...) ● This results in call to WM's addWindow() ● ViewRootImpl's performTraversals() ● Calls on relayoutWindow() ● Calls to WM session's relayout() ● Call to WM's relayoutWindow() ● Call to createSurfaceLocked() ● new Surface(...) 24
  • 25. frameworks/base/core/java/android/*/* LocalActivityManager.java: startActivity() - moveToState() - startActivityNow() ActivityThread.java: startActivityNow() - performLaunchActivity() - attach() -- gets AM handle and ties to it - handleResumeActivity() - makeVisible() Activity.java: makeVisible() - wm.addView() WindowManagerGlobal.java: addView() - root = new ViewRootImpl() - root.setView() ViewRootImpl.java: setView() - mWindowSession.addToDisplay() IWindowSession.aidl: addToDisplay() 25
  • 26. frameworks/base/services/java/com/android/server/wm/* Session.java: addToDisplay() - mService.addWindow() WindowManagerService.java: addWindow() ... frameworks/base/core/java/android/*/* ViewRootImpl.java: performTraversals() - relayoutWindow() - mWindowSession.relayout() frameworks/base/services/java/com/android/server/wm/* Session.java: relayoutWindow() - mService.relayoutWindow() WindowManagerService.java: relayoutWindow() - surface = winAnimator.createSurfaceLocked(); WindowStateAnimator.java: createSurfaceLocked() - new Surface(); 26
  • 27. 4. OpenGL ● What's OpenGL? ● What's in a modern-day GPU? ● Software layers involved ● Kernel driver ● EGL libs ● Native interface ● Java interface ● Software GL implementation 27
  • 28. 4.1. What's OpenGL? ● It's just an API ... nothing but an API ... ● Check out Wikipedia ● Multiple versions out ● “ES” versions for embedded use ● Up to ES 3.0 ● Android support up to ES 2.0 28
  • 29. 4.2. What's in a modern-day GPU? ● A tremendous amount of parallel processing units ● “SIMD”-like instruction set ● Video decoding/encoding capabilities ● ... 29
  • 30. 4.3. Software layers involved ● Kernel driver ● GL libraries ● Native GL API ● Java GL API 30
  • 31. 4.4. Kernel driver Y AR ET RI OP PR 31
  • 32. 4.5. EGL libs ● /frameworks/base/native/opengl/libs ● Entry point: /system/lib/libEGL.so ● Looks for /system/lib/egl/egl.cfg ● /system/lib/egl - Mot Xoom: ● egl.cfg ● libEGL_perfhud.so ● libEGL_tegra.so ● libGLES_android.so ● libGLESv1_CM_perfhud.so ● libGLESv1_CM_tegra.so ● libGLESv2_perfhud.so ● libGLESv2_tegra.so ● elg.cfg: 0 0 tegra 32
  • 33. 4.6. Native interface ● /frameworks/native/opengl/include ● EGL ● ETC1 ● GLES ● GLES2 ● KHR 33
  • 34. 4.7. Java interface ● GL libs required by libandroid_runtime.so ● /frameworks/base/opengl/java/android/opengl: ● ... 34
  • 35. 4.8. Software GL implementation ● /frameworks/native/opengl/libagl 35
  • 36. 5. Input Layer ● Kernel side - “std” Linux input layer: ● /dev/input/* ● No HAL use ● Native lib: ● libinput ● /frameworks/base/services/input ● Input Manager Service: ● /frameworks/base/services/java/com/android/server/input ● Started and directly tied to Window Manager ● Specific config files (see source.android.com) ● Soft keyboard: ● /frameworks/base/core/java/android/inputmethodservice ● Input methods: ● /packages/inputmehods ● http://developer.android.com/guide/topics/text/creating-input-method.html 36
  • 37. 6. Relevant Apps and Services ● Launcher ● StatusBar ● Wallpaper Manager Service ● Notification Service ● App Widgets 37
  • 38. 6.1. Launcher ● An app like any other ● See /packages/app/Launcher2 38
  • 39. 6.2. StatusBar ● A unique app ● See /frameworks/base/packages/SystemUI ● Connects to Status Bar Manager and gives an interface it can use to call back into Status Bar ● Can use setIcon() to display icons on the right ● Provides a CPU usage add-on that renders straight on rest of display using higher z-order 39
  • 40. 6.3. Wallpaper Manager Service ● See /frameworks/base/services/java/com/android/se rver/WallpaperManagerService.java 40
  • 41. 6.4. Notification Service ● Toasts ● Status bar notifications ● Gets handle to Status Bar Service at instantiation ● Uses handle to communicate with Status Bar 41
  • 42. 6.5. App Widgets ● See /frameworks/base/services/java/com/android/se rver/AppWidgetService.java 42
  • 43. 7. System Startup ● Kernel ● Init ● Boot animation ● Launcher 43
  • 44. 7.1. Boot animation ● Started by Surface Flinger ● “bootanim” binary ● /frameworks/base/cmds/bootanimation ● Relies on bootanimation.zip w/ PNGs (nothing but) ● See https://github.com/CyanogenMod/android_vendor_cm/tree/jellybean/pre built/common/bootanimatino ● Must contain a desc.txt: <width> <height> <fps> p <count> <pause> <path> p <count> <pause> <path> 44
  • 45. 8. References and Pointers ● “Use the source, Luke” ● Jim Huang's “Android Graphics” ● Benjamin Zores' “Linux Magazine / France” articles ● MIPS article on graphics internals: http://developer.mips.com/2012/04/11/learning-about- android-graphics-subsystem/ ● Stéphane Marchesin's “Linux Graphics Drivers: an Introduction” http://source.android.com/tech/input/index.html 45