SlideShare a Scribd company logo
1 of 37
Download to read offline
Outline
               Building Blocks
              Under the Hood
                     Get Dirty
                        Q&A




Introduction to Android Window System

                     Chia-I Wu
                   olv@0xlab.org



                     May 15, 2009




      Chia-I Wu olv@0xlab.org    Introduction to Android Window System
Outline
                       Building Blocks
                      Under the Hood
                             Get Dirty
                                Q&A




Building Blocks
   Overview
   Interested Components

Under the Hood
   Random Topics

Get Dirty
   Development
   Code

Q&A



              Chia-I Wu olv@0xlab.org    Introduction to Android Window System
Outline
                          Building Blocks
                                            Overview
                         Under the Hood
                                            Interested Components
                                Get Dirty
                                   Q&A


Outline

   Building Blocks
      Overview
      Interested Components

   Under the Hood
      Random Topics

   Get Dirty
      Development
      Code

   Q&A


                 Chia-I Wu olv@0xlab.org    Introduction to Android Window System
Outline
                       Building Blocks
                                         Overview
                      Under the Hood
                                         Interested Components
                             Get Dirty
                                Q&A


System Architecture




              Chia-I Wu olv@0xlab.org    Introduction to Android Window System
Outline
                       Building Blocks
                                         Overview
                      Under the Hood
                                         Interested Components
                             Get Dirty
                                Q&A


System Architecture




              Chia-I Wu olv@0xlab.org    Introduction to Android Window System
Outline
                       Building Blocks
                                         Overview
                      Under the Hood
                                         Interested Components
                             Get Dirty
                                Q&A


System Architecture




              Chia-I Wu olv@0xlab.org    Introduction to Android Window System
Outline
                           Building Blocks
                                             Overview
                          Under the Hood
                                             Interested Components
                                 Get Dirty
                                    Q&A


Building Blocks



   There are more, but we focus on
       SurfaceManager
       WindowManager
       ActivityManager




                  Chia-I Wu olv@0xlab.org    Introduction to Android Window System
Outline
                          Building Blocks
                                            Overview
                         Under the Hood
                                            Interested Components
                                Get Dirty
                                   Q&A


SurfaceManager




      frameworks/base/libs/surfaceflinger/
      a.k.a SurfaceFlinger
      Allocate surfaces. Backed by ashmem/pmem/?
      Composite surfaces




                 Chia-I Wu olv@0xlab.org    Introduction to Android Window System
Outline
                         Building Blocks
                                           Overview
                        Under the Hood
                                           Interested Components
                               Get Dirty
                                  Q&A


WindowManager


     frameworks/base/services/java/
     com/android/server/WindowManagerService.java
     About 9000 SLOC in one file. Poorly documented, bad
     namings, ...
     (Ask SurfaceManager to) create/layout surfaces on behalf of
     the clients
     Dispatch input events to clients
     Transition animation
     WindowManagerPolicy


                Chia-I Wu olv@0xlab.org    Introduction to Android Window System
Outline
                          Building Blocks
                                            Overview
                         Under the Hood
                                            Interested Components
                                Get Dirty
                                   Q&A


ActivityManager



      frameworks/base/services/java/
      com/android/server/am/
      Manage lifecycles of activities
      Manage stacking of activities
      Dispatch intents
      Spawn processes




                 Chia-I Wu olv@0xlab.org    Introduction to Android Window System
Outline
                          Building Blocks
                                            Overview
                         Under the Hood
                                            Interested Components
                                Get Dirty
                                   Q&A


Confusions



      An activity has one or more windows (e.g. dialogs)
      A window has one or more surfaces (e.g. surface views)
      However, in window manager, a window is called a session
      A surface is called a window
      And an activity becomes roughly a token




                 Chia-I Wu olv@0xlab.org    Introduction to Android Window System
Outline
                          Building Blocks
                                            Overview
                         Under the Hood
                                            Interested Components
                                Get Dirty
                                   Q&A


Special Keys




      HOME key
      BACK key




                 Chia-I Wu olv@0xlab.org    Introduction to Android Window System
Outline
                          Building Blocks
                         Under the Hood     Random Topics
                                Get Dirty
                                   Q&A


Outline

   Building Blocks
      Overview
      Interested Components

   Under the Hood
      Random Topics

   Get Dirty
      Development
      Code

   Q&A


                 Chia-I Wu olv@0xlab.org    Introduction to Android Window System
Outline
                          Building Blocks
                         Under the Hood     Random Topics
                                Get Dirty
                                   Q&A


Process View




      SurfaceManager, WindowManager, and SurfaceManager are
      threads of a single process (system server)
      Every application is usually a process of itself




                 Chia-I Wu olv@0xlab.org    Introduction to Android Window System
Outline
                             Building Blocks
                            Under the Hood     Random Topics
                                   Get Dirty
                                      Q&A


Zygote




         Is a process started on system initialization
         Preloads java classes and resources
         Forks system server
         Listens silently on /dev/socket/zygote




                    Chia-I Wu olv@0xlab.org    Introduction to Android Window System
Outline
                             Building Blocks
                            Under the Hood     Random Topics
                                   Get Dirty
                                      Q&A


Binder




         Early in the lifetime of an application process, thread(s) are
         created and blocked on /dev/binder
         Binder is used mainly for RPC
         Fragile




                    Chia-I Wu olv@0xlab.org    Introduction to Android Window System
Outline
                          Building Blocks
                                            Development
                         Under the Hood
                                            Code
                                Get Dirty
                                   Q&A


Outline

   Building Blocks
      Overview
      Interested Components

   Under the Hood
      Random Topics

   Get Dirty
      Development
      Code

   Q&A


                 Chia-I Wu olv@0xlab.org    Introduction to Android Window System
Outline
                         Building Blocks
                                           Development
                        Under the Hood
                                           Code
                               Get Dirty
                                  Q&A


Build System




      build/core/core/build-system.html
      .   build/envsetup.sh
      showcommands
      export ANDROID JAVA HOME if non-standard




                Chia-I Wu olv@0xlab.org    Introduction to Android Window System
Outline
                             Building Blocks
                                               Development
                            Under the Hood
                                               Code
                                   Get Dirty
                                      Q&A


adb



      ADBHOST for transport over TCP/IP
      kill-server
      remount
      pull/push
      logcat
      shell




                    Chia-I Wu olv@0xlab.org    Introduction to Android Window System
Outline
                           Building Blocks
                                             Development
                          Under the Hood
                                             Code
                                 Get Dirty
                                    Q&A


hierarchyviewer




       Display view hierarchy
       Display view
       Invalidate/Relayout




                  Chia-I Wu olv@0xlab.org    Introduction to Android Window System
Outline
                         Building Blocks
                                           Development
                        Under the Hood
                                           Code
                               Get Dirty
                                  Q&A


Graphics: Memory Management




     SurfaceFlinger has a SurfaceHeapManager
     Every client has a MemoryDealer, as returned by
     SurfaceHeapManager
     Every surface of a client also has dealer(s), from client or GPU




                Chia-I Wu olv@0xlab.org    Introduction to Android Window System
Outline
                          Building Blocks
                                            Development
                         Under the Hood
                                            Code
                                Get Dirty
                                   Q&A


Graphics: Memory Management cont.




      A dealer consists of a heap and an allocator
      A heap represents a sharable big chunk of memory
      An allocator is an algorithm
      Small chunks of memory from the heap are returned




                 Chia-I Wu olv@0xlab.org    Introduction to Android Window System
Outline
                          Building Blocks
                                            Development
                         Under the Hood
                                            Code
                                Get Dirty
                                   Q&A


Graphics: Memory Management cont.


  Real flow
      A client asks for a new surface, createSurface




                 Chia-I Wu olv@0xlab.org    Introduction to Android Window System
Outline
                          Building Blocks
                                            Development
                         Under the Hood
                                            Code
                                Get Dirty
                                   Q&A


Graphics: Memory Management cont.


  Real flow
      A client asks for a new surface, createSurface
      createSurface calls createNormalSurfaceLocked




                 Chia-I Wu olv@0xlab.org    Introduction to Android Window System
Outline
                          Building Blocks
                                            Development
                         Under the Hood
                                            Code
                                Get Dirty
                                   Q&A


Graphics: Memory Management cont.


  Real flow
      A client asks for a new surface, createSurface
      createSurface calls createNormalSurfaceLocked
      A layer is created and setBuffers is called to allocate buffers




                 Chia-I Wu olv@0xlab.org    Introduction to Android Window System
Outline
                          Building Blocks
                                            Development
                         Under the Hood
                                            Code
                                Get Dirty
                                   Q&A


Graphics: Memory Management cont.


  Real flow
      A client asks for a new surface, createSurface
      createSurface calls createNormalSurfaceLocked
      A layer is created and setBuffers is called to allocate buffers
      Two dealers are created from client, one for front buffer and
      one for back buffer




                 Chia-I Wu olv@0xlab.org    Introduction to Android Window System
Outline
                          Building Blocks
                                            Development
                         Under the Hood
                                            Code
                                Get Dirty
                                   Q&A


Graphics: Memory Management cont.


  Real flow
      A client asks for a new surface, createSurface
      createSurface calls createNormalSurfaceLocked
      A layer is created and setBuffers is called to allocate buffers
      Two dealers are created from client, one for front buffer and
      one for back buffer
      Two LayerBitmaps are created, initialized with the two dealers




                 Chia-I Wu olv@0xlab.org    Introduction to Android Window System
Outline
                          Building Blocks
                                            Development
                         Under the Hood
                                            Code
                                Get Dirty
                                   Q&A


Graphics: Memory Management cont.


  Real flow
      A client asks for a new surface, createSurface
      createSurface calls createNormalSurfaceLocked
      A layer is created and setBuffers is called to allocate buffers
      Two dealers are created from client, one for front buffer and
      one for back buffer
      Two LayerBitmaps are created, initialized with the two dealers
      Heaps of dealers along with info about the layer are returned



                 Chia-I Wu olv@0xlab.org    Introduction to Android Window System
Outline
                         Building Blocks
                                           Development
                        Under the Hood
                                           Code
                               Get Dirty
                                  Q&A


Hello World




      http://people.debian.org.tw/˜olv/surfaceflinger/demo.tar.gz




                Chia-I Wu olv@0xlab.org    Introduction to Android Window System
Outline
                        Building Blocks
                                          Development
                       Under the Hood
                                          Code
                              Get Dirty
                                 Q&A


Many Buffers




     Surface is double buffered
     EGLDisplaySurface is double buffered
     Same technique; Different code pathes, different purposes




               Chia-I Wu olv@0xlab.org    Introduction to Android Window System
Outline
                         Building Blocks
                                           Development
                        Under the Hood
                                           Code
                               Get Dirty
                                  Q&A


Double Buffering




      Sofware v.s. Hardware
      Memory copy
      Page flipping




                Chia-I Wu olv@0xlab.org    Introduction to Android Window System
Outline
                           Building Blocks
                                             Development
                          Under the Hood
                                             Code
                                 Get Dirty
                                    Q&A


Dirty Region




      Associate buffers with dirty regions
      Copy back




                  Chia-I Wu olv@0xlab.org    Introduction to Android Window System
Outline
                   Building Blocks
                                     Development
                  Under the Hood
                                     Code
                         Get Dirty
                            Q&A


Frame 0




          Chia-I Wu olv@0xlab.org    Introduction to Android Window System
Outline
                   Building Blocks
                                     Development
                  Under the Hood
                                     Code
                         Get Dirty
                            Q&A


Frame 1




          Chia-I Wu olv@0xlab.org    Introduction to Android Window System
Outline
                   Building Blocks
                                     Development
                  Under the Hood
                                     Code
                         Get Dirty
                            Q&A


Frame 2




          Chia-I Wu olv@0xlab.org    Introduction to Android Window System
Outline
                          Building Blocks
                         Under the Hood
                                Get Dirty
                                   Q&A


Outline

   Building Blocks
      Overview
      Interested Components

   Under the Hood
      Random Topics

   Get Dirty
      Development
      Code

   Q&A


                 Chia-I Wu olv@0xlab.org    Introduction to Android Window System
Outline
                            Building Blocks
                           Under the Hood
                                  Get Dirty
                                     Q&A


Q&A




      Questions?




                   Chia-I Wu olv@0xlab.org    Introduction to Android Window System

More Related Content

What's hot

Booting Android: bootloaders, fastboot and boot images
Booting Android: bootloaders, fastboot and boot imagesBooting Android: bootloaders, fastboot and boot images
Booting Android: bootloaders, fastboot and boot imagesChris Simmonds
 
Learning AOSP - Android Booting Process
Learning AOSP - Android Booting ProcessLearning AOSP - Android Booting Process
Learning AOSP - Android Booting ProcessNanik Tolaram
 
Android Binder IPC for Linux
Android Binder IPC for LinuxAndroid Binder IPC for Linux
Android Binder IPC for LinuxYu-Hsin Hung
 
Android Boot Time Optimization
Android Boot Time OptimizationAndroid Boot Time Optimization
Android Boot Time OptimizationKan-Ru Chen
 
Q4.11: Porting Android to new Platforms
Q4.11: Porting Android to new PlatformsQ4.11: Porting Android to new Platforms
Q4.11: Porting Android to new PlatformsLinaro
 
Android Booting Sequence
Android Booting SequenceAndroid Booting Sequence
Android Booting SequenceJayanta Ghoshal
 
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 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.
 
Android Storage - Vold
Android Storage - VoldAndroid Storage - Vold
Android Storage - VoldWilliam Lee
 
Learning AOSP - Android Linux Device Driver
Learning AOSP - Android Linux Device DriverLearning AOSP - Android Linux Device Driver
Learning AOSP - Android Linux Device DriverNanik Tolaram
 

What's hot (20)

Low Level View of Android System Architecture
Low Level View of Android System ArchitectureLow Level View of Android System Architecture
Low Level View of Android System Architecture
 
Android Things : Building Embedded Devices
Android Things : Building Embedded DevicesAndroid Things : Building Embedded Devices
Android Things : Building Embedded Devices
 
Booting Android: bootloaders, fastboot and boot images
Booting Android: bootloaders, fastboot and boot imagesBooting Android: bootloaders, fastboot and boot images
Booting Android: bootloaders, fastboot and boot images
 
Android Binder: Deep Dive
Android Binder: Deep DiveAndroid Binder: Deep Dive
Android Binder: Deep Dive
 
Learning AOSP - Android Booting Process
Learning AOSP - Android Booting ProcessLearning AOSP - Android Booting Process
Learning AOSP - Android Booting Process
 
Applied Computer Science Concepts in Android
Applied Computer Science Concepts in AndroidApplied Computer Science Concepts in Android
Applied Computer Science Concepts in Android
 
Android IPC Mechanism
Android IPC MechanismAndroid IPC Mechanism
Android IPC Mechanism
 
Embedded Android : System Development - Part II (HAL)
Embedded Android : System Development - Part II (HAL)Embedded Android : System Development - Part II (HAL)
Embedded Android : System Development - Part II (HAL)
 
Android Binder IPC for Linux
Android Binder IPC for LinuxAndroid Binder IPC for Linux
Android Binder IPC for Linux
 
Android Boot Time Optimization
Android Boot Time OptimizationAndroid Boot Time Optimization
Android Boot Time Optimization
 
Q4.11: Porting Android to new Platforms
Q4.11: Porting Android to new PlatformsQ4.11: Porting Android to new Platforms
Q4.11: Porting Android to new Platforms
 
Android Booting Sequence
Android Booting SequenceAndroid Booting Sequence
Android Booting Sequence
 
Embedded Android : System Development - Part IV
Embedded Android : System Development - Part IVEmbedded Android : System Development - Part IV
Embedded Android : System Development - Part IV
 
Android Internals
Android InternalsAndroid Internals
Android Internals
 
Embedded Android : System Development - Part III (Audio / Video HAL)
Embedded Android : System Development - Part III (Audio / Video HAL)Embedded Android : System Development - Part III (Audio / Video HAL)
Embedded Android : System Development - Part III (Audio / Video HAL)
 
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 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
 
Android presentation
Android presentationAndroid presentation
Android presentation
 
Android Storage - Vold
Android Storage - VoldAndroid Storage - Vold
Android Storage - Vold
 
Learning AOSP - Android Linux Device Driver
Learning AOSP - Android Linux Device DriverLearning AOSP - Android Linux Device Driver
Learning AOSP - Android Linux Device Driver
 

Similar to Introduction to Android Window System

Develop Community-based Android Distribution and Upstreaming Experience
Develop Community-based Android Distribution and Upstreaming Experience Develop Community-based Android Distribution and Upstreaming Experience
Develop Community-based Android Distribution and Upstreaming Experience National Cheng Kung University
 
Build to Hack, Hack to Build
Build to Hack, Hack to BuildBuild to Hack, Hack to Build
Build to Hack, Hack to BuildCloudVillage
 
Architecting modern Android apps
Architecting modern Android appsArchitecting modern Android apps
Architecting modern Android appsGrigori Hlopkov
 
[Wroclaw #7] Why So Serial?
[Wroclaw #7] Why So Serial?[Wroclaw #7] Why So Serial?
[Wroclaw #7] Why So Serial?OWASP
 
Java course-in-mumbai
Java course-in-mumbaiJava course-in-mumbai
Java course-in-mumbaivibrantuser
 
Neal Ford Emergent Design And Evolutionary Architecture
Neal Ford Emergent Design And Evolutionary ArchitectureNeal Ford Emergent Design And Evolutionary Architecture
Neal Ford Emergent Design And Evolutionary ArchitectureThoughtWorks Studios
 
Neal Ford Emergent Design And Evolutionary Architecture
Neal Ford Emergent Design And Evolutionary ArchitectureNeal Ford Emergent Design And Evolutionary Architecture
Neal Ford Emergent Design And Evolutionary ArchitectureThoughtworks
 
DefCon 2012 - Finding Firmware Vulnerabilities
DefCon 2012 - Finding Firmware VulnerabilitiesDefCon 2012 - Finding Firmware Vulnerabilities
DefCon 2012 - Finding Firmware VulnerabilitiesMichael Smith
 
DefCon 2012 - Firmware Vulnerability Hunting with FRAK
DefCon 2012 - Firmware Vulnerability Hunting with FRAKDefCon 2012 - Firmware Vulnerability Hunting with FRAK
DefCon 2012 - Firmware Vulnerability Hunting with FRAKMichael Smith
 
Mocking vtcc3 - en
Mocking   vtcc3 - enMocking   vtcc3 - en
Mocking vtcc3 - envgrondin
 
2.1. Dissecting blackberry
2.1. Dissecting blackberry2.1. Dissecting blackberry
2.1. Dissecting blackberrydefconmoscow
 
OWASP AppSec Cali 2018 - Enabling Product Security With Culture and Cloud (As...
OWASP AppSec Cali 2018 - Enabling Product Security With Culture and Cloud (As...OWASP AppSec Cali 2018 - Enabling Product Security With Culture and Cloud (As...
OWASP AppSec Cali 2018 - Enabling Product Security With Culture and Cloud (As...Patrick Thomas
 
Dip(dependency inversion principle) presentation
Dip(dependency inversion principle) presentationDip(dependency inversion principle) presentation
Dip(dependency inversion principle) presentationqamar mustafa
 
Google Developer Group(GDG) DevFest Event 2012 Android talk
Google Developer Group(GDG) DevFest Event 2012 Android talkGoogle Developer Group(GDG) DevFest Event 2012 Android talk
Google Developer Group(GDG) DevFest Event 2012 Android talkImam Raza
 
Neal Ford Emergent Design And Evolutionary Architecture
Neal Ford Emergent Design And Evolutionary ArchitectureNeal Ford Emergent Design And Evolutionary Architecture
Neal Ford Emergent Design And Evolutionary ArchitectureThoughtworks
 
2015 06-wso2 coneu-closingkeynote-asanka
2015 06-wso2 coneu-closingkeynote-asanka2015 06-wso2 coneu-closingkeynote-asanka
2015 06-wso2 coneu-closingkeynote-asankaAsanka Abeysinghe
 
Cloud Security & Compliance - JPMC Overview
Cloud Security & Compliance - JPMC OverviewCloud Security & Compliance - JPMC Overview
Cloud Security & Compliance - JPMC OverviewCanturk Isci
 

Similar to Introduction to Android Window System (20)

Improve Android System Component Performance
Improve Android System Component PerformanceImprove Android System Component Performance
Improve Android System Component Performance
 
Develop Community-based Android Distribution and Upstreaming Experience
Develop Community-based Android Distribution and Upstreaming Experience Develop Community-based Android Distribution and Upstreaming Experience
Develop Community-based Android Distribution and Upstreaming Experience
 
Build to Hack, Hack to Build
Build to Hack, Hack to BuildBuild to Hack, Hack to Build
Build to Hack, Hack to Build
 
Architecting modern Android apps
Architecting modern Android appsArchitecting modern Android apps
Architecting modern Android apps
 
What is web2.0
What is web2.0What is web2.0
What is web2.0
 
[Wroclaw #7] Why So Serial?
[Wroclaw #7] Why So Serial?[Wroclaw #7] Why So Serial?
[Wroclaw #7] Why So Serial?
 
Java course-in-mumbai
Java course-in-mumbaiJava course-in-mumbai
Java course-in-mumbai
 
Neal Ford Emergent Design And Evolutionary Architecture
Neal Ford Emergent Design And Evolutionary ArchitectureNeal Ford Emergent Design And Evolutionary Architecture
Neal Ford Emergent Design And Evolutionary Architecture
 
Neal Ford Emergent Design And Evolutionary Architecture
Neal Ford Emergent Design And Evolutionary ArchitectureNeal Ford Emergent Design And Evolutionary Architecture
Neal Ford Emergent Design And Evolutionary Architecture
 
DefCon 2012 - Finding Firmware Vulnerabilities
DefCon 2012 - Finding Firmware VulnerabilitiesDefCon 2012 - Finding Firmware Vulnerabilities
DefCon 2012 - Finding Firmware Vulnerabilities
 
DefCon 2012 - Firmware Vulnerability Hunting with FRAK
DefCon 2012 - Firmware Vulnerability Hunting with FRAKDefCon 2012 - Firmware Vulnerability Hunting with FRAK
DefCon 2012 - Firmware Vulnerability Hunting with FRAK
 
Mocking vtcc3 - en
Mocking   vtcc3 - enMocking   vtcc3 - en
Mocking vtcc3 - en
 
2.1. Dissecting blackberry
2.1. Dissecting blackberry2.1. Dissecting blackberry
2.1. Dissecting blackberry
 
OWASP AppSec Cali 2018 - Enabling Product Security With Culture and Cloud (As...
OWASP AppSec Cali 2018 - Enabling Product Security With Culture and Cloud (As...OWASP AppSec Cali 2018 - Enabling Product Security With Culture and Cloud (As...
OWASP AppSec Cali 2018 - Enabling Product Security With Culture and Cloud (As...
 
Dip(dependency inversion principle) presentation
Dip(dependency inversion principle) presentationDip(dependency inversion principle) presentation
Dip(dependency inversion principle) presentation
 
Google Developer Group(GDG) DevFest Event 2012 Android talk
Google Developer Group(GDG) DevFest Event 2012 Android talkGoogle Developer Group(GDG) DevFest Event 2012 Android talk
Google Developer Group(GDG) DevFest Event 2012 Android talk
 
Bhavin_Resume
Bhavin_ResumeBhavin_Resume
Bhavin_Resume
 
Neal Ford Emergent Design And Evolutionary Architecture
Neal Ford Emergent Design And Evolutionary ArchitectureNeal Ford Emergent Design And Evolutionary Architecture
Neal Ford Emergent Design And Evolutionary Architecture
 
2015 06-wso2 coneu-closingkeynote-asanka
2015 06-wso2 coneu-closingkeynote-asanka2015 06-wso2 coneu-closingkeynote-asanka
2015 06-wso2 coneu-closingkeynote-asanka
 
Cloud Security & Compliance - JPMC Overview
Cloud Security & Compliance - JPMC OverviewCloud Security & Compliance - JPMC Overview
Cloud Security & Compliance - JPMC Overview
 

More from National Cheng Kung University

PyPy's approach to construct domain-specific language runtime
PyPy's approach to construct domain-specific language runtimePyPy's approach to construct domain-specific language runtime
PyPy's approach to construct domain-specific language runtimeNational Cheng Kung University
 
進階嵌入式作業系統設計與實做 (2015 年秋季 ) 課程說明
進階嵌入式作業系統設計與實做 (2015 年秋季 ) 課程說明進階嵌入式作業系統設計與實做 (2015 年秋季 ) 課程說明
進階嵌入式作業系統設計與實做 (2015 年秋季 ) 課程說明National Cheng Kung University
 
給自己更好未來的 3 個練習:嵌入式作業系統設計、實做,與移植 (2015 年春季 ) 課程說明
給自己更好未來的 3 個練習:嵌入式作業系統設計、實做,與移植 (2015 年春季 ) 課程說明給自己更好未來的 3 個練習:嵌入式作業系統設計、實做,與移植 (2015 年春季 ) 課程說明
給自己更好未來的 3 個練習:嵌入式作業系統設計、實做,與移植 (2015 年春季 ) 課程說明National Cheng Kung University
 
進階嵌入式系統開發與實做 (2014 年秋季 ) 課程說明
進階嵌入式系統開發與實做 (2014 年秋季 ) 課程說明進階嵌入式系統開發與實做 (2014 年秋季 ) 課程說明
進階嵌入式系統開發與實做 (2014 年秋季 ) 課程說明National Cheng Kung University
 
Develop Your Own Operating Systems using Cheap ARM Boards
Develop Your Own Operating Systems using Cheap ARM BoardsDevelop Your Own Operating Systems using Cheap ARM Boards
Develop Your Own Operating Systems using Cheap ARM BoardsNational Cheng Kung University
 
Lecture notice about Embedded Operating System Design and Implementation
Lecture notice about Embedded Operating System Design and ImplementationLecture notice about Embedded Operating System Design and Implementation
Lecture notice about Embedded Operating System Design and ImplementationNational Cheng Kung University
 
中輟生談教育: 完全用開放原始碼軟體進行 嵌入式系統教學
中輟生談教育: 完全用開放原始碼軟體進行 嵌入式系統教學中輟生談教育: 完全用開放原始碼軟體進行 嵌入式系統教學
中輟生談教育: 完全用開放原始碼軟體進行 嵌入式系統教學National Cheng Kung University
 
F9: A Secure and Efficient Microkernel Built for Deeply Embedded Systems
F9: A Secure and Efficient Microkernel Built for Deeply Embedded SystemsF9: A Secure and Efficient Microkernel Built for Deeply Embedded Systems
F9: A Secure and Efficient Microkernel Built for Deeply Embedded SystemsNational Cheng Kung University
 

More from National Cheng Kung University (20)

PyPy's approach to construct domain-specific language runtime
PyPy's approach to construct domain-specific language runtimePyPy's approach to construct domain-specific language runtime
PyPy's approach to construct domain-specific language runtime
 
Making Linux do Hard Real-time
Making Linux do Hard Real-timeMaking Linux do Hard Real-time
Making Linux do Hard Real-time
 
2016 年春季嵌入式作業系統課程說明
2016 年春季嵌入式作業系統課程說明2016 年春季嵌入式作業系統課程說明
2016 年春季嵌入式作業系統課程說明
 
Interpreter, Compiler, JIT from scratch
Interpreter, Compiler, JIT from scratchInterpreter, Compiler, JIT from scratch
Interpreter, Compiler, JIT from scratch
 
進階嵌入式作業系統設計與實做 (2015 年秋季 ) 課程說明
進階嵌入式作業系統設計與實做 (2015 年秋季 ) 課程說明進階嵌入式作業系統設計與實做 (2015 年秋季 ) 課程說明
進階嵌入式作業系統設計與實做 (2015 年秋季 ) 課程說明
 
Construct an Efficient and Secure Microkernel for IoT
Construct an Efficient and Secure Microkernel for IoTConstruct an Efficient and Secure Microkernel for IoT
Construct an Efficient and Secure Microkernel for IoT
 
The Internals of "Hello World" Program
The Internals of "Hello World" ProgramThe Internals of "Hello World" Program
The Internals of "Hello World" Program
 
How A Compiler Works: GNU Toolchain
How A Compiler Works: GNU ToolchainHow A Compiler Works: GNU Toolchain
How A Compiler Works: GNU Toolchain
 
Virtual Machine Constructions for Dummies
Virtual Machine Constructions for DummiesVirtual Machine Constructions for Dummies
Virtual Machine Constructions for Dummies
 
給自己更好未來的 3 個練習:嵌入式作業系統設計、實做,與移植 (2015 年春季 ) 課程說明
給自己更好未來的 3 個練習:嵌入式作業系統設計、實做,與移植 (2015 年春季 ) 課程說明給自己更好未來的 3 個練習:嵌入式作業系統設計、實做,與移植 (2015 年春季 ) 課程說明
給自己更好未來的 3 個練習:嵌入式作業系統設計、實做,與移植 (2015 年春季 ) 課程說明
 
從線上售票看作業系統設計議題
從線上售票看作業系統設計議題從線上售票看作業系統設計議題
從線上售票看作業系統設計議題
 
進階嵌入式系統開發與實做 (2014 年秋季 ) 課程說明
進階嵌入式系統開發與實做 (2014 年秋季 ) 課程說明進階嵌入式系統開發與實做 (2014 年秋季 ) 課程說明
進階嵌入式系統開發與實做 (2014 年秋季 ) 課程說明
 
Xvisor: embedded and lightweight hypervisor
Xvisor: embedded and lightweight hypervisorXvisor: embedded and lightweight hypervisor
Xvisor: embedded and lightweight hypervisor
 
Making Linux do Hard Real-time
Making Linux do Hard Real-timeMaking Linux do Hard Real-time
Making Linux do Hard Real-time
 
Implement Runtime Environments for HSA using LLVM
Implement Runtime Environments for HSA using LLVMImplement Runtime Environments for HSA using LLVM
Implement Runtime Environments for HSA using LLVM
 
Priority Inversion on Mars
Priority Inversion on MarsPriority Inversion on Mars
Priority Inversion on Mars
 
Develop Your Own Operating Systems using Cheap ARM Boards
Develop Your Own Operating Systems using Cheap ARM BoardsDevelop Your Own Operating Systems using Cheap ARM Boards
Develop Your Own Operating Systems using Cheap ARM Boards
 
Lecture notice about Embedded Operating System Design and Implementation
Lecture notice about Embedded Operating System Design and ImplementationLecture notice about Embedded Operating System Design and Implementation
Lecture notice about Embedded Operating System Design and Implementation
 
中輟生談教育: 完全用開放原始碼軟體進行 嵌入式系統教學
中輟生談教育: 完全用開放原始碼軟體進行 嵌入式系統教學中輟生談教育: 完全用開放原始碼軟體進行 嵌入式系統教學
中輟生談教育: 完全用開放原始碼軟體進行 嵌入式系統教學
 
F9: A Secure and Efficient Microkernel Built for Deeply Embedded Systems
F9: A Secure and Efficient Microkernel Built for Deeply Embedded SystemsF9: A Secure and Efficient Microkernel Built for Deeply Embedded Systems
F9: A Secure and Efficient Microkernel Built for Deeply Embedded Systems
 

Recently uploaded

Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodJuan lago vázquez
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...Zilliz
 
Six Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal OntologySix Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal Ontologyjohnbeverley2021
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAndrey Devyatkin
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...apidays
 
[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdfSandro Moreira
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...apidays
 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Victor Rentea
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyKhushali Kathiriya
 
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Orbitshub
 
FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024The Digital Insurer
 
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...apidays
 
WSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering DevelopersWSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering DevelopersWSO2
 
Exploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusExploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusZilliz
 
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...Angeliki Cooney
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Jeffrey Haguewood
 
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfRising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfOrbitshub
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FMESafe Software
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProduct Anonymous
 

Recently uploaded (20)

Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
 
Six Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal OntologySix Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal Ontology
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 
[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
 
FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024
 
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
 
WSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering DevelopersWSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering Developers
 
Exploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusExploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with Milvus
 
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
 
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfRising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 

Introduction to Android Window System

  • 1. Outline Building Blocks Under the Hood Get Dirty Q&A Introduction to Android Window System Chia-I Wu olv@0xlab.org May 15, 2009 Chia-I Wu olv@0xlab.org Introduction to Android Window System
  • 2. Outline Building Blocks Under the Hood Get Dirty Q&A Building Blocks Overview Interested Components Under the Hood Random Topics Get Dirty Development Code Q&A Chia-I Wu olv@0xlab.org Introduction to Android Window System
  • 3. Outline Building Blocks Overview Under the Hood Interested Components Get Dirty Q&A Outline Building Blocks Overview Interested Components Under the Hood Random Topics Get Dirty Development Code Q&A Chia-I Wu olv@0xlab.org Introduction to Android Window System
  • 4. Outline Building Blocks Overview Under the Hood Interested Components Get Dirty Q&A System Architecture Chia-I Wu olv@0xlab.org Introduction to Android Window System
  • 5. Outline Building Blocks Overview Under the Hood Interested Components Get Dirty Q&A System Architecture Chia-I Wu olv@0xlab.org Introduction to Android Window System
  • 6. Outline Building Blocks Overview Under the Hood Interested Components Get Dirty Q&A System Architecture Chia-I Wu olv@0xlab.org Introduction to Android Window System
  • 7. Outline Building Blocks Overview Under the Hood Interested Components Get Dirty Q&A Building Blocks There are more, but we focus on SurfaceManager WindowManager ActivityManager Chia-I Wu olv@0xlab.org Introduction to Android Window System
  • 8. Outline Building Blocks Overview Under the Hood Interested Components Get Dirty Q&A SurfaceManager frameworks/base/libs/surfaceflinger/ a.k.a SurfaceFlinger Allocate surfaces. Backed by ashmem/pmem/? Composite surfaces Chia-I Wu olv@0xlab.org Introduction to Android Window System
  • 9. Outline Building Blocks Overview Under the Hood Interested Components Get Dirty Q&A WindowManager frameworks/base/services/java/ com/android/server/WindowManagerService.java About 9000 SLOC in one file. Poorly documented, bad namings, ... (Ask SurfaceManager to) create/layout surfaces on behalf of the clients Dispatch input events to clients Transition animation WindowManagerPolicy Chia-I Wu olv@0xlab.org Introduction to Android Window System
  • 10. Outline Building Blocks Overview Under the Hood Interested Components Get Dirty Q&A ActivityManager frameworks/base/services/java/ com/android/server/am/ Manage lifecycles of activities Manage stacking of activities Dispatch intents Spawn processes Chia-I Wu olv@0xlab.org Introduction to Android Window System
  • 11. Outline Building Blocks Overview Under the Hood Interested Components Get Dirty Q&A Confusions An activity has one or more windows (e.g. dialogs) A window has one or more surfaces (e.g. surface views) However, in window manager, a window is called a session A surface is called a window And an activity becomes roughly a token Chia-I Wu olv@0xlab.org Introduction to Android Window System
  • 12. Outline Building Blocks Overview Under the Hood Interested Components Get Dirty Q&A Special Keys HOME key BACK key Chia-I Wu olv@0xlab.org Introduction to Android Window System
  • 13. Outline Building Blocks Under the Hood Random Topics Get Dirty Q&A Outline Building Blocks Overview Interested Components Under the Hood Random Topics Get Dirty Development Code Q&A Chia-I Wu olv@0xlab.org Introduction to Android Window System
  • 14. Outline Building Blocks Under the Hood Random Topics Get Dirty Q&A Process View SurfaceManager, WindowManager, and SurfaceManager are threads of a single process (system server) Every application is usually a process of itself Chia-I Wu olv@0xlab.org Introduction to Android Window System
  • 15. Outline Building Blocks Under the Hood Random Topics Get Dirty Q&A Zygote Is a process started on system initialization Preloads java classes and resources Forks system server Listens silently on /dev/socket/zygote Chia-I Wu olv@0xlab.org Introduction to Android Window System
  • 16. Outline Building Blocks Under the Hood Random Topics Get Dirty Q&A Binder Early in the lifetime of an application process, thread(s) are created and blocked on /dev/binder Binder is used mainly for RPC Fragile Chia-I Wu olv@0xlab.org Introduction to Android Window System
  • 17. Outline Building Blocks Development Under the Hood Code Get Dirty Q&A Outline Building Blocks Overview Interested Components Under the Hood Random Topics Get Dirty Development Code Q&A Chia-I Wu olv@0xlab.org Introduction to Android Window System
  • 18. Outline Building Blocks Development Under the Hood Code Get Dirty Q&A Build System build/core/core/build-system.html . build/envsetup.sh showcommands export ANDROID JAVA HOME if non-standard Chia-I Wu olv@0xlab.org Introduction to Android Window System
  • 19. Outline Building Blocks Development Under the Hood Code Get Dirty Q&A adb ADBHOST for transport over TCP/IP kill-server remount pull/push logcat shell Chia-I Wu olv@0xlab.org Introduction to Android Window System
  • 20. Outline Building Blocks Development Under the Hood Code Get Dirty Q&A hierarchyviewer Display view hierarchy Display view Invalidate/Relayout Chia-I Wu olv@0xlab.org Introduction to Android Window System
  • 21. Outline Building Blocks Development Under the Hood Code Get Dirty Q&A Graphics: Memory Management SurfaceFlinger has a SurfaceHeapManager Every client has a MemoryDealer, as returned by SurfaceHeapManager Every surface of a client also has dealer(s), from client or GPU Chia-I Wu olv@0xlab.org Introduction to Android Window System
  • 22. Outline Building Blocks Development Under the Hood Code Get Dirty Q&A Graphics: Memory Management cont. A dealer consists of a heap and an allocator A heap represents a sharable big chunk of memory An allocator is an algorithm Small chunks of memory from the heap are returned Chia-I Wu olv@0xlab.org Introduction to Android Window System
  • 23. Outline Building Blocks Development Under the Hood Code Get Dirty Q&A Graphics: Memory Management cont. Real flow A client asks for a new surface, createSurface Chia-I Wu olv@0xlab.org Introduction to Android Window System
  • 24. Outline Building Blocks Development Under the Hood Code Get Dirty Q&A Graphics: Memory Management cont. Real flow A client asks for a new surface, createSurface createSurface calls createNormalSurfaceLocked Chia-I Wu olv@0xlab.org Introduction to Android Window System
  • 25. Outline Building Blocks Development Under the Hood Code Get Dirty Q&A Graphics: Memory Management cont. Real flow A client asks for a new surface, createSurface createSurface calls createNormalSurfaceLocked A layer is created and setBuffers is called to allocate buffers Chia-I Wu olv@0xlab.org Introduction to Android Window System
  • 26. Outline Building Blocks Development Under the Hood Code Get Dirty Q&A Graphics: Memory Management cont. Real flow A client asks for a new surface, createSurface createSurface calls createNormalSurfaceLocked A layer is created and setBuffers is called to allocate buffers Two dealers are created from client, one for front buffer and one for back buffer Chia-I Wu olv@0xlab.org Introduction to Android Window System
  • 27. Outline Building Blocks Development Under the Hood Code Get Dirty Q&A Graphics: Memory Management cont. Real flow A client asks for a new surface, createSurface createSurface calls createNormalSurfaceLocked A layer is created and setBuffers is called to allocate buffers Two dealers are created from client, one for front buffer and one for back buffer Two LayerBitmaps are created, initialized with the two dealers Chia-I Wu olv@0xlab.org Introduction to Android Window System
  • 28. Outline Building Blocks Development Under the Hood Code Get Dirty Q&A Graphics: Memory Management cont. Real flow A client asks for a new surface, createSurface createSurface calls createNormalSurfaceLocked A layer is created and setBuffers is called to allocate buffers Two dealers are created from client, one for front buffer and one for back buffer Two LayerBitmaps are created, initialized with the two dealers Heaps of dealers along with info about the layer are returned Chia-I Wu olv@0xlab.org Introduction to Android Window System
  • 29. Outline Building Blocks Development Under the Hood Code Get Dirty Q&A Hello World http://people.debian.org.tw/˜olv/surfaceflinger/demo.tar.gz Chia-I Wu olv@0xlab.org Introduction to Android Window System
  • 30. Outline Building Blocks Development Under the Hood Code Get Dirty Q&A Many Buffers Surface is double buffered EGLDisplaySurface is double buffered Same technique; Different code pathes, different purposes Chia-I Wu olv@0xlab.org Introduction to Android Window System
  • 31. Outline Building Blocks Development Under the Hood Code Get Dirty Q&A Double Buffering Sofware v.s. Hardware Memory copy Page flipping Chia-I Wu olv@0xlab.org Introduction to Android Window System
  • 32. Outline Building Blocks Development Under the Hood Code Get Dirty Q&A Dirty Region Associate buffers with dirty regions Copy back Chia-I Wu olv@0xlab.org Introduction to Android Window System
  • 33. Outline Building Blocks Development Under the Hood Code Get Dirty Q&A Frame 0 Chia-I Wu olv@0xlab.org Introduction to Android Window System
  • 34. Outline Building Blocks Development Under the Hood Code Get Dirty Q&A Frame 1 Chia-I Wu olv@0xlab.org Introduction to Android Window System
  • 35. Outline Building Blocks Development Under the Hood Code Get Dirty Q&A Frame 2 Chia-I Wu olv@0xlab.org Introduction to Android Window System
  • 36. Outline Building Blocks Under the Hood Get Dirty Q&A Outline Building Blocks Overview Interested Components Under the Hood Random Topics Get Dirty Development Code Q&A Chia-I Wu olv@0xlab.org Introduction to Android Window System
  • 37. Outline Building Blocks Under the Hood Get Dirty Q&A Q&A Questions? Chia-I Wu olv@0xlab.org Introduction to Android Window System