SlideShare ist ein Scribd-Unternehmen logo
1 von 13
Downloaden Sie, um offline zu lesen
“ Learning AOSP”

Hardware Abstraction Layer

Nanik Tolaram
@nanikjava
(kernel).ozandroid.info
plus.google.com/+NanikT
Thank You !
Architecture
Questions !


What is HAL ?



Why is it such a big deal ?



Why do we care ?



What hardware is part of HAL ?



What is relationship between Android and HAL ?
Hardware Layer
What is HAL ?


Cater for non-GPL vendor code



Included in Android image as blob (.so)



Freeing developer to focus on their app (Camera3 multiple
camera support - KitKat)



Software layer that interact with kernel drivers *NOT* to hardware



/system/lib/hw and /vendor/lib/hw
Hardware
Nexus 7 (2012) [“grouper” ] : Camera, Sensors, Wi-Fi, Bluetooth,
GPS, Touch Panel, Orientation Sensor, Graphics, NFC, DRM
Nexus 7 (2013) [“razor”] : Camera, Sensors, Wi-Fi, Bluetooth, GPS,
Graphics, NFC, DRM, Audio, Sensors, Media, DSP, USB
Nexus 5 [“hammerhead”] : Camera, Sensors, Wi-Fi, Bluetooth, GPS,
Graphics, NFC, Audio, GSM, Camera, Media, DSP, USB
Framework and HAL
HAL Stubs
Android provides the interface that vendors must implement
(/hardware/libhardware/include/hardware)
 HAL process
1.
2.
3.
4.
5.

Java application call hardware framework service API
Framework service call internal API
HAL framework loads hardware library
Obtain device structure from memory
Call HAL stub function
Example - Power HAL
DisplayPowerState.java
DisplayPowerState.java

PowerManagerService.java
PowerManagerService.java

com_android_server_power_PowerManagerService.cpp
com_android_server_power_PowerManagerService.cpp

power.c
power.c

/sys/devices/system/cpu/cpufreq/interactive/timer_rate
/sys/devices/system/cpu/cpufreq/interactive/timer_rate
/sys/devices/system/cpu/cpufreq/interactive/go_hispeed_load
/sys/devices/system/cpu/cpufreq/interactive/go_hispeed_load
/sys/devices/system/cpu/cpufreq/interactive/input_boost
/sys/devices/system/cpu/cpufreq/interactive/input_boost
Example – LCD Backlight
DisplayPowerState.java
DisplayPowerState.java

LightsService.java
LightsService.java

com_android_server_LightsService.cpp
com_android_server_LightsService.cpp

device/asus/grouper/liblights/lights.c
device/asus/grouper/liblights/lights.c

/sys/class/backlight/pwm-backlight/brightness
/sys/class/backlight/pwm-backlight/brightness
HAL Structure
(1)

hw_module_t
hw_module_t

hw_device_t
hw_device_t

Device specific structure
contain hw_module_t
which is queried by
Android framework from
HAL library through
hw_get_module
function

'open' generally called to obtain device
implementation structure

(2)
camera_device
camera_device

nfc_nci_device
nfc_nci_device

audio_hw_device
audio_hw_device

different structure implementation for different hardware

hw_module_methods_t
hw_module_methods_t
* * open (..)
open (..)
Thank You

Weitere ähnliche Inhalte

Was ist angesagt?

Using and Customizing the Android Framework / part 4 of Embedded Android Work...
Using and Customizing the Android Framework / part 4 of Embedded Android Work...Using and Customizing the Android Framework / part 4 of Embedded Android Work...
Using and Customizing the Android Framework / part 4 of Embedded Android Work...Opersys inc.
 
Native Android Userspace part of the Embedded Android Workshop at Linaro Conn...
Native Android Userspace part of the Embedded Android Workshop at Linaro Conn...Native Android Userspace part of the Embedded Android Workshop at Linaro Conn...
Native Android Userspace part of the Embedded Android Workshop at Linaro Conn...Opersys inc.
 
Android booting sequece and setup and debugging
Android booting sequece and setup and debuggingAndroid booting sequece and setup and debugging
Android booting sequece and setup and debuggingUtkarsh Mankad
 
Understanding the Android System Server
Understanding the Android System ServerUnderstanding the Android System Server
Understanding the Android System ServerOpersys inc.
 
A deep dive into Android OpenSource Project(AOSP)
A deep dive into Android OpenSource Project(AOSP)A deep dive into Android OpenSource Project(AOSP)
A deep dive into Android OpenSource Project(AOSP)Siji Sunny
 
Android for Embedded Linux Developers
Android for Embedded Linux DevelopersAndroid for Embedded Linux Developers
Android for Embedded Linux DevelopersOpersys inc.
 
Android Binder IPC for Linux
Android Binder IPC for LinuxAndroid Binder IPC for Linux
Android Binder IPC for LinuxYu-Hsin Hung
 
Learning AOSP - Android Booting Process
Learning AOSP - Android Booting ProcessLearning AOSP - Android Booting Process
Learning AOSP - Android Booting ProcessNanik Tolaram
 
Android's Multimedia Framework
Android's Multimedia FrameworkAndroid's Multimedia Framework
Android's Multimedia FrameworkOpersys inc.
 
Customizing AOSP For Different Embedded Devices And Integration at Applicatio...
Customizing AOSP For Different Embedded Devices And Integration at Applicatio...Customizing AOSP For Different Embedded Devices And Integration at Applicatio...
Customizing AOSP For Different Embedded Devices And Integration at Applicatio...ijafrc
 

Was ist angesagt? (20)

Using and Customizing the Android Framework / part 4 of Embedded Android Work...
Using and Customizing the Android Framework / part 4 of Embedded Android Work...Using and Customizing the Android Framework / part 4 of Embedded Android Work...
Using and Customizing the Android Framework / part 4 of Embedded Android Work...
 
Embedded Android : System Development - Part II (Linux device drivers)
Embedded Android : System Development - Part II (Linux device drivers)Embedded Android : System Development - Part II (Linux device drivers)
Embedded Android : System Development - Part II (Linux device drivers)
 
Android Things : Building Embedded Devices
Android Things : Building Embedded DevicesAndroid Things : Building Embedded Devices
Android Things : Building Embedded Devices
 
Android Internals
Android InternalsAndroid Internals
Android Internals
 
Binder: Android IPC
Binder: Android IPCBinder: Android IPC
Binder: Android IPC
 
Explore Android Internals
Explore Android InternalsExplore Android Internals
Explore 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 Audio System
Android Audio SystemAndroid Audio System
Android Audio System
 
Native Android Userspace part of the Embedded Android Workshop at Linaro Conn...
Native Android Userspace part of the Embedded Android Workshop at Linaro Conn...Native Android Userspace part of the Embedded Android Workshop at Linaro Conn...
Native Android Userspace part of the Embedded Android Workshop at Linaro Conn...
 
Android Internals
Android InternalsAndroid Internals
Android Internals
 
Embedded Android : System Development - Part IV (Android System Services)
Embedded Android : System Development - Part IV (Android System Services)Embedded Android : System Development - Part IV (Android System Services)
Embedded Android : System Development - Part IV (Android System Services)
 
Android booting sequece and setup and debugging
Android booting sequece and setup and debuggingAndroid booting sequece and setup and debugging
Android booting sequece and setup and debugging
 
Understanding the Android System Server
Understanding the Android System ServerUnderstanding the Android System Server
Understanding the Android System Server
 
A deep dive into Android OpenSource Project(AOSP)
A deep dive into Android OpenSource Project(AOSP)A deep dive into Android OpenSource Project(AOSP)
A deep dive into Android OpenSource Project(AOSP)
 
Android for Embedded Linux Developers
Android for Embedded Linux DevelopersAndroid for Embedded Linux Developers
Android for Embedded Linux Developers
 
Android Binder IPC for Linux
Android Binder IPC for LinuxAndroid Binder IPC for Linux
Android Binder IPC for Linux
 
Learning AOSP - Android Booting Process
Learning AOSP - Android Booting ProcessLearning AOSP - Android Booting Process
Learning AOSP - Android Booting Process
 
Android's Multimedia Framework
Android's Multimedia FrameworkAndroid's Multimedia Framework
Android's Multimedia Framework
 
Customizing AOSP For Different Embedded Devices And Integration at Applicatio...
Customizing AOSP For Different Embedded Devices And Integration at Applicatio...Customizing AOSP For Different Embedded Devices And Integration at Applicatio...
Customizing AOSP For Different Embedded Devices And Integration at Applicatio...
 
Android presentation
Android presentationAndroid presentation
Android presentation
 

Ähnlich wie "Learning AOSP" - Android Hardware Abstraction Layer (HAL)

0xdroid -- community-developed Android distribution by 0xlab
0xdroid -- community-developed Android distribution by 0xlab0xdroid -- community-developed Android distribution by 0xlab
0xdroid -- community-developed Android distribution by 0xlabNational Cheng Kung University
 
Google Android Naver 1212
Google Android Naver 1212Google Android Naver 1212
Google Android Naver 1212Yoojoo Jang
 
Android – As a tool of innovation
Android – As a tool of innovation Android – As a tool of innovation
Android – As a tool of innovation Pallab Sarkar
 
Introduction to Android
Introduction to Android Introduction to Android
Introduction to Android Ranjith Kumar
 
2011 01-24 dragino
2011 01-24 dragino2011 01-24 dragino
2011 01-24 draginoAndy Gelme
 
Slides bootcamp21
Slides bootcamp21Slides bootcamp21
Slides bootcamp21dxsaki
 
Android understanding
Android understandingAndroid understanding
Android understandingRamesh Rao
 
Everything about Internet of Things
Everything about Internet of ThingsEverything about Internet of Things
Everything about Internet of ThingsMuhammad Nasr
 
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
 
OW2con'14 - XLcoud, 3D rendering in the cloud, Marius Preda, Institut Mines T...
OW2con'14 - XLcoud, 3D rendering in the cloud, Marius Preda, Institut Mines T...OW2con'14 - XLcoud, 3D rendering in the cloud, Marius Preda, Institut Mines T...
OW2con'14 - XLcoud, 3D rendering in the cloud, Marius Preda, Institut Mines T...xlcloud
 
Android Operating System
Android Operating SystemAndroid Operating System
Android Operating Systemrenoy reji
 
Getting started with Android
Getting started with AndroidGetting started with Android
Getting started with Androidhjue
 
Android Applications Development (a Walkthrough)
Android Applications Development (a Walkthrough)Android Applications Development (a Walkthrough)
Android Applications Development (a Walkthrough)Deuphil Kaufmann
 

Ähnlich wie "Learning AOSP" - Android Hardware Abstraction Layer (HAL) (20)

Android
AndroidAndroid
Android
 
0xdroid -- community-developed Android distribution by 0xlab
0xdroid -- community-developed Android distribution by 0xlab0xdroid -- community-developed Android distribution by 0xlab
0xdroid -- community-developed Android distribution by 0xlab
 
Google Android Naver 1212
Google Android Naver 1212Google Android Naver 1212
Google Android Naver 1212
 
Android Overview
Android OverviewAndroid Overview
Android Overview
 
Android – As a tool of innovation
Android – As a tool of innovation Android – As a tool of innovation
Android – As a tool of innovation
 
Introduction to Android
Introduction to Android Introduction to Android
Introduction to Android
 
Arm
ArmArm
Arm
 
Immersed in the Web
Immersed in the WebImmersed in the Web
Immersed in the Web
 
2011 01-24 dragino
2011 01-24 dragino2011 01-24 dragino
2011 01-24 dragino
 
Slides bootcamp21
Slides bootcamp21Slides bootcamp21
Slides bootcamp21
 
Android understanding
Android understandingAndroid understanding
Android understanding
 
Everything about Internet of Things
Everything about Internet of ThingsEverything about Internet of Things
Everything about Internet of Things
 
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
 
OW2con'14 - XLcoud, 3D rendering in the cloud, Marius Preda, Institut Mines T...
OW2con'14 - XLcoud, 3D rendering in the cloud, Marius Preda, Institut Mines T...OW2con'14 - XLcoud, 3D rendering in the cloud, Marius Preda, Institut Mines T...
OW2con'14 - XLcoud, 3D rendering in the cloud, Marius Preda, Institut Mines T...
 
Android Operating System
Android Operating SystemAndroid Operating System
Android Operating System
 
Getting started with Android
Getting started with AndroidGetting started with Android
Getting started with Android
 
Android Applications Development (a Walkthrough)
Android Applications Development (a Walkthrough)Android Applications Development (a Walkthrough)
Android Applications Development (a Walkthrough)
 
Android Applications Development
Android Applications DevelopmentAndroid Applications Development
Android Applications Development
 
Android Technology
Android TechnologyAndroid Technology
Android Technology
 
2013 Lecture 8: Mobile AR
2013 Lecture 8: Mobile AR2013 Lecture 8: Mobile AR
2013 Lecture 8: Mobile AR
 

Mehr von Nanik Tolaram

Barcelona Meetup Presentation
Barcelona Meetup PresentationBarcelona Meetup Presentation
Barcelona Meetup PresentationNanik Tolaram
 
Diving inside Android Wifi
Diving inside Android WifiDiving inside Android Wifi
Diving inside Android WifiNanik Tolaram
 
Android Internal Services
Android Internal ServicesAndroid Internal Services
Android Internal ServicesNanik Tolaram
 
ODROID Magazine June 2015
ODROID Magazine June 2015ODROID Magazine June 2015
ODROID Magazine June 2015Nanik Tolaram
 
ODROID Magazine January 2015
ODROID Magazine January 2015ODROID Magazine January 2015
ODROID Magazine January 2015Nanik Tolaram
 
ODROID Magazine December 2014
 ODROID Magazine December 2014 ODROID Magazine December 2014
ODROID Magazine December 2014Nanik Tolaram
 
Peeking into Android Source
Peeking into Android SourcePeeking into Android Source
Peeking into Android SourceNanik Tolaram
 
ODROID Magazine September 2014
ODROID Magazine September 2014ODROID Magazine September 2014
ODROID Magazine September 2014Nanik Tolaram
 
Building Android Devices
Building Android DevicesBuilding Android Devices
Building Android DevicesNanik Tolaram
 
ODROID Magazine August 2014
ODROID Magazine August 2014ODROID Magazine August 2014
ODROID Magazine August 2014Nanik Tolaram
 
Android Wear Presentation
Android Wear PresentationAndroid Wear Presentation
Android Wear PresentationNanik Tolaram
 
ODROID Magazine June 2014
ODROID Magazine June 2014ODROID Magazine June 2014
ODROID Magazine June 2014Nanik Tolaram
 
ODROID Magazine May 2014
ODROID Magazine May 2014ODROID Magazine May 2014
ODROID Magazine May 2014Nanik Tolaram
 
Odroid Magazine March 2014
Odroid Magazine March 2014Odroid Magazine March 2014
Odroid Magazine March 2014Nanik Tolaram
 
ODROID Magazine April 2014
ODROID Magazine April 2014ODROID Magazine April 2014
ODROID Magazine April 2014Nanik Tolaram
 
Learning AOSP - Building AOSP for Nexus 7
Learning AOSP - Building AOSP for Nexus 7Learning AOSP - Building AOSP for Nexus 7
Learning AOSP - Building AOSP for Nexus 7Nanik Tolaram
 

Mehr von Nanik Tolaram (17)

Barcelona Meetup Presentation
Barcelona Meetup PresentationBarcelona Meetup Presentation
Barcelona Meetup Presentation
 
Diving inside Android Wifi
Diving inside Android WifiDiving inside Android Wifi
Diving inside Android Wifi
 
Android Source Code
Android Source CodeAndroid Source Code
Android Source Code
 
Android Internal Services
Android Internal ServicesAndroid Internal Services
Android Internal Services
 
ODROID Magazine June 2015
ODROID Magazine June 2015ODROID Magazine June 2015
ODROID Magazine June 2015
 
ODROID Magazine January 2015
ODROID Magazine January 2015ODROID Magazine January 2015
ODROID Magazine January 2015
 
ODROID Magazine December 2014
 ODROID Magazine December 2014 ODROID Magazine December 2014
ODROID Magazine December 2014
 
Peeking into Android Source
Peeking into Android SourcePeeking into Android Source
Peeking into Android Source
 
ODROID Magazine September 2014
ODROID Magazine September 2014ODROID Magazine September 2014
ODROID Magazine September 2014
 
Building Android Devices
Building Android DevicesBuilding Android Devices
Building Android Devices
 
ODROID Magazine August 2014
ODROID Magazine August 2014ODROID Magazine August 2014
ODROID Magazine August 2014
 
Android Wear Presentation
Android Wear PresentationAndroid Wear Presentation
Android Wear Presentation
 
ODROID Magazine June 2014
ODROID Magazine June 2014ODROID Magazine June 2014
ODROID Magazine June 2014
 
ODROID Magazine May 2014
ODROID Magazine May 2014ODROID Magazine May 2014
ODROID Magazine May 2014
 
Odroid Magazine March 2014
Odroid Magazine March 2014Odroid Magazine March 2014
Odroid Magazine March 2014
 
ODROID Magazine April 2014
ODROID Magazine April 2014ODROID Magazine April 2014
ODROID Magazine April 2014
 
Learning AOSP - Building AOSP for Nexus 7
Learning AOSP - Building AOSP for Nexus 7Learning AOSP - Building AOSP for Nexus 7
Learning AOSP - Building AOSP for Nexus 7
 

Kürzlich hochgeladen

Young adult book quiz by SJU quizzers.ppt
Young adult book quiz by SJU quizzers.pptYoung adult book quiz by SJU quizzers.ppt
Young adult book quiz by SJU quizzers.pptSJU Quizzers
 
Inside Look: Brooke Monk's Exclusive OnlyFans Content Production
Inside Look: Brooke Monk's Exclusive OnlyFans Content ProductionInside Look: Brooke Monk's Exclusive OnlyFans Content Production
Inside Look: Brooke Monk's Exclusive OnlyFans Content Productionget joys
 
Holi:: "The Festival of Colors in India"
Holi:: "The Festival of Colors in India"Holi:: "The Festival of Colors in India"
Holi:: "The Festival of Colors in India"IdolsArts
 
Taylor Swift quiz( with answers) by SJU quizzers
Taylor Swift quiz( with answers) by SJU quizzersTaylor Swift quiz( with answers) by SJU quizzers
Taylor Swift quiz( with answers) by SJU quizzersSJU Quizzers
 
5 Moments of Everyday Self-Loathing That Perfectly Describe Your Life
5 Moments of Everyday Self-Loathing That Perfectly Describe Your Life5 Moments of Everyday Self-Loathing That Perfectly Describe Your Life
5 Moments of Everyday Self-Loathing That Perfectly Describe Your LifeSalty Vixen Stories & More
 
Carowinds 2024: Thrills, Spills & Surprises
Carowinds 2024: Thrills, Spills & SurprisesCarowinds 2024: Thrills, Spills & Surprises
Carowinds 2024: Thrills, Spills & Surprisescarawinds99
 
"Quest for Knowledge: An Exciting Journey Through 40 Brain-Bending Questions ...
"Quest for Knowledge: An Exciting Journey Through 40 Brain-Bending Questions ..."Quest for Knowledge: An Exciting Journey Through 40 Brain-Bending Questions ...
"Quest for Knowledge: An Exciting Journey Through 40 Brain-Bending Questions ...RAGHURAMYC
 

Kürzlich hochgeladen (7)

Young adult book quiz by SJU quizzers.ppt
Young adult book quiz by SJU quizzers.pptYoung adult book quiz by SJU quizzers.ppt
Young adult book quiz by SJU quizzers.ppt
 
Inside Look: Brooke Monk's Exclusive OnlyFans Content Production
Inside Look: Brooke Monk's Exclusive OnlyFans Content ProductionInside Look: Brooke Monk's Exclusive OnlyFans Content Production
Inside Look: Brooke Monk's Exclusive OnlyFans Content Production
 
Holi:: "The Festival of Colors in India"
Holi:: "The Festival of Colors in India"Holi:: "The Festival of Colors in India"
Holi:: "The Festival of Colors in India"
 
Taylor Swift quiz( with answers) by SJU quizzers
Taylor Swift quiz( with answers) by SJU quizzersTaylor Swift quiz( with answers) by SJU quizzers
Taylor Swift quiz( with answers) by SJU quizzers
 
5 Moments of Everyday Self-Loathing That Perfectly Describe Your Life
5 Moments of Everyday Self-Loathing That Perfectly Describe Your Life5 Moments of Everyday Self-Loathing That Perfectly Describe Your Life
5 Moments of Everyday Self-Loathing That Perfectly Describe Your Life
 
Carowinds 2024: Thrills, Spills & Surprises
Carowinds 2024: Thrills, Spills & SurprisesCarowinds 2024: Thrills, Spills & Surprises
Carowinds 2024: Thrills, Spills & Surprises
 
"Quest for Knowledge: An Exciting Journey Through 40 Brain-Bending Questions ...
"Quest for Knowledge: An Exciting Journey Through 40 Brain-Bending Questions ..."Quest for Knowledge: An Exciting Journey Through 40 Brain-Bending Questions ...
"Quest for Knowledge: An Exciting Journey Through 40 Brain-Bending Questions ...
 

"Learning AOSP" - Android Hardware Abstraction Layer (HAL)

  • 1. “ Learning AOSP” Hardware Abstraction Layer Nanik Tolaram @nanikjava (kernel).ozandroid.info plus.google.com/+NanikT
  • 4. Questions !  What is HAL ?  Why is it such a big deal ?  Why do we care ?  What hardware is part of HAL ?  What is relationship between Android and HAL ?
  • 6. What is HAL ?  Cater for non-GPL vendor code  Included in Android image as blob (.so)  Freeing developer to focus on their app (Camera3 multiple camera support - KitKat)  Software layer that interact with kernel drivers *NOT* to hardware  /system/lib/hw and /vendor/lib/hw
  • 7. Hardware Nexus 7 (2012) [“grouper” ] : Camera, Sensors, Wi-Fi, Bluetooth, GPS, Touch Panel, Orientation Sensor, Graphics, NFC, DRM Nexus 7 (2013) [“razor”] : Camera, Sensors, Wi-Fi, Bluetooth, GPS, Graphics, NFC, DRM, Audio, Sensors, Media, DSP, USB Nexus 5 [“hammerhead”] : Camera, Sensors, Wi-Fi, Bluetooth, GPS, Graphics, NFC, Audio, GSM, Camera, Media, DSP, USB
  • 9. HAL Stubs Android provides the interface that vendors must implement (/hardware/libhardware/include/hardware)  HAL process 1. 2. 3. 4. 5. Java application call hardware framework service API Framework service call internal API HAL framework loads hardware library Obtain device structure from memory Call HAL stub function
  • 10. Example - Power HAL DisplayPowerState.java DisplayPowerState.java PowerManagerService.java PowerManagerService.java com_android_server_power_PowerManagerService.cpp com_android_server_power_PowerManagerService.cpp power.c power.c /sys/devices/system/cpu/cpufreq/interactive/timer_rate /sys/devices/system/cpu/cpufreq/interactive/timer_rate /sys/devices/system/cpu/cpufreq/interactive/go_hispeed_load /sys/devices/system/cpu/cpufreq/interactive/go_hispeed_load /sys/devices/system/cpu/cpufreq/interactive/input_boost /sys/devices/system/cpu/cpufreq/interactive/input_boost
  • 11. Example – LCD Backlight DisplayPowerState.java DisplayPowerState.java LightsService.java LightsService.java com_android_server_LightsService.cpp com_android_server_LightsService.cpp device/asus/grouper/liblights/lights.c device/asus/grouper/liblights/lights.c /sys/class/backlight/pwm-backlight/brightness /sys/class/backlight/pwm-backlight/brightness
  • 12. HAL Structure (1) hw_module_t hw_module_t hw_device_t hw_device_t Device specific structure contain hw_module_t which is queried by Android framework from HAL library through hw_get_module function 'open' generally called to obtain device implementation structure (2) camera_device camera_device nfc_nci_device nfc_nci_device audio_hw_device audio_hw_device different structure implementation for different hardware hw_module_methods_t hw_module_methods_t * * open (..) open (..)