SlideShare a Scribd company logo
Making a Headless Android Device
Making a
Headless-Android
Device
Lessons Learned
NDC TechTown, 2017
Patricia Aas & Johan Herland
Pictures from pixabay.com (CC0)
Patricia Aas
Vivaldi Technologies
Cisco Systems
Opera Software
Twitter: @pati_gallardo
Johan Herland
Cisco Systems
Opera Software
Git Dev Community
Twitter: @jherland
Outline
- Why?
- Architecture
- Devices
- Composition
- Chromium
- Lessons Learned
So… What do we know?
Making a Headless Android Device
And why should you care?
Full Android
Using Google’s AOSP, or a more
customized Android Board Support
Package (BSP) from a chip vendor.
Embedded Linux
No Android parts.
Typically based on
glibc, busybox, etc.
Unchartered Territory
Important questions
Do you have:
- Existing codebase?
- Upstream BSP?
- 3rd party dependencies?
What kind of device:
- Display?
- Single or multiple apps?
- Custom H/W?
Architecture : Deep Dive
Full Stack Android
- Java App ecosystem
- Graphics infrastructure
- Supported by modern SoCs
- Linux kernel w/Android features
- Libc : Bionic
Embedded Linux
- Stable/well-known components
- “Mix-and-match”
- C/C++ or web apps
- “Vanilla” kernel (or not...)
- Libc : GNU glibc
Bionic
- Developed specifically for Android
- Focus: small size and speed
- Compatibility:
- Almost all of C11 and POSIX
- Some GNU/BSD extensions
- C++ : “It’s complicated”
GNU glibc
- Used “everywhere”
- Focus:
- Application support
- Standards compliance
- Completeness
- Compatibility: Yes ☺
Platform Architecture - Embedded Linux
Linux kernel
Device drivers GNU glibc
Libraries (SSL, SQLite, etc.) System utils (systemd, busybox)H/W abstraction (OpenGL, alsalib, etc.)
Compositor (XServer, Wayland)
Application framework (Qt, GTK, Chromium)
Apps
Services/daemons (sshd, httpd)
Your application
Platform Architecture - Full Stack Android
Linux kernel (w/Android features: binder, wakelocks, etc.)
Device drivers Bionic libc
H/W Abstraction Layer (HWC, etc.) Libraries (SSL, SQLite, etc.)
Services (SurfaceFlinger, AudioFlinger, etc.)
Android runtime (ART;
previously Dalvik JVM)
Android Application Framework
Android Apps
System utils (init, ADB, toolbox)
Your application
Platform Architecture - Headless Android based on Bionic
Linux kernel (w/Android features: binder, wakelocks, etc.)
Device drivers Bionic libc
H/W Abstraction Layer (HWC, etc.) Libraries (SSL, SQLite, etc.)
Services? (SurfaceFlinger, etc.)
System utils (init, ADB, toolbox)
Your application
Platform Architecture - Headless Android based on glibc
Linux kernel (w/Android features: binder, wakelocks, etc.)
Device drivers Bionic libc
H/W Abstraction Layer (HWC, etc.) Libraries (SSL, SQLite, etc.)
Services? (SurfaceFlinger, etc.)
System utils (systemd, busybox)
GNU glibc
Hybris?
Your application
Embedded LinuxFull stack Android Headless GlibcHeadless Bionic
Devices
Display Composition
- No display
- Single full-screen app
- Multiple apps
No display
Multi app
Single app
Embedded LinuxFull stack Android Headless GlibcHeadless Bionic
No Display
Traditional Embedded
- Appliance / IOT
No Graphics Integration
No Composition
No display
Multi app
Single app
Embedded LinuxFull stack Android Headless GlibcHeadless Bionic
Java app/service C/C++ app/service C/C++ app/daemon C/C++ app/daemon
No bionic dependencies
No display
Multi app
Single app
Embedded LinuxFull stack Android Headless GlibcHeadless Bionic
Java app/service C/C++ app/service C/C++ app/daemon C/C++ app/daemon
OpenWRT et al
Single full-screen app
Single-purpose device :
- Digital signage
- Kiosk-style device
- Videoconferencing endpoint
Needs Graphics Integration
No Complex Composition
No display
Multi app
Single app
Embedded LinuxFull stack Android Headless GlibcHeadless Bionic
Java app/service
One “home screen” app EGL Window/Framebuffer
C/C++ app/service C/C++ app/daemon C/C++ app/daemon
SurfaceFlinger/HWC SurfaceFlinger/HWC via
e.g. Hybris
Needs glibc/bionic bridge
for graphics integration
No display
Multi app
Single app
Embedded LinuxFull stack Android Headless GlibcHeadless Bionic
Java app/service
One “home screen” app EGL Window/Framebuffer
C/C++ app/service C/C++ app/daemon C/C++ app/daemon
SurfaceFlinger/HWC SurfaceFlinger/HWC via
e.g. Hybris
Cisco Sparkboard Cisco Spark Room Series
Cisco TelePresence MX/SX
Tesla Car OS?
OpenWRT et al
Multiple Apps
Consumer Device :
- Phone
- Tablet
- Smart TV
Needs App Store (e.g. Google Play)
Needs Complex Composition
No display
Multi app
Single app
Embedded LinuxFull stack Android Headless GlibcHeadless Bionic
Java app/service
One “home screen” app
App Store (Google’s Play
Store if CDD-compliant)
Multiple apps composited
by XServer/Wayland
EGL Window/Framebuffer
C/C++ app/service C/C++ app/daemon C/C++ app/daemon
Multiple apps composited
by SurfaceFlinger/HWC
via e.g. Hybris
Multiple apps composited
by SurfaceFlinger/HWC
SurfaceFlinger/HWC SurfaceFlinger/HWC via
e.g. Hybris
Needs glibc/bionic bridge
Needs complex composition
No display
Multi app
Single app
Embedded LinuxFull stack Android Headless GlibcHeadless Bionic
Java app/service
One “home screen” app
App Store (Google’s Play
Store if CDD-compliant)
Multiple apps composited
by XServer/Wayland
EGL Window/Framebuffer
C/C++ app/service C/C++ app/daemon C/C++ app/daemon
Multiple apps composited
by SurfaceFlinger/HWC
via e.g. Hybris
Multiple apps composited
by SurfaceFlinger/HWC
SurfaceFlinger/HWC SurfaceFlinger/HWC via
e.g. Hybris
Kindle Fire Boot2Qt (1st version) Sailfish (Jolla), Ubuntu Touch
Cisco Sparkboard Cisco Spark Room Series
Samsung Tizen, LG webOS
Cisco TelePresence MX/SX
Tesla Car OS?
OpenWRT et al
Composition
Composition
Need to get pixels on screen
- Compose just one window
with OpenGL
- Compose multiple windows
using external composer /
Hardware Composer
The Hardware Composer
Standardized Android porting
API for rendering to the screen.
Takes a set of surfaces and
composes them to the full frame
for the screen.
LibHybris : Runtime Linker Magic
What is LibHybris?
Dynamically loads and links
bionic libc and bionic linked libs
into a glibc process
Gives access to the bionic libs in
a glibc process
Creator : Carsten Munk
Linux kernel (w/Android features: binder, wakelocks, etc.)
Headless Glibc Android using LibHybris
Your Compositor / GUI App
LibHybris
Bionic
SurfaceFlinger / HWC
OpenGL shared lib
GUI lib
GNU glibc
Other libs
A bionic GPU process?
Pipe GPU commands over a
local pipe to a bionic process
that does the composition.
Linux kernel (w/Android features: binder, wakelocks, etc.)
Headless Glibc Android using a Bionic GPU Process + IPC
GUI AppCompositor
GUI lib
GNU glibc
IPC-GL client
SurfaceFlinger / HWC
OpenGL shared lib
Bionic
IPC
Other libs
IPC-GL server
Using Chromium as GUI
Composing With Chromium
- Single App : Single
fullscreen webapp
(e.g. Electron model)
- Multi App : Browser model,
several webapps composed
together
Process Architecture
- Multi-process
- GPU access and composition
is done in a separate process
Lessons Learned
CC image courtesy of penjelly on Flickr
Existing Codebase
Porting to Java?
Porting from glibc to Bionic?
Rewrite to Android APIs?
What about other APIs you use?
- Do they exist in Android?
3rd-party dependencies?
Port to Bionic? Really !?
Will upstream accept the port?
Remove deps if possible!
What about alternative deps?
Push towards glibc platform!
Bringup & Maintenance
Minimize custom hardware!
Decouple customizations from
upstream BSP/platform
Keep changes out of the BSP
- Above the Android APIs
- Or below user space
(kernel drivers, device tree)
Maintaining Patches
Avoid patches when you can!
Minimize changes to the BSP itself
Decouple your changes from the guts of
Android
Structure your patches!
Patches across many different repos:
- Common scheme for maintenance
- Enumerate your current patchset
- Integrating new upstream release:
- Remove and Refresh
Big Ball of Mud
Plan for updates!
AOSP / BSP : Every year
3rd-party dependencies : Varies
Strict security policies (e.g. OpenSSL)
Chromium : Every month
Chip vendor : Hopefully never!
Too many patches!
- Can’t update Android version
- Can’t update 3rd-party libs
- Security pipeline clogged
- Project stalled!
Wrap it up!
No display
Multi app
Single app
Embedded LinuxFull stack Android Headless GlibcHeadless Bionic
Java app/service
One “home screen” app
App Store (Google’s Play
Store if CDD-compliant)
Multiple apps composited
by XServer/Wayland
EGL Window/Framebuffer
C/C++ app/service C/C++ app/daemon C/C++ app/daemon
Multiple apps composited
by SurfaceFlinger/HWC
via e.g. Hybris
Multiple apps composited
by SurfaceFlinger/HWC
SurfaceFlinger/HWC SurfaceFlinger/HWC via
e.g. Hybris
Your code + 3rd-party
dependencies built
against Bionic
Your code +
3rd-party
dependencies
built against
glibc
Bionic / Glibc
bridge
needed for
graphics &
composition
No display
Multi app
Single app
Embedded LinuxFull stack Android Headless GlibcHeadless Bionic
Java app/service
One “home screen” app
App Store (Google’s Play
Store if CDD-compliant)
Multiple apps composited
by XServer/Wayland
EGL Window/Framebuffer
C/C++ app/service C/C++ app/daemon C/C++ app/daemon
Multiple apps composited
by SurfaceFlinger/HWC
via e.g. Hybris
Multiple apps composited
by SurfaceFlinger/HWC
SurfaceFlinger/HWC SurfaceFlinger/HWC via
e.g. Hybris
Plan for maintenance
Questions?
Feedback, please
Swag!

More Related Content

PDF
Embedded Android Workshop with Pie
Opersys inc.
 
PPTX
GS-4106 The AMD GCN Architecture - A Crash Course, by Layla Mah
AMD Developer Central
 
PPTX
[TGDF 2019] Mali GPU Architecture and Mobile Studio
Owen Wu
 
PPTX
QEMU - Binary Translation
Jiann-Fuh Liaw
 
PDF
Building aosp
gvercoutere
 
PDF
Kernel Module Programming
Saurabh Bangad
 
PPTX
The pocl Kernel Compiler
Clay (Chih-Hao) Chang
 
PDF
Embedded Android : System Development - Part III (Audio / Video HAL)
Emertxe Information Technologies Pvt Ltd
 
Embedded Android Workshop with Pie
Opersys inc.
 
GS-4106 The AMD GCN Architecture - A Crash Course, by Layla Mah
AMD Developer Central
 
[TGDF 2019] Mali GPU Architecture and Mobile Studio
Owen Wu
 
QEMU - Binary Translation
Jiann-Fuh Liaw
 
Building aosp
gvercoutere
 
Kernel Module Programming
Saurabh Bangad
 
The pocl Kernel Compiler
Clay (Chih-Hao) Chang
 
Embedded Android : System Development - Part III (Audio / Video HAL)
Emertxe Information Technologies Pvt Ltd
 

What's hot (20)

ODP
An Introduction to PC-Lint
Ralf Holly
 
PDF
Design and Concepts of Android Graphics
National Cheng Kung University
 
PDF
Power Management from Linux Kernel to Android
National Cheng Kung University
 
PPTX
Yocto Project introduction
Yi-Hsiu Hsu
 
PDF
Ceph RBD Update - June 2021
Ceph Community
 
PDF
Understanding the Android System Server
Opersys inc.
 
PPTX
Linux operating system
ITz_1
 
ODP
Q4.11: Porting Android to new Platforms
Linaro
 
PDF
Linux Systems: Getting started with setting up an Embedded platform
Emertxe Information Technologies Pvt Ltd
 
PDF
AMD EPYC™ Microprocessor Architecture
AMD
 
PDF
Android Chromium Rendering Pipeline
Hyungwook Lee
 
PDF
The Android graphics path, in depth
Chris Simmonds
 
PPT
Learning AOSP - Android Booting Process
Nanik Tolaram
 
PDF
Ceph Object Storage Performance Secrets and Ceph Data Lake Solution
Karan Singh
 
PDF
Reverse Mapping (rmap) in Linux Kernel
Adrian Huang
 
PDF
Embedded Android Workshop
Opersys inc.
 
PDF
Embedded Android
晓东 杜
 
PPTX
Bootloaders (U-Boot)
Omkar Rane
 
PPT
linux device driver
Rahul Batra
 
PDF
Linux Kernel vs DPDK: HTTP Performance Showdown
ScyllaDB
 
An Introduction to PC-Lint
Ralf Holly
 
Design and Concepts of Android Graphics
National Cheng Kung University
 
Power Management from Linux Kernel to Android
National Cheng Kung University
 
Yocto Project introduction
Yi-Hsiu Hsu
 
Ceph RBD Update - June 2021
Ceph Community
 
Understanding the Android System Server
Opersys inc.
 
Linux operating system
ITz_1
 
Q4.11: Porting Android to new Platforms
Linaro
 
Linux Systems: Getting started with setting up an Embedded platform
Emertxe Information Technologies Pvt Ltd
 
AMD EPYC™ Microprocessor Architecture
AMD
 
Android Chromium Rendering Pipeline
Hyungwook Lee
 
The Android graphics path, in depth
Chris Simmonds
 
Learning AOSP - Android Booting Process
Nanik Tolaram
 
Ceph Object Storage Performance Secrets and Ceph Data Lake Solution
Karan Singh
 
Reverse Mapping (rmap) in Linux Kernel
Adrian Huang
 
Embedded Android Workshop
Opersys inc.
 
Embedded Android
晓东 杜
 
Bootloaders (U-Boot)
Omkar Rane
 
linux device driver
Rahul Batra
 
Linux Kernel vs DPDK: HTTP Performance Showdown
ScyllaDB
 
Ad

Similar to Making a Headless Android Device (20)

PDF
Making a Headless Android Device (Oslo Embedded Meetup 2018)
Patricia Aas
 
PDF
Android Hacks, Variants, Tricks and Resources ESC SV 2012
Opersys inc.
 
PDF
Leveraging Android's Linux Heritage at Android Open 2011
Opersys inc.
 
PDF
Leveraging Android's Linux Heritage at AnDevCon IV
Opersys inc.
 
PDF
Headless Android
Opersys inc.
 
PDF
Leveraging Android's Linux Heritage
Opersys inc.
 
PDF
Leveraging Android's Linux Heritage at ELC-E 2011
Opersys inc.
 
PDF
Is Android the New Embedded Linux? at AnDevCon V
Opersys inc.
 
PDF
Android Variants, Hacks, Tricks and Resources presented at AnDevConII
Opersys inc.
 
PDF
Leveraging Android's Linux Heritage at AnDevCon V
Opersys inc.
 
PDF
Is Android the New Embedded Linux? at AnDevCon VI
Opersys inc.
 
PDF
Leveraging Android's Linux Heritage at AnDevCon VI
Opersys inc.
 
PDF
Leveraging Android's Linux Heritage at AnDevCon3
Opersys inc.
 
PDF
Is Android the New Embedded Linux? at AnDevCon IV
Opersys inc.
 
PDF
Android Things Internals
Opersys inc.
 
PDF
Is Android the New King of Embedded OSes at Embedded World 2014
Opersys inc.
 
PDF
Embedded Android Workshop with Marshmallow
Opersys inc.
 
PDF
Is Android the New Embedded Embedded Linux? at Embedded World 2013
Opersys inc.
 
PDF
Embedded Android: Android beyond the smartphone
Chris Simmonds
 
PPT
Portinig Application, Drivers And Os
momobangalore
 
Making a Headless Android Device (Oslo Embedded Meetup 2018)
Patricia Aas
 
Android Hacks, Variants, Tricks and Resources ESC SV 2012
Opersys inc.
 
Leveraging Android's Linux Heritage at Android Open 2011
Opersys inc.
 
Leveraging Android's Linux Heritage at AnDevCon IV
Opersys inc.
 
Headless Android
Opersys inc.
 
Leveraging Android's Linux Heritage
Opersys inc.
 
Leveraging Android's Linux Heritage at ELC-E 2011
Opersys inc.
 
Is Android the New Embedded Linux? at AnDevCon V
Opersys inc.
 
Android Variants, Hacks, Tricks and Resources presented at AnDevConII
Opersys inc.
 
Leveraging Android's Linux Heritage at AnDevCon V
Opersys inc.
 
Is Android the New Embedded Linux? at AnDevCon VI
Opersys inc.
 
Leveraging Android's Linux Heritage at AnDevCon VI
Opersys inc.
 
Leveraging Android's Linux Heritage at AnDevCon3
Opersys inc.
 
Is Android the New Embedded Linux? at AnDevCon IV
Opersys inc.
 
Android Things Internals
Opersys inc.
 
Is Android the New King of Embedded OSes at Embedded World 2014
Opersys inc.
 
Embedded Android Workshop with Marshmallow
Opersys inc.
 
Is Android the New Embedded Embedded Linux? at Embedded World 2013
Opersys inc.
 
Embedded Android: Android beyond the smartphone
Chris Simmonds
 
Portinig Application, Drivers And Os
momobangalore
 
Ad

More from Patricia Aas (20)

PDF
The fundamental misunderstanding in Team Topologies
Patricia Aas
 
PDF
NDC TechTown 2023_ Return Oriented Programming an introduction.pdf
Patricia Aas
 
PDF
Telling a story
Patricia Aas
 
PDF
Return Oriented Programming, an introduction
Patricia Aas
 
PDF
I can't work like this (KDE Academy Keynote 2021)
Patricia Aas
 
PDF
Dependency Management in C++ (NDC TechTown 2021)
Patricia Aas
 
PDF
Introduction to Memory Exploitation (Meeting C++ 2021)
Patricia Aas
 
PDF
Classic Vulnerabilities (MUCplusplus2022).pdf
Patricia Aas
 
PDF
Classic Vulnerabilities (ACCU Keynote 2022)
Patricia Aas
 
PDF
Introduction to Memory Exploitation (CppEurope 2021)
Patricia Aas
 
PDF
Thoughts On Learning A New Programming Language
Patricia Aas
 
PDF
Trying to build an Open Source browser in 2020
Patricia Aas
 
PDF
Trying to build an Open Source browser in 2020
Patricia Aas
 
PDF
DevSecOps for Developers, How To Start (ETC 2020)
Patricia Aas
 
PDF
The Anatomy of an Exploit (NDC TechTown 2019)
Patricia Aas
 
PDF
Elections: Trust and Critical Infrastructure (NDC TechTown 2019)
Patricia Aas
 
PDF
The Anatomy of an Exploit (NDC TechTown 2019))
Patricia Aas
 
PDF
Elections, Trust and Critical Infrastructure (NDC TechTown)
Patricia Aas
 
PDF
Survival Tips for Women in Tech (JavaZone 2019)
Patricia Aas
 
PDF
Embedded Ethics (EuroBSDcon 2019)
Patricia Aas
 
The fundamental misunderstanding in Team Topologies
Patricia Aas
 
NDC TechTown 2023_ Return Oriented Programming an introduction.pdf
Patricia Aas
 
Telling a story
Patricia Aas
 
Return Oriented Programming, an introduction
Patricia Aas
 
I can't work like this (KDE Academy Keynote 2021)
Patricia Aas
 
Dependency Management in C++ (NDC TechTown 2021)
Patricia Aas
 
Introduction to Memory Exploitation (Meeting C++ 2021)
Patricia Aas
 
Classic Vulnerabilities (MUCplusplus2022).pdf
Patricia Aas
 
Classic Vulnerabilities (ACCU Keynote 2022)
Patricia Aas
 
Introduction to Memory Exploitation (CppEurope 2021)
Patricia Aas
 
Thoughts On Learning A New Programming Language
Patricia Aas
 
Trying to build an Open Source browser in 2020
Patricia Aas
 
Trying to build an Open Source browser in 2020
Patricia Aas
 
DevSecOps for Developers, How To Start (ETC 2020)
Patricia Aas
 
The Anatomy of an Exploit (NDC TechTown 2019)
Patricia Aas
 
Elections: Trust and Critical Infrastructure (NDC TechTown 2019)
Patricia Aas
 
The Anatomy of an Exploit (NDC TechTown 2019))
Patricia Aas
 
Elections, Trust and Critical Infrastructure (NDC TechTown)
Patricia Aas
 
Survival Tips for Women in Tech (JavaZone 2019)
Patricia Aas
 
Embedded Ethics (EuroBSDcon 2019)
Patricia Aas
 

Recently uploaded (20)

PPTX
New ThousandEyes Product Innovations: Cisco Live June 2025
ThousandEyes
 
PDF
MASTERDECK GRAPHSUMMIT SYDNEY (Public).pdf
Neo4j
 
PDF
Tea4chat - another LLM Project by Kerem Atam
a0m0rajab1
 
PDF
This slide provides an overview Technology
mineshkharadi333
 
PDF
Unlocking the Future- AI Agents Meet Oracle Database 23ai - AIOUG Yatra 2025.pdf
Sandesh Rao
 
PPTX
How to Build a Scalable Micro-Investing Platform in 2025 - A Founder’s Guide ...
Third Rock Techkno
 
PPTX
cloud computing vai.pptx for the project
vaibhavdobariyal79
 
PDF
Event Presentation Google Cloud Next Extended 2025
minhtrietgect
 
PPTX
The-Ethical-Hackers-Imperative-Safeguarding-the-Digital-Frontier.pptx
sujalchauhan1305
 
PDF
NewMind AI Weekly Chronicles - July'25 - Week IV
NewMind AI
 
PDF
Advances in Ultra High Voltage (UHV) Transmission and Distribution Systems.pdf
Nabajyoti Banik
 
PPTX
ChatGPT's Deck on The Enduring Legacy of Fax Machines
Greg Swan
 
PDF
Software Development Company | KodekX
KodekX
 
PDF
Orbitly Pitch Deck|A Mission-Driven Platform for Side Project Collaboration (...
zz41354899
 
PDF
Research-Fundamentals-and-Topic-Development.pdf
ayesha butalia
 
PPTX
What-is-the-World-Wide-Web -- Introduction
tonifi9488
 
PDF
REPORT: Heating appliances market in Poland 2024
SPIUG
 
PDF
Architecture of the Future (09152021)
EdwardMeyman
 
PPTX
AI and Robotics for Human Well-being.pptx
JAYMIN SUTHAR
 
PDF
Oracle AI Vector Search- Getting Started and what's new in 2025- AIOUG Yatra ...
Sandesh Rao
 
New ThousandEyes Product Innovations: Cisco Live June 2025
ThousandEyes
 
MASTERDECK GRAPHSUMMIT SYDNEY (Public).pdf
Neo4j
 
Tea4chat - another LLM Project by Kerem Atam
a0m0rajab1
 
This slide provides an overview Technology
mineshkharadi333
 
Unlocking the Future- AI Agents Meet Oracle Database 23ai - AIOUG Yatra 2025.pdf
Sandesh Rao
 
How to Build a Scalable Micro-Investing Platform in 2025 - A Founder’s Guide ...
Third Rock Techkno
 
cloud computing vai.pptx for the project
vaibhavdobariyal79
 
Event Presentation Google Cloud Next Extended 2025
minhtrietgect
 
The-Ethical-Hackers-Imperative-Safeguarding-the-Digital-Frontier.pptx
sujalchauhan1305
 
NewMind AI Weekly Chronicles - July'25 - Week IV
NewMind AI
 
Advances in Ultra High Voltage (UHV) Transmission and Distribution Systems.pdf
Nabajyoti Banik
 
ChatGPT's Deck on The Enduring Legacy of Fax Machines
Greg Swan
 
Software Development Company | KodekX
KodekX
 
Orbitly Pitch Deck|A Mission-Driven Platform for Side Project Collaboration (...
zz41354899
 
Research-Fundamentals-and-Topic-Development.pdf
ayesha butalia
 
What-is-the-World-Wide-Web -- Introduction
tonifi9488
 
REPORT: Heating appliances market in Poland 2024
SPIUG
 
Architecture of the Future (09152021)
EdwardMeyman
 
AI and Robotics for Human Well-being.pptx
JAYMIN SUTHAR
 
Oracle AI Vector Search- Getting Started and what's new in 2025- AIOUG Yatra ...
Sandesh Rao
 

Making a Headless Android Device

  • 2. Making a Headless-Android Device Lessons Learned NDC TechTown, 2017 Patricia Aas & Johan Herland Pictures from pixabay.com (CC0)
  • 3. Patricia Aas Vivaldi Technologies Cisco Systems Opera Software Twitter: @pati_gallardo Johan Herland Cisco Systems Opera Software Git Dev Community Twitter: @jherland
  • 4. Outline - Why? - Architecture - Devices - Composition - Chromium - Lessons Learned
  • 5. So… What do we know?
  • 7. And why should you care? Full Android Using Google’s AOSP, or a more customized Android Board Support Package (BSP) from a chip vendor. Embedded Linux No Android parts. Typically based on glibc, busybox, etc.
  • 9. Important questions Do you have: - Existing codebase? - Upstream BSP? - 3rd party dependencies? What kind of device: - Display? - Single or multiple apps? - Custom H/W?
  • 11. Full Stack Android - Java App ecosystem - Graphics infrastructure - Supported by modern SoCs - Linux kernel w/Android features - Libc : Bionic Embedded Linux - Stable/well-known components - “Mix-and-match” - C/C++ or web apps - “Vanilla” kernel (or not...) - Libc : GNU glibc
  • 12. Bionic - Developed specifically for Android - Focus: small size and speed - Compatibility: - Almost all of C11 and POSIX - Some GNU/BSD extensions - C++ : “It’s complicated” GNU glibc - Used “everywhere” - Focus: - Application support - Standards compliance - Completeness - Compatibility: Yes ☺
  • 13. Platform Architecture - Embedded Linux Linux kernel Device drivers GNU glibc Libraries (SSL, SQLite, etc.) System utils (systemd, busybox)H/W abstraction (OpenGL, alsalib, etc.) Compositor (XServer, Wayland) Application framework (Qt, GTK, Chromium) Apps Services/daemons (sshd, httpd) Your application
  • 14. Platform Architecture - Full Stack Android Linux kernel (w/Android features: binder, wakelocks, etc.) Device drivers Bionic libc H/W Abstraction Layer (HWC, etc.) Libraries (SSL, SQLite, etc.) Services (SurfaceFlinger, AudioFlinger, etc.) Android runtime (ART; previously Dalvik JVM) Android Application Framework Android Apps System utils (init, ADB, toolbox) Your application
  • 15. Platform Architecture - Headless Android based on Bionic Linux kernel (w/Android features: binder, wakelocks, etc.) Device drivers Bionic libc H/W Abstraction Layer (HWC, etc.) Libraries (SSL, SQLite, etc.) Services? (SurfaceFlinger, etc.) System utils (init, ADB, toolbox) Your application
  • 16. Platform Architecture - Headless Android based on glibc Linux kernel (w/Android features: binder, wakelocks, etc.) Device drivers Bionic libc H/W Abstraction Layer (HWC, etc.) Libraries (SSL, SQLite, etc.) Services? (SurfaceFlinger, etc.) System utils (systemd, busybox) GNU glibc Hybris? Your application
  • 17. Embedded LinuxFull stack Android Headless GlibcHeadless Bionic
  • 19. Display Composition - No display - Single full-screen app - Multiple apps
  • 20. No display Multi app Single app Embedded LinuxFull stack Android Headless GlibcHeadless Bionic
  • 21. No Display Traditional Embedded - Appliance / IOT No Graphics Integration No Composition
  • 22. No display Multi app Single app Embedded LinuxFull stack Android Headless GlibcHeadless Bionic Java app/service C/C++ app/service C/C++ app/daemon C/C++ app/daemon No bionic dependencies
  • 23. No display Multi app Single app Embedded LinuxFull stack Android Headless GlibcHeadless Bionic Java app/service C/C++ app/service C/C++ app/daemon C/C++ app/daemon OpenWRT et al
  • 24. Single full-screen app Single-purpose device : - Digital signage - Kiosk-style device - Videoconferencing endpoint Needs Graphics Integration No Complex Composition
  • 25. No display Multi app Single app Embedded LinuxFull stack Android Headless GlibcHeadless Bionic Java app/service One “home screen” app EGL Window/Framebuffer C/C++ app/service C/C++ app/daemon C/C++ app/daemon SurfaceFlinger/HWC SurfaceFlinger/HWC via e.g. Hybris Needs glibc/bionic bridge for graphics integration
  • 26. No display Multi app Single app Embedded LinuxFull stack Android Headless GlibcHeadless Bionic Java app/service One “home screen” app EGL Window/Framebuffer C/C++ app/service C/C++ app/daemon C/C++ app/daemon SurfaceFlinger/HWC SurfaceFlinger/HWC via e.g. Hybris Cisco Sparkboard Cisco Spark Room Series Cisco TelePresence MX/SX Tesla Car OS? OpenWRT et al
  • 27. Multiple Apps Consumer Device : - Phone - Tablet - Smart TV Needs App Store (e.g. Google Play) Needs Complex Composition
  • 28. No display Multi app Single app Embedded LinuxFull stack Android Headless GlibcHeadless Bionic Java app/service One “home screen” app App Store (Google’s Play Store if CDD-compliant) Multiple apps composited by XServer/Wayland EGL Window/Framebuffer C/C++ app/service C/C++ app/daemon C/C++ app/daemon Multiple apps composited by SurfaceFlinger/HWC via e.g. Hybris Multiple apps composited by SurfaceFlinger/HWC SurfaceFlinger/HWC SurfaceFlinger/HWC via e.g. Hybris Needs glibc/bionic bridge Needs complex composition
  • 29. No display Multi app Single app Embedded LinuxFull stack Android Headless GlibcHeadless Bionic Java app/service One “home screen” app App Store (Google’s Play Store if CDD-compliant) Multiple apps composited by XServer/Wayland EGL Window/Framebuffer C/C++ app/service C/C++ app/daemon C/C++ app/daemon Multiple apps composited by SurfaceFlinger/HWC via e.g. Hybris Multiple apps composited by SurfaceFlinger/HWC SurfaceFlinger/HWC SurfaceFlinger/HWC via e.g. Hybris Kindle Fire Boot2Qt (1st version) Sailfish (Jolla), Ubuntu Touch Cisco Sparkboard Cisco Spark Room Series Samsung Tizen, LG webOS Cisco TelePresence MX/SX Tesla Car OS? OpenWRT et al
  • 31. Composition Need to get pixels on screen - Compose just one window with OpenGL - Compose multiple windows using external composer / Hardware Composer
  • 32. The Hardware Composer Standardized Android porting API for rendering to the screen. Takes a set of surfaces and composes them to the full frame for the screen.
  • 33. LibHybris : Runtime Linker Magic
  • 34. What is LibHybris? Dynamically loads and links bionic libc and bionic linked libs into a glibc process Gives access to the bionic libs in a glibc process Creator : Carsten Munk
  • 35. Linux kernel (w/Android features: binder, wakelocks, etc.) Headless Glibc Android using LibHybris Your Compositor / GUI App LibHybris Bionic SurfaceFlinger / HWC OpenGL shared lib GUI lib GNU glibc Other libs
  • 36. A bionic GPU process? Pipe GPU commands over a local pipe to a bionic process that does the composition.
  • 37. Linux kernel (w/Android features: binder, wakelocks, etc.) Headless Glibc Android using a Bionic GPU Process + IPC GUI AppCompositor GUI lib GNU glibc IPC-GL client SurfaceFlinger / HWC OpenGL shared lib Bionic IPC Other libs IPC-GL server
  • 39. Composing With Chromium - Single App : Single fullscreen webapp (e.g. Electron model) - Multi App : Browser model, several webapps composed together
  • 40. Process Architecture - Multi-process - GPU access and composition is done in a separate process
  • 41. Lessons Learned CC image courtesy of penjelly on Flickr
  • 42. Existing Codebase Porting to Java? Porting from glibc to Bionic? Rewrite to Android APIs? What about other APIs you use? - Do they exist in Android?
  • 43. 3rd-party dependencies? Port to Bionic? Really !? Will upstream accept the port? Remove deps if possible! What about alternative deps? Push towards glibc platform!
  • 44. Bringup & Maintenance Minimize custom hardware! Decouple customizations from upstream BSP/platform Keep changes out of the BSP - Above the Android APIs - Or below user space (kernel drivers, device tree)
  • 46. Avoid patches when you can! Minimize changes to the BSP itself Decouple your changes from the guts of Android
  • 47. Structure your patches! Patches across many different repos: - Common scheme for maintenance - Enumerate your current patchset - Integrating new upstream release: - Remove and Refresh
  • 48. Big Ball of Mud
  • 49. Plan for updates! AOSP / BSP : Every year 3rd-party dependencies : Varies Strict security policies (e.g. OpenSSL) Chromium : Every month Chip vendor : Hopefully never!
  • 50. Too many patches! - Can’t update Android version - Can’t update 3rd-party libs - Security pipeline clogged - Project stalled!
  • 52. No display Multi app Single app Embedded LinuxFull stack Android Headless GlibcHeadless Bionic Java app/service One “home screen” app App Store (Google’s Play Store if CDD-compliant) Multiple apps composited by XServer/Wayland EGL Window/Framebuffer C/C++ app/service C/C++ app/daemon C/C++ app/daemon Multiple apps composited by SurfaceFlinger/HWC via e.g. Hybris Multiple apps composited by SurfaceFlinger/HWC SurfaceFlinger/HWC SurfaceFlinger/HWC via e.g. Hybris Your code + 3rd-party dependencies built against Bionic Your code + 3rd-party dependencies built against glibc Bionic / Glibc bridge needed for graphics & composition
  • 53. No display Multi app Single app Embedded LinuxFull stack Android Headless GlibcHeadless Bionic Java app/service One “home screen” app App Store (Google’s Play Store if CDD-compliant) Multiple apps composited by XServer/Wayland EGL Window/Framebuffer C/C++ app/service C/C++ app/daemon C/C++ app/daemon Multiple apps composited by SurfaceFlinger/HWC via e.g. Hybris Multiple apps composited by SurfaceFlinger/HWC SurfaceFlinger/HWC SurfaceFlinger/HWC via e.g. Hybris