1. 程式人生 > >Android Framework 深入淺出-HAL, Binder, View System 與 Native Service

Android Framework 深入淺出-HAL, Binder, View System 與 Native Service

     Android 的 HAL (硬體抽像層)是 Google 因應廠商“希望不公開原始碼”(就是為了避開linux kernel的GPL license的束縛)的要求下,所推出的新觀念。HAL 的目的是為了把 Android framework 與 Linux kernel 完整“隔開”,簡而言之,Android把控制硬體的動作都放到了user space中,而再kernel driver裡面只有最簡單的讀寫暫存器的操作,而完全去掉了各種功能性的操作(比如控制邏輯等),這些能夠體現硬體特性的操作都放到了Android的HAL層,而Android是基於Aparch的license,因此硬體廠商可以只提供二進位制程式碼,所以說Android只是一個開放的平臺,並不是一個開源的平臺。讓 Android 不至過度依賴 Linux kernel ,讓 Android framework 的開發能在不考慮驅動程式的前提下進行發展。
由於Android的Java層級只是一個外殼框架而已,大部分的系統元件(Android本身)都是在Nataive層(又稱C/C++層)執行。這是Android的整體架構,所以我們的應用程式也必須考慮分為兩層的必要性,才能完全的融入Android的整體架構裡。我們看到的Android應用架構(Application Framework)其實只是Android整體架構裡的外殼結構而已。

第01堂課:Hardware Abstract Layer 架構與驅動模組開發

1.1 Service與Manager的內涵
1.2 libhardware 與 HAL API
1.3 Stub & Module 的理念
1.4 HAL Stub Analysis and Design (OOAD)
1.5 HAL Stub Class
1.6 HAL Stub Interface

第02堂課:Android Service 架構與 SystemServer 整合開發
2.1 Zygote & SystemServer 介紹
2.2 ServiceManager介紹
2.3 IPC、 Remote method call與Binder觀念說明
2.4 AIDL介紹與IInterface設計理念解析
2.5 Activity & ApplicationContext
2.6 ServiceManager

第03堂課:Android Framework 架構原理分析 (OOD)
3.1 JNI 開發
3.2 Remote Object觀念與IBinder介紹
3.3 如何以Proxy Object整合Android Service
3.4 Handler 與 Message 的解析與案例剖析

3.5 Doing Long Operations

3.6 Design Patterns of Android Framework

第04堂課:Android Process 模式與系統程式
4.1 Component與 Main Thread
4.2 Instance of Dalvik VM
4.3 Introduction of Dalvik VM
4.4 Android Process Model
4.5 Class Preloading
4.6 Dalvik VM Instantiation & Initialization

第5堂課:Manager API & Context
6.1 Introduction Context
6.2 getSystemService()
6.3 IPC & AIDL
6.4 IPC with Android Service using Binder Proxy

第7堂課:Native Service 實現完整解析
7.1 使用 IInterface (Java vs C++)
7.2 使用 BnInterface 與 BpInterface
7.4 Implementation of Native Servic
7.5 Implement Native Binder Proxy

第8堂課:Binder 原理與核心架構解析
8.1 Proxy Design Pattern
8.2 .asInterface() 深入解析
8.3 Linux Binder 驅動解析
8.4 BpInterface, Proxy object 與 IPC transaction
8.5 Architect of SensorManager

第9堂課:View System 設計模式與實現原理解析
9.1 Introduction to Activity, Window and View
9.2 Architecture of Android View System
9.3 Surface and Canvas
9.4 The flow of drawing: from View to SurfaceFlinger
9.5 The MVC design of View Hierarchy
9.6 The Composite pattern of View Hierarchy