SlideShare a Scribd company logo
Copyright 2016 ITRI 工業技術研究院 0
Container-based Android
(Android Containerization)
TC Wu, Victor Hsu, Sting Cheng @ ICL/ITRI
Sponsored by
Department of Industrial Technology,
Ministry of Economic Affair
1Copyright 2016 ITRI 工業技術研究院
Outline
Preliminaries
Containerizing Android
Isolate/share services among Android instances
Linux Kernel, Drivers and Android Binder
Window System and Graphics
Performance Benchmark
To Be Continued
Open Source Release Schedule
2Copyright 2016 ITRI 工業技術研究院
Preliminaries
 Android Platforms
 Nexus 7 with Android 6.X/Kernel 3.4.0
 Pixel XL with Android 7.1.X/Kernel 3.18.31
 LXC and Other Tools
 Built with Android NDK: android-toolchain-arm_64-4.9-android-24
 libcap (https://github.com/abstrakraft/lxc-android-libcap)
• Only libcap is required, built in static (libcap.a)
• libcap.a is statically linked into lxc
 SELinux
• Using essential Android code base: external/selinux
– libselinux: external/selinux/libselinux
» NOT external/libselinux which is a small port of libselinux for Android framework
– libsepol: external/selinux/libsepol
– setfiles: external/selinux/policycoreutils/setfiles
LXC
3Copyright 2016 ITRI 工業技術研究院
Preliminaries - LXC
 Configuring & building LXC  Packaging LXC and tools
/odm
├── bin
│ ├── ....
│ ├── lxc-start
│ ├── lxc-stop
│ ├── ....
│ ├── setfilecon
│ ├── setfiles
│ └── ...
├── lib
│ ├── liblxc.la
│ ├── liblxc.so
├── libexec
│ └── lxc
│ ├── hooks
│ │ └── unmount-namespace
│ ├── lxc-apparmor-load
│ ├── lxc-containers
│ ├── lxc-monitord
│ ├── lxc-net
│ └── lxc-user-nic
export CBA_HOME=/odm
export PREFIX=$CBA_HOME
export PIXEL_LIBS=/home/sting/cba/lxc/pixel-libs/usr
CFLAGS="--sysroot=$SYSROOT -I$PIXEL_LIBS/include -fPIE" 
CPPFLAGS="$CPPFLAGS $CFLAGS" 
LDFLAGS="$LDFLAGS -fPIE -pie -L$PIXEL_LIBS/lib" 
./configure --host=aarch64-linux-android 
--enable-shared=yes --enable-static=yes 
--disable-api-docs 
--enable-selinux 
--enable-capabilities 
--disable-examples 
--disable-lua 
--disable-python 
--disable-bash 
--enable-configpath-log 

--prefix=$PREFIX 
--with-systemdsystemunitdir=$PREFIX/lib/systemd/system 
--with-config-path=$CBA_HOME/containers 
--with-global-conf=$CBA_HOME/.config 
--with-runtime-path=/cache
4Copyright 2016 ITRI 工業技術研究院
Containerizing Android
5Copyright 2016 ITRI 工業技術研究院
Android Containerization Overview
 Android was essentially designed for single instance architecture
 In order to better containerized Android, we need to
 Refactor essential Android key services architecture design to make it namespace-
aware and sharable among Android containers
 Extend the current LXC to support namespace-aware device model and namespace-
aware deriver development
 Extend Android virtual devices and drivers to support namespace-awareness
Unified Linux Kernel & Drivers
LXC Container (Cgroups, Namespace)
SELinux
Virtual Device
Drivers
Host Android
Shared
Framework
Services
Service Manager Surface Flinger
Camera
LXCTools
Virtual
Devices
binder RIL
alarm
….
Netfilter,
Virtual Ethernet Bridging
iptables
Power Mgmt. ….
Android 1 Android 2
Audio Sensors
6Copyright 2016 ITRI 工業技術研究院
Android Containerization Overview (2)
Linux Kernel + LXC
Surface Flinger buffer
Host Android
Shared Framework
Services
Surface Flinger
Window Manager
Android n
Window Manager
namespace-aware binder
Unshared service invocation
Shared service invocation
Virtual Devices alarm- dev State 1 State n
Before After
Power Mgmt.
Activity Manager
Activity Manager
 Sharing or Isolating critical and resource-constrained services among Android
containers
Namespace-aware IPC binder (Android service invocation is through IPC binder)
 Virtual devices and their namespace-aware drivers
State-ful/Stateless device driver, state-ful devices, like alarm device, the state of different
namespaces must be maintained
Preventing performance lose with limited container interception overhead
Service Manager
Camera Audio
Sensors
7Copyright 2016 ITRI 工業技術研究院
Linux Kernel, Drivers and
Android Binder
8Copyright 2016 ITRI 工業技術研究院
Isolate/Share Services among
Android Containers
 Refactoring essential Android binder architecture design to
enable isolate/share services among Android instances
 Namespace-aware IPC binder (Inspired by Container Virtualization
Adapted to Android @浙江大学计算机系统结构实验室)
 Reduce the total # of Linux process
 Can be configured which services to be shared
 Caller is aware of the container ID of callee
Linux Kernel + LXC + Drivers
Virtual Devicesbinder 1 binder n
Linux Kernel + LXC + Drivers
Virtual Devices namespace-aware binder
Shared service invocation
Unshared service invocation
Before After
9Copyright 2016 ITRI 工業技術研究院
Android Service
Registration & Discovery
ServiceManagerService App
1. addService(name, service)
2. getService(name)
3. Binder IPC Transactions
service
10Copyright 2016 ITRI 工業技術研究院
Virtual Binder Driver
Lei Xu, Wenzhi Chen, Zonghui Wang, Guoxi Li, Chuan Li, Weijie Sun, Condroid: A Container-Based
Virtualization Solution Adapted for Android Devices , Proceedings of IEEE International Conference on Mobile
Cloud Computing, Services, and Engineering, 2015
Real
binder
driver
Host
Service
Manager
SHARED
11Copyright 2016 ITRI 工業技術研究院
Android Virtual Binder Architecture
Service
Manager
Service App
Host
Service App
Container1
Service App
Container2
/dev/binder /dev/virtualbinder1 /dev/virtualbinder2
Virtual Binder Driver
Real Binder Deriver
Linux Kernel
12Copyright 2016 ITRI 工業技術研究院
Virtual Devices and their Drivers
 Device Namespaces : namespace aware device driver (inspired by
Cells proj. @ Columbia University)
 Stateful/Stateless device driver, stateful devices, like alarm device, the
state of different namespaces must be maintained
 AlarmManagerService
 alarm-dev driver has been removed in Android Nougat, the functionality
provided by the Android alarm-dev driver should now be present in the
timerfd interface
 com_android_server_AlarmManagerService.cpp
static const clockid_t android_alarm_to_clockid[N_ANDROID_TIMERFDS]
• CLOCK_REALTIME_ALARM (since Linux 3.11)
• CLOCK_REALTIME
• CLOCK_BOOTTIME_ALARM (since Linux 3.11)
• CLOCK_BOOTTIME (since Linux 3.15)
• CLOCK_MONOTONIC
• CLOCK_REALTIME
Linux Kernel + LXC + Drivers
Virtual Devices alarm- dev
Android 1 Android n
State 1 State n
13Copyright 2016 ITRI 工業技術研究院
Window System and Graphics
14Copyright 2016 ITRI 工業技術研究院
Share or Not to Share
SurfaceFlinger/WindowManager
浙江大学计算机系统结构实验室
Share both SurfaceFlinger and Window
Manager
Maintains different z-order range for different
containers
Linux Kernel + LXC + Drivers
Surface Flinger buffer
Host Android
Shared
Framework
Services
Surface Flinger
Window Manager
15Copyright 2016 ITRI 工業技術研究院
Share or Not to Share
SurfaceFlinger/WindowManager (2)
ICL Approach
Window Manager in each container
Single SurfaceFlinger instance on host
• Maintains list of Layers of different Android containers
• Groups Layers according to their container ID
Linux Kernel + LXC + Drivers
Surface Flinger buffer
Host Android
Shared Framework
Services
Surface Flinger
Window Manager
Android n
Window Manager
16Copyright 2016 ITRI 工業技術研究院
Display Switching between Containers
• Layers of different Android
containers in SurfaceFlinger
• SurfaceFlinger groups layers
according to their container
ID
Assign layers of host container to
layersSortedByZ of primary display
primary display
compose
Assign layers of container 1 to
layersSortedByZ of primary display
primary display
compose
17Copyright 2016 ITRI 工業技術研究院
Benchmark
18Copyright 2016 ITRI 工業技術研究院
Benchmark on Nexus 7
Host Container Host + Container
Host Container
Score 11227 11024 5976 5356
FPS (avg) 41.24 40.68 21.17 19.39
GPU Benchmark 3D
Host Container Host + Container
Host Container
Score 2560 2527 1588 1579
3DRating for OpenGL ES 2.0
Host Container Host + Container
Host Container
OpenGL Cube 58.35 fps 58.27 fps 57.56 fps 57.60 fps
OpenGL Blending 61.35 fps 61.24 fps 59.91 fps 59.62 fps
OpenGL Fog 61.37 fps 61.34 fps 60.50 fps 60.08 fps
Flying Teapot 55.54 fps 55.40 fps 32.54 fps 32.53 fps
0xbench
19Copyright 2016 ITRI 工業技術研究院
To Be Continued
20Copyright 2016 ITRI 工業技術研究院
To Be Continued
Power Management
To share or not to share PowerManagerService
Activity Manager Service
SELinux
To further isolate host and containers
SEE (Secure Execution Environment)
Integration
vold and Qualcomm SEE issues
DRM
21Copyright 2016 ITRI 工業技術研究院
Open Source Release Schedule
ICL/ITRI is going to release the code as an
open source project on GitHub
Sept, 2017 Q1, 2018 Q2, 2018
•Mid-September
–Nexus 7 ROM image with
Android 6.X/Kernel 3.4.0
–Pixel XL ROM Image with
Android 7.1.X/Kernel 3.18.31
•End of September
–Source code for Nexus 7 with
Android 6.X/Kernel 3.4.0
Mid-Q2
Source code and ROM
image for Pixel 2 with
Android 8.X
Mid-Q1
Source code for Pixel
XL with Android
7.1.X/Kernel 3.18.31

More Related Content

What's hot (19)

PDF
Red Hat and kubernetes: awesome stuff coming your way
Johannes Brännström
 
DOCX
Android
Anand Buddarapu
 
PPTX
OpenShift Introduction
Red Hat Developers
 
PDF
Multi-Container Applications Spanning Docker, Mesos and OpenStack
Andrew Kennedy
 
PDF
OpenShift Taiwan Vol.1 Technology Overview
Jason Peng
 
PPTX
Docker, cornerstone of an hybrid cloud?
Adrien Blind
 
PDF
Openshift Container Platform: First ItalyMeetup
Giuseppe Bonocore
 
PPTX
Android understanding
Ramesh Rao
 
PDF
OpenShift Overview - Red Hat Open School 2017
Rodolfo Carvalho
 
PPTX
Vulnerabilities of machine learning infrastructure
Sergey Gordeychik
 
PDF
Gérer vos clusters Kubernetes avec Flux 2 et la méthode GitOps
Open Source Experience
 
PDF
02 - Introduction to Hyperledger Fabric
Merlec Mpyana
 
PDF
Kubernetes and CNCF Landscape 101
Giulio Roggero
 
PDF
Diagnose Your Microservices
Marcus Hirt
 
PDF
OpenShift pour le developpement cloud native - 20171214
Laurent Broudoux
 
PDF
OpenShift Overview - Red Hat Open House 2017
Rodolfo Carvalho
 
PDF
Kubernetes One-Click Deployment: Hands-on Workshop (Mainz)
QAware GmbH
 
PPTX
Building Cross-Platform Apps using Qt and Qyoto
Jeff Alstadt
 
PPTX
[DevDay 2017] OpenShift Enterprise - Speaker: Linh Do - DevOps Engineer at Ax...
DevDay Da Nang
 
Red Hat and kubernetes: awesome stuff coming your way
Johannes Brännström
 
Android
Anand Buddarapu
 
OpenShift Introduction
Red Hat Developers
 
Multi-Container Applications Spanning Docker, Mesos and OpenStack
Andrew Kennedy
 
OpenShift Taiwan Vol.1 Technology Overview
Jason Peng
 
Docker, cornerstone of an hybrid cloud?
Adrien Blind
 
Openshift Container Platform: First ItalyMeetup
Giuseppe Bonocore
 
Android understanding
Ramesh Rao
 
OpenShift Overview - Red Hat Open School 2017
Rodolfo Carvalho
 
Vulnerabilities of machine learning infrastructure
Sergey Gordeychik
 
Gérer vos clusters Kubernetes avec Flux 2 et la méthode GitOps
Open Source Experience
 
02 - Introduction to Hyperledger Fabric
Merlec Mpyana
 
Kubernetes and CNCF Landscape 101
Giulio Roggero
 
Diagnose Your Microservices
Marcus Hirt
 
OpenShift pour le developpement cloud native - 20171214
Laurent Broudoux
 
OpenShift Overview - Red Hat Open House 2017
Rodolfo Carvalho
 
Kubernetes One-Click Deployment: Hands-on Workshop (Mainz)
QAware GmbH
 
Building Cross-Platform Apps using Qt and Qyoto
Jeff Alstadt
 
[DevDay 2017] OpenShift Enterprise - Speaker: Linh Do - DevOps Engineer at Ax...
DevDay Da Nang
 

Similar to Android containerization in brief (20)

PDF
Container based android
Lihan Chen
 
PDF
Android IPC Mechanism
Lihan Chen
 
PDF
Linuxカーネルから紐解くAndroid
demuyan
 
PDF
Android Things : Building Embedded Devices
Emertxe Information Technologies Pvt Ltd
 
PDF
Android device driver structure introduction
William Liang
 
PDF
Binding android piece by piece
Bucharest Java User Group
 
PDF
Android Binder IPC for Linux
Yu-Hsin Hung
 
PDF
Android Internals
Opersys inc.
 
PDF
Android presentation
Siva Ramakrishna kv
 
PDF
Android porting-on-embedded-platform v2-0633850602027036930
weitulislide
 
PDF
Leveraging Android's Linux Heritage at AnDevCon IV
Opersys inc.
 
PDF
State of Containers and the Convergence of HPC and BigData
inside-BigData.com
 
PDF
July 2014 HUG : Privilege Isolation in Docker Containers
Yahoo Developer Network
 
PDF
Android Internals
Opersys inc.
 
PPTX
DockerCon EU 2015: Persistent, stateful services with docker cluster, namespa...
Docker, Inc.
 
PDF
20220406 - SDAN_Presentation1_SDANOverview.pdf
ssuser34f58c1
 
PDF
Developing Android Platform Tools
Opersys inc.
 
PDF
Android Architecture
Pietro Alberto Rossi
 
PPTX
linux and kernelnand its dicovedfds.pptx
RAGULB5
 
PPT
Android platform overview
tamilmani1020
 
Container based android
Lihan Chen
 
Android IPC Mechanism
Lihan Chen
 
Linuxカーネルから紐解くAndroid
demuyan
 
Android Things : Building Embedded Devices
Emertxe Information Technologies Pvt Ltd
 
Android device driver structure introduction
William Liang
 
Binding android piece by piece
Bucharest Java User Group
 
Android Binder IPC for Linux
Yu-Hsin Hung
 
Android Internals
Opersys inc.
 
Android presentation
Siva Ramakrishna kv
 
Android porting-on-embedded-platform v2-0633850602027036930
weitulislide
 
Leveraging Android's Linux Heritage at AnDevCon IV
Opersys inc.
 
State of Containers and the Convergence of HPC and BigData
inside-BigData.com
 
July 2014 HUG : Privilege Isolation in Docker Containers
Yahoo Developer Network
 
Android Internals
Opersys inc.
 
DockerCon EU 2015: Persistent, stateful services with docker cluster, namespa...
Docker, Inc.
 
20220406 - SDAN_Presentation1_SDANOverview.pdf
ssuser34f58c1
 
Developing Android Platform Tools
Opersys inc.
 
Android Architecture
Pietro Alberto Rossi
 
linux and kernelnand its dicovedfds.pptx
RAGULB5
 
Android platform overview
tamilmani1020
 
Ad

Recently uploaded (20)

PDF
Why Businesses Are Switching to Open Source Alternatives to Crystal Reports.pdf
Varsha Nayak
 
PDF
Open Chain Q2 Steering Committee Meeting - 2025-06-25
Shane Coughlan
 
PDF
4K Video Downloader Plus Pro Crack for MacOS New Download 2025
bashirkhan333g
 
PDF
HiHelloHR – Simplify HR Operations for Modern Workplaces
HiHelloHR
 
PPTX
Home Care Tools: Benefits, features and more
Third Rock Techkno
 
PPTX
Tally software_Introduction_Presentation
AditiBansal54083
 
PDF
TheFutureIsDynamic-BoxLang witch Luis Majano.pdf
Ortus Solutions, Corp
 
PDF
Download Canva Pro 2025 PC Crack Full Latest Version
bashirkhan333g
 
PDF
AI + DevOps = Smart Automation with devseccops.ai.pdf
Devseccops.ai
 
PPTX
Finding Your License Details in IBM SPSS Statistics Version 31.pptx
Version 1 Analytics
 
PDF
iTop VPN With Crack Lifetime Activation Key-CODE
utfefguu
 
PPTX
Milwaukee Marketo User Group - Summer Road Trip: Mapping and Personalizing Yo...
bbedford2
 
PPTX
Tally_Basic_Operations_Presentation.pptx
AditiBansal54083
 
PDF
Top Agile Project Management Tools for Teams in 2025
Orangescrum
 
PDF
vMix Pro 28.0.0.42 Download vMix Registration key Bundle
kulindacore
 
PDF
Automate Cybersecurity Tasks with Python
VICTOR MAESTRE RAMIREZ
 
PPTX
AEM User Group: India Chapter Kickoff Meeting
jennaf3
 
PPTX
Foundations of Marketo Engage - Powering Campaigns with Marketo Personalization
bbedford2
 
PPTX
Hardware(Central Processing Unit ) CU and ALU
RizwanaKalsoom2
 
PDF
MiniTool Partition Wizard Free Crack + Full Free Download 2025
bashirkhan333g
 
Why Businesses Are Switching to Open Source Alternatives to Crystal Reports.pdf
Varsha Nayak
 
Open Chain Q2 Steering Committee Meeting - 2025-06-25
Shane Coughlan
 
4K Video Downloader Plus Pro Crack for MacOS New Download 2025
bashirkhan333g
 
HiHelloHR – Simplify HR Operations for Modern Workplaces
HiHelloHR
 
Home Care Tools: Benefits, features and more
Third Rock Techkno
 
Tally software_Introduction_Presentation
AditiBansal54083
 
TheFutureIsDynamic-BoxLang witch Luis Majano.pdf
Ortus Solutions, Corp
 
Download Canva Pro 2025 PC Crack Full Latest Version
bashirkhan333g
 
AI + DevOps = Smart Automation with devseccops.ai.pdf
Devseccops.ai
 
Finding Your License Details in IBM SPSS Statistics Version 31.pptx
Version 1 Analytics
 
iTop VPN With Crack Lifetime Activation Key-CODE
utfefguu
 
Milwaukee Marketo User Group - Summer Road Trip: Mapping and Personalizing Yo...
bbedford2
 
Tally_Basic_Operations_Presentation.pptx
AditiBansal54083
 
Top Agile Project Management Tools for Teams in 2025
Orangescrum
 
vMix Pro 28.0.0.42 Download vMix Registration key Bundle
kulindacore
 
Automate Cybersecurity Tasks with Python
VICTOR MAESTRE RAMIREZ
 
AEM User Group: India Chapter Kickoff Meeting
jennaf3
 
Foundations of Marketo Engage - Powering Campaigns with Marketo Personalization
bbedford2
 
Hardware(Central Processing Unit ) CU and ALU
RizwanaKalsoom2
 
MiniTool Partition Wizard Free Crack + Full Free Download 2025
bashirkhan333g
 
Ad

Android containerization in brief

  • 1. Copyright 2016 ITRI 工業技術研究院 0 Container-based Android (Android Containerization) TC Wu, Victor Hsu, Sting Cheng @ ICL/ITRI Sponsored by Department of Industrial Technology, Ministry of Economic Affair
  • 2. 1Copyright 2016 ITRI 工業技術研究院 Outline Preliminaries Containerizing Android Isolate/share services among Android instances Linux Kernel, Drivers and Android Binder Window System and Graphics Performance Benchmark To Be Continued Open Source Release Schedule
  • 3. 2Copyright 2016 ITRI 工業技術研究院 Preliminaries  Android Platforms  Nexus 7 with Android 6.X/Kernel 3.4.0  Pixel XL with Android 7.1.X/Kernel 3.18.31  LXC and Other Tools  Built with Android NDK: android-toolchain-arm_64-4.9-android-24  libcap (https://github.com/abstrakraft/lxc-android-libcap) • Only libcap is required, built in static (libcap.a) • libcap.a is statically linked into lxc  SELinux • Using essential Android code base: external/selinux – libselinux: external/selinux/libselinux » NOT external/libselinux which is a small port of libselinux for Android framework – libsepol: external/selinux/libsepol – setfiles: external/selinux/policycoreutils/setfiles LXC
  • 4. 3Copyright 2016 ITRI 工業技術研究院 Preliminaries - LXC  Configuring & building LXC  Packaging LXC and tools /odm ├── bin │ ├── .... │ ├── lxc-start │ ├── lxc-stop │ ├── .... │ ├── setfilecon │ ├── setfiles │ └── ... ├── lib │ ├── liblxc.la │ ├── liblxc.so ├── libexec │ └── lxc │ ├── hooks │ │ └── unmount-namespace │ ├── lxc-apparmor-load │ ├── lxc-containers │ ├── lxc-monitord │ ├── lxc-net │ └── lxc-user-nic export CBA_HOME=/odm export PREFIX=$CBA_HOME export PIXEL_LIBS=/home/sting/cba/lxc/pixel-libs/usr CFLAGS="--sysroot=$SYSROOT -I$PIXEL_LIBS/include -fPIE" CPPFLAGS="$CPPFLAGS $CFLAGS" LDFLAGS="$LDFLAGS -fPIE -pie -L$PIXEL_LIBS/lib" ./configure --host=aarch64-linux-android --enable-shared=yes --enable-static=yes --disable-api-docs --enable-selinux --enable-capabilities --disable-examples --disable-lua --disable-python --disable-bash --enable-configpath-log --prefix=$PREFIX --with-systemdsystemunitdir=$PREFIX/lib/systemd/system --with-config-path=$CBA_HOME/containers --with-global-conf=$CBA_HOME/.config --with-runtime-path=/cache
  • 5. 4Copyright 2016 ITRI 工業技術研究院 Containerizing Android
  • 6. 5Copyright 2016 ITRI 工業技術研究院 Android Containerization Overview  Android was essentially designed for single instance architecture  In order to better containerized Android, we need to  Refactor essential Android key services architecture design to make it namespace- aware and sharable among Android containers  Extend the current LXC to support namespace-aware device model and namespace- aware deriver development  Extend Android virtual devices and drivers to support namespace-awareness Unified Linux Kernel & Drivers LXC Container (Cgroups, Namespace) SELinux Virtual Device Drivers Host Android Shared Framework Services Service Manager Surface Flinger Camera LXCTools Virtual Devices binder RIL alarm …. Netfilter, Virtual Ethernet Bridging iptables Power Mgmt. …. Android 1 Android 2 Audio Sensors
  • 7. 6Copyright 2016 ITRI 工業技術研究院 Android Containerization Overview (2) Linux Kernel + LXC Surface Flinger buffer Host Android Shared Framework Services Surface Flinger Window Manager Android n Window Manager namespace-aware binder Unshared service invocation Shared service invocation Virtual Devices alarm- dev State 1 State n Before After Power Mgmt. Activity Manager Activity Manager  Sharing or Isolating critical and resource-constrained services among Android containers Namespace-aware IPC binder (Android service invocation is through IPC binder)  Virtual devices and their namespace-aware drivers State-ful/Stateless device driver, state-ful devices, like alarm device, the state of different namespaces must be maintained Preventing performance lose with limited container interception overhead Service Manager Camera Audio Sensors
  • 8. 7Copyright 2016 ITRI 工業技術研究院 Linux Kernel, Drivers and Android Binder
  • 9. 8Copyright 2016 ITRI 工業技術研究院 Isolate/Share Services among Android Containers  Refactoring essential Android binder architecture design to enable isolate/share services among Android instances  Namespace-aware IPC binder (Inspired by Container Virtualization Adapted to Android @浙江大学计算机系统结构实验室)  Reduce the total # of Linux process  Can be configured which services to be shared  Caller is aware of the container ID of callee Linux Kernel + LXC + Drivers Virtual Devicesbinder 1 binder n Linux Kernel + LXC + Drivers Virtual Devices namespace-aware binder Shared service invocation Unshared service invocation Before After
  • 10. 9Copyright 2016 ITRI 工業技術研究院 Android Service Registration & Discovery ServiceManagerService App 1. addService(name, service) 2. getService(name) 3. Binder IPC Transactions service
  • 11. 10Copyright 2016 ITRI 工業技術研究院 Virtual Binder Driver Lei Xu, Wenzhi Chen, Zonghui Wang, Guoxi Li, Chuan Li, Weijie Sun, Condroid: A Container-Based Virtualization Solution Adapted for Android Devices , Proceedings of IEEE International Conference on Mobile Cloud Computing, Services, and Engineering, 2015 Real binder driver Host Service Manager SHARED
  • 12. 11Copyright 2016 ITRI 工業技術研究院 Android Virtual Binder Architecture Service Manager Service App Host Service App Container1 Service App Container2 /dev/binder /dev/virtualbinder1 /dev/virtualbinder2 Virtual Binder Driver Real Binder Deriver Linux Kernel
  • 13. 12Copyright 2016 ITRI 工業技術研究院 Virtual Devices and their Drivers  Device Namespaces : namespace aware device driver (inspired by Cells proj. @ Columbia University)  Stateful/Stateless device driver, stateful devices, like alarm device, the state of different namespaces must be maintained  AlarmManagerService  alarm-dev driver has been removed in Android Nougat, the functionality provided by the Android alarm-dev driver should now be present in the timerfd interface  com_android_server_AlarmManagerService.cpp static const clockid_t android_alarm_to_clockid[N_ANDROID_TIMERFDS] • CLOCK_REALTIME_ALARM (since Linux 3.11) • CLOCK_REALTIME • CLOCK_BOOTTIME_ALARM (since Linux 3.11) • CLOCK_BOOTTIME (since Linux 3.15) • CLOCK_MONOTONIC • CLOCK_REALTIME Linux Kernel + LXC + Drivers Virtual Devices alarm- dev Android 1 Android n State 1 State n
  • 14. 13Copyright 2016 ITRI 工業技術研究院 Window System and Graphics
  • 15. 14Copyright 2016 ITRI 工業技術研究院 Share or Not to Share SurfaceFlinger/WindowManager 浙江大学计算机系统结构实验室 Share both SurfaceFlinger and Window Manager Maintains different z-order range for different containers Linux Kernel + LXC + Drivers Surface Flinger buffer Host Android Shared Framework Services Surface Flinger Window Manager
  • 16. 15Copyright 2016 ITRI 工業技術研究院 Share or Not to Share SurfaceFlinger/WindowManager (2) ICL Approach Window Manager in each container Single SurfaceFlinger instance on host • Maintains list of Layers of different Android containers • Groups Layers according to their container ID Linux Kernel + LXC + Drivers Surface Flinger buffer Host Android Shared Framework Services Surface Flinger Window Manager Android n Window Manager
  • 17. 16Copyright 2016 ITRI 工業技術研究院 Display Switching between Containers • Layers of different Android containers in SurfaceFlinger • SurfaceFlinger groups layers according to their container ID Assign layers of host container to layersSortedByZ of primary display primary display compose Assign layers of container 1 to layersSortedByZ of primary display primary display compose
  • 18. 17Copyright 2016 ITRI 工業技術研究院 Benchmark
  • 19. 18Copyright 2016 ITRI 工業技術研究院 Benchmark on Nexus 7 Host Container Host + Container Host Container Score 11227 11024 5976 5356 FPS (avg) 41.24 40.68 21.17 19.39 GPU Benchmark 3D Host Container Host + Container Host Container Score 2560 2527 1588 1579 3DRating for OpenGL ES 2.0 Host Container Host + Container Host Container OpenGL Cube 58.35 fps 58.27 fps 57.56 fps 57.60 fps OpenGL Blending 61.35 fps 61.24 fps 59.91 fps 59.62 fps OpenGL Fog 61.37 fps 61.34 fps 60.50 fps 60.08 fps Flying Teapot 55.54 fps 55.40 fps 32.54 fps 32.53 fps 0xbench
  • 20. 19Copyright 2016 ITRI 工業技術研究院 To Be Continued
  • 21. 20Copyright 2016 ITRI 工業技術研究院 To Be Continued Power Management To share or not to share PowerManagerService Activity Manager Service SELinux To further isolate host and containers SEE (Secure Execution Environment) Integration vold and Qualcomm SEE issues DRM
  • 22. 21Copyright 2016 ITRI 工業技術研究院 Open Source Release Schedule ICL/ITRI is going to release the code as an open source project on GitHub Sept, 2017 Q1, 2018 Q2, 2018 •Mid-September –Nexus 7 ROM image with Android 6.X/Kernel 3.4.0 –Pixel XL ROM Image with Android 7.1.X/Kernel 3.18.31 •End of September –Source code for Nexus 7 with Android 6.X/Kernel 3.4.0 Mid-Q2 Source code and ROM image for Pixel 2 with Android 8.X Mid-Q1 Source code for Pixel XL with Android 7.1.X/Kernel 3.18.31