SlideShare ist ein Scribd-Unternehmen logo
1 von 13
“ 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?

Android audio system(audioflinger)
Android audio system(audioflinger)Android audio system(audioflinger)
Android audio system(audioflinger)
fefe7270
 
Overview of Android binder IPC implementation
Overview of Android binder IPC implementationOverview of Android binder IPC implementation
Overview of Android binder IPC implementation
Chethan Pchethan
 
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 Boot Time Optimization
Android Boot Time OptimizationAndroid Boot Time Optimization
Android Boot Time Optimization
Kan-Ru Chen
 

Was ist angesagt? (20)

Learning AOSP - Android Booting Process
Learning AOSP - Android Booting ProcessLearning AOSP - Android Booting Process
Learning AOSP - Android Booting Process
 
Android audio system(audioflinger)
Android audio system(audioflinger)Android audio system(audioflinger)
Android audio system(audioflinger)
 
Learning AOSP - Android Linux Device Driver
Learning AOSP - Android Linux Device DriverLearning AOSP - Android Linux Device Driver
Learning AOSP - Android Linux Device Driver
 
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)
 
Understanding the Android System Server
Understanding the Android System ServerUnderstanding the Android System Server
Understanding the Android System Server
 
Android Internals
Android InternalsAndroid Internals
Android Internals
 
Overview of Android binder IPC implementation
Overview of Android binder IPC implementationOverview of Android binder IPC implementation
Overview of Android binder IPC implementation
 
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 presentation
Android presentationAndroid presentation
Android presentation
 
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 Audio System
Android Audio SystemAndroid Audio System
Android Audio System
 
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
 
Embedded Android Workshop
Embedded Android WorkshopEmbedded Android Workshop
Embedded Android Workshop
 
Android Treble: Blessing or Trouble?
Android Treble: Blessing or Trouble?Android Treble: Blessing or Trouble?
Android Treble: Blessing or Trouble?
 
Accessing Hardware on Android
Accessing Hardware on AndroidAccessing Hardware on Android
Accessing Hardware on Android
 
Explore Android Internals
Explore Android InternalsExplore Android Internals
Explore Android Internals
 
Android Internals
Android InternalsAndroid Internals
Android Internals
 
Android's Multimedia Framework
Android's Multimedia FrameworkAndroid's Multimedia Framework
Android's Multimedia Framework
 
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 Boot Time Optimization
Android Boot Time OptimizationAndroid Boot Time Optimization
Android Boot Time Optimization
 

Ä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 0xlab
National Cheng Kung University
 
Google Android Naver 1212
Google Android Naver 1212Google Android Naver 1212
Google Android Naver 1212
Yoojoo Jang
 
Getting started with Android
Getting started with AndroidGetting started with Android
Getting started with Android
hjue
 

Ä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

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

Russian Escorts Agency In Goa 💚 9316020077 💚 Russian Call Girl Goa
Russian Escorts Agency In Goa  💚 9316020077 💚 Russian Call Girl GoaRussian Escorts Agency In Goa  💚 9316020077 💚 Russian Call Girl Goa
Russian Escorts Agency In Goa 💚 9316020077 💚 Russian Call Girl Goa
sexy call girls service in goa
 
Call Girls Agency In Goa 💚 9316020077 💚 Call Girl Goa By Russian Call Girl ...
Call Girls  Agency In Goa  💚 9316020077 💚 Call Girl Goa By Russian Call Girl ...Call Girls  Agency In Goa  💚 9316020077 💚 Call Girl Goa By Russian Call Girl ...
Call Girls Agency In Goa 💚 9316020077 💚 Call Girl Goa By Russian Call Girl ...
russian goa call girl and escorts service
 
Russian ℂall gIRLS In Goa 9316020077 ℂall gIRLS Service In Goa
Russian ℂall gIRLS In Goa 9316020077  ℂall gIRLS Service  In GoaRussian ℂall gIRLS In Goa 9316020077  ℂall gIRLS Service  In Goa
Russian ℂall gIRLS In Goa 9316020077 ℂall gIRLS Service In Goa
russian goa call girl and escorts service
 

Kürzlich hochgeladen (20)

5* Hotels Call Girls In Goa {{07028418221}} Call Girls In North Goa Escort Se...
5* Hotels Call Girls In Goa {{07028418221}} Call Girls In North Goa Escort Se...5* Hotels Call Girls In Goa {{07028418221}} Call Girls In North Goa Escort Se...
5* Hotels Call Girls In Goa {{07028418221}} Call Girls In North Goa Escort Se...
 
Russian Escorts Agency In Goa 💚 9316020077 💚 Russian Call Girl Goa
Russian Escorts Agency In Goa  💚 9316020077 💚 Russian Call Girl GoaRussian Escorts Agency In Goa  💚 9316020077 💚 Russian Call Girl Goa
Russian Escorts Agency In Goa 💚 9316020077 💚 Russian Call Girl Goa
 
📞 Contact Number 8617697112 VIP Ganderbal Call Girls
📞 Contact Number 8617697112 VIP Ganderbal Call Girls📞 Contact Number 8617697112 VIP Ganderbal Call Girls
📞 Contact Number 8617697112 VIP Ganderbal Call Girls
 
↑Top Model (Kolkata) Call Girls Sonagachi ⟟ 8250192130 ⟟ High Class Call Girl...
↑Top Model (Kolkata) Call Girls Sonagachi ⟟ 8250192130 ⟟ High Class Call Girl...↑Top Model (Kolkata) Call Girls Sonagachi ⟟ 8250192130 ⟟ High Class Call Girl...
↑Top Model (Kolkata) Call Girls Sonagachi ⟟ 8250192130 ⟟ High Class Call Girl...
 
𓀤Call On 6297143586 𓀤 Sonagachi Call Girls In All Kolkata 24/7 Provide Call W...
𓀤Call On 6297143586 𓀤 Sonagachi Call Girls In All Kolkata 24/7 Provide Call W...𓀤Call On 6297143586 𓀤 Sonagachi Call Girls In All Kolkata 24/7 Provide Call W...
𓀤Call On 6297143586 𓀤 Sonagachi Call Girls In All Kolkata 24/7 Provide Call W...
 
Independent Joka Escorts ✔ 8250192130 ✔ Full Night With Room Online Booking 2...
Independent Joka Escorts ✔ 8250192130 ✔ Full Night With Room Online Booking 2...Independent Joka Escorts ✔ 8250192130 ✔ Full Night With Room Online Booking 2...
Independent Joka Escorts ✔ 8250192130 ✔ Full Night With Room Online Booking 2...
 
VIP Model Call Girls Koregaon Park ( Pune ) Call ON 8005736733 Starting From ...
VIP Model Call Girls Koregaon Park ( Pune ) Call ON 8005736733 Starting From ...VIP Model Call Girls Koregaon Park ( Pune ) Call ON 8005736733 Starting From ...
VIP Model Call Girls Koregaon Park ( Pune ) Call ON 8005736733 Starting From ...
 
↑Top Model (Kolkata) Call Girls Howrah ⟟ 8250192130 ⟟ High Class Call Girl In...
↑Top Model (Kolkata) Call Girls Howrah ⟟ 8250192130 ⟟ High Class Call Girl In...↑Top Model (Kolkata) Call Girls Howrah ⟟ 8250192130 ⟟ High Class Call Girl In...
↑Top Model (Kolkata) Call Girls Howrah ⟟ 8250192130 ⟟ High Class Call Girl In...
 
Model Call Girls In Pazhavanthangal WhatsApp Booking 7427069034 call girl ser...
Model Call Girls In Pazhavanthangal WhatsApp Booking 7427069034 call girl ser...Model Call Girls In Pazhavanthangal WhatsApp Booking 7427069034 call girl ser...
Model Call Girls In Pazhavanthangal WhatsApp Booking 7427069034 call girl ser...
 
↑Top Model (Kolkata) Call Girls Rajpur ⟟ 8250192130 ⟟ High Class Call Girl In...
↑Top Model (Kolkata) Call Girls Rajpur ⟟ 8250192130 ⟟ High Class Call Girl In...↑Top Model (Kolkata) Call Girls Rajpur ⟟ 8250192130 ⟟ High Class Call Girl In...
↑Top Model (Kolkata) Call Girls Rajpur ⟟ 8250192130 ⟟ High Class Call Girl In...
 
Book Paid Sonagachi Call Girls Kolkata 𖠋 8250192130 𖠋Low Budget Full Independ...
Book Paid Sonagachi Call Girls Kolkata 𖠋 8250192130 𖠋Low Budget Full Independ...Book Paid Sonagachi Call Girls Kolkata 𖠋 8250192130 𖠋Low Budget Full Independ...
Book Paid Sonagachi Call Girls Kolkata 𖠋 8250192130 𖠋Low Budget Full Independ...
 
VIP Model Call Girls Budhwar Peth ( Pune ) Call ON 8005736733 Starting From 5...
VIP Model Call Girls Budhwar Peth ( Pune ) Call ON 8005736733 Starting From 5...VIP Model Call Girls Budhwar Peth ( Pune ) Call ON 8005736733 Starting From 5...
VIP Model Call Girls Budhwar Peth ( Pune ) Call ON 8005736733 Starting From 5...
 
Hotel And Home Service Available Kolkata Call Girls Sonagachi ✔ 6297143586 ✔C...
Hotel And Home Service Available Kolkata Call Girls Sonagachi ✔ 6297143586 ✔C...Hotel And Home Service Available Kolkata Call Girls Sonagachi ✔ 6297143586 ✔C...
Hotel And Home Service Available Kolkata Call Girls Sonagachi ✔ 6297143586 ✔C...
 
𓀤Call On 6297143586 𓀤 Ultadanga Call Girls In All Kolkata 24/7 Provide Call W...
𓀤Call On 6297143586 𓀤 Ultadanga Call Girls In All Kolkata 24/7 Provide Call W...𓀤Call On 6297143586 𓀤 Ultadanga Call Girls In All Kolkata 24/7 Provide Call W...
𓀤Call On 6297143586 𓀤 Ultadanga Call Girls In All Kolkata 24/7 Provide Call W...
 
Call Girls in Barasat | 7001035870 At Low Cost Cash Payment Booking
Call Girls in Barasat | 7001035870 At Low Cost Cash Payment BookingCall Girls in Barasat | 7001035870 At Low Cost Cash Payment Booking
Call Girls in Barasat | 7001035870 At Low Cost Cash Payment Booking
 
Call Girls Agency In Goa 💚 9316020077 💚 Call Girl Goa By Russian Call Girl ...
Call Girls  Agency In Goa  💚 9316020077 💚 Call Girl Goa By Russian Call Girl ...Call Girls  Agency In Goa  💚 9316020077 💚 Call Girl Goa By Russian Call Girl ...
Call Girls Agency In Goa 💚 9316020077 💚 Call Girl Goa By Russian Call Girl ...
 
Kanpur call girls 📞 8617697112 At Low Cost Cash Payment Booking
Kanpur call girls 📞 8617697112 At Low Cost Cash Payment BookingKanpur call girls 📞 8617697112 At Low Cost Cash Payment Booking
Kanpur call girls 📞 8617697112 At Low Cost Cash Payment Booking
 
Russian ℂall gIRLS In Goa 9316020077 ℂall gIRLS Service In Goa
Russian ℂall gIRLS In Goa 9316020077  ℂall gIRLS Service  In GoaRussian ℂall gIRLS In Goa 9316020077  ℂall gIRLS Service  In Goa
Russian ℂall gIRLS In Goa 9316020077 ℂall gIRLS Service In Goa
 
College Call Girls Pune 8617697112 Short 1500 Night 6000 Best call girls Service
College Call Girls Pune 8617697112 Short 1500 Night 6000 Best call girls ServiceCollege Call Girls Pune 8617697112 Short 1500 Night 6000 Best call girls Service
College Call Girls Pune 8617697112 Short 1500 Night 6000 Best call girls Service
 
Science City Kolkata ( Call Girls ) Kolkata ✔ 6297143586 ✔ Hot Model With Sex...
Science City Kolkata ( Call Girls ) Kolkata ✔ 6297143586 ✔ Hot Model With Sex...Science City Kolkata ( Call Girls ) Kolkata ✔ 6297143586 ✔ Hot Model With Sex...
Science City Kolkata ( Call Girls ) Kolkata ✔ 6297143586 ✔ Hot Model With Sex...
 

"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 (..)