先上圖
圖片來源和本文參考地址:https://developer.android.com/guide/platform/index.html
Android 5.0 起的平臺架構從原來的四層變成了五層,新增了一個硬件抽象層,這五層分別是Linux 內核層、硬件抽象層、原生 C/C++ 庫 和 Android運行時、Java API框架層、系統應用。
Linux 內核層
Linux內核層包括電源管理和硬件驅動,硬件驅動有音頻、Binder(IPC 進程間通信)、顯示、鍵盤、藍牙、攝像頭、共享內存、USB、WIFI。
硬件抽象層
對于新增的這層,官方給出的定義是
The hardware abstraction layer (HAL) provides standard interfaces that expose device hardware capabilities to the higher-level Java API framework. The HAL consists of multiple library modules, each of which implements an interface for a specific type of hardware component, such as the camera or bluetooth module. When a framework API makes a call to access device hardware, the Android system loads the library module for that hardware component.
翻譯過來就是:
硬件抽象層 (HAL) 提供標準接口,暴露設備硬件功能給上層的 Java API 框架(也就是連接底層的內核驅動和上層的Java API框架)。HAL 包含多個庫模塊,其中每個模塊都為特定類型的硬件組件實現一個接口,例如相機或藍牙模塊。當框架 API 要求訪問設備硬件時,Android 系統將為該硬件組件加載庫模塊。
原生 C/C++ 庫
Many core Android system components and services, such as ART and HAL, are built from native code that require native libraries written in C and C++.
原生庫是用C和C++編寫的,許多核心 Android 系統組件和服務都依賴于這個庫
原生庫包含Webkit瀏覽器引擎、Media Framework多媒體框架、OpenGL ES圖形引擎、OpenMAX AL解碼器、Libc即C語言函數庫 等
Android運行時
Android5.0之前的Android運行時是Dalvik,之后是ART。
Android also includes a set of core runtime libraries that provide most of the functionality of the Java programming language, including some Java 8 language features, that the Java API framework uses.
Android 還包含一套核心運行時庫,提供上層 Java API 框架使用的 Java 編程語言大部分功能,包括 Java 8 新特性。
Java API框架層
這層我就不細說了,主要包括View System、ContentProvider和各類管理器
系統應用
這層系統應用指的是Android 系統自帶的應用(安裝在/system/app分區),比如電話、短信、聯系人、日歷、瀏覽器、電子郵件、下載等
The system apps function both as apps for users and to provide key capabilities that developers can access from their own app. For example, if your app would like to deliver an SMS message, you don't need to build that functionality yourself—you can instead invoke whichever SMS app is already installed to deliver a message to the recipient you specify.
系統應用可用作用戶的應用,以及提供開發者從自己的應用訪問的功能。例如,如果您的應用要發短信,您無需自己構建該功能,可以改為調用已安裝的短信應用向您指定的接收者發送消息。