Android 7.0,(N) 相容性定義

目錄

一、簡介

本文檔列舉了裝置與 Android 7.1 相容必須滿足的要求。

「MUST」、「MUST NOT」、「REQUIRED」、「SHALL」、「SHALL NOT」、「SHOULD」、「SHOULD NOT」、「RECOMMENDED」、「MAY」和「OPTIONAL」的使用符合 IETF 標準RFC2119中定義的標準。

在本文檔中,「裝置實施者」或「實施者」是指開發運行 Android 7.1 的硬體/軟體解決方案的個人或組織。 “設備實現”或“實現是這樣開發的硬體/軟體解決方案。

若要被視為與 Android 7.1 相容,裝置實作必須滿足此相容性定義中提出的要求,包括透過引用納入的任何文件。

如果第 10 節中所述的此定義或軟體測試是沉默的、不明確的或不完整的,則設備實現者有責任確保與現有實現的兼容性。

因此, Android 開源專案既是 Android 的參考實現,也是首選實現。強烈建議設備實現者最大程度地基於 Android 開源專案提供的「上游」原始程式碼來實現其實現。雖然假設某些組件可以替換為替代實現,但強烈建議不要遵循這種做法,因為通過軟體測試將變得更加困難。實作者有責任確保與標準 Android 實作完全行為相容,包括相容性測試套件。最後,請注意,本文檔明確禁止某些組件替換和修改。

本文檔中連結的許多資源直接或間接源自 Android SDK,並且在功能上與該 SDK 文件中的資訊相同。在任何情況下,如果本相容性定義或相容性測試套件與 SDK 文件不一致,則 SDK 文件被視為具有權威性。本文檔中連結資源中提供的任何技術細節均被視為本相容性定義的一部分。

2. 設備類型

雖然 Android 開源專案已用於實現各種裝置類型和外形尺寸,但架構和相容性要求的許多方面都針對手持裝置進行了最佳化。從 Android 5.0 開始,Android 開源專案旨在涵蓋本節中所述的更廣泛的裝置類型。

Android 手持裝置是指通常手持使用的 Android 裝置實現,例如 MP3 播放器、手機和平板電腦。 Android 手持裝置實作:

  • 設備中必須嵌入觸控螢幕。
  • 必須有提供移動性的電源,例如電池。

Android TV 裝置是指一種Android 裝置實現,它是一個娛樂介面,用於為坐在大約10 英尺外的用戶消費數位媒體、電影、遊戲、應用程式和/或直播電視(「向後靠」或“10 英尺使用者介面”) ”)。 Android 電視裝置:

  • 必須具有嵌入式螢幕或包含視訊輸出端口,例如 VGA、HDMI 或用於顯示的無線端口。
  • 必須聲明android.software.leanback和 android.hardware.type.television 功能。

Android Watch 裝置是指旨在佩戴在身體上(可能戴在手腕上)的 Android 裝置實現,並且:

  • 螢幕的實體對角線長度必須在 1.1 到 2.5 吋範圍內。
  • 必須聲明 android.hardware.type.watch 功能。
  • 必須支援 uiMode = UI_MODE_TYPE_WATCH

Android Automotive 實作是指運行 Android 作為部分或全部系統和/或資訊娛樂功能的作業系統的車輛主機。 Android 汽車實現:

  • 螢幕的物理對角線長度必須等於或大於 6 吋。
  • 必須聲明 android.hardware.type.automotive 功能。
  • 必須支援 uiMode = UI_MODE_TYPE_CAR
  • Android Automotive 實作必須支援android.car.*命名空間中的所有公用 API。

所有不適合上述任何裝置類型的 Android 裝置實作仍必須滿足本文檔中與 Android 7.1 相容的所有要求,除非該要求明確描述為僅適用於上述特定 Android 裝置類型。

2.1 設備配置

這是按設備類型劃分的硬體配置主要差異的摘要。 (空單元格表示“可以”)。此表並未涵蓋所有配置;有關更多詳細信息,請參閱相關硬體部分。

類別特徵部分手持式電視手錶汽車其他
輸入方向鍵7.2.2.非觸控式導航必須
觸控螢幕7.2.4.觸控螢幕輸入必須必須應該
麥克風7.8.1.麥克風必須應該必須必須應該
感應器加速度計7.3.1 加速度計應該應該應該
全球定位系統7.3.3.全球定位系統應該應該
連接性無線上網7.4.2. IEEE 802.11應該應該應該應該
無線直連7.4.2.1.無線直連應該應該應該
藍牙7.4.3.藍牙應該必須必須必須應該
藍牙低功耗7.4.3.藍牙應該必須應該應該應該
蜂巢式無線電7.4.5。最低網路能力應該
USB週邊/主機模式7.7. USB應該應該應該
輸出揚聲器和/或音訊輸出端口7.8.2.音訊輸出必須必須必須必須

3、軟體

3.1.託管 API 相容性

託管的 Dalvik 字節碼執行環境是 Android 應用程式的主要工具。 Android 應用程式介面 (API) 是向在託管執行時間環境中運行的應用程式公開的一組 Android 平台介面。裝置實作必須提供完整的實現,包括Android SDK公開的任何記錄的 API 或上游 Android 原始碼中用「@SystemApi」標記修飾的任何 API 的完整實現,包括所有記錄的行為。

裝置實作必須支援/保留由 TestApi 註解 (@TestApi) 標記的所有類別、方法和關聯元素。

設備實作不得省略任何託管 API、更改 API 介面或簽章、偏離記錄的行為或包含無操作,除非本相容性定義明確允許。

此相容性定義允許裝置實作省略 Android 包含的 API 的某些類型的硬體。在這種情況下,API 必須仍然存在並以合理的方式運行。有關此場景的具體要求,請參閱第 7 節

3.1.1.安卓擴充

Android 支援擴充託管 API,同時保持相同的 API 等級版本。 Android 裝置實作必須預先載入共用程式庫ExtShared和服務ExtServices的 AOSP 實現,其版本高於或等於每個 API 等級允許的最低版本。例如,執行 API 等級 24 的 Android 7.0 裝置實作必須至少包含版本 1。

3.2.軟 API 相容性

除了第 3.1 節中的託管 API 之外,Android 還包括一個重要的僅運行時「軟」API,其形式為意圖、權限和 Android 應用程式的類似方面,這些方面無法在應用程式編譯時強制執行。

3.2.1.權限

設備實現者必須支援並強制執行權限參考頁中記錄的所有權限常數。請注意,第 9 節列出了與 Android 安全模型相關的其他要求。

3.2.2.建構參數

Android API 在android.os.Build 類別中包含許多常數,用於描述目前裝置。為了跨裝置實作提供一致、有意義的值,下表包含裝置實作必須遵守的這些值的格式的附加限制。

範圍細節
版本.發布目前執行的 Android 系統的版本,採用人類可讀的格式。此欄位必須具有7.1中定義的字串值之一。
版本.SDK目前執行的 Android 系統的版本,採用第三方應用程式程式碼可存取的格式。對於 Android 7.1,此欄位必須具有整數值 7.1_INT。
版本.SDK_INT目前執行的 Android 系統的版本,採用第三方應用程式程式碼可存取的格式。對於 Android 7.1,此欄位必須具有整數值 7.1_INT。
版本.增量裝置實現者選擇的值,以人類可讀的格式指定目前正在執行的 Android 系統的特定版本。該值不得重複用於提供給最終用戶的不同建置。此欄位的典型用途是指示使用哪個版本號或原始碼控制變更標識符來產生版本。該欄位的具體格式沒有要求,但不能為 null 或空字串 ("")。
木板設備實現者選擇的值,以人類可讀的格式標識設備使用的特定內部硬體。此欄位的一個可能用途是指示為設備供電的板的特定版本。此欄位的值必須可編碼為 7 位元 ASCII 並符合正規表示式「^[a-zA-Z0-9_-]+$」。
品牌反映最終用戶所知的與設備相關的品牌名稱的值。必須採用人類可讀的格式,並且應該代表設備的製造商或設備銷售的公司品牌。此欄位的值必須可編碼為 7 位元 ASCII 並符合正規表示式「^[a-zA-Z0-9_-]+$」。
支援_ABIS本機程式碼的指令集名稱(CPU 類型 + ABI 約定)。請參閱第 3.3 節。本機 API 相容性
SUPPORTED_32_BIT_ABIS本機程式碼的指令集名稱(CPU 類型 + ABI 約定)。請參閱第 3.3 節。本機 API 相容性
SUPPORTED_64_BIT_ABIS本機程式碼的第二指令集(CPU 類型 + ABI 約定)的名稱。請參閱第 3.3 節。本機 API 相容性
CPU_ABI本機程式碼的指令集名稱(CPU 類型 + ABI 約定)。請參閱第 3.3 節。本機 API 相容性
CPU_ABI2本機程式碼的第二指令集(CPU 類型 + ABI 約定)的名稱。請參閱第 3.3 節。本機 API 相容性
裝置設備實現者選擇的值,包含標識硬體功能配置和設備工業設計的開發名稱或代號。此欄位的值必須可編碼為 7 位元 ASCII 並符合正規表示式「^[a-zA-Z0-9_-]+$」。該設備名稱在產品的生命週期內不得更改。
指紋唯一標識此建置的字串。它應該是合理的人類可讀的。它必須遵循以下模板:

$(品牌)/$(產品)/
$(設備):$(版本.發佈)/$(ID)/$(版本.增量):$(類型)/$(標籤)

例如:

acme/我的產品/
mydevice:7.1/LMYXX/3359:userdebug/test-keys

指紋不得包含空白字元。如果上述模板中包含的其他字段具有空白字符,則必須在構建指紋中將它們替換為另一個字符,例如下劃線(“_”)字符。此欄位的值必須可編碼為 7 位元 ASCII。

硬體硬體的名稱(來自核心命令列或/proc)。它應該是合理的人類可讀的。此欄位的值必須可編碼為 7 位元 ASCII 並符合正規表示式「^[a-zA-Z0-9_-]+$」。
主持人一個字串,以人類可讀的格式唯一標識建構建構的主機。該欄位的具體格式沒有要求,但不能為 null 或空字串 ("")。
ID設備實現者選擇的標識符,用於引用特定版本,採用人類可讀的格式。該欄位可以與 android.os.Build.VERSION.INCRMENTAL 相同,但應該是一個對於最終用戶區分軟體版本足夠有意義的值。此欄位的值必須可編碼為 7 位元 ASCII 並符合正規表示式「^[a-zA-Z0-9._-]+$」。
製造商產品原始設備製造商 (OEM) 的商品名稱。該欄位的具體格式沒有要求,但不能為 null 或空字串 ("")。
模型設備實現者選擇的值,包含最終使用者已知的設備名稱。此名稱應與設備行銷和銷售給最終用戶時使用的名稱相同。該欄位的具體格式沒有要求,但不能為 null 或空字串 ("")。
產品設備實施者選擇的值,包含特定產品 (SKU) 的開發名稱或程式碼名稱,該產品在同一品牌中必須是唯一的。必須是人類可讀的,但不一定供最終用戶查看。此欄位的值必須可編碼為 7 位元 ASCII 並符合正規表示式「^[a-zA-Z0-9_-]+$」。該產品名稱在產品的生命週期內不得更改。
串口硬體序號,在具有相同型號和製造商的設備之間必須可用且唯一。此欄位的值必須可編碼為 7 位元 ASCII 並符合正規表示式「^([a-zA-Z0-9]{6,20})$」。
標籤由設備實現者選擇的以逗號分隔的標籤列表,可進一步區分建置。此欄位必須具有與三種典型 Android 平台簽章配置相對應的值之一:release-keys、dev-keys、test-keys。
時間表示建構發生時間的時間戳記的值。
類型由設備實現者選擇的值,指定建置的運行時配置。此欄位必須具有與三種典型 Android 運行時配置相對應的值之一:user、userdebug 或 eng。
使用者產生建置的使用者(或自動使用者)的名稱或使用者 ID。該欄位的具體格式沒有要求,但不能為 null 或空字串 ("")。
安全補丁指示建置的安全性修補程式等級的值。它必須表明該構建不會以任何方式受到指定 Android 公共安全公告中描述的任何問題的影響。它必須採用 [YYYY-MM-DD] 格式,與Android 公共安全公告Android 安全通報中記錄的定義字串相符,例如「2015-11-01」。
基本作業系統表示建置的 FINGERPRINT 參數的值,除 Android 公共安全公告中提供的補丁外,該值與此建置相同。它必須報告正確的值,如果這樣的建置不存在,則報告空字串(“”)。

3.2.3.意圖相容性

3.2.3.1.核心應用意圖

Android 意圖允許應用程式元件向其他 Android 元件請求功能。 Android 上游項目包括被視為核心 Android 應用程式的應用程式列表,這些應用程式實現了多種意圖模式來執行常見操作。 Android 的核心應用程式是:

  • 英式鐘
  • 瀏覽器
  • 日曆
  • 聯絡方式
  • 畫廊
  • 全球搜尋
  • 啟動器
  • 音樂
  • 設定

裝置實作必須包括適當的核心 Android 應用程式或實作由這些核心 Android 應用程式的所有 Activity 或服務元件定義的相同意圖模式的元件,這些核心 Android 應用程式透過android:exported屬性隱式或明確暴露給其他應用程式.

3.2.3.2.意圖解析

由於 Android 是一個可擴展平台,裝置實作必須允許第三方應用程式覆蓋第 3.2.3.1 節中引用的每個意圖模式。上游 Android 開源實作預設允許這樣做;設備實現者不得為系統應用程式對這些意圖模式的使用附加特殊權限,或阻止第三方應用程式綁定到這些模式並承擔對這些模式的控制。該禁止具體包括但不限於停用「選擇器」使用者介面,該介面允許使用者在全部處理相同意圖模式的多個應用程式之間進行選擇。

設備實作必須為使用者提供一個使用者介面來修改意圖的預設活動。

但是,當預設活動為資料 URI 提供更具體的屬性時,裝置實作可以為特定 URI 模式(例如 http://play.google.com)提供預設活動。例如,指定資料 URI「http://www.android.com」的意圖過濾器模式比瀏覽器的「http://」核心意圖模式更具體。

Android 還包含一種機制,供第三方應用程式為某些類型的 Web URI 意圖聲明權威的預設應用程式連結行為。當在應用程式的意圖過濾器模式中定義此類權威聲明時,設備實作:

  • 必須嘗試透過執行數位資產連結規範中定義的驗證步驟來驗證任何意圖過濾器,這些步驟由上游 Android 開源專案中的套件管理器實作。
  • 必須在應用程式安裝期間嘗試驗證意圖過濾器,並將所有成功驗證的 UIR 意圖過濾器設定為其 UIR 的預設應用程式處理程序。
  • 如果成功驗證但其他候選 URI 過濾器驗證失敗,則可以將特定 URI 意圖過濾器設定為其 URI 的預設應用程式處理程序。如果裝置實作這樣做,它必須在設定選單中為使用者提供適當的每 URI 模式覆蓋。
  • 必須在設定中為使用者提供每個應用程式的應用程式連結控件,如下所示:
    • 使用者必須能夠全面覆蓋應用程式的預設應用程式連結行為:始終打開、始終詢問或從不打開,這必須同樣適用於所有候選 URI 意圖過濾器。
    • 使用者必須能夠看到候選 URI 意圖過濾器的清單。
    • 設備實作可以為使用者提供基於每個意圖過濾器覆蓋已成功驗證的特定候選 URI 意圖過濾器的能力。
    • 如果裝置實作允許某些候選 URI 意圖過濾器成功驗證,而其他一些可能失敗,則裝置實作必須為使用者提供檢視和覆寫特定候選 URI 意圖過濾器的能力。

3.2.3.3.意圖命名空間

裝置實作不得包含任何使用 ACTION、CATEGORY 或 android.xml 檔案中的其他鍵字串來支援任何新意圖或廣播意圖模式的 Android 元件。或com.android。命名空間。裝置實現者不得包含任何使用 ACTION、CATEGORY 或屬於另一個組織的套件空間中的其他關鍵字串來遵循任何新意圖或廣播意圖模式的 Android 元件。設備實現者不得更改或擴展第 3.2.3.1 節中列出的核心應用程式使用的任何意圖模式。設備實作可以包括使用與其自己的組織明確相關的命名空間的意圖模式。該禁止類似於3.6 節中針對 Java 語言類別指定的禁止。

3.2.3.4.廣播意圖

第三方應用程式依靠平台廣播某些意圖,以通知它們硬體或軟體環境的變化。 Android 相容裝置必須廣播公共廣播意圖以回應適當的系統事件。 SDK 文件中描述了廣播意圖。

3.2.3.5.預設應用程式設定

Android 包含的設定可讓用戶輕鬆選擇預設應用程序,例如主螢幕或簡訊。在有意義的情況下,設備實作必須提供類似的設定選單,並與 SDK 文件中所述的意圖過濾器模式和 API 方法相容,如下所示。

設備實現:

3.3.本機 API 相容性

本機程式碼相容性具有挑戰性。因此,強烈建議裝置實現者使用來自上游 Android 開源專案的下列程式庫的實作。

3.3.1.應用程式二進位接口

託管 Dalvik 字節碼可以呼叫應用程式 .apk 檔案中提供的本機程式碼,作為針對適當裝置硬體架構編譯的 ELF .so 檔案。由於本機程式碼高度依賴底層處理器技術,Android 在 Android NDK 中定義了許多應用程式二進位介面 (ABI)。裝置實作必須與一個或多個定義的 ABI 相容,並且必須實現與 Android NDK 的兼容性,如下所示。

如果裝置實現包含對 Android ABI 的支持,則:

  • 必須支援在託管環境中執行的程式碼,以使用標準 Java 本機介面 (JNI) 語義呼叫本機程式碼。
  • 必須與下面列表中每個所需的庫來源相容(即標頭相容)和二進位相容(對於 ABI)。
  • 如果支援任何 64 位元 ABI,則必須支援等效的 32 位元 ABI。
  • 必須透過 android.os.Build.SUPPORTED_ABIS、android.os.Build.SUPPORTED_32_BIT_ABIS 和 android.os.Build.SUPPORTED_64_BIT_ABIS 參數來準確報告裝置支援的本機應用程式二進位介面 (ABI),每個清單都是逗號分隔的ABI 按從最受青睞到最不受青睞的順序排列。
  • 必須透過上述參數僅報告最新版本的Android NDK ABI 管理文件中記錄和描述的 ABI,並且必須包含對高級 SIMD (又稱 NEON)擴充的支援。
  • 應使用上游 Android 開源專案中提供的源代碼和頭文件進行構建

請注意,Android NDK 的未來版本可能會引入對其他 ABI 的支援。如果設備實作與現有的預定義 ABI 不相容,則它根本無法報告對任何 ABI 的支援。

以下本機程式碼 API 必須可用於包含本機程式碼的應用程式:

  • libandroid.so(原生 Android 活動支援)
  • libc(C 庫)
  • libcamera2ndk.so
  • libdl(動態連結器)
  • libEGL.so(原生 OpenGL 表面管理)
  • libGLESv1_CM.so (OpenGL ES 1.x)
  • libGLESv2.so(OpenGL ES 2.0)
  • libGLESv3.so (OpenGL ES 3.x)
  • libicui18n.so
  • 庫克庫克
  • libjnigraphics.so
  • liblog(Android 日誌記錄)
  • libmediandk.so(原生媒體 API 支援)
  • libm(數學庫)
  • libOpenMAXAL.so(OpenMAX AL 1.0.1 支援)
  • libOpenSLES.so(OpenSL ES 1.0.1 音訊支援)
  • libRS.so
  • libstdc++(對 C++ 的最低支援)
  • libvulkan.so(Vulkan)
  • libz(Zlib 壓縮)
  • JNI介面
  • 支援 OpenGL,如下所述

對於上面列出的本機庫,設備實作不得新增或刪除公共函數。

上面未列出但在 AOSP 中實作和提供的本機程式庫作為保留的系統函式庫,不得暴露給針對 API 等級 24 或更高等級的第三方應用程式。

設備實作可以添加非 AOSP 庫並將它們直接作為 API 公開給第三方應用程序,但附加庫應該位於/vendor/lib/vendor/lib64中,並且必須列在/vendor/etc/public.libraries.txt

請注意,裝置實作必須包含 libGLESv3.so,並且必須匯出 NDK 版本 android-24 中定義的所有 OpenGL ES 3.1 和Android 擴充包函數符號。儘管所有符號都必須存在,但只有裝置實際支援的 OpenGL ES 版本和擴充功能的相應功能必須完全實作。

3.3.1.1.圖形庫

Vulkan是一種低開銷、跨平台的 API,用於高效能 3D 圖形。設備實現,即使不包括對 Vulkan API 的支持,也必須滿足以下要求:

  • 它必須始終提供一個名為libvulkan.so的本機庫,該庫導出核心 Vulkan 1.0 API 的函數符號以及VK_KHR_surfaceVK_KHR_android_surfaceVK_KHR_swapchain擴充功能。

設備實作(如果包括 Vulkan API 支援):

  • 必須透過vkEnumeratePhysicalDevices呼叫報告一個或多個VkPhysicalDevices
  • 每個枚舉的VkPhysicalDevices必須完全實作 Vulkan 1.0 API。
  • 必須報告正確的PackageManager#FEATURE_VULKAN_HARDWARE_LEVELPackageManager#FEATURE_VULKAN_HARDWARE_VERSION功能標誌。
  • 必須透過libvulkan.so中的vkEnumerateInstanceLayerPropertiesvkEnumerateDeviceLayerProperties函式列舉應用程式包的本機函式庫目錄中名為libVkLayer*.so的本機函式庫中包含的層
  • 不得列舉應用程式套件外部的程式庫提供的層,或提供其他追蹤或攔截 Vulkan API 的方法,除非應用程式具有android:debuggable=”true”屬性。

設備實作(如果不包括 Vulkan API 支援):

3.3.2. 32 位元 ARM 本機程式碼相容性

ARMv8 架構棄用了多個 CPU 操作,包括現有本機程式碼中使用的一些操作。在 64 位元 ARM 裝置上,透過本機 CPU 支援或透過軟體模擬,以下已棄用的操作必須對 32 位元本機 ARM 程式碼保持可用:

  • SWP 和 SWPB 指令
  • 設定指令
  • CP15ISB、CP15DSB 和 CP15DMB 屏障操作

舊版 Android NDK 使用 /proc/cpuinfo 從 32 位元 ARM 本機程式碼發現 CPU 功能。為了與使用此 NDK 建置的應用程式相容,當 32 位元 ARM 應用程式讀取 /proc/cpuinfo 時,裝置必須在 /proc/cpuinfo 中包含以下行:

  • “功能:”,後面是裝置支援的任何可選 ARMv7 CPU 功能的清單。
  • “CPU 架構:”,後面跟著一個整數,描述裝置支援的最高 ARM 架構(例如,“8”表示 ARMv8 裝置)。

這些要求僅在 32 位元 ARM 應用程式讀取 /proc/cpuinfo 時適用。當 64 位元 ARM 或非 ARM 應用程式讀取 /proc/cpuinfo 時,裝置不應變更。

3.4.網路相容性

3.4.1.網頁視圖相容性

Android Watch 裝置可以,但所有其他裝置實作必須提供 android.webkit.Webview API 的完整實作。

平台功能 android.software.webview 必須在提供 android.webkit.WebView API 完整實作的任何裝置上報告,且不得在沒有完整 API 實作的裝置上報告。 Android 開源實作使用 Chromium 專案中的程式碼來實作android.webkit.WebView 。由於為 Web 渲染系統開發全面的測試套件是不可行的,因此設備實作者必須在 WebView 實作中使用 Chromium 的特定上游版本。具體來說:

  • 裝置 android.webkit.WebView 實作必須基於 Android 7.1 上游 Android 開源專案的Chromium建置。此版本包括一組針對 WebView 的特定功能和安全性修復。
  • WebView 報告的用戶代理字串必須採用以下格式:

    Mozilla/5.0(Linux;Android $(VERSION);$(MODEL) Build/$(BUILD);wv) AppleWebKit/537.36(KHTML,如 Gecko)版本/4.0 $(CHROMIUM_VER) Mobile Safari/537.36

    • $(VERSION) 字串的值必須與 android.os.Build.VERSION.RELEASE 的值相同。
    • $(MODEL) 字串的值必須與 android.os.Build.MODEL 的值相同。
    • $(BUILD) 字串的值必須與 android.os.Build.ID 的值相同。
    • $(CHROMIUM_VER) 字串的值必須是上游 Android 開源專案中 Chromium 的版本。
    • 設備實作可以在用戶代理字串中省略 Mobile。

WebView 元件應該包含對盡可能多的 HTML5 功能的支持,並且如果它支援該功能,則應該符合HTML5 規範

3.4.2.瀏覽器相容性

Android Television、Watch 和 Android Automotive 實作可以省略瀏覽器應用程序,但必須支援第 3.2.3.1 節中所述的公共意圖模式。所有其他類型的裝置實作必須包括用於一般使用者 Web 瀏覽的獨立瀏覽器應用程式。

獨立瀏覽器可以基於 WebKit 以外的瀏覽器技術。但是,即使使用備用瀏覽器應用程序,提供給第三方應用程式的 android.webkit.WebView 元件也必須基於 WebKit,如3.4.1 節中所述。

實作可以在獨立的瀏覽器應用程式中提供自訂使用者代理字串。

獨立的瀏覽器應用程式(無論是基於上游 WebKit 瀏覽器應用程式還是第三方替代品)應該包含對盡可能多的HTML5的支援。設備實作至少必須支援與 HTML5 相關的每個 API:

此外,設備實作必須支援 HTML5/W3C webstorage API並且應該支援 HTML5/W3C IndexedDB API 。請注意,隨著 Web 開發標準機構逐漸轉向支援 IndexedDB 而不是 Webstorage,IndexedDB 預計將成為 Android 未來版本中的必要組件。

3.5. API 行為相容性

每個 API 類型(託管、軟體、本機和 Web)的行為必須與上游Android 開源專案的首選實作一致。一些特定的兼容性領域是:

  • 設備不得更改標準意圖的行為或語意。
  • 設備不得更改特定類型的系統元件(例如服務、活動、ContentProvider 等)的生命週期或生命週期語意。
  • 設備不得更改標準權限的語意。

上面的列表並不全面。相容性測試套件 (CTS) 測試平台的重要部分(但不是全部)的行為相容性。實作者有責任確保與 Android 開源專案的行為相容性。因此,裝置實現者應該盡可能使用透過 Android 開源專案提供的原始程式碼,而不是重新實作系統的重要部分。

3.6. API命名空間

Android 遵循 Java 程式語言定義的套件和類別命名空間約定。為了確保與第三方應用程式的相容性,裝置實作者不得對這些套件命名空間進行任何禁止的修改(見下文):

  • java.*
  • javax.*
  • 太陽。*
  • 安卓。*
  • com.android.*

禁止的修改包括

  • 裝置實作不得透過更改任何方法或類別簽名,或刪除類別或類別欄位來修改 Android 平台上公開的 API。
  • 設備實作者可以修改 API 的底層實現,但此類修改不得影響任何公開暴露的 API 的規定行為和 Java 語言簽章。
  • 設備實作者不得為上述 API 新增任何公開暴露的元素(例如類別或接口,或現有類別或介面的欄位或方法)。

「公開暴露的元素」是指未使用上游 Android 原始碼中使用的「@hide」標記修飾的任何構造。換句話說,設備實現者不得公開新的 API 或更改上述命名空間中的現有 API。設備實現者可以進行僅限內部的修改,但這些修改不得公佈或以其他方式暴露給開發人員。

設備實作者可以新增自訂 API,但任何此類 API 不得位於另一個組織擁有或引用另一個組織的命名空間中。例如,裝置實作者不得將 API 新增至 com.google.* 或類似的命名空間:只有 Google 可以做到。同樣,Google 不得將 API 新增至其他公司的命名空間。此外,如果裝置實作包含標準Android 命名空間以外的自訂API,則這些API 必須打包在Android 共用程式庫中,以便只有明確使用它們(透過<uses-library> 機制)的應用程式才會受到內存使用量增加的影響此類 API。

如果設備實現者建議改進上述包命名空間之一(例如透過向現有 API 添加有用的新功能,或添加新 API),則實現者應該訪問source.android.com並開始貢獻更改和的過程代碼,根據該網站上的信息。

請注意,上述限制對應於 Java 程式語言中命名 API 的標準約定;本節的目的只是為了加強這些約定,並透過將其納入此相容性定義來使其具有約束力。

3.7.運行時相容性

設備實作必須支援完整的 Dalvik 可執行檔 (DEX) 格式以及Dalvik 字節碼規格和語意。設備實作者應該使用 ART、Dalvik 可執行格式的參考上游實作以及參考實作的套件管理系統。

裝置實作必須配置 Dalvik 運行時以根據上游 Android 平台分配內存,並如下表所示。 (有關螢幕尺寸和螢幕密度定義,請參閱第 7.1.1 節。)請注意,下面指定的記憶體值被視為最小值,裝置實作可以為每個應用程式分配更多記憶體。

螢幕佈局螢幕密度最小應用記憶體
安卓手錶120 dpi(LDPI) 32MB
160 dpi (mdpi)
213 dpi(電視dpi)
240 dpi(高清) 36MB
280dpi (280dpi)
320 dpi(xhdpi) 48MB
360dpi (360dpi)
400dpi (400dpi) 56MB
420 dpi (420dpi) 64MB
480 dpi (xxhdpi) 88MB
560dpi(560dpi) 112MB
640 dpi (xxxhdpi) 154MB
小/正常120 dpi(LDPI) 32MB
160 dpi (mdpi)
213 dpi(電視dpi) 48MB
240 dpi(高清)
280dpi (280dpi)
320 dpi(xhdpi) 80MB
360dpi (360dpi)
400dpi (400dpi) 96MB
420 dpi (420dpi) 112MB
480 dpi (xxhdpi) 128MB
560dpi(560dpi) 192MB
640 dpi (xxxhdpi) 256MB
大的120 dpi(LDPI) 32MB
160 dpi (mdpi) 48MB
213 dpi(電視dpi) 80MB
240 dpi(高清)
280dpi (280dpi) 96MB
320 dpi(xhdpi) 128MB
360dpi (360dpi) 160MB
400dpi (400dpi) 192MB
420 dpi (420dpi) 228MB
480 dpi (xxhdpi) 256MB
560dpi(560dpi) 384MB
640 dpi (xxxhdpi) 512MB
超大120 dpi(LDPI) 48MB
160 dpi (mdpi) 80MB
213 dpi(電視dpi) 96MB
240 dpi(高清)
280dpi (280dpi) 144MB
320 dpi(xhdpi) 192MB
360dpi (360dpi) 240MB
400dpi (400dpi) 288MB
420 dpi (420dpi) 336MB
480 dpi (xxhdpi) 384MB
560dpi(560dpi) 576MB
640 dpi (xxxhdpi) 768MB

3.8.使用者介面相容性

3.8.1.啟動器(主螢幕)

Android 包括啟動器應用程式(主畫面)並支援第三方應用程式來取代裝置啟動器(主畫面)。允許第三方應用程式替換裝置主畫面的裝置實作必須聲明平台功能 android.software.home_screen。

3.8.2.小部件

小部件對於所有 Android 裝置實作都是可選的,但 Android 手持裝置應該支援。

Android 定義了元件類型以及相應的 API 和生命週期,允許應用程式向最終用戶公開「AppWidget」 ,強烈建議手持裝置實作支援該功能。支援在主畫面上嵌入小工具的裝置實作必須滿足以下要求並聲明對平台功能 android.software.app_widgets 的支援。

  • 裝置啟動器必須包含對 AppWidget 的內建支持,並公開使用者介面功能以直接在啟動器中新增、配置、檢視和刪除 AppWidget。
  • 設備實作必須能夠渲染標準網格大小為 4 x 4 的小工具。有關詳細信息,請參閱 Android SDK 文件中的應用程式小部件設計指南
  • 包括鎖定螢幕的支援的裝置實作可以支援鎖定螢幕上的應用程式小工具。

3.8.3.通知

Android 包含 API,讓開發人員可以使用裝置的硬體和軟體功能向使用者通知值得注意的事件

某些 API 允許應用程式使用硬體(特別是聲音、振動和燈光)執行通知或吸引註意。設備實作必須支援使用硬體功能的通知,如 SDK 文件所述,並儘可能支援設備實現硬體。例如,如果裝置實作包含振動器,則它必須正確實作振動 API。如果設備實作缺少硬件,則對應的 API 必須實作為無操作。此行為在第 7 節中有進一步詳細介紹。

此外,實作必須正確呈現 API 或狀態/系統列圖示樣式指南中提供的所有資源(圖示、動畫檔案等),在 Android Television 裝置的情況下,可能不會顯示通知。裝置實現者可以為通知提供替代的使用者體驗,而不是參考 Android 開源實作提供的體驗;然而,如上所述,此類替代通知系統必須支援現有通知資源。

Android Automotive 實作可以管理通知的可見性和時間,以減輕駕駛員分心,但必須在應用程式要求時顯示使用CarExtender的通知。

Android 支援各種通知,例如:

  • 豐富的通知。持續通知的互動式視圖。
  • 平視通知。互動式視圖使用者可以在不離開目前應用程式的情況下執行或關閉。
  • 鎖定螢幕通知。通知顯示在鎖定畫面上,可對可見性進行精細控制。

當此類通知可見時,Android 裝置實作必須正確執行豐富通知和提示通知,並包含Android API 中記錄的標題/名稱、圖示、文字。

Android 包含通知偵聽器服務 API,允許應用程式(一旦使用者明確啟用)在發布或更新通知時接收所有通知的副本。裝置實作必須正確、及時地將通知完整傳送至所有此類已安裝和使用者啟用的偵聽器服務,包括附加到通知對象的任何和所有元資料。

手持裝置實作必須支援本所述的更新、刪除、回覆和捆綁通知的行為。

此外,手持裝置實作必須提供:

  • 能夠直接在通知欄控制通知。
  • 在通知欄中觸發控制面板的視覺功能。
  • 能夠在內聯控制面板和設定應用程式中從套件中封鎖、靜音和重設通知首選項。

正如SDK 文件中所述, Notification.Style class的所有 6 個直接子類別都必須支援。

支援 DND(請勿打擾)功能的設備實現必須滿足以下要求:

  • 必須實現一個回應意圖ACTION_NOTIFICATION_POLICY_ACCESS_SETTINGS的活動,對於 UI_MODE_TYPE_NORMAL 的實現,它必須是使用者可以授予或拒絕應用程式存取 DND 策略配置的活動。
  • 當裝置實作為使用者提供了一種授予或拒絕第三方應用程式存取 DND 策略配置的方法時,必須顯示應用程式建立的自動 DND 規則以及使用者建立的和預先定義的規則。
  • 必須遵守沿著NotificationManager.Policy傳遞的suppressedVisualEffects值,並且如果應用程式設定了任何SUPPRESSED_EFFECT_SCREEN_OFF或SUPPRESSED_EFFECT_SCREEN_ON標誌,它應該向使用者指示視覺效果在DND設定選單中被抑制。

Android 包含的 API 允許開發人員將搜尋合併到他們的應用程式中,並將應用程式的資料公開到全域系統搜尋中。一般來說,此功能由單一系統範圍的使用者介面組成,允許使用者輸入查詢、在使用者鍵入時顯示建議並顯示結果。 Android API 允許開發人員重複使用此介面在自己的應用程式中提供搜索,並允許開發人員向通用全域搜尋使用者介面提供結果。

Android 裝置實作應該包括全域搜索,這是一個單一的、共享的、系統範圍的搜尋使用者介面,能夠響應用戶輸入提供即時建議。設備實作應該實作允許開發人員重複使用此使用者介面以在自己的應用程式中提供搜尋的 API。實作全域搜尋介面的裝置實作必須實作允許第三方應用程式在全域搜尋模式下執行時向搜尋框新增建議的 API。如果沒有安裝使用此功能的第三方應用程序,則預設行為應該是顯示網路搜尋引擎結果和建議。

Android 裝置實作應該(並且 Android Automotive 實作必須)在裝置上實現助手來處理協助操作

Android 還包含Assist API ,允許應用程式選擇與裝置上的助理共享當前上下文的多少資訊。支援輔助操作的設備實作必須透過在螢幕邊緣周圍顯示白光來向最終用戶清楚地指示何時共享上下文。為了確保最終用戶清晰可見,指示必須滿足或超過 Android 開源專案實施的持續時間和亮度。

如果滿足以下所有要求,則對於使用 Assist 和 VoiceInteractionService API 的預先安裝應用程式,此指示可能會預設為停用:

  • 只有當使用者透過以下方式之一呼叫應用程式並且應用程式在前台運行時,預先安裝的應用程式才必須請求共用上下文:

    • 熱詞調用
    • ASSIST 導航鍵/按鈕/手勢的輸入
  • 裝置實作必須提供啟用指示的功能,距離第 3.2.3.5 節(預設語音輸入和助理應用程式設定選單)的導航距離少於兩次。

3.8.5。吐司

應用程式可以使用“Toast”API向最終用戶顯示簡短的非模態字串,這些字串會在短時間內消失。裝置實作必須以某種高可見性的方式向最終使用者顯示應用程式的 Toast。

3.8.6。主題

Android 提供「主題」作為應用程式在整個 Activity 或應用程式中應用樣式的機制。

Android 包含一個「Holo」主題系列,作為一組定義的樣式,供應用程式開發人員在想要匹配 Android SDK 定義的Holo 主題外觀和感覺時使用。裝置實作不得變更向應用程式公開的任何Holo 主題屬性

Android 包含一個「Material」主題系列,作為一組定義的樣式,供應用程式開發人員在想要在各種不同的 Android 裝置類型上匹配設計主題的外觀和感覺時使用。裝置實作必須支援「Material」主題系列,且不得變更任何Material 主題屬性或其向應用程式公開的資產。

Android 還包含一個「裝置預設」主題系列,作為一組定義的樣式,供應用程式開發人員在想要匹配裝置實現者定義的裝置主題的外觀和風格時使用。設備實作可以修改向應用程式公開的設備預設主題屬性

Android 支援具有半透明系統列的變體主題,允許應用程式開發人員使用其應用程式內容填充狀態列和導覽列後面的區域。為了在此配置中實現一致的開發人員體驗,在不同的裝置實作中保持狀態列圖示樣式非常重要。因此,Android 裝置實作必須對系統狀態圖示(例如訊號強度和電池電量)和系統發出的通知使用白色,除非圖示指示有問題的狀態或應用程式使用 SYSTEM_UI_FLAG_LIGHT_STATUS_BAR 標誌要求淺色狀態列。當應用程式要求淺色狀態列時,Android 裝置實作必須將系統狀態圖示的顏色變更為黑色(有關詳細信息,請參閱R.style )。

3.8.7.動態壁紙

Android 定義了一種元件類型以及相應的 API 和生命週期,允許應用程式向最終用戶公開一個或多個「動態桌布」 。動態壁紙是動畫、圖案或具有有限輸入功能的類似圖像,在其他應用程式後面顯示為壁紙。

如果硬體能夠以合理的幀速率運行所有動態壁紙,且沒有功能限制,並且不會對其他應用程式產生不利影響,則該硬體被認為能夠可靠地運行動態壁紙。如果硬體限制導致壁紙和/或應用程式崩潰、故障、消耗過多的 CPU 或電池電量,或以不可接受的低幀速率運行,則該硬體被視為無法運行動態壁紙。例如,某些動態桌布可能使用 OpenGL 2.0 或 3.x 上下文來渲染其內容。動態桌布將無法在不支援多個 OpenGL 上下文的硬體上可靠地運行,因為使用 OpenGL 上下文的動態桌布可能會與也使用 OpenGL 上下文的其他應用程式發生衝突。

如上所述,能夠可靠運行動態壁紙的設備實現應該實現動態壁紙,並且在實現時必須報告平台功能標誌 android.software.live_wallpaper。

3.8.8.活動切換

由於「最近」功能導航鍵是可選的,因此對於 Android Watch 和 Android Automotive 實作來說,實現概覽畫面的要求是可選的,而對於 Android Television 裝置則建議實作。仍然應該有一種方法可以在 Android Automotive 實現的活動之間進行切換。

上游 Android 原始程式碼包括概覽畫面、系統級使用者介面,用於任務切換以及使用使用者上次離開應用程式時應用程式圖形狀態的縮圖顯示最近造訪的活動和任務。設備實作(包括第 7.2.3 節中詳述的最近功能導航鍵)可能會變更介面,但必須滿足以下要求:

  • 必須支援至少最多 20 個顯示的活動。
  • 應至少一次顯示 4 個活動的標題。
  • 必須實現螢幕固定行為並為使用者提供設定選單來切換該功能。
  • 應顯示最近的突出顯示顏色、圖示、螢幕標題。
  • 應顯示關閉可供性(“x”),但可以延遲顯示,直到使用者與螢幕互動。
  • 應該實現一個快捷方式來輕鬆切換到上一個活動
  • 可以將關聯的最近內容顯示為一起移動的群組。
  • 當最近使用的功能鍵被點擊兩次時,應該會觸發兩個最近使用的應用程式之間的快速切換操作。
  • 當長按最近使用的功能鍵時,如果支持,應該觸發分割畫面多視窗模式。

強烈建議裝置實現使用上游 Android 使用者介面(或類似的基於縮圖的介面)作為概覽畫面。

3.8.9。輸入管理

Android 包括對輸入管理的支援以及對第三方輸入法編輯器的支援。允許使用者在裝置上使用第三方輸入法的裝置實作必須聲明平台功能 android.software.input_methods 並支援 Android SDK 文件中定義的 IME API。

聲明 android.software.input_methods 功能的裝置實作必須提供使用者可存取的機制來新增和設定第三方輸入法。裝置實作必須顯示設定介面以回應 android.settings.INPUT_METHOD_SETTINGS 意圖。

3.8.10.鎖定螢幕媒體控制

從 Android 5.0 開始,遠端控制用戶端 API 已被棄用,取而代之的是媒體通知模板,該模板允許媒體應用程式與鎖定螢幕上顯示的播放控制項整合。支援鎖定螢幕的裝置實作(除非 Android Automotive 或 Watch 實作)必須顯示鎖定螢幕通知,包括媒體通知範本。

3.8.11.螢幕保護程式(以前的夢想)

Android 支援互動式螢幕保護程序,以前稱為 Dreams。當連接到電源的裝置空閒或停靠在桌面擴充座時,螢幕保護程式允許使用者與應用程式互動。 Android Watch 裝置可以實現螢幕保護程序,但其他類型的裝置實作應該包括對螢幕保護程式的支持,並為使用者提供一個設定選項來配置螢幕保護程式以回應android.settings.DREAM_SETTINGS意圖。

3.8.12.地點

當設備具有能夠提供位置座標的硬體感測器(例如 GPS)時,位置模式必須顯示在「設定」內的「位置」選單中。

3.8.13.統一碼和字體

Android 支援Unicode 9.0中定義的表情符號字元。所有裝置實作都必須能夠以彩色字形呈現這些表情符號字符,並且當 Android 裝置實作包含 IME 時,它應該為使用者提供這些表情符號字元的輸入方法。

Android 手持裝置應支援Unicode 技術報告 #51中指定的膚色和多樣化的家庭表情符號。

Android 支援不同粗細的 Roboto 2 字體——sans-serif-thin、sans-serif-light、sans-serif-medium、sans-serif-black、sans-serif-condensed、sans-serif-condensed-light——其中必須包含裝置上可用的所有語言以及拉丁語、希臘語和西里爾語的完整Unicode 7.0 涵蓋範圍,包括拉丁語擴展A、B、C 和D 範圍,以及Unicode 7.0 貨幣符號區塊中的所有字形。

3.8.14.多視窗

裝置實作可以選擇不實作任何多視窗模式,但如果它能夠同時顯示多個活動,則它必須根據應用程式行為和 API 中描述的應用程式行為和 API 來實現此類多視窗模式。 Android SDK多窗口模式支援文件並滿足以下要求:

  • 應用程式可以在 AndroidManifest.xml 檔案中指示它們是否能夠在多視窗模式下運行,可以明確地透過android:resizeableActivity屬性,也可以隱式地透過設定targetSdkVersion > 24。在清單中明確將此屬性設定為false 的應用程式必須不能在多視窗模式下啟動。未在清單檔案中設定該屬性(targetSdkVersion < 24)的應用程式可以在多視窗模式下啟動,但係統必須提供警告,表明應用程式可能無法在多視窗模式下按預期工作。
  • 如果螢幕高度和寬度均小於 440 dp,則裝置實作不得提供分割畫面或自由格式模式。
  • 螢幕尺寸xlarge裝置實作應該支援自由格式模式。
  • Android TV 裝置實作必須支援畫中畫 (PIP) 模式多窗口,並在 PIP 開啟時將 PIP 多窗口放置在右上角。
  • 支援 PIP 模式多視窗的裝置實作必須為 PIP 視窗指派至少 240x135 dp。
  • 如果支援 PIP 多視窗模式,則必須使用KeyEvent.KEYCODE_WINDOW鍵來控制 PIP 視窗;否則,密鑰必須可供前台活動使用。

3.9.設備管理

Android 包含允許安全感知應用程式在系統層級執行裝置管理功能的功能,例如透過Android 裝置管理 API強制執行密碼原則或執行遠端清除]。設備實作必須提供DevicePolicyManager類別的實作。支援安全鎖定螢幕的裝置實作必須實作 Android SDK 文件中定義的全部裝置管理策略,並報告平台功能 android.software.device_admin。

3.9.1 準備配置

3.9.1.1 設備所有者配置

如果裝置實作聲明了android.software.device_admin功能,那麼它必須實現裝置策略用戶端 (DPC) 應用程式的裝置擁有者應用程式的配置,如下所示:

設備實作可以預先安裝執行設備管理功能的應用程序,但未經使用者或設備管理員的明確同意或操作,不得將此應用程式設定為設備所有者應用程式。

3.9.1.2 託管設定檔配置

如果裝置實作聲明 android.software.managed_users,則必須可以將裝置原則控制器 (DPC) 應用程式註冊為新的 Managed Profile 的擁有者

託管設定檔配置流程(由android.app.action.PROVISION_MANAGED_PROFILE啟動的流程)使用者體驗必須與 AOSP 實作保持一致。

設備實作必須在設定使用者介面中提供以下使用者功能,以便在裝置原則控制器 (DPC) 停用特定係統功能時向使用者指示:

  • 一致的圖示或其他使用者可供性(例如上游 AOSP 資訊圖示),用於表示特定設定何時受到設備管理員的限制。
  • 簡短的解釋訊息,由設備管理員透過setShortSupportMessage提供。
  • DPC 應用程式的圖示。

3.9.2 託管設定檔支持

支援受管理設定檔的設備是指以下設備:

支援託管設定檔的設備必須:

  • 聲明平台功能標誌android.software.managed_users
  • 透過android.app.admin.DevicePolicyManager API 支援託管設定檔。
  • 允許建立一個且僅一個託管設定檔
  • 使用圖示徽章(類似於 AOSP 上游工作徽章)來表示託管應用程式和小部件以及其他帶有徽章的 UI 元素(例如「最近的記錄」和「通知」)。
  • 顯示通知圖示(類似於 AOSP 上游工作徽章)以指示使用者何時位於託管設定檔應用程式中。
  • 如果裝置喚醒 (ACTION_USER_PRESENT) 且前台應用程式位於託管設定檔內,則顯示一個 toast,指示使用者位於託管設定檔中。
  • 如果存在託管設定文件,則在意圖「選擇器」中顯示視覺可供性,以允許用戶將意圖從託管設定檔轉發到主用戶,反之亦然(如果裝置策略控制器已啟用)。
  • 如果存在託管設定文件,請為主用戶和託管設定檔公開以下使用者功能:
    • 單獨核算主要使用者和託管設定檔的電池、位置、行動資料和儲存使用情況。
    • 獨立管理安裝在主要使用者或託管設定檔中的 VPN 應用程式。
    • 獨立管理安裝在主用戶或託管設定檔中的應用程式。
    • 對主要使用者或託管設定檔中的帳戶進行獨立管理。
  • 如果裝置策略控制器允許,請確保預先安裝的撥號器、聯絡人和訊息應用程式可以從託管設定檔(如果存在)以及主設定檔中搜尋和尋找呼叫者資訊。當託管設定檔中的聯絡人顯示在預先安裝的通話記錄、通話中UI、進行中和未接來電通知、聯絡人和訊息應用程式中時,他們應該使用與指示託管設定檔應用程式相同的徽章。
  • 必須確保它符合適用於啟用了多個使用者的裝置的所有安全要求(請參閱第 9.5 節),即使託管設定檔不被視為除主使用者之外的其他使用者。
  • 支援指定滿足以下要求的單獨鎖定畫面的功能,以授予在託管設定檔中執行的應用程式的存取權限。

3.10.無障礙

Android 提供了一個輔助功能層,可以幫助殘障用戶更輕鬆地導航其裝置。此外,Android 還提供平台 API,使輔助功能服務實現能夠接收使用者和系統事件的回調,並產生備用回饋機制,例如文字轉語音、觸覺回饋和軌跡球/方向鍵導航。

設備實現包括以下要求:

  • Android Automotive 實作應該提供與預設 Android 實作一致的 Android 輔助功能框架的實作。
  • 設備實作(不包括Android汽車)必須提供與預設的Android實作一致的Android可訪問性框架的實作。
  • 設備實作(不包括Android汽車)必須支援透過Android.Ascorsibilityservice API的第三方可訪問性服務實作。
  • 設備實現(排除Android汽車)必須產生可訪問性,並以與預設的Android實現一致的方式將這些事件交付給所有註冊的可訪問性服務實現
  • 設備實作(Android Automotive和Android Watch設備,不包括音訊輸出),必須提供可啟用和停用可存取性服務的使用者存取機制,並且必須對Android.provider.settings.action.action_accessibility_settings的意圖顯示此介面。

  • 強烈建議使用具有音訊輸出的Android設備實現,以在對Talkback **的功能或超出功能的設備上提供可訪問性服務的實現,然後開關訪問訪問權限服務(https://github.com/google/ talkback)。

  • 具有音訊輸出的Android手錶設備應在設備上提供可訪問性服務的實現,可比較或超出對講機訪問性服務(https://github.com/google/talkback)。
  • 設備實現應在盒子外設定流中提供一種機制,以便用戶啟用相關的可訪問性服務,以及調整字體尺寸,顯示尺寸和放大倍率的選項。

**對於文字轉語音支援的語言。

另外,請注意,如果有預先載入的可訪問性服務,則必須使用基於文件的加密(FBE)加密存儲,它必須是直接啟動{DirectBootaware}應用程式。

3.11.文字轉語音

Android 包含的 API 允許應用程式使用文字轉語音 (TTS) 服務,並允許服務提供者提供 TTS 服務的實作。裝置實作報表功能Android.hardware.audio.Output必須符合與Android TTS框架相關的這些要求。

Android 汽車實現:

  • 必須支援Android TTS框架API。
  • 可能支援安裝第三方TTS引擎。如果得到支持,合作夥伴必須提供一個可存取用戶的接口,該接口允許用戶選擇用於系統級別的TTS引擎。

所有其他設備實作:

  • 必須支援Android TTS框架API,並應包括支援裝置上可用語言的TTS引擎。請注意,上游Android開源軟體包含功能齊全的TTS引擎實作。
  • 必須支援安裝第三方TTS引擎。
  • 必須提供一個可存取使用者的接口,該接口允許使用者選擇在系統層級使用的TTS引擎。

3.12.電視輸入框架

Android電視輸入框架(TIF)簡化了直播內容到Android電視裝置的交付。 TIF提供了一個標準API來建立控制Android電視裝置的輸入模組。 Android電視裝置實作必須支援電視輸入框架。

支援TIF的裝置實作必須聲明平台功能Android.software.live_tv。

3.12.1.電視應用程式

任何聲明對直播電視支援的裝置實作都必須具有已安裝的電視應用程式(電視應用程式)。 Android開源專案提供了電視應用程式的實作。

電視應用必須提供安裝和使用電視頻道並符合以下要求的設施:

  • 設備實現必須允許安裝和管理基於第三方TIF的輸入(第三方輸入)。
  • 設備實作可能會在基於TIF的預先安裝的輸入(安裝輸入)和第三方輸入之間提供視覺分離。
  • 裝置實作不得顯示遠離電視應用程式的單一導航操作(即從電視應用程式擴充第三方輸入清單)。

3.12.1.1.電子節目指南

Android電視設備的實作必須顯示資訊和互動式覆蓋層,其中必須包括從TVContract.Programs.programs欄位產生的電子程式指南(EPG)。 EPG必須符合以下要求:

  • EPG必須顯示所有已安裝的輸入和第三方輸入的資訊。
  • EPG可以在已安裝的輸入和第三方輸入之間提供視覺分離。
  • 強烈建議使用EPG顯示同等突出的安裝輸入和第三方輸入。 EPG不得顯示第三方輸入超過單一導覽操作,而非EPG上的已安裝輸入。
  • 關於頻道更改,裝置實作必須顯示目前播放程式的EPG資料。

3.12.1.2.導航

電視應用程式必須允許透過Android電視裝置的輸入裝置(即遙控器,遠端控制應用程式或遊戲控制器)上的D-Pad,Back和Home Keys進行以下功能導航:

  • 變更電視頻道
  • 開放EPG
  • 配置和調諧到第三方基於TIF的輸入
  • 開啟設定選單

電視應用程式應透過CEC將關鍵事件傳遞給HDMI輸入。

3.12.1.3。電視輸入應用程式鏈接

Android電視設備實現必須支援電視輸入應用程式鏈接,該鏈接允許所有輸入提供從當前活動到另一個活動的活動鏈接(即從實時編程到相關內容的鏈接)。電視應用程式必須顯示電視輸入應用程式在提供時連結。

3.12.1.4。時間變化

Android電視設備實現必須支援時間變化,這使用戶可以暫停並恢復即時內容。設備實作必須為使用者提供暫停並恢復目前播放程式的方法,如果時間換取該程式的時間。

3.12.1.5。電視錄音

強烈建議使用Android電視設備實現來支援電視錄製。如果電視輸入支援錄製,則EPG可能會提供記錄程式的方法,如果不禁止使用此類程式的記錄。設備實作應提供使用者介面來播放錄製的程式。

3.13.快速設定

Android裝置實作應包括一個快速設定UI元件,該元件允許快速存取經常使用或緊急需要的操作。

Android包括quicksettings API,讓第三方應用程式實作使用者可以在快速設定UI元件中與系統提供的圖塊一起新增的圖塊。如果設備實現具有快速設定UI組件,則它:

  • 必須允許用戶從第三方應用程式中新增或刪除圖塊到快速設定。
  • 不得直接將第三方應用程式中的磁磚自動添加到快速設定。
  • 必須與系統提供的快速設定磁磚一起從第三方應用程式顯示所有使用者添加的磁磚。

3.14。車輛UI API

3.14.1.車輛媒體UI

任何聲明汽車支援的裝置實作都必須包含一個UI框架,以支援消耗MediaBrowserMediaSession API的第三方應用程式。

支援依賴MediaBrowser和MediaSession的第三方應用程式的UI框架具有以下視覺需求:

  • 必須顯示MediaItem圖示和通知圖示。
  • 必須按照MediaSession,EG,Metadata,Icons,Imagery的描述來顯示這些項目。
  • 必須顯示應用程式標題。
  • 必須有抽屜才能呈現MediaBrowser層次結構。

4. 應用程式封裝相容性

裝置實作必須依照官方Android SDK中包含的「 AAPT」工具產生的安裝並執行Android「 .APK」檔案。因此,設備實現應使用參考實現的軟體包管理系統。

軟體套件管理器必須使用APK簽章方案V2JAR簽章支援驗證「 .APK」檔案。

裝置實作不得擴充.APKAndroid清單Dalvik字節碼或RenderScript字節碼以阻止這些檔案在其他相容裝置上正確安裝和運行的方式。

設備實作不得允許應用程式以外的「記錄的安裝程式」以使軟體包無需任何提示即可默默卸載該應用程序,如SDK中的DELETE_PACKAGE權限所記錄的那樣。唯一的例外是系統軟體包驗證器應用程式處理程序包_needs_verification Intent和儲存管理器應用程式處理action_manage_storage Intent。

5. 多媒體相容性

5.1.媒體編解碼器

設備實現 -

  • 必須支援Android SDK文件中指定的核心媒體格式,除非本文檔明確允許。

  • 必須支援媒體格式,編碼器,解碼器,檔案類型和容器格式,並透過MediaCodeClist報告。

  • 還必須能夠解碼其camcorderprofile中報告的所有設定文件

  • 必須能夠解碼它可以編碼的所有格式。這包括其編碼器產生的所有bitstreams。

編解碼器應以最小編解碼器延遲為目標,換句話說,編解碼器 -

  • 不應食用並儲存輸入緩衝區,並僅返回輸入緩衝區一次處理一次
  • 不應比標準(例如SP)指定的解碼緩衝液更長。
  • 不應將編碼的緩衝液固定的時間比GOP結構所要求的更長。

下表中列出的所有編解碼器均以Android開源專案的首選Android實作中的軟體實作提供。

請注意,Google和開放手機聯盟都沒有做出任何代碼器,即這些編解碼器沒有第三方專利。打算在硬體或軟體產品中使用此原始碼的人請注意,此程式碼的實現(包括在開源軟體或共享軟體中)可能需要相關專利持有者的專利許可。

5.1.1.音訊編解碼器

格式/編解碼器編碼器解碼器細節支援的文件類型/容器格式
MPEG-4 AAC設定文件
(AAC LC)
需要1必需的支援單聲道/立體聲/5.0/5.1 2的內容,其標準取樣率從8到48 kHz。
  • 3GPP (.3gp)
  • MPEG-4(.mp4、.m4a)
  • ADTS RAW AAC(.AAC,在Android 3.1+中解碼,在Android 4.0+中編碼,不支援ADIF)
  • mpeg-ts(.ts,不可尋求,Android 3.0+)
MPEG-4 HE AAC設定檔(AAC+)需要1
(安卓4.1+)
必需的支援單聲道/立體聲/5.0/5.1 2的內容,其標準取樣率從16到48 kHz。
MPEG-4 HE AACV2
設定檔(增強AAC+)
必需的支援單聲道/立體聲/5.0/5.1 2的內容,其標準取樣率從16到48 kHz。
AAC ELD(增強的低延遲AAC)需要1
(安卓4.1+)
必需的
(安卓4.1+)
支援單聲道/立體聲含量,標準取樣率從16到48 kHz。
AMR-NB需要3需要3 4.75至12.2 kbps @ 8 kHz採樣3GPP (.3gp)
AMR-WB需要3需要3 9速率從6.60 kbit/s到23.85 kbit/s取樣 @ 16 kHz
FLAC必需的
(Android 3.1+)
單聲道/立體聲(無多聲道)。最高48 kHz的樣品速率(但建議在44.1 kHz輸出的設備上使用高達44.1 kHz,因為48至44.1 kHz傾斜的傾角不包括低通濾波器)。建議使用16位;沒有抖動適用於24位。僅FLAC(.flac)
MP3必需的單一/立體聲8-320kbps常數(CBR)或可變位元率(VBR) MP3 (.mp3)
MIDI必需的MIDI 類型 0 和 1。DLS 版本 1 和 2。XMF 和 Mobile XMF。支援鈴聲格式 RTTTL/RTX、OTA 和 iMelody
  • 類型0和1(.mid,.xmf,.mxmf)
  • rtttl/rtx(.rtttl,.rtx)
  • ota(.ota)
  • imelody(.imy)
沃爾比斯必需的
  • 奧格 (.ogg)
  • Matroska(.MKV,Android 4.0+)
PCM/WAVE需要4
(安卓4.1+)
必需的16位元線性PCM(速率達到硬體限制)。設備必須支援8000、11025、16000和44100 Hz頻率的原始PCM記錄的取樣率。波形 (.wav)
作品必需的
(Android 5.0+)
Matroska(.MKV),OGG(.OGG)

1定義Android.hardware.microphone但可選的Android Watch設備實現的設備實現所需的1。

2錄音或播放可以在單聲道或立體聲中執行,但是透過預設AAC AAC音訊解碼器在Android.media.mediacodec API中,多通道串流的AAC輸入緩衝區(即多兩個頻道)的解碼,必須是以下的支援:

  • 執行解碼沒有下降(例如,必須將5.0 AAC流解碼為PCM的五個通道,必須將5.1 AAC流解碼為PCM的六個通道),
  • 在ISO/IEC 14496-3中的「動態範圍控制(DRC)」中定義的動態範圍元資料和Android.media.Media.Media.Media.MediaFormat DRC鍵以配置音訊解碼器的動態範圍相關行為。 AAC DRC鍵在API 21中引入,為:KEY_AAC_DRC_ATTENUATION_FACTOR,key_aac_drc_boost_factor,key_aac_drc_heavy_compression,key_aac_aac_drc_drc_trtarc_target_tararget_level_leac_aac_drc_drc_trtarc_target_tararget_level_lev

3 Android手持裝置實現所需。

4定義Android.hardware.microphone(包括Android Watch設備實作)所需的設備實作所需。

5.1.2.圖像編解碼器

格式/編解碼器編碼器解碼器細節支援的文件類型/容器格式
JPEG必需的必需的基礎+漸進式jpeg(.jpg)
動圖必需的GIF (.gif)
巴布亞紐幾內亞必需的必需的PNG(.png)
骨形態發生蛋白必需的BMP(.bmp)
網路P必需的必需的WebP(.WEBP)
生的必需的ARW(.ARW),CR2(.CR2),DNG(.DNG),NEF(.NEF),NRW(.NRW),ORF(.orf),PEF(.pef(.pef),raf(.raf( .raf),rw2(rw2),rw2(rw2)( .rw2),srw(.srw)

5.1.3.視訊編解碼器

  • 編解碼器廣告HDR設定檔支援必須支援HDR靜態元資料解析與處理。

  • 如果媒體編解碼器宣傳Intra Intra Support,則必須支援10-60幀範圍內的刷新週期,並在配置刷新期的20%之內準確運行。

  • 視訊編解碼器必須支援輸出和輸入位元組式大小,以適應標準和配置所規定的最大可行壓縮和未壓縮框架,但也不全部分配。

  • 視訊編碼器和解碼器必須支援YUV420靈活的顏色格式(color_formatyuv420 flexible)。

格式/編解碼器編碼器解碼器細節支援的文件類型/
容器格式
H.263可能可能
  • 3GPP (.3gp)
  • MPEG-4(.mp4)
H.264AVC需要2需要2有關詳細信息,請參見第5.2和5.3
  • 3GPP (.3gp)
  • MPEG-4(.mp4)
  • mpeg-2 ts(.ts,僅AAC音頻,不可尋找,Android 3.0+)
H.265 HEVC需要5有關詳細信息,請參見第5.3節MPEG-4(.mp4)
MPEG-2強烈建議6主要簡介mpeg2-ts
MPEG-4 sp需要2 3GPP (.3gp)
VP8 3需要2
(Android 4.3+)
需要2
(Android 2.3.3+)
有關詳細信息,請參見第5.2和5.3
VP9需要2
(Android 4.4+)
有關詳細信息,請參見第5.3節

1設備實現所需的,包括相機硬體並定義Android.hardware.Camera或Android.hardware.Camera.Front。

2設備實現所需的2。

3對於Web視訊串流和視訊會議服務的可接受質量,設備實現應使用符合要求的硬體VP8編解碼器。

4設備實作應支援編寫Matroska WebM文件。

5強建議用於Android汽車,可選的Android手錶,並且所有其他設備類型都需要。

6僅適用於Android電視設備實現。

5.2.視訊編碼

視訊編解碼器對於Android Watch設備實作是可選的。

H.264,VP8,VP9和HEVC視訊編碼器 -

  • 必須支援動態配置的位元率。
  • 應支援可變幀速率,在此,視訊編碼器應根據輸入緩衝區的時間戳確定瞬時幀持續時間,並根據該框架持續時間分配其位元儲存桶。

H.263和MPEG-4視訊編碼器應支援動態配置的位元率。

所有視訊編碼器都應在兩個滑動視窗上滿足以下位元率目標:

  • 在框架內(I-Frame)間隔之間的位元速率中,它的比率不應不超過15%。
  • 在1秒鐘的滑動視窗上,它的位元率不應超過100%。

5.2.1. H.263

使用H.263編碼器的Android設備實作必須支援基線設定檔等級45。

5.2.2. H-264

具有H.264編解碼器​​支援的Android設備實作:

  • 必須支援基線概況等級3。
    但是,支援ASO(任意切片排序),FMO(靈活的大塊訂購)和RS(冗餘切片)是可選的。此外,為了維持與其他Android設備的兼容性,建議不要用編碼器將ASO,FMO和RS用於基線設定檔。
  • 必須支援下表中的SD(標準定義)視訊編碼設定檔。
  • 應該支援主要概況等級4。
  • 如下表所示,應支援HD(高清)視訊編碼設定檔。
  • 此外,強烈建議使用Android電視設備以30 fps編碼HD 1080p視訊。
SD(低品質) SD(高品質)高清720p 1高清1080p 1
視訊解析度320 x 240 PX 720 x 480 PX 1280 x 720 像素1920 x 1080 像素
視訊幀率20 幀/秒30 幀/秒30 幀/秒30 幀/秒
視訊比特率384Kbps 2Mbps 4Mbps 10Mbps

1當由硬體支援時,但強烈建議用於Android電視設備。

5.2.3. VP8

具有VP8編解碼器支援的Android設備實作必須支援SD視訊編碼設定文件,並應支援以下HD(高畫質)視訊編碼設定檔。

SD(低品質) SD(高品質)高清720p 1高清1080p 1
視訊解析度320 x 180 PX 640 x 360 PX 1280 x 720 像素1920 x 1080 像素
視訊幀率30 幀/秒30 幀/秒30 幀/秒30 幀/秒
視訊比特率800 kbps 2Mbps 4Mbps 10Mbps

1當硬體支援時。

5.3.視訊解碼

視訊編解碼器對於Android Watch設備實作是可選的。

設備實現 -

  • 對於所有VP8,VP9,H.264和H.265編解碼器,必須支援動態視訊解析度和幀速率透過同一流中的標準Android API切換,並即時到達設備上每個編解碼器支援的最大分辨率。

  • 支持杜比願景解碼器的實施 -

  • 必須提供具有杜比視覺能力的提取器。
  • 必須在裝置螢幕或標準視訊輸出連接埠(例如HDMI)上正確顯示Dolby Vision內容。

  • 提供具有杜比視覺能力提取器的實作必須將向後相容的基層(S)(如果存在)設定與杜比視覺層的組合軌道索引相同的軌道索引。

5.3.1. MPEG-2

使用MPEG-2解碼器的Android裝置實作必須支援主設定檔高階。

5.3.2. H.263

使用H.263解碼器的Android設備實作必須支援基線設定檔等級30和45級。

5.3.3. MPEG-4

使用MPEG-4解碼器的Android設備實作必須支援簡單的設定檔等級3。

5.3.4. H.264

H.264解碼器的Android設備實作:

  • 必須支援主概況等級3.1和基線設定檔。
    支援ASO(任意切片排序),FMO(靈活的宏觀嵌入訂購)和RS(冗餘切片)是可選的。
  • 必須能夠使用下表中列出的SD(標準定義)配置文件來解碼視頻,並使用基線配置文件和主配置文件級別3.1(包括720P30)進行編碼。
  • 如下表所示,應能使用HD(高清)設定檔來解碼影片。
  • 另外,Android電視設備 -
    • 必須支援高調等級4.2和HD 1080P60解碼輪廓。
    • 必須能夠如下表所示的兩個HD配置文件解碼視頻,並用基線配置文件,主配置文件或High Profile Level 4.2編碼
SD(低品質) SD(高品質)高清720p 1高清1080p 1
視訊解析度320 x 240 PX 720 x 480 PX 1280 x 720 像素1920 x 1080 像素
視訊幀率30 幀/秒30 幀/秒60 幀/秒30 fps(60 fps 2
視訊比特率800 kbps 2Mbps 8Mbps 20Mbps

1當顯示的高度。getSupportedModes()方法等於或大於視訊解析度所需。

2 Android電視裝置實現所需。

5.3.5。 H.265 (HEVC)

第5.1.3節所述支援H.265編解碼器時,Android裝置實作:

  • 必須支援主配置級3主層和SD視訊解碼設定文件,如下表所示。
  • 應如下表所示支援HD解碼曲線。
  • 如果有硬體解碼器,則必須支援下表中的HD解碼設定檔。
  • 另外,Android電視設備:
  • 必須支援HD 720p解碼曲線。
  • 強烈建議支援HD 1080p解碼輪廓。如果支援HD 1080P解碼設定文件,則必須支援主設定檔4.1主層。
  • 應支援UHD解碼設定檔。如果支援UHD解碼設定文件,則編解碼器必須支援MAIN10等級5主層設定檔。
SD(低品質) SD(高品質)高清720p高清1080p超高畫質
視訊解析度352 x 288 PX 720 x 480 PX 1280 x 720 像素1920 x 1080 像素3840 x 2160 像素
視訊幀率30 幀/秒30 幀/秒30 幀/秒30 fps(60 fps 1 60 幀/秒
視訊比特率600 kbps 1.6Mbps 4Mbps 5Mbps 20Mbps

1使用H.265硬體解碼的Android電視設備實現所需的1。

5.3.6。 VP8

第5.1.3節所述支援VP8編解碼器時,Android設備實作了:

  • 必須支援下表中的SD解碼設定檔。
  • 應支援下表中的HD解碼概況。
  • Android電視設備必須支援HD 1080P60解碼設定檔。
SD(低品質) SD(高品質)高清720p 1高清1080p 1
視訊解析度320 x 180 PX 640 x 360 PX 1280 x 720 像素1920 x 1080 像素
視訊幀率30 幀/秒30 幀/秒30 fps(60 fps 2 30(60 fps 2
視訊比特率800 kbps 2Mbps 8Mbps 20Mbps

1當顯示的高度。getSupportedModes()方法等於或大於視訊解析度所需。

2 Android電視裝置實現所需。

5.3.7. VP9

第5.1.3節所述支援VP9編解碼器時,Android設備實作了:

  • 必須支援下表所示的SD視訊解碼設定檔。
  • 應如下表所示支援HD解碼曲線。
  • 如果有硬體解碼器,則必須支援下表中的HD解碼設定檔。
  • 另外,Android電視設備:

    • 必須支援HD 720p解碼曲線。
    • 強烈建議支援HD 1080p解碼輪廓。
    • 應支援UHD解碼設定檔。如果支援UHD視訊解碼設定文件,則必須支援8位元顏色深度,並應支援VP9設定檔2(10位元)。
SD(低品質) SD(高品質)高清720p高清1080p超高畫質
視訊解析度320 x 180 PX 640 x 360 PX 1280 x 720 像素1920 x 1080 像素3840 x 2160 像素
視訊幀率30 幀/秒30 幀/秒30 幀/秒30 fps(60 fps 1 60 幀/秒
視訊比特率600 kbps 1.6Mbps 4Mbps 5Mbps 20Mbps

1具有VP9硬體解碼的Android電視設備實現所需的1。

5.4.聲音錄製

雖然本節中概述的某些要求是自Android 4.3以來應該說的,但計劃將來版本的兼容性定義將其更改為必須。強烈建議使用現有的和新的Android設備來滿足應按應有的規定的要求,或者在升級到將來版本時,它們將無法達到Android相容性。

5.4.1.原始音訊捕獲

聲明Android.hardware.microphone的裝置實作必須允許擷取具有以下特徵的原始音訊內容:

  • 格式:線性PCM,16位
  • 取樣率:8000,11025,16000,44100
  • 頻道:單聲道

必須在不進行上採樣的情況下完成上述樣品速率的捕獲,任何向下採樣都必須包括適當的抗氧化過濾器。

聲明Android.hardware.microphone的裝置實作應允許擷取具有以下特徵的原始音訊內容:

  • 格式:線性PCM,16位
  • 取樣率:22050,48000
  • 頻道:立體聲

如果支援上述樣本率的捕獲,則必須在任何比率上進行捕獲,而不會在任何比率上進行更高採樣,以高於16000:22050或44100:48000。任何向上採樣或下採樣都必須包括適當的抗縮合過濾器。

5.4.2.語音辨識捕獲

android.media.mediarecorder.audiosource.voice_recognition音訊來源必須以44100和48000的取樣率之一支援擷取。

除上述記錄規格外,當應用程式開始使用android.media.mediarecorder.audiosource.voice_recognition Audio來源來錄製音訊串流時,

  • 該設備應顯示大致平坦的幅度與頻率特徵:具體來說,±3 dB,從100 Hz到4000 Hz。
  • 應該設定音頻輸入靈敏度,以使1000 Hz的90 dB聲音源(SPL)源可為16位元樣品產生2500的RMS。
  • PCM振幅水平應線性追蹤至少30 dB上的SPL變化,從-18 dB到+12 dB re 90 dB re 90 dB spl在麥克風上。
  • 在麥克風處的90 dB SPL輸入水平,1 kHz的總諧波失真應小於1%。
  • 降噪處理,如果存在,則必須停用。
  • 自動增益控制(如果存在)必須停用。

如果該平台支援抑制語音辨識的噪音抑制技術,則該效果必須從android.media.audiofx.noisesuppressor API中控制。此外,噪音抑制器效果描述符的UUID欄位必須唯一確定噪音抑制技術的每個實作。

5.4.3.捕獲以重新路由播放

android.media.mediarecorder.audiosource類別包含遠端_submix音訊來源。宣告Android.hardware.Audio.Output的裝置必須正確實作remote_submix音訊來源,以便應用程式使用android.media.media.audiorecord api從此音訊來源記錄時,它可以擷取所有音訊串流的混音:

  • STREAM_RING
  • STREAM_ALARM
  • STREAM_通知

5.5.音訊播放

聲明Android.hardware.audio.Output的裝置實作必須符合本節中的要求。

5.5.1.原始音訊播放

該設備必須允許具有以下特徵的原始音訊內容播放:

  • 格式:線性PCM,16位
  • 取樣率:8000,11025,16000,22050,32000,44100
  • 頻道:單,立體聲

該設備應允許播放具有以下特徵的原始音訊內容:

  • 取樣率:24000,48000

5.5.2.音訊效果

Android為裝置實作提供了音訊效果的API 。聲明功能Android.hardware.audio.Output的裝置實作:

  • 必須支援效果_type_equalizer和效果_type_loudness_enhancer實作可透過音頻效應子類均衡器Louynessenhancer控制。
  • 必須支援可視化器API實現,該實現可透過可視化器類別控制。
  • 應支援效果_TYPE_BASS_BOOST,效果_TYPE_ENV_REVERB,FEMPLECT_TYPE_PRESET_REVERB和FENSCER_TYPE_TYPE_VIRTUALIZER實作可透過Audioeffect子類別Bassboost,EmoventerAlvironingAlreRever

5.5.3.音訊輸出音量

Android電視設備的實現必須包括對支援輸出的系統主音量和數位音訊輸出量衰減的支持,除了壓縮音訊傳遞輸出(在設備上未完成音訊解碼)。

Android Automotive設備實作應允許使用android.car.CarAudioManager中公開定義的AudioAttributes和CAR Audio用法所定義的內容類型或用法分別調整音訊量。

5.6.音訊延遲

音訊延遲是隨著音訊訊號通過系統的時間延遲。許多類別的應用程式都依賴短延遲來實現即時聲音效果。

出於本節的目的,請使用以下定義:

  • 輸出延遲。當應用程式寫入PCM編碼資料的訊框與將對應的聲音呈現給在裝置感測器處的環境或訊號通過連接埠離開裝置時,可以在外部觀察到裝置時的間隔。
  • 冷輸出潛伏期。當音訊輸出系統閒置並在請求之前降低電源時,第一幀的輸出延遲。
  • 連續輸出延遲。設備播放音訊後,後續幀的輸出延遲。
  • 輸入延遲。環境向設備在設備感測器處提出聲音之間的間隔或透過連接埠進入設備以及應用程式讀取相應的PCM編碼資料幀時的間隔。
  • 輸入遺失。輸入訊號的初始部分是無法使用或不可用的。
  • 冷輸入延遲。遺失的輸入時間和第一幀的輸入延遲的總和,當音訊輸入系統閒置並在請求之前停止電源。
  • 連續輸入延遲。設備擷取音訊時,後續幀的輸入延遲。
  • 冷輸出抖動。冷輸出延遲值的單獨測量值之間的可變性。
  • 冷輸入抖動。冷輸入延遲值單獨測量之間的可變性。
  • 連續的往返潛伏期。連續輸入延遲加連續輸出延遲加一個緩衝區的總和。緩衝區允許應用程式處理應用程式的訊號和時間的時間,以減輕輸入和輸出流之間的相位差異。
  • OpenSL ES PCM緩衝液佇列APIAndroid NDK中的PCM相關的集合OPESL ES API。

強烈建議使用android.hardware.audio.Output來滿足或超越這些音訊輸出要求:

  • 100毫秒或更少的冷輸出潛伏期
  • 連續輸出潛伏期為45毫秒或更少
  • 最小化冷輸出抖動

如果設備實現在使用OPENSL ES PCM緩衝液隊列API時進行任何初始校準後符合本節的要求,則在至少一個支援的音訊輸出設備上,對於連續的輸出延遲和冷輸出潛伏期,強烈建議報告對低的支援支援。-latency音頻,透過報告android.hardware.low_latency的功能,透過android.content.pm.packagemanager類別。相反,如果設備實現不符合這些要求,則不得報告對低延遲音訊的支援。

強烈建議使用Android.hardware.microphone在內的裝置實作以滿足以下音訊要求:

  • 100毫秒或更少的冷輸入潛伏期
  • 連續輸入潛伏期為30毫秒或更少
  • 連續50毫秒或更少的往返潛伏期
  • 最大程度地減少冷輸入抖動

5.7.網路協定

設備必須支援Android SDK文件中指定的音訊和視訊播放的媒體網路協定。具體而言,設備必須支援以下媒體網路協定:

細分格式參考)所需的編解碼器支持
MPEG-2 傳輸流ISO 13818視訊編解碼器:
  • H264 AVC
  • MPEG-4 sp
  • MPEG-2
有關H264 AVC,MPEG2-4 SP的詳細信息,請參見第5.1.3節
和MPEG-2。

音訊編解碼器:

  • 亞克力
有關AAC及其變體的詳細信息,請參見第5.1.1節
帶有ADT框架和ID3標籤的AAC ISO 13818-7有關AAC及其變體的詳細信息,請參見第5.1.1節
網路VTT網路VTT
  • RTSP(RTP,SDP)

    必須支援以下RTP音訊視訊設定檔和相關編解碼器。例外,請參閱第5.1節的腳註。

個人資料名稱參考)所需的編解碼器支持
H264 AVC RFC 6184有關H264 AVC的詳細信息,請參見第5.1.3節
mp4a-latm RFC 6416有關AAC及其變體的詳細信息,請參見第5.1.1節
H263-1998 RFC 3551
RFC 4629
RFC 2190
有關H263的詳細信息,請參見第5.1.3節
H263-2000 RFC 4629有關H263的詳細信息,請參見第5.1.3節
抗微生物藥物抗藥性RFC 4867有關AMR-NB的詳細信息,請參見第5.1.1節
AMR-WB RFC 4867有關AMR-WB的詳細信息,請參見第5.1.1節
MP4V-ES RFC 6416有關MPEG-4 SP的詳細信息,請參見第5.1.3節
MPEG4生成RFC 3640有關AAC及其變體的詳細信息,請參見第5.1.1節
MP2T RFC 2250有關詳細信息

5.8.安全媒體

支援安全視訊輸出並且能夠支援安全表面的裝置實作必須聲明對display.flag_secure的支援。聲明支援Display.flag_secure的設備實現,如果它們支援無線顯示協議,則必須使用密碼強的機制(例如HDCP 2.x或更高)來保護鏈接,以供Miracast Wireless顯示器。同樣,如果它們支援有線外部顯示,則設備實作必須支援HDCP 1.2或更高。 Android Television設備實作必須支援HDCP 2.2,用於支援4K解析度和HDCP 1.4或更高的設備,以供較低的解析度。上游Android開源實作包括滿足此要求的無線(Miracast)和有線(HDMI)顯示的支援。

5.9.樂器數位介面 (MIDI)

如果設備實現支援Inter-App MIDI軟體傳輸(虛擬MIDI設備),並且它支援MIDI在以下所有具有MIDI功能的硬體運輸中,它為其提供通用的非中型連接性,強烈建議報告對對的支援功能android.software.midi透過android.content.pm.packagemanager類別。

具有MIDI功能的硬體運輸是:

  • USB主機模式(第7.7節USB)
  • USB外圍模式(第7.7節USB)
  • MIDI藍牙LE表演中心角色(第7.4.3節藍牙)

相反,如果裝置實現在上面列出的特定具有MIDI功能的硬體傳輸方面提供了通用的非中間連接性,但不支援MIDI對硬體傳輸的支持,則不得報告對功能Android.software.midi的支援。

5.10.專業音響

如果設備實現符合以下所有要求,則強烈建議透過android.content.content.pm.packagagemanager類別報告功能android.hardware.audio.pro的支援。

  • 設備實作必須報告功能android.hardware.audio.low_latency的支援。
  • 在第5.6節音訊延遲中定義的連續往返音訊延遲必須為20毫秒或更少,且在至少一個支援的路徑上應為10毫秒或更少。
  • 如果設備包含4個導體3.5毫米音訊插孔,則連續的往返音訊延遲必須在音訊插孔路徑上花費20毫秒或更少,並且在音訊千斤頂路徑上應為10毫秒或更少。
  • 設備實作必須包括支援USB主機模式和USB外圍模式的USB連接埠。
  • USB主機模式必須實作USB音訊類別。
  • 如果設備包括HDMI端口,則該設備實現必須支援立體聲的輸出,在20位元或24位元深度和192 kHz的八個通道中,不會損失或重新取樣。
  • 設備實作必須報告功能android.software.midi的支援。
  • 如果裝置包含4個導體3.5mm音訊插孔,則強烈建議使用該裝置實作來遵守有線音訊耳機規範(V1.1)的Section Mobile Device(JACK)規格

必須使用OpenSL ES PCM緩衝區佇列API滿足潛伏期和USB音訊要求。

此外,報告支援此功能的設備實現應:

  • 音訊活躍時,提供可持續的CPU效能水準。
  • 最小化音頻時鐘的不準確性和相對於標準時間的漂移。
  • 當兩者都處於活動狀態時,相對於CPU CLOCK_MONOTONIC音訊時鐘漂移最小。
  • 最大程度地減少對啟動感測器的音訊延遲。
  • 最大程度地減少USB數位音訊上的音訊延遲。
  • 記錄所有路徑上的音訊延遲測量。
  • 最大程度地減少音訊緩衝區完成回調時間的抖動,因為這會影響完整CPU頻寬的可用百分比。
  • 在報告的延遲時,在正常使用下提供零音訊底底(輸出)或越門(輸入)。
  • 提供零通道延遲差異。
  • 最大程度地減少MIDI在所有運輸中的平均潛伏期。
  • 在所有運輸中,將負載下的MIDI潛伏期變異(抖動)最小化。
  • 在所有運輸工具上提供準確的MIDI時間戳記。
  • 最大程度地減少在啟動器換能器上的音頻訊號噪聲,包括冷啟動後立即的時期。
  • 當兩者都處於活動狀態時,在相應終點的輸入和輸出側之間提供零音訊時脈差。相應的終點的範例包括在裝置上的麥克風和揚聲器,或音訊插孔輸入和輸出。
  • 當兩者都處於活動狀態時,處理對應終點的輸入和輸出側的音訊緩衝區完成回調,並在輸入回調返回後立即輸入輸出回調。或者,如果在同一線程上處理回調是不可行的,請在輸入輸入回調後不久輸入輸出回調以允許應用程式具有輸入和輸出側的一致時機。
  • 最小化對應終點的輸入和輸出側的HAL音訊緩衝之間的相位差。
  • 最小化觸控延遲。
  • 最小化負載下的觸控延遲可變性(抖動)。

5.11.捕獲未加工

從Android 7.0開始,新增了新的錄製來源。可以使用android.media.MediaRecorder.AudioSource.UNPROCESSED音訊來源存取它。在OpenSL ES中,可以使用記錄預設SL_ANDROID_RECORDING_PRESET_UNPROCESSED來存取它。

設備必須滿足以下所有要求,以透過android.media.AudioManager property報告未經處理的音訊來源的支援:

  • 該設備必須在中頻範圍內表現出大約平坦的振幅頻率特徵:特別是±10dB從100 Hz到7000 Hz。

  • 該設備必須在低頻範圍內表現出振幅等級:特別是從5 Hz到100 Hz的±20 dB相比,與中頻範圍相比。

  • 該設備必須在高頻範圍內表現出振幅水準:特別是從7000 Hz到22 kHz的±30 dB相比,與中頻範圍相比。

  • 必須設定音訊輸入靈敏度,以使1000 Hz正弦音源以94 dB的聲壓等級(SPL)播放的16個單一樣本的RMS響應(或浮點/雙精度樣品的-36 dB全尺度)的響應)。

  • SNR> 60 dB(94 dB SPL與同等的自噪聲SPL之間的差異,A加權)。

  • 在麥克風下,在90 dB的SPL輸入水準下,1 kHz的總諧波失真必須小於1%。

  • 路徑中允許的唯一訊號處理是將水平提高到所需範圍的等級乘數。此級乘數不得將延遲或延遲引入訊號路徑。

  • 路徑中不允許其他訊號處理,例如自動增益控制,高通濾波器或ECHO取消。如果出於任何原因存在架構中的任何訊號處理,則必須停用它並有效地引入零延遲或訊號路徑的額外延遲。

所有SPL測量值直接在正在測試的麥克風旁邊進行。

對於多個麥克風配置,這些要求適用於每個麥克風。

強烈建議設備滿足未經處理記錄來源的訊號路徑的許多要求;但是,如果設備聲稱支援未加工的音訊來源,則必須滿足上述所有這些要求。

6. 開發者工具和選項相容性

6.1.開發者工具

設備實作必須支援Android SDK中提供的Android開發人員工具。 Android相容裝置必須與:

  • Android Debug Bridge(ADB)
    • 設備實作必須支援Android SDK(包括Dumpsys)中記錄的所有ADB功能。
    • 預設情況下,裝置側ADB守護程式必須不活動,並且必須有一個可存取使用者的機制來開啟Android偵錯橋。如果裝置實作省略了USB週邊模式,則必須透過本地區域網路(例如乙太網路或802.11)實作Android調試橋。
    • Android包含安全ADB的支援。安全ADB可以在已知身份驗證的宿主上啟用ADB。設備實作必須支援安全的ADB。
  • Dalvik 調試監控服務 (ddms)
    • 設備實作必須支援Android SDK中記錄的所有DDMS功能。
    • 由於 ddms 使用 adb,因此預設對 ddms 的支援應該處於非活動狀態,但只要使用者啟動 Android 偵錯橋就必須支持,如上所述。
  • 猴子設備的實作必須包括猴子框架,並使其可用於使用應用程式。
  • Systrace
    • 設備實作必須支援Android SDK中記錄的Systrace工具。 Systrace預設必須不活動,且必須有一個可存取Systrace的使用者存取機制。
    • 大多數基於Linux的系統和Apple Macintosh系統使用標準Android SDK工具識別Android設備,而無需額外支援;但是,Microsoft Windows系統通常需要新的Android裝置的驅動程式。 (例如,新的供應商ID和新設備ID需要Windows系統的自訂USB驅動程式。)
    • 如果標準Android SDK中提供的ADB工具無法識別裝置實現,則裝置實現者必須為Windows驅動程式提供允許開發人員使用ADB協定連接到裝置的Windows驅動程式。必須為Windows XP,Windows Vista,Windows 7,Windows 8和Windows 10提供這些驅動程序,並在32位元和64位元版本中提供。

6.2.開發者選項

Android 支援開發人員配置應用程式開發相關的設定。裝置實作必須尊重Android.settings.application_development_settings意圖顯示與應用程式開發相關的設定上游Android實作預設情況下封鎖了開發人員選項選單,並使使用者在設定>設定>「關於設定>「設定」> 「關於設定> 7)之後」啟動開發人員選項。建立編號選單項目。設備實作必須為開發人員選項提供一致的體驗。具體而言,設備實作必須預設使用開發人員選項,並且必須提供一種機制來啟用與上游Android實作一致的開發人員選項。

Android Automotive實作可能會在車輛啟動時透過視覺隱藏或停用選單來限制對開發人員選項選單的存取。

7. 硬體相容性

如果裝置包含具有針對第三方開發人員對應的API的特定硬體元件,則裝置實作必須如Android SDK文件中所述實作該API。如果 SDK 中的 API 與指定為可選的硬體元件交互,且裝置實作不擁有該元件:

  • 必須介紹組件API的完整類別定義(由SDK記錄)。
  • API的行為必須以某種合理的方式實現為無措施。
  • 在SDK文件允許的情況下,API方法必須傳回空值。
  • API方法必須傳回SDK文件不允許未允許的null值的類別的NO-OP實作。
  • API方法不得拋出SDK文件未記錄的例外。

應用這些要求的場景的典型範例是電話 API:即使在非電話設備上,這些 API 也必須以合理的無操作方式實作。

設備實作必須透過getSystemavailableFeatures()()和hassystemfeature(String)方法在Android.content.content.pm.packagemanager類別上始終報告準確的硬體配置資訊。

7.1.顯示和圖形

Android 包含自動調整應用程式資源和適合裝置的 UI 佈局的功能,以確保第三方應用程式在各種硬體配置上運作良好。如本節所述,設備必須正確實施這些API和行為。

本節要求引用的單位定義如下:

  • 物理對角線尺寸。顯示器照明部分的兩個相對角落之間的距離(以英吋為單位)。
  • 每吋點數 (dpi) 。 1 英吋的線性水平或垂直跨度所包含的像素數。在列出 dpi 值的地方,水平和垂直 dpi 都必須落在該範圍內。
  • 長寬比。螢幕較長尺寸與較短尺寸的像素之比。例如,480x854 像素的顯示器將為 854/480 = 1.779,或大致為「16:9」。
  • 與密度無關的像素 (dp) 。歸一化為 160 dpi 螢幕的虛擬像素單位,計算公式為:像素 = dps * (密度/160)。

7.1.1.螢幕配置

7.1.1.1.螢幕尺寸

如本節所述,Android手錶設備(第2節中詳細介紹)可能具有較小的螢幕尺寸。

Android UI框架支援各種不同的螢幕尺寸,並允許應用程式透過android.content.res.res.configuration.screenlayout進行screenlaylayout_size_mask 。如Android SDK文件中定義的,並由上游Android平台確定。具體來說,設備實現必須根據以下邏輯密度無關的像素(DP)螢幕尺寸報告正確的螢幕大小。

  • 設備必須具有至少426 dp x 320 dp('small')的螢幕尺寸,除非它是Android Watch設備。
  • 報告螢幕尺寸「正常」的裝置必須具有至少480 dp x 320 dp的螢幕尺寸。
  • 報告螢幕尺寸「大」的裝置必須具有至少640 dp x 480 dp的螢幕尺寸。
  • 報告螢幕尺寸「 Xlarge」的裝置必須具有至少960 dp x 720 dp的螢幕尺寸。

另外:

  • Android Watch設備必須具有一個物理對角線尺寸在1.1到2.5英吋的螢幕。
  • Android汽車設備必須具有物理對角線大小大於或等於6英吋的螢幕。
  • Android汽車裝置的螢幕尺寸至少為750 dp x 480 dp。
  • 具有物理整合的螢幕的其他類型的Android設備實現必須具有至少2.5英寸的物理對角線尺寸。

設備不得隨時更改其報告的螢幕尺寸。

應用程式可選擇地指示透過<Supports-Screens> AndroidManifest.xml檔案中的<supports-Screens>屬性支援的螢幕大小。裝置實作必須正確地尊重應用程式對Android SDK文件中所述的小型,正常,大和Xlarge螢幕的指定支援。

7.1.1.2.螢幕縱橫比

儘管實體螢幕顯示的螢幕縱橫比值沒有限制,但第三方應用程式呈現的表面的螢幕縱橫比呈現在上面,並且可以從透過顯示器報告的值中得出以下要求:

  • 如果將UIMODE配置為UI_MODE_TYPE_WATCH,則縱橫比值可以設定為1.0(1:1)。
  • 如果第三方應用程式顯示它可以透過Android:resizeableactivity屬性來重新算起,則沒有對縱橫比值的限制。
  • 對於所有其他情況,除非APP明確表示透過Maxaspectratio元資料值明確表示,否則長寬比必須為1.3333(4:3)和1.86(約16:9)的值。

7.1.1.3。螢幕密度

Android UI框架定義了一組標準邏輯密度,以幫助應用程式開發人員針對應用程式資源。 By default, device implementations MUST report only one of the following logical Android framework densities through the DENSITY_DEVICE_STABLE API and this value MUST NOT change at any time;但是,設備可以根據使用者在初始啟動後設定的顯示配置變更(例如,顯示尺寸)報告不同的任意密度。

  • 120 dpi(LDPI)
  • 160 dpi (mdpi)
  • 213 dpi(電視dpi)
  • 240 dpi(高清)
  • 260 dpi (260dpi)
  • 280dpi (280dpi)
  • 300 dpi (300dpi)
  • 320 dpi(xhdpi)
  • 340 dpi (340dpi)
  • 360dpi (360dpi)
  • 400dpi (400dpi)
  • 420 dpi (420dpi)
  • 480 dpi (xxhdpi)
  • 560dpi(560dpi)
  • 640 dpi (xxxhdpi)

裝置實現應該定義在數值上最接近螢幕物理密度的標準 Android 框架密度,除非該邏輯密度將報告的螢幕尺寸推至支援的最小值以下。如果在數字上最接近物理密度的標準 Android 框架密度導致螢幕尺寸小於支援的最小相容螢幕尺寸(320 dp 寬度),則裝置實現應該報告下一個最低的標準 Android 框架密度。

Device implementations are STRONGLY RECOMMENDED to provide users a setting to change the display size. If there is an implementation to change the display size of the device, it MUST align with the AOSP implementation as indicated below:

  • The display size MUST NOT be scaled any larger than 1.5 times the native density or produce an effective minimum screen dimension smaller than 320dp (equivalent to resource qualifier sw320dp), whichever comes first.
  • Display size MUST NOT be scaled any smaller than 0.85 times the native density.
  • 為了確保良好的可用性和一致的字體大小,建議提供以下本機顯示選項縮放(同時遵守上述指定的限制)
  • Small: 0.85x
  • 預設值:1x(本機顯示比例)
  • 大:1.15x
  • 更大:1.3x
  • 最大1.45倍

7.1.2.顯示指標

Device implementations MUST report correct values for all display metrics defined in android.util.DisplayMetrics and MUST report the same values regardless of whether the embedded or external screen is used as the default display.

7.1.3.螢幕方向

Devices MUST report which screen orientations they support (android.hardware.screen.portrait and/or android.hardware.screen.landscape) and MUST report at least one supported orientation. For example, a device with a fixed orientation landscape screen, such as a television or laptop, SHOULD only report android.hardware.screen.landscape.

Devices that report both screen orientations MUST support dynamic orientation by applications to either portrait or landscape screen orientation.也就是說,設備必須尊重應用程式對特定螢幕方向的請求。設備實作可以選擇肖像或景觀方向作為預設設備。

每當透過android.content.res.configuration.orientation,android.view.display.getorientation()或其他apis查詢時,裝置必須報告裝置目前方向的正確值。

Devices MUST NOT change the reported screen size or density when changing orientation.

7.1.4. 2D 和 3D 圖形加速

Device implementations MUST support both OpenGL ES 1.0 and 2.0, as embodied and detailed in the Android SDK documentations. Device implementations SHOULD support OpenGL ES 3.0, 3.1, or 3.2 on devices capable of supporting it. Device implementations MUST also support Android RenderScript , as detailed in the Android SDK documentation.

Device implementations MUST also correctly identify themselves as supporting OpenGL ES 1.0, OpenGL ES 2.0, OpenGL ES 3.0, OpenGL 3.1, or OpenGL 3.2.那是:

  • The managed APIs (such as via the GLES10.getString() method) MUST report support for OpenGL ES 1.0 and OpenGL ES 2.0.
  • The native C/C++ OpenGL APIs (APIs available to apps via libGLES_v1CM.so, libGLES_v2.so, or libEGL.so) MUST report support for OpenGL ES 1.0 and OpenGL ES 2.0.
  • Device implementations that declare support for OpenGL ES 3.0, 3.1, or 3.2 MUST support the corresponding managed APIs and include support for native C/C++ APIs. On device implementations that declare support for OpenGL ES 3.0, 3.1, or 3.2 libGLESv2.so MUST export the corresponding function symbols in addition to the OpenGL ES 2.0 function symbols.

Android provides an OpenGL ES extension pack with Java interfaces and native support for advanced graphics functionality such as tessellation and the ASTC texture compression format. Android device implementations MUST support the extension pack if the device supports OpenGL ES 3.2 and MAY support it otherwise. If the extension pack is supported in its entirety, the device MUST identify the support through the android.hardware.opengles.aep feature flag.

Also, device implementations MAY implement any desired OpenGL ES extensions. However, device implementations MUST report via the OpenGL ES managed and native APIs all extension strings that they do support, and conversely MUST NOT report extension strings that they do not support.

Note that Android includes support for applications to optionally specify that they require specific OpenGL texture compression formats. These formats are typically vendor-specific. Device implementations are not required by Android to implement any specific texture compression format. However, they SHOULD accurately report any texture compression formats that they do support, via the getString() method in the OpenGL API.

Android 包含一種機制,供應用程式透過使用清單標記android:hardwareAccelerated或直接 API 呼叫來聲明它們希望在應用程式、活動、視窗或視圖層級啟用 2D 圖形的硬體加速。

Device implementations MUST enable hardware acceleration by default, and MUST disable hardware acceleration if the developer so requests by setting android:hardwareAccelerated="false” or disabling hardware acceleration directly through the Android View APIs.

In addition, device implementations MUST exhibit behavior consistent with the Android SDK documentation on hardware acceleration .

Android 包含一個 TextureView 對象,可讓開發人員直接將硬體加速的 OpenGL ES 紋理集成為 UI 層次結構中的渲染目標。 Device implementations MUST support the TextureView API, and MUST exhibit consistent behavior with the upstream Android implementation.

Android includes support for EGL_ANDROID_RECORDABLE, an EGLConfig attribute that indicates whether the EGLConfig supports rendering to an ANativeWindow that records images to a video. Device implementations MUST support EGL_ANDROID_RECORDABLE extension.

7.1.5。舊版應用程式相容模式

Android specifies a “compatibility mode” in which the framework operates in a 'normal' screen size equivalent (320dp width) mode for the benefit of legacy applications not developed for old versions of Android that pre-date screen-size independence.

  • Android Automotive does not support legacy compatibility mode.
  • All other device implementations MUST include support for legacy application compatibility mode as implemented by the upstream Android open source code. That is, device implementations MUST NOT alter the triggers or thresholds at which compatibility mode is activated, and MUST NOT alter the behavior of the compatibility mode itself.

7.1.6。螢幕技術

The Android platform includes APIs that allow applications to render rich graphics to the display.除非本文檔特別允許,否則裝置必須支援 Android SDK 定義的所有這些 API。

  • Devices MUST support displays capable of rendering 16-bit color graphics and SHOULD support displays capable of 24-bit color graphics.
  • Devices MUST support displays capable of rendering animations.
  • The display technology used MUST have a pixel aspect ratio (PAR) between 0.9 and 1.15.也就是說,像素長寬比必須接近正方形 (1.0),容差為 10 ~ 15%。

7.1.7.輔助顯示器

Android includes support for secondary display to enable media sharing capabilities and developer APIs for accessing external displays. If a device supports an external display either via a wired, wireless, or an embedded additional display connection then the device implementation MUST implement the display manager API as described in the Android SDK documentation.

7.2.輸入裝置

Devices MUST support a touchscreen or meet the requirements listed in 7.2.2 for non-touch navigation.

7.2.1.鍵盤

Android Watch and Android Automotive implementations MAY implement a soft keyboard. All other device implementations MUST implement a soft keyboard and:

設備實現:

  • MUST include support for the Input Management Framework (which allows third-party developers to create Input Method Editors—ie soft keyboard) as detailed at http://developer.android.com .
  • MUST provide at least one soft keyboard implementation (regardless of whether a hard keyboard is present) except for Android Watch devices where the screen size makes it less reasonable to have a soft keyboard.
  • MAY include additional soft keyboard implementations.
  • MAY include a hardware keyboard.
  • MUST NOT include a hardware keyboard that does not match one of the formats specified in android.content.res.Configuration.keyboard (QWERTY or 12-key).

7.2.2.非觸控式導航

Android Television devices MUST support D-pad.

設備實現:

  • MAY omit a non-touch navigation option (trackball, d-pad, or wheel) if the device implementation is not an Android Television device.
  • MUST report the correct value for android.content.res.Configuration.navigation .
  • MUST provide a reasonable alternative user interface mechanism for the selection and editing of text, compatible with Input Management Engines. The upstream Android open source implementation includes a selection mechanism suitable for use with devices that lack non-touch navigation inputs.

7.2.3.導航鍵

The availability and visibility requirement of the Home, Recents, and Back functions differ between device types as described in this section.

The Home, Recents, and Back functions (mapped to the key events KEYCODE_HOME, KEYCODE_APP_SWITCH, KEYCODE_BACK, respectively) are essential to the Android navigation paradigm and therefore:

  • Android Handheld device implementations MUST provide the Home, Recents, and Back functions.
  • Android Television device implementations MUST provide the Home and Back functions.
  • Android Watch device implementations MUST have the Home function available to the user, and the Back function except for when it is in UI_MODE_TYPE_WATCH .
  • Android Watch device implementations, and no other Android device types, MAY consume the long press event on the key event KEYCODE_BACK and omit it from being sent to the foreground application.
  • Android Automotive implementations MUST provide the Home function and MAY provide Back and Recent functions.
  • All other types of device implementations MUST provide the Home and Back functions.

These functions MAY be implemented via dedicated physical buttons (such as mechanical or capacitive touch buttons), or MAY be implemented using dedicated software keys on a distinct portion of the screen, gestures, touch panel, etc. Android supports both implementations. All of these functions MUST be accessible with a single action (eg tap, double-click or gesture) when visible.

Recents function, if provided, MUST have a visible button or icon unless hidden together with other navigation functions in full-screen mode. This does not apply to devices upgrading from earlier Android versions that have physical buttons for navigation and no recents key.

The Home and Back functions, if provided, MUST each have a visible button or icon unless hidden together with other navigation functions in full-screen mode or when the uiMode UI_MODE_TYPE_MASK is set to UI_MODE_TYPE_WATCH.

The Menu function is deprecated in favor of action bar since Android 4.0. Therefore the new device implementations shipping with Android 7.1 and later MUST NOT implement a dedicated physical button for the Menu function. Older device implementations SHOULD NOT implement a dedicated physical button for the Menu function, but if the physical Menu button is implemented and the device is running applications with targetSdkVersion > 10, the device implementation:

  • MUST display the action overflow button on the action bar when it is visible and the resulting action overflow menu popup is not empty. For a device implementation launched before Android 4.4 but upgrading to Android 7.1, this is RECOMMENDED.
  • MUST NOT modify the position of the action overflow popup displayed by selecting the overflow button in the action bar.
  • MAY render the action overflow popup at a modified position on the screen when it is displayed by selecting the physical menu button.

For backwards compatibility, device implementations MUST make the Menu function available to applications when targetSdkVersion is less than 10, either by a physical button, a software key, or gestures. This Menu function should be presented unless hidden together with other navigation functions.

Android device implementations supporting the Assist action and/or VoiceInteractionService MUST be able to launch an assist app with a single interaction (eg tap, double-click, or gesture) when other navigation keys are visible. It is STRONGLY RECOMMENDED to use long press on home as this interaction. The designated interaction MUST launch the user-selected assist app, in other words the app that implements a VoiceInteractionService, or an activity handling the ACTION_ASSIST intent.

Device implementations MAY use a distinct portion of the screen to display the navigation keys, but if so, MUST meet these requirements:

  • Device implementation navigation keys MUST use a distinct portion of the screen, not available to applications, and MUST NOT obscure or otherwise interfere with the portion of the screen available to applications.
  • Device implementations MUST make available a portion of the display to applications that meets the requirements defined in section 7.1.1 .
  • Device implementations MUST display the navigation keys when applications do not specify a system UI mode, or specify SYSTEM_UI_FLAG_VISIBLE.
  • Device implementations MUST present the navigation keys in an unobtrusive “low profile” (eg. dimmed) mode when applications specify SYSTEM_UI_FLAG_LOW_PROFILE.
  • Device implementations MUST hide the navigation keys when applications specify SYSTEM_UI_FLAG_HIDE_NAVIGATION.

7.2.4.觸控螢幕輸入

Android Handhelds and Watch Devices MUST support touchscreen input.

Device implementations SHOULD have a pointer input system of some kind (either mouse-like or touch). However, if a device implementation does not support a pointer input system, it MUST NOT report the android.hardware.touchscreen or android.hardware.faketouch feature constant. Device implementations that do include a pointer input system:

  • SHOULD support fully independently tracked pointers, if the device input system supports multiple pointers.
  • MUST report the value of android.content.res.Configuration.touchscreen corresponding to the type of the specific touchscreen on the device.

Android includes support for a variety of touchscreens, touch pads, and fake touch input devices.基於觸控螢幕的裝置實現與顯示器相關聯,使得使用者有直接操縱螢幕上的項目的印象。由於使用者直接觸摸螢幕,系統不需要任何額外的功能來指示正在操作的物件。 In contrast, a fake touch interface provides a user input system that approximates a subset of touchscreen capabilities. For example, a mouse or remote control that drives an on-screen cursor approximates touch, but requires the user to first point or focus then click. Numerous input devices like the mouse, trackpad, gyro-based air mouse, gyro-pointer, joystick, and multi-touch trackpad can support fake touch interactions. Android includes the feature constant android.hardware.faketouch, which corresponds to a high-fidelity non-touch (pointer-based) input device such as a mouse or trackpad that can adequately emulate touch-based input (including basic gesture support), and indicates that the device supports an emulated subset of touchscreen functionality. Device implementations that declare the fake touch feature MUST meet the fake touch requirements in section 7.2.5 .

Device implementations MUST report the correct feature corresponding to the type of input used. Device implementations that include a touchscreen (single-touch or better) MUST report the platform feature constant android.hardware.touchscreen. Device implementations that report the platform feature constant android.hardware.touchscreen MUST also report the platform feature constant android.hardware.faketouch. Device implementations that do not include a touchscreen (and rely on a pointer device only) MUST NOT report any touchscreen feature, and MUST report only android.hardware.faketouch if they meet the fake touch requirements in section 7.2.5 .

7.2.5.假觸摸輸入

Device implementations that declare support for android.hardware.faketouch:

  • MUST report the absolute X and Y screen positions of the pointer location and display a visual pointer on the screen.
  • MUST report touch event with the action code that specifies the state change that occurs on the pointer going down or up on the screen .
  • MUST support pointer down and up on an object on the screen, which allows users to emulate tap on an object on the screen.
  • MUST support pointer down, pointer up, pointer down then pointer up in the same place on an object on the screen within a time threshold, which allows users to emulate double tap on an object on the screen.
  • MUST support pointer down on an arbitrary point on the screen, pointer move to any other arbitrary point on the screen, followed by a pointer up, which allows users to emulate a touch drag.
  • MUST support pointer down then allow users to quickly move the object to a different position on the screen and then pointer up on the screen, which allows users to fling an object on the screen.

Devices that declare support for android.hardware.faketouch.multitouch.distinct MUST meet the requirements for faketouch above, and MUST also support distinct tracking of two or more independent pointer inputs.

7.2.6。遊戲控制器支持

Android Television device implementations MUST support button mappings for game controllers as listed below. The upstream Android implementation includes implementation for game controllers that satisfies this requirement.

7.2.6.1.按鈕映射

Android Television device implementations MUST support the following key mappings:

按鈕HID Usage 2安卓按鈕
1 0x09 0x0001 KEYCODE_BUTTON_A (96)
1 0x09 0x0002 KEYCODE_BUTTON_B (97)
X 1 0x09 0x0004 KEYCODE_BUTTON_X (99)
Y 1 0x09 0x0005 KEYCODE_BUTTON_Y (100)
D-pad up 1
D-pad down 1
0x01 0x0039 3 AXIS_HAT_Y 4
D-pad left 1
D-pad right 1
0x01 0x0039 3 AXIS_HAT_X 4
左肩按鈕1 0x09 0x0007 KEYCODE_BUTTON_L1 (102)
右肩按鈕1 0x09 0x0008 KEYCODE_BUTTON_R1 (103)
Left stick click 1 0x09 0x000E KEYCODE_BUTTON_THUMBL (106)
右搖桿點選1 0x09 0x000F KEYCODE_BUTTON_THUMBR (107)
首頁1 0x0c 0x0223 KEYCODE_HOME (3)
返回1 0x0c 0x0224 KEYCODE_BACK (4)

1關鍵事件

2 上述 HID 用法必須在遊戲手把 CA (0x01 0x0005) 內聲明。

3 此用法必須具有邏輯最小值 0、邏輯最大值 7、物理最小值 0、物理最大值 315、單位為度和報告大小 4。邏輯值定義為順時針旋轉遠離垂直軸;例如,邏輯值0表示不旋轉且按下向上按鈕,而邏輯值1表示旋轉45度並且按下向上和向左鍵。

4 MotionEvent

模擬控制1 HID 使用安卓按鈕
左扳機0x02 0x00C5 AXIS_LTRIGGER
右邊扳機0x02 0x00C4 AXIS_RTRIGGER
左搖桿0x01 0x0030
0x01 0x0031
軸_X
Y軸
右搖桿0x01 0x0032
0x01 0x0035
AXIS_Z
軸_RZ

1 個運動事件

7.2.7.遙控

Android Television device implementations SHOULD provide a remote control to allow users to access the TV interface. The remote control MAY be a physical remote or can be a software-based remote that is accessible from a mobile phone or tablet. The remote control MUST meet the requirements defined below.

  • Search affordance . Device implementations MUST fire KEYCODE_SEARCH (or KEYCODE_ASSIST if the device supports an assistant) when the user invokes voice search on either the physical or software-based remote.
  • 導航。 All Android Television remotes MUST include Back, Home, and Select buttons and support for D-pad events .

7.3.感應器

Android includes APIs for accessing a variety of sensor types. Devices implementations generally MAY omit these sensors, as provided for in the following subsections. If a device includes a particular sensor type that has a corresponding API for third-party developers, the device implementation MUST implement that API as described in the Android SDK documentation and the Android Open Source documentation on sensors . For example, device implementations:

  • MUST accurately report the presence or absence of sensors per the android.content.pm.PackageManager class.
  • MUST return an accurate list of supported sensors via the SensorManager.getSensorList() and similar methods.
  • MUST behave reasonably for all other sensor APIs (for example, by returning true or false as appropriate when applications attempt to register listeners, not calling sensor listeners when the corresponding sensors are not present; etc.).
  • MUST report all sensor measurements using the relevant International System of Units (metric) values for each sensor type as defined in the Android SDK documentation.
  • SHOULD report the event time in nanoseconds as defined in the Android SDK documentation, representing the time the event happened and synchronized with the SystemClock.elapsedRealtimeNano() clock. Existing and new Android devices are STRONGLY RECOMMENDED to meet these requirements so they will be able to upgrade to the future platform releases where this might become a REQUIRED component. The synchronization error SHOULD be below 100 milliseconds.
  • MUST report sensor data with a maximum latency of 100 milliseconds + 2 * sample_time for the case of a sensor streamed with a minimum required latency of 5 ms + 2 * sample_time when the application processor is active.此延遲不包括任何過濾延遲。
  • MUST report the first sensor sample within 400 milliseconds + 2 * sample_time of the sensor being activated.此樣本的準確度為 0 是可以接受的。

上面的列表並不全面; Android SDK 和 Android 開源文件在感測器上記錄的行為被視為具有權威性。

Some sensor types are composite, meaning they can be derived from data provided by one or more other sensors. (Examples include the orientation sensor and the linear acceleration sensor.) Device implementations SHOULD implement these sensor types, when they include the prerequisite physical sensors as described in sensor types . If a device implementation includes a composite sensor it MUST implement the sensor as described in the Android Open Source documentation on composite sensors .

Some Android sensors support a “continuous” trigger mode , which returns data continuously.為 any API indicated by the Android SDK documentation to be a continuous sensor, device implementations MUST continuously provide periodic data samples that SHOULD have a jitter below 3%, where jitter is definion as the standard valviues the stand valviue.事件。

Note that the device implementations MUST ensure that the sensor event stream MUST NOT prevent the device CPU from entering a suspend state or waking up from a suspend state.

Finally, when several sensors are activated, the power consumption SHOULD NOT exceed the sum of the individual sensor's reported power consumption.

7.3.1.加速度計

Device implementations SHOULD include a 3-axis accelerometer. Android Handheld devices, Android Automotive implementations, and Android Watch devices are STRONGLY RECOMMENDED to include this sensor. If a device implementation does include a 3-axis accelerometer, it:

  • MUST implement and report TYPE_ACCELEROMETER sensor .
  • MUST be able to report events up to a frequency of at least 50 Hz for Android Watch devices as such devices have a stricter power constraint and 100 Hz for all other device types.
  • 應報告至少 200 Hz 的事件。
  • MUST comply with the Android sensor coordinate system as detailed in the Android APIs. Android Automotive implementations MUST comply with the Android car sensor coordinate system .
  • MUST be capable of measuring from freefall up to four times the gravity (4g) or more on any axis.
  • MUST have a resolution of at least 12-bits and SHOULD have a resolution of at least 16-bits.
  • 如果特性在生命週期內發生變化,則應在使用時進行校準並進行補償,並在設備重新啟動之間保留補償參數。
  • 應進行溫度補償。
  • MUST have a standard deviation no greater than 0.05 m/s^, where the standard deviation should be calculated on a per axis basis on samples collected over a period of at least 3 seconds at the fastest sampling rate.
  • SHOULD implement the TYPE_SIGNIFICANT_MOTION, TYPE_TILT_DETECTOR, TYPE_STEP_DETECTOR, TYPE_STEP_COUNTER composite sensors as described in the Android SDK document. Existing and new Android devices are STRONGLY RECOMMENDED to implement the TYPE_SIGNIFICANT_MOTION composite sensor. If any of these sensors are implemented, the sum of their power consumption MUST always be less than 4 mW and SHOULD each be below 2 mW and 0.5 mW for when the device is in a dynamic or static condition.
  • If a gyroscope sensor is included, MUST implement the TYPE_GRAVITY and TYPE_LINEAR_ACCELERATION composite sensors and SHOULD implement the TYPE_GAME_ROTATION_VECTOR composite sensor. Existing and new Android devices are STRONGLY RECOMMENDED to implement the TYPE_GAME_ROTATION_VECTOR sensor.
  • MUST implement a TYPE_ROTATION_VECTOR composite sensor, if a gyroscope sensor and a magnetometer sensor is also included.

7.3.2.磁力計

Device implementations SHOULD include a 3-axis magnetometer (compass). If a device does include a 3-axis magnetometer, it:

  • MUST implement the TYPE_MAGNETIC_FIELD sensor and SHOULD also implement TYPE_MAGNETIC_FIELD_UNCALIBRATED sensor. Existing and new Android devices are STRONGLY RECOMMENDED to implement the TYPE_MAGNETIC_FIELD_UNCALIBRATED sensor.
  • MUST be able to report events up to a frequency of at least 10 Hz and SHOULD report events up to at least 50 Hz.
  • MUST comply with the Android sensor coordinate system as detailed in the Android APIs.
  • MUST be capable of measuring between -900 µT and +900 µT on each axis before saturating.
  • MUST have a hard iron offset value less than 700 µT and SHOULD have a value below 200 µT, by placing the magnetometer far from dynamic (current-induced) and static (magnet-induced) magnetic fields.
  • MUST have a resolution equal or denser than 0.6 µT and SHOULD have a resolution equal or denser than 0.2 µT.
  • 應進行溫度補償。
  • MUST support online calibration and compensation of the hard iron bias, and preserve the compensation parameters between device reboots.
  • MUST have the soft iron compensation applied—the calibration can be done either while in use or during the production of the device.
  • SHOULD have a standard deviation, calculated on a per axis basis on samples collected over a period of at least 3 seconds at the fastest sampling rate, no greater than 0.5 µT.
  • MUST implement a TYPE_ROTATION_VECTOR composite sensor, if an accelerometer sensor and a gyroscope sensor is also included.
  • MAY implement the TYPE_GEOMAGNETIC_ROTATION_VECTOR sensor if an accelerometer sensor is also implemented. However if implemented, it MUST consume less than 10 mW and SHOULD consume less than 3 mW when the sensor is registered for batch mode at 10 Hz.

7.3.3.全球定位系統

Device implementations SHOULD include a GPS/GNSS receiver. If a device implementation does include a GPS/GNSS receiver and reports the capability to applications through the android.hardware.location.gps feature flag:

  • It is STRONGLY RECOMMENDED that the device continue to deliver normal GPS/GNSS outputs to applications during an emergency phone call and that location output not be blocked during an emergency phone call.
  • It MUST support location outputs at a rate of at least 1 Hz when requested via LocationManager#requestLocationUpdate .
  • It MUST be able to determine the location in open-sky conditions (strong signals, negligible multipath, HDOP < 2) within 10 seconds (fast time to first fix), when connected to a 0.5 Mbps or faster data speed internet connection.通常透過使用某種形式的輔助或預測 GPS/GNSS 技術來滿足此要求,以最大限度地減少 GPS/GNSS 鎖定時間(輔助資料包括參考時間、參考位置和衛星星曆/時鐘)。
    • After making such a location calculation, it is STRONGLY RECOMMENDED for the device to be able to determine its location, in open sky, within 10 seconds, when location requests are restarted, up to an hour after the initial location calculation, even when the subsequent request is made without a data connection, and/or after a power cycle.
  • 在決定位置後的開闊天空條件下,靜止或以小於 1 公尺每秒平方的加速度移動時:
    • It MUST be able to determine location within 20 meters, and speed within 0.5 meters per second, at least 95% of the time.
    • It MUST simultaneously track and report via GnssStatus.Callback at least 8 satellites from one constellation.
    • It SHOULD be able to simultaneously track at least 24 satellites, from multiple constellations (eg GPS + at least one of Glonass, Beidou, Galileo).
  • It MUST report the GNSS technology generation through the test API 'getGnssYearOfHardware'.
  • It is STRONGLY RECOMMENDED to meet and MUST meet all requirements below if the GNSS technology generation is reported as the year "2016" or newer.
    • It MUST report GPS measurements, as soon as they are found, even if a location calculated from GPS/GNSS is not yet reported.
    • It MUST report GPS pseudoranges and pseudorange rates, that, in open-sky conditions after determining the location, while stationary or moving with less than 0.2 meter per second squared of acceleration, are sufficient to calculate position within 20 meters, and speed within 0.2 meters per second, at least 95% of the time.

Note that while some of the GPS requirements above are stated as STRONGLY RECOMMENDED, the Compatibility Definition for the next major version is expected to change these to a MUST.

7.3.4.陀螺儀

Device implementations SHOULD include a gyroscope (angular change sensor). Devices SHOULD NOT include a gyroscope sensor unless a 3-axis accelerometer is also included. If a device implementation includes a gyroscope, it:

  • MUST implement the TYPE_GYROSCOPE sensor and SHOULD also implement TYPE_GYROSCOPE_UNCALIBRATED sensor. Existing and new Android devices are STRONGLY RECOMMENDED to implement the SENSOR_TYPE_GYROSCOPE_UNCALIBRATED sensor.
  • MUST be capable of measuring orientation changes up to 1,000 degrees per second.
  • MUST be able to report events up to a frequency of at least 50 Hz for Android Watch devices as such devices have a stricter power constraint and 100 Hz for all other device types.
  • 應報告至少 200 Hz 的事件。
  • MUST have a resolution of 12-bits or more and SHOULD have a resolution of 16-bits or more.
  • MUST be temperature compensated.
  • MUST be calibrated and compensated while in use, and preserve the compensation parameters between device reboots.
  • MUST have a variance no greater than 1e-7 rad^2 / s^2 per Hz (variance per Hz, or rad^2 / s). The variance is allowed to vary with the sampling rate, but must be constrained by this value. In other words, if you measure the variance of the gyro at 1 Hz sampling rate it should be no greater than 1e-7 rad^2/s^2.
  • MUST implement a TYPE_ROTATION_VECTOR composite sensor, if an accelerometer sensor and a magnetometer sensor is also included.
  • If an accelerometer sensor is included, MUST implement the TYPE_GRAVITY and TYPE_LINEAR_ACCELERATION composite sensors and SHOULD implement the TYPE_GAME_ROTATION_VECTOR composite sensor. Existing and new Android devices are STRONGLY RECOMMENDED to implement the TYPE_GAME_ROTATION_VECTOR sensor.

7.3.5。晴雨表

Device implementations SHOULD include a barometer (ambient air pressure sensor). If a device implementation includes a barometer, it:

  • MUST implement and report TYPE_PRESSURE sensor.
  • MUST be able to deliver events at 5 Hz or greater.
  • MUST have adequate precision to enable estimating altitude.
  • MUST be temperature compensated.

7.3.6。溫度計

Device implementations MAY include an ambient thermometer (temperature sensor). If present, it MUST be defined as SENSOR_TYPE_AMBIENT_TEMPERATURE and it MUST measure the ambient (room) temperature in degrees Celsius.

Device implementations MAY but SHOULD NOT include a CPU temperature sensor. If present, it MUST be defined as SENSOR_TYPE_TEMPERATURE, it MUST measure the temperature of the device CPU, and it MUST NOT measure any other temperature. Note the SENSOR_TYPE_TEMPERATURE sensor type was deprecated in Android 4.0.

For Android Automotive implementations, SENSOR_TYPE_AMBIENT_TEMPERATURE MUST measure the temperature inside the vehicle cabin.

7.3.7.光度計

Device implementations MAY include a photometer (ambient light sensor).

7.3.8.接近感測器

Device implementations MAY include a proximity sensor. Devices that can make a voice call and indicate any value other than PHONE_TYPE_NONE in getPhoneType SHOULD include a proximity sensor. If a device implementation does include a proximity sensor, it:

  • MUST measure the proximity of an object in the same direction as the screen. That is, the proximity sensor MUST be oriented to detect objects close to the screen, as the primary intent of this sensor type is to detect a phone in use by the user. If a device implementation includes a proximity sensor with any other orientation, it MUST NOT be accessible through this API.
  • MUST have 1-bit of accuracy or more.

7.3.9.高保真感應器

Device implementations supporting a set of higher quality sensors that can meet all the requirements listed in this section MUST identify the support through the android.hardware.sensor.hifi_sensors feature flag.

A device declaring android.hardware.sensor.hifi_sensors MUST support all of the following sensor types meeting the quality requirements as below:

  • SENSOR_TYPE_ACCELEROMETER
    • MUST have a measurement range between at least -8g and +8g.
    • MUST have a measurement resolution of at least 1024 LSB/G.
    • MUST have a minimum measurement frequency of 12.5 Hz or lower.
    • MUST have a maximum measurement frequency of 400 Hz or higher.
    • MUST have a measurement noise not above 400 uG/√Hz.
    • 必須實現該感測器的非喚醒形式,並具有至少 3000 個感測器事件的緩衝能力。
    • MUST have a batching power consumption not worse than 3 mW.
    • SHOULD have a stationary noise bias stability of \<15 μg √Hz from 24hr static dataset.
    • SHOULD have a bias change vs. temperature of ≤ +/- 1mg / °C.
    • SHOULD have a best-fit line non-linearity of ≤ 0.5%, and sensitivity change vs. temperature of ≤ 0.03%/C°.
  • SENSOR_TYPE_GYROSCOPE

    • 測量範圍必須至少在 -1000 到 +1000 dps 之間。
    • MUST have a measurement resolution of at least 16 LSB/dps.
    • MUST have a minimum measurement frequency of 12.5 Hz or lower.
    • MUST have a maximum measurement frequency of 400 Hz or higher.
    • 測量雜訊必須不高於 0.014°/s/√Hz。
    • SHOULD have a stationary bias stability of < 0.0002 °/s √Hz from 24-hour static dataset.
    • 偏差隨溫度的變化應為 ≤ +/- 0.05 °/ s / °C。
    • 靈敏度隨溫度的變化應≤ 0.02%/°C。
    • 最佳擬合線非線性度應≤ 0.2%。
    • SHOULD have a noise density of ≤ 0.007 °/s/√Hz.
  • SENSOR_TYPE_GYROSCOPE_UNCALIBRATED with the same quality requirements as SENSOR_TYPE_GYROSCOPE.

  • SENSOR_TYPE_GEOMAGNETIC_FIELD
    • MUST have a measurement range between at least -900 and +900 uT.
    • MUST have a measurement resolution of at least 5 LSB/uT.
    • MUST have a minimum measurement frequency of 5 Hz or lower.
    • 最大測量頻率必須為 50 Hz 或更高。
    • MUST have a measurement noise not above 0.5 uT.
  • SENSOR_TYPE_MAGNETIC_FIELD_UNCALIBRATED with the same quality requirements as SENSOR_TYPE_GEOMAGNETIC_FIELD and in addition:
    • 必須實現該感測器的非喚醒形式,並具有至少 600 個感測器事件的緩衝能力。
  • SENSOR_TYPE_PRESSURE
    • 測量範圍必須至少在 300 至 1100 hPa 之間。
    • MUST have a measurement resolution of at least 80 LSB/hPa.
    • MUST have a minimum measurement frequency of 1 Hz or lower.
    • MUST have a maximum measurement frequency of 10 Hz or higher.
    • MUST have a measurement noise not above 2 Pa/√Hz.
    • 必須實現該感測器的非喚醒形式,並具有至少 300 個感測器事件的緩衝能力。
    • 批次功耗必須不低於 2 mW。
  • SENSOR_TYPE_GAME_ROTATION_VECTOR
    • 必須實現該感測器的非喚醒形式,並具有至少 300 個感測器事件的緩衝能力。
    • 批次功耗必須不低於 4 mW。
  • SENSOR_TYPE_SIGNIFICANT_MOTION
    • 設備靜態時功耗不得低於 0.5 mW,設備移動時功耗不得低於 1.5 mW。
  • SENSOR_TYPE_STEP_DETECTOR
    • 必須實現該感測器的非喚醒形式,並具有至少 100 個感測器事件的緩衝能力。
    • 設備靜態時功耗不得低於 0.5 mW,設備移動時功耗不得低於 1.5 mW。
    • 批次功耗必須不低於 4 mW。
  • SENSOR_TYPE_STEP_COUNTER
    • 設備靜態時功耗不得低於 0.5 mW,設備移動時功耗不得低於 1.5 mW。
  • SENSOR_TILT_DETECTOR
    • 設備靜態時功耗不得低於 0.5 mW,設備移動時功耗不得低於 1.5 mW。

Also such a device MUST meet the following sensor subsystem requirements:

  • The event timestamp of the same physical event reported by the Accelerometer, Gyroscope sensor and Magnetometer MUST be within 2.5 milliseconds of each other.
  • The Gyroscope sensor event timestamps MUST be on the same time base as the camera subsystem and within 1 milliseconds of error.
  • High Fidelity sensors MUST deliver samples to applications within 5 milliseconds from the time when the data is available on the physical sensor to the application.
  • The power consumption MUST not be higher than 0.5 mW when device is static and 2.0 mW when device is moving when any combination of the following sensors are enabled:
    • SENSOR_TYPE_SIGNIFICANT_MOTION
    • SENSOR_TYPE_STEP_DETECTOR
    • SENSOR_TYPE_STEP_COUNTER
    • SENSOR_TILT_DETECTORS

Note that all power consumption requirements in this section do not include the power consumption of the Application Processor. It is inclusive of the power drawn by the entire sensor chain—the sensor, any supporting circuitry, any dedicated sensor processing system, etc.

The following sensor types MAY also be supported on a device implementation declaring android.hardware.sensor.hifi_sensors, but if these sensor types are present they MUST meet the following minimum buffering capability requirement:

  • SENSOR_TYPE_PROXIMITY: 100 sensor events

7.3.10.指紋感應器

Device implementations with a secure lock screen SHOULD include a fingerprint sensor. If a device implementation includes a fingerprint sensor and has a corresponding API for third-party developers, it:

  • MUST declare support for the android.hardware.fingerprint feature.
  • MUST fully implement the corresponding API as described in the Android SDK documentation.
  • MUST have a false acceptance rate not higher than 0.002%.
  • Is STRONGLY RECOMMENDED to have a false rejection rate of less than 10%, as measured on the device
  • Is STRONGLY RECOMMENDED to have a latency below 1 second, measured from when the fingerprint sensor is touched until the screen is unlocked, for one enrolled finger.
  • MUST rate limit attempts for at least 30 seconds after five false trials for fingerprint verification.
  • MUST have a hardware-backed keystore implementation, and perform the fingerprint matching in a Trusted Execution Environment (TEE) or on a chip with a secure channel to the TEE.
  • MUST have all identifiable fingerprint data encrypted and cryptographically authenticated such that they cannot be acquired, read or altered outside of the Trusted Execution Environment (TEE) as documented in the implementation guidelines on the Android Open Source Project site.
  • MUST prevent adding a fingerprint without first establishing a chain of trust by having the user confirm existing or add a new device credential (PIN/pattern/password) that's secured by TEE; the Android Open Source Project implementation provides the mechanism in the framework to do so.
  • MUST NOT enable 3rd-party applications to distinguish between individual fingerprints.
  • MUST honor the DevicePolicyManager.KEYGUARD_DISABLE_FINGERPRINT flag.
  • MUST, when upgraded from a version earlier than Android 6.0, have the fingerprint data securely migrated to meet the above requirements or removed.
  • SHOULD use the Android Fingerprint icon provided in the Android Open Source Project.

7.3.11. Android Automotive-only sensors

Automotive-specific sensors are defined in the android.car.CarSensorManager API .

7.3.11.1.目前檔位

Android Automotive implementations SHOULD provide current gear as SENSOR_TYPE_GEAR.

7.3.11.2. Day Night Mode

Android Automotive implementations MUST support day/night mode defined as SENSOR_TYPE_NIGHT. The value of this flag MUST be consistent with dashboard day/night mode and SHOULD be based on ambient light sensor input. The underlying ambient light sensor MAY be the same as Photometer .

7.3.11.3.駕駛狀態

Android Automotive implementations MUST support driving status defined as SENSOR_TYPE_DRIVING_STATUS, with a default value of DRIVE_STATUS_UNRESTRICTED when the vehicle is fully stopped and parked. It is the responsibility of device manufacturers to configure SENSOR_TYPE_DRIVING_STATUS in compliance with all laws and regulations that apply to markets where the product is shipping.

7.3.11.4. Wheel Speed

Android Automotive implementations MUST provide vehicle speed defined as SENSOR_TYPE_CAR_SPEED.

7.3.12.姿勢感測器

Device implementations MAY support pose sensor with 6 degrees of freedom. Android Handheld devices are RECOMMENDED to support this sensor. If a device implementation does support pose sensor with 6 degrees of freedom, it:

  • MUST implement and report TYPE_POSE_6DOF sensor.
  • MUST be more accurate than the rotation vector alone.

7.4.數據連接

7.4.1.電話

“Telephony” as used by the Android APIs and this document refers specifically to hardware related to placing voice calls and sending SMS messages via a GSM or CDMA network. While these voice calls may or may not be packet-switched, they are for the purposes of Android considered independent of any data connectivity that may be implemented using the same network. In other words, the Android “telephony” functionality and APIs refer specifically to voice calls and SMS. For instance, device implementations that cannot place calls or send/receive SMS messages MUST NOT report the android.hardware.telephony feature or any subfeatures, regardless of whether they use a cellular network for data connectivity.

Android MAY be used on devices that do not include telephony hardware. That is, Android is compatible with devices that are not phones. However, if a device implementation does include GSM or CDMA telephony, it MUST implement full support for the API for that technology.不包括電話硬體的設備實作必須將完整的API作為NO-OPS實作。

7.4.1.1. Number Blocking Compatibility

Android Telephony device implementations MUST include number blocking support and:

  • MUST fully implement BlockedNumberContract and the corresponding API as described in the SDK documentation.
  • MUST block all calls and messages from a phone number in 'BlockedNumberProvider' without any interaction with apps. The only exception is when number blocking is temporarily lifted as described in the SDK documentation.
  • MUST NOT write to the platform call log provider for a blocked call.
  • MUST NOT write to the Telephony provider for a blocked message.
  • MUST implement a blocked numbers management UI, which is opened with the intent returned by TelecomManager.createManageBlockedNumbersIntent() method.
  • MUST NOT allow secondary users to view or edit the blocked numbers on the device as the Android platform assumes the primary user to have full control of the telephony services, a single instance, on the device. All blocking related UI MUST be hidden for secondary users and the blocked list MUST still be respected.
  • SHOULD migrate the blocked numbers into the provider when a device updates to Android 7.0.

7.4.2. IEEE 802.11(無線網路)

All Android device implementations SHOULD include support for one or more forms of 802.11. If a device implementation does include support for 802.11 and exposes the functionality to a third-party application, it MUST implement the corresponding Android API and:

  • MUST report the hardware feature flag android.hardware.wifi.
  • MUST implement the multicast API as described in the SDK documentation.
  • MUST support multicast DNS (mDNS) and MUST NOT filter mDNS packets (224.0.0.251) at any time of operation including:
    • Even when the screen is not in an active state.
    • For Android Television device implementations, even when in standby power states.

7.4.2.1.無線直連

Device implementations SHOULD include support for Wi-Fi Direct (Wi-Fi peer-to-peer). If a device implementation does include support for Wi-Fi Direct, it MUST implement the corresponding Android API as described in the SDK documentation. If a device implementation includes support for Wi-Fi Direct, then it:

  • MUST report the hardware feature android.hardware.wifi.direct.
  • MUST support regular Wi-Fi operation.
  • SHOULD support concurrent Wi-Fi and Wi-Fi Direct operation.

Device implementations SHOULD include support for Wi-Fi Tunneled Direct Link Setup (TDLS) as described in the Android SDK Documentation. If a device implementation does include support for TDLS and TDLS is enabled by the WiFiManager API, the device:

  • SHOULD use TDLS only when it is possible AND beneficial.
  • SHOULD have some heuristic and NOT use TDLS when its performance might be worse than going through the Wi-Fi access point.

7.4.3.藍牙

Android Watch implementations MUST support Bluetooth. Android Television implementations MUST support Bluetooth and Bluetooth LE. Android Automotive implementations MUST support Bluetooth and SHOULD support Bluetooth LE.

Device implementations that support android.hardware.vr.high_performance feature MUST support Bluetooth 4.2 and Bluetooth LE Data Length Extension.

Android includes support for Bluetooth and Bluetooth Low Energy . Device implementations that include support for Bluetooth and Bluetooth Low Energy MUST declare the relevant platform features (android.hardware.bluetooth and android.hardware.bluetooth_le respectively) and implement the platform APIs. Device implementations SHOULD implement relevant Bluetooth profiles such as A2DP, AVCP, OBEX, etc. as appropriate for the device.

Android Automotive implementations SHOULD support Message Access Profile (MAP). Android Automotive implementations MUST support the following Bluetooth profiles:

  • Phone calling over Hands-Free Profile (HFP).
  • 透過音訊分發設定檔 (A2DP) 進行媒體播放。
  • 透過遠端控製設定檔 (AVRCP) 進行媒體播放控制。
  • Contact sharing using the Phone Book Access Profile (PBAP).

Device implementations including support for Bluetooth Low Energy:

  • MUST declare the hardware feature android.hardware.bluetooth_le.
  • MUST enable the GATT (generic attribute profile) based Bluetooth APIs as described in the SDK documentation and android.bluetooth .
  • are STRONGLY RECOMMENDED to implement a Resolvable Private Address (RPA) timeout no longer than 15 minutes and rotate the address at timeout to protect user privacy.
  • SHOULD support offloading of the filtering logic to the bluetooth chipset when implementing the ScanFilter API , and MUST report the correct value of where the filtering logic is implemented whenever queried via the android.bluetooth.BluetoothAdapter.isOffloadedFilteringSupported() method.
  • SHOULD support offloading of the batched scanning to the bluetooth chipset, but if not supported, MUST report 'false' whenever queried via the android.bluetooth.BluetoothAdapter.isOffloadedScanBatchingSupported() method.
  • SHOULD support multi advertisement with at least 4 slots, but if not supported, MUST report 'false' whenever queried via the android.bluetooth.BluetoothAdapter.isMultipleAdvertisementSupported() method.

7.4.4.近場通訊

Device implementations SHOULD include a transceiver and related hardware for Near-Field Communications (NFC). If a device implementation does include NFC hardware and plans to make it available to third-party apps, then it:

  • MUST report the android.hardware.nfc feature from the android.content.pm.PackageManager.hasSystemFeature() method .
  • MUST be capable of reading and writing NDEF messages via the following NFC standards:
    • MUST be capable of acting as an NFC Forum reader/writer (as defined by the NFC Forum technical specification NFCForum-TS-DigitalProtocol-1.0) via the following NFC standards:
      • NfcA (ISO14443-3A)
      • NfcB (ISO14443-3B)
      • NfcF (JIS X 6319-4)
      • IsoDep (ISO 14443-4)
      • NFC Forum Tag Types 1, 2, 3, 4 (defined by the NFC Forum)
    • STRONGLY RECOMMENDED to be capable of reading and writing NDEF messages as well as raw data via the following NFC standards. Note that while the NFC standards below are stated as STRONGLY RECOMMENDED, the Compatibility Definition for a future version is planned to change these to MUST. These standards are optional in this version but will be required in future versions. Existing and new devices that run this version of Android are very strongly encouraged to meet these requirements now so they will be able to upgrade to the future platform releases.
      • NfcV (ISO 15693)
    • SHOULD be capable of reading the barcode and URL (if encoded) of Thinfilm NFC Barcode products.
    • MUST be capable of transmitting and receiving data via the following peer-to-peer standards and protocols:
      • ISO 18092
      • LLCP 1.2 (defined by the NFC Forum)
      • SDP 1.0 (defined by the NFC Forum)
      • NDEF Push Protocol
      • SNEP 1.0 (defined by the NFC Forum)
    • MUST include support for Android Beam .
    • MUST implement the SNEP default server. Valid NDEF messages received by the default SNEP server MUST be dispatched to applications using the android.nfc.ACTION_NDEF_DISCOVERED intent. Disabling Android Beam in settings MUST NOT disable dispatch of incoming NDEF message.
    • MUST honor the android.settings.NFCSHARING_SETTINGS intent to show NFC sharing settings .
    • MUST implement the NPP server. Messages received by the NPP server MUST be processed the same way as the SNEP default server.
    • MUST implement a SNEP client and attempt to send outbound P2P NDEF to the default SNEP server when Android Beam is enabled. If no default SNEP server is found then the client MUST attempt to send to an NPP server.
    • MUST allow foreground activities to set the outbound P2P NDEF message using android.nfc.NfcAdapter.setNdefPushMessage, and android.nfc.NfcAdapter.setNdefPushMessageCallback, and android.nfc.NfcAdapter.enableForegroundNdefPush.
    • SHOULD use a gesture or on-screen confirmation, such as 'Touch to Beam', before sending outbound P2P NDEF messages.
    • SHOULD enable Android Beam by default and MUST be able to send and receive using Android Beam, even when another proprietary NFC P2p mode is turned on.
    • MUST support NFC Connection handover to Bluetooth when the device supports Bluetooth Object Push Profile. Device implementations MUST support connection handover to Bluetooth when using android.nfc.NfcAdapter.setBeamPushUris, by implementing the “ Connection Handover version 1.2 ” and “ Bluetooth Secure Simple Pairing Using NFC version 1.0 ” specs from the NFC Forum. Such an implementation MUST implement the handover LLCP service with service name “urn:nfc:sn:handover” for exchanging the handover request/select records over NFC, and it MUST use the Bluetooth Object Push Profile for the actual Bluetooth data transfer. For legacy reasons (to remain compatible with Android 4.1 devices), the implementation SHOULD still accept SNEP GET requests for exchanging the handover request/select records over NFC. However an implementation itself SHOULD NOT send SNEP GET requests for performing connection handover.
    • MUST poll for all supported technologies while in NFC discovery mode.
    • SHOULD be in NFC discovery mode while the device is awake with the screen active and the lock-screen unlocked.

(Note that publicly available links are not available for the JIS, ISO, and NFC Forum specifications cited above.)

Android includes support for NFC Host Card Emulation (HCE) mode. If a device implementation does include an NFC controller chipset capable of HCE (for NfcA and/or NfcB) and it supports Application ID (AID) routing, then it:

  • MUST report the android.hardware.nfc.hce feature constant.
  • MUST support NFC HCE APIs as defined in the Android SDK.

If a device implementation does include an NFC controller chipset capable of HCE for NfcF, and it implements the feature for third-party applications, then it:

  • MUST report the android.hardware.nfc.hcef feature constant.
  • MUST implement the NfcF Card Emulation APIs as defined in the Android SDK.

Additionally, device implementations MAY include reader/writer support for the following MIFARE technologies.

  • MIFARE Classic
  • MIFARE 超輕量
  • NDEF on MIFARE Classic

Note that Android includes APIs for these MIFARE types. If a device implementation supports MIFARE in the reader/writer role, it:

  • MUST implement the corresponding Android APIs as documented by the Android SDK.
  • MUST report the feature com.nxp.mifare from the android.content.pm.PackageManager.hasSystemFeature() method. Note that this is not a standard Android feature and as such does not appear as a constant in the android.content.pm.PackageManager class.
  • MUST NOT implement the corresponding Android APIs nor report the com.nxp.mifare feature unless it also implements general NFC support as described in this section.

If a device implementation does not include NFC hardware, it MUST NOT declare the android.hardware.nfc feature from the android.content.pm.PackageManager.hasSystemFeature() method, and MUST implement the Android NFC API as a no-op.

As the classes android.nfc.NdefMessage and android.nfc.NdefRecord represent a protocol-independent data representation format, device implementations MUST implement these APIs even if they do not include support for NFC or declare the android.hardware.nfc feature.

7.4.5。最低網路能力

Device implementations MUST include support for one or more forms of data networking. Specifically, device implementations MUST include support for at least one data standard capable of 200Kbit/sec or greater. Examples of technologies that satisfy this requirement include EDGE, HSPA, EV-DO, 802.11g, Ethernet, Bluetooth PAN, etc.

Device implementations where a physical networking standard (such as Ethernet) is the primary data connection SHOULD also include support for at least one common wireless data standard, such as 802.11 (Wi-Fi).

Devices MAY implement more than one form of data connectivity.

Devices MUST include an IPv6 networking stack and support IPv6 communication using the managed APIs, such as java.net.Socket and java.net.URLConnection , as well as the native APIs, such as AF_INET6 sockets. The required level of IPv6 support depends on the network type, as follows:

  • Devices that support Wi-Fi networks MUST support dual-stack and IPv6-only operation on Wi-Fi.
  • Devices that support Ethernet networks MUST support dual-stack operation on Ethernet.
  • Devices that support cellular data SHOULD support IPv6 operation (IPv6-only and possibly dual-stack) on cellular data.
  • When a device is simultaneously connected to more than one network (eg, Wi-Fi and cellular data), it MUST simultaneously meet these requirements on each network to which it is connected.

IPv6 MUST be enabled by default.

In order to ensure that IPv6 communication is as reliable as IPv4, unicast IPv6 packets sent to the device MUST NOT be dropped, even when the screen is not in an active state. Redundant multicast IPv6 packets, such as repeated identical Router Advertisements, MAY be rate-limited in hardware or firmware if doing so is necessary to save power. In such cases, rate-limiting MUST NOT cause the device to lose IPv6 connectivity on any IPv6-compliant network that uses RA lifetimes of at least 180 seconds.

IPv6 connectivity MUST be maintained in doze mode.

7.4.6。同步設定

Device implementations MUST have the master auto-sync setting on by default so that the method getMasterSyncAutomatically() returns “true”.

7.4.7。資料保護程式

Device implementations with a metered connection are STRONGLY RECOMMENDED to provide the data saver mode.

If a device implementation provides the data saver mode, it:

  • MUST support all the APIs in the ConnectivityManager class as described in the SDK documentation

  • MUST provide a user interface in the settings, allowing users to add applications to or remove applications from the allowlist.

Conversely if a device implementation does not provide the data saver mode, it:

  • MUST return the value RESTRICT_BACKGROUND_STATUS_DISABLED for ConnectivityManager.getRestrictBackgroundStatus()

  • MUST not broadcast ConnectivityManager.ACTION_RESTRICT_BACKGROUND_CHANGED

  • MUST have an activity that handles the Settings.ACTION_IGNORE_BACKGROUND_DATA_RESTRICTIONS_SETTINGS intent but MAY implement it as a no-op.

7.5。相機

Device implementations SHOULD include a rear-facing camera and MAY include a front-facing camera.後置相機是位於裝置與顯示器相對的一側的攝影機;也就是說,它像傳統相機一樣對設備遠端的場景進行成像。 A front-facing camera is a camera located on the same side of the device as the display; that is, a camera typically used to image the user, such as for video conferencing and similar applications.

If a device implementation includes at least one camera, it MUST be possible for an application to simultaneously allocate 3 RGBA_8888 bitmaps equal to the size of the images produced by the largest-resolution camera sensor on the device, while camera is open for the purpose of basic preview and still capture.

7.5.1.後置攝像頭

Device implementations SHOULD include a rear-facing camera. If a device implementation includes at least one rear-facing camera, it:

  • MUST report the feature flag android.hardware.camera and android.hardware.camera.any.
  • MUST have a resolution of at least 2 megapixels.
  • 應該在相機驅動程式中實現硬體自動對焦或軟體自動對焦(對應用程式軟體透明)。
  • 可能具有定焦或 EDOF(擴展景深)硬體。
  • 可能包括閃光燈。如果攝影機包含閃光燈,則在Android.hardware.Camera.previewCallback實例中已註冊在相機預覽表面上,除非應用程式已透過啟用Flash_mode_auto或flash_mode_on屬性明確啟用flash,否則不得點亮閃光燈。相機。參數物件。 Note that this constraint does not apply to the device's built-in system camera application, but only to third-party applications using Camera.PreviewCallback.

7.5.2.前置鏡頭

設備實現可能包括前置鏡頭。 If a device implementation includes at least one front-facing camera, it:

  • MUST report the feature flag android.hardware.camera.any and android.hardware.camera.front.
  • MUST have a resolution of at least VGA (640x480 pixels).
  • MUST NOT use a front-facing camera as the default for the Camera API. The camera API in Android has specific support for front-facing cameras and device implementations MUST NOT configure the API to to treat a front-facing camera as the default rear-facing camera, even if it is the only camera on the device.
  • MAY include features (such as auto-focus, flash, etc.) available to rear-facing cameras as described in section 7.5.1 .
  • MUST horizontally reflect (ie mirror) the stream displayed by an app in a CameraPreview, as follows:
    • If the device implementation is capable of being rotated by user (such as automatically via an accelerometer or manually via user input), the camera preview MUST be mirrored horizontally relative to the device's current orientation.
    • If the current application has explicitly requested that the Camera display be rotated via a call to the android.hardware.Camera.setDisplayOrientation() method, the camera preview MUST be mirrored horizontally relative to the orientation specified by the application.
    • Otherwise, the preview MUST be mirrored along the device's default horizontal axis.
  • MUST mirror the image displayed by the postview in the same manner as the camera preview image stream. If the device implementation does not support postview, this requirement obviously does not apply.
  • MUST NOT mirror the final captured still image or video streams returned to application callbacks or committed to media storage.

7.5.3.外接攝影機

Device implementations MAY include support for an external camera that is not necessarily always connected. If a device includes support for an external camera, it:

  • MUST declare the platform feature flag android.hardware.camera.external and android.hardware camera.any .
  • MAY support multiple cameras.
  • MUST support USB Video Class (UVC 1.0 or higher) if the external camera connects through the USB port.
  • SHOULD support video compressions such as MJPEG to enable transfer of high-quality unencoded streams (ie raw or independently compressed picture streams).
  • MAY support camera-based video encoding. If supported, a simultaneous unencoded / MJPEG stream (QVGA or greater resolution) MUST be accessible to the device implementation.

7.5.4.相機 API 行為

Android includes two API packages to access the camera, the newer android.hardware.camera2 API expose lower-level camera control to the app, including efficient zero-copy burst/streaming flows and per-frame controls of exposure, gain, white balance gains, color conversion, denoising, sharpening, and more.

The older API package, android.hardware.Camera, is marked as deprecated in Android 5.0 but as it should still be available for apps to use Android device implementations MUST ensure the continued support of the API as descred in this as thiss in the 。

Device implementations MUST implement the following behaviors for the camera-related APIs, for all available cameras:

  • 如果應用程式從未呼叫android.hardware.camera.parameters.setpreviewformat(int),則該裝置必須使用android.hardware.pixelformat.ycbcr_420_sp進行提供給應用程式呼叫的預覽資料。
  • 如果一個應用程式註冊Android.hardware.camera.previewCallback實例,且系統在預覽格式為ycbcr_420_sp時呼叫onpreviewFrame()方法,則必須在onpreviewframe()中傳遞到onpreviewframe()中的資料中,也必須在NV21編碼格式中進一步。 That is, NV21 MUST be the default.
  • For android.hardware.Camera, device implementations MUST support the YV12 format (as denoted by the android.graphics.ImageFormat.YV12 constant) for camera previews for both front- and rear-facing cameras. (The hardware video encoder and camera may use any native pixel format, but the device implementation MUST support conversion to YV12.)
  • For android.hardware.camera2, device implementations must support the android.hardware.ImageFormat.YUV_420_888 and android.hardware.ImageFormat.JPEG formats as outputs through the android.media.ImageReader API.

Device implementations MUST still implement the full Camera API included in the Android SDK documentation, regardless of whether the device includes hardware autofocus or other capabilities. For instance, cameras that lack autofocus MUST still call any registered android.hardware.Camera.AutoFocusCallback instances (even though this has no relevance to a non-autofocus camera.) Note that this does apply to front-facing cameras;例如,即使大多數前置鏡頭不支援自動對焦,API 回呼仍然必須按照描述進行「偽造」。

裝置實作必須識別並尊重每個參數名稱,該名稱在Android.hardware.camera.parameters類別上定義為常數,如果基礎硬體支援該功能。如果設備硬體不支援功能,則API必須依照記錄。 Conversely, device implementations MUST NOT honor or recognize string constants passed to the android.hardware.Camera.setParameters() method other than those documented as constants on the android.hardware.Camera.Parameters.也就是說,如果硬體允許,則必須支援所有標準攝影機參數,並且必須不支援自訂相機參數類型。 For instance, device implementations that support image capture using high dynamic range (HDR) imaging techniques MUST support camera parameter Camera.SCENE_MODE_HDR.

Because not all device implementations can fully support all the features of the android.hardware.camera2 API, device implementations MUST report the proper level of support with the android.info.supportedHardwareLevel property as level of support with the android.info.supportedHardwareLevel property as descramef in found SDdrowate lagrox

Device implementations MUST also declare its Individual camera capabilities of android.hardware.camera2 via the android.request.availableCapabilities property and declare the appropriate feature flags ; a device must define the feature flag if any of its attached camera devices supports the feature.

Device implementations MUST broadcast the Camera.ACTION_NEW_PICTURE intent whenever a new picture is taken by the camera and the entry of the picture has been added to the media store.

Device implementations MUST broadcast the Camera.ACTION_NEW_VIDEO intent whenever a new video is recorded by the camera and the entry of the picture has been added to the media store.

7.5.5。相機方向

Both front- and rear-facing cameras, if present, MUST be oriented so that the long dimension of the camera aligns with the screen's long dimension.也就是說,當設備處於橫向方向時,相機必須以橫向方向捕捉影像。無論設備的自然方向如何,這都適用;也就是說,它適用於橫向主設備以及縱向主設備。

7.6。記憶體和儲存

7.6.1.最小內存和存儲

Android Television devices MUST have at least 4GB of non-volatile storage available for application private data.

The memory available to the kernel and userspace on device implementations MUST be at least equal or larger than the minimum values specified by the following table. (See section 7.1.1 for screen size and density definitions.)

Density and screen size 32-bit device 64-bit device
Android Watch devices (due to smaller screens) 416MB不適用
  • 280dpi or lower on small/normal screens
  • mdpi or lower on large screens
  • ldpi or lower on extra large screens
512MB 816MB
  • xhdpi or higher on small/normal screens
  • hdpi or higher on large screens
  • mdpi or higher on extra large screens
608MB 944MB
  • 400dpi or higher on small/normal screens
  • xhdpi or higher on large screens
  • tvdpi or higher on extra large screens
896MB 1280MB
  • 560dpi or higher on small/normal screens
  • 400dpi or higher on large screens
  • xhdpi or higher on extra large screens
1344MB 1824MB

The minimum memory values MUST be in addition to any memory space already dedicated to hardware components such as radio, video, and so on that is not under the kernel's control.

Device implementations with less than 512MB of memory available to the kernel and userspace, unless an Android Watch, MUST return the value "true" for ActivityManager.isLowRamDevice().

Android Television devices MUST have at least 4GB and other device implementations MUST have at least 3GB of non-volatile storage available for application private data. That is, the /data partition MUST be at least 4GB for Android Television devices and at least 3GB for other device implementations. Device implementations that run Android are STRONGLY RECOMMENDED to have at least 4GB of non-volatile storage for application private data so they will be able to upgrade to the future platform releases.

The Android APIs include a Download Manager that applications MAY use to download data files. The device implementation of the Download Manager MUST be capable of downloading individual files of at least 100MB in size to the default “cache” location.

7.6.2.應用程式共享儲存

Device implementations MUST offer shared storage for applications also often referred as “shared external storage”.

Device implementations MUST be configured with shared storage mounted by default, “out of the box”. If the shared storage is not mounted on the Linuxpath /sdcard, then the device MUST include a Linux symbolic link from /sdcard to the actual mount point.

Device implementations MAY have hardware for user-accessible removable storage, such as a Secure Digital (SD) card slot. If this slot is used to satisfy the shared storage requirement, the device implementation:

  • MUST implement a toast or pop-up user interface warning the user when there is no SD card.
  • MUST include a FAT-formatted SD card 1GB in size or larger OR show on the box and other material available at time of purchase that the SD card has to be separately purchased.
  • MUST mount the SD card by default.

Alternatively, device implementations MAY allocate internal (non-removable) storage as shared storage for apps as included in the upstream Android Open Source Project; device implementations SHOULD use this configuration and software implementation. If a device implementation uses internal (non-removable) storage to satisfy the shared storage requirement, while that storage MAY share space with the application private data, it MUST be at least 1GB in size and mounted on /sdcard (or /sdcard MUST be a symbolic link to the physical location if it is mounted elsewhere).

裝置實作必須依照記錄的android.permission.write_external_storage在此共用儲存中執行。共享儲存否則必須透過獲得該許可的任何應用程式可寫入。

Device implementations that include multiple shared storage paths (such as both an SD card slot and shared internal storage) MUST allow only pre-installed & privileged Android applications with the WRITE_EXTERNAL_STORAGE permission to write to the secondary external storage, except when writing to their package-specific directories or within the URI returned by firing the ACTION_OPEN_DOCUMENT_TREE intent.

However, device implementations SHOULD expose content from both storage paths transparently through Android's media scanner service and android.provider.MediaStore.

Regardless of the form of shared storage used, if the device implementation has a USB port with USB peripheral mode support, it MUST provide some mechanism to access the contents of shared storage from a host computer. Device implementations MAY use USB mass storage, but SHOULD use Media Transfer Protocol to satisfy this requirement. If the device implementation supports Media Transfer Protocol, it:

  • 應與參考 Android MTP 主機、 Android 檔案傳輸相容。
  • 應報告 USB 裝置類別 0x00。
  • 應報告 USB 介面名稱“MTP”。

7.6.3.可採用的存儲

Device implementations are STRONGLY RECOMMENDED to implement adoptable storage if the removable storage device port is in a long-term stable location, such as within the battery compartment or other protective cover.

Device implementations such as a television, MAY enable adoption through USB ports as the device is expected to be static and not mobile. But for other device implementations that are mobile in nature, it is STRONGLY RECOMMENDED to implement the adoptable storage in a long-term stable location, since accidentally disconnecting them can cause data loss/corruption.

7.7. USB

Device implementations SHOULD support USB peripheral mode and SHOULD support USB host mode.

7.7.1. USB週邊模式

If a device implementation includes a USB port supporting peripheral mode:

  • The port MUST be connectable to a USB host that has a standard type-A or type-C USB port.
  • The port SHOULD use micro-B, micro-AB or Type-C USB form factor.強烈建議現有和新的 Android 裝置滿足這些要求,以便它們能夠升級到未來的平台版本。
  • The port SHOULD be located on the bottom of the device (according to natural orientation) or enable software screen rotation for all apps (including home screen), so that the display draws correctly when the device is oriented with the port at bottom.強烈建議現有和新的 Android 裝置滿足這些要求,以便它們能夠升級到未來的平台版本。
  • It MUST allow a USB host connected with the Android device to access the contents of the shared storage volume using either USB mass storage or Media Transfer Protocol.
  • It SHOULD implement the Android Open Accessory (AOA) API and specification as documented in the Android SDK documentation, and if it is an Android Handheld device it MUST implement the AOA API. Device implementations implementing the AOA specification:
    • MUST declare support for the hardware feature android.hardware.usb.accessory .
    • MUST implement the USB audio class as documented in the Android SDK documentation.
    • The USB mass storage class MUST include the string "android" at the end of the interface description iInterface string of the USB mass storage
  • It SHOULD implement support to draw 1.5 A current during HS chirp and traffic as specified in the USB Battery Charging specification, revision 1.2 .強烈建議現有和新的 Android 裝置滿足這些要求,以便它們能夠升級到未來的平台版本。
  • Type-C devices MUST detect 1.5A and 3.0A chargers per the Type-C resistor standard and it must detect changes in the advertisement.
  • Type-C devices also supporting USB host mode are STRONGLY RECOMMENDED to support Power Delivery for data and power role swapping.
  • Type-C devices SHOULD support Power Delivery for high-voltage charging and support for Alternate Modes such as display out.
  • The value of iSerialNumber in USB standard device descriptor MUST be equal to the value of android.os.Build.SERIAL.
  • Type-C devices are STRONGLY RECOMMENDED to not support proprietary charging methods that modify Vbus voltage beyond default levels, or alter sink/source roles as such may result in interoperability issues with the chargers or devices that support the standard USB Power Delivery methods.雖然這被稱為“強烈建議”,但在未來的 Android 版本中,我們可能會要求所有 C 型設備支援與標準 C 型充電器的完全互通性。

7.7.2. USB主機模式

If a device implementation includes a USB port supporting host mode, it:

  • SHOULD use a type-C USB port, if the device implementation supports USB 3.1.
  • MAY use a non-standard port form factor, but if so MUST ship with a cable or cables adapting the port to a standard type-A or type-C USB port.
  • MAY use a micro-AB USB port, but if so SHOULD ship with a cable or cables adapting the port to a standard type-A or type-C USB port.
  • is STRONGLY RECOMMENDED to implement the USB audio class as documented in the Android SDK documentation.
  • MUST implement the Android USB host API as documented in the Android SDK, and MUST declare support for the hardware feature android.hardware.usb.host .
  • SHOULD support device charging while in host mode; advertising a source current of at least 1.5A as specified in the Termination Parameters section of the [USB Type-C Cable and Connector Specification Revision 1.2] (http://www.usb.org/developers/docs/usb_31_021517.zip) for USB Type-C connectors or using Charging Downstream Port(CDP) output current range as specified in the USB Battery Charging specifications, revision 1.2 for Micro-AB connectors.
  • USB Type-C devices are STRONGLY RECOMMENDED to support DisplayPort, SHOULD support USB SuperSpeed Data Rates, and are STRONGLY RECOMMENDED to support Power Delivery for data and power role swapping.
  • Devices with any type-A or type-AB ports MUST NOT ship with an adapter converting from this port to a type-C receptacle.
  • MUST recognize any remotely connected MTP (Media Transfer Protocol) devices and make their contents accessible through the ACTION_GET_CONTENT , ACTION_OPEN_DOCUMENT , and ACTION_CREATE_DOCUMENT intents, if the Storage Access Framework (SAF) is supported.
  • MUST, if using a Type-C USB port and including support for peripheral mode, implement Dual Role Port functionality as defined by the USB Type-C specification (section 4.5.1.3.3).
  • SHOULD, if the Dual Role Port functionality is supported, implement the Try.* model that is most appropriate for the device form factor.例如,手持裝置應該實作 Try.SNK 模型。

7.8。聲音的

7.8.1.麥克風

Android Handheld, Watch, and Automotive implementations MUST include a microphone.

Device implementations MAY omit a microphone. However, if a device implementation omits a microphone, it MUST NOT report the android.hardware.microphone feature constant, and MUST implement the audio recording API at least as no-ops, per section 7 . Conversely, device implementations that do possess a microphone:

  • MUST report the android.hardware.microphone feature constant.
  • MUST meet the audio recording requirements in section 5.4 .
  • MUST meet the audio latency requirements in section 5.6 .
  • STRONGLY RECOMMENDED to support near-ultrasound recording as described in section 7.8.3 .

7.8.2.音訊輸出

Android Watch devices MAY include an audio output.

Device implementations including a speaker or with an audio/multimedia output port for an audio output peripheral as a headset or an external speaker:

  • MUST report the android.hardware.audio.output feature constant.
  • MUST meet the audio playback requirements in section 5.5 .
  • MUST meet the audio latency requirements in section 5.6 .
  • STRONGLY RECOMMENDED to support near-ultrasound playback as described in section 7.8.3 .

Conversely, if a device implementation does not include a speaker or audio output port, it MUST NOT report the android.hardware.audio output feature, and MUST implement the Audio Output related APIs as no-ops at least.

Android Watch device implementation MAY but SHOULD NOT have audio output, but other types of Android device implementations MUST have an audio output and declare android.hardware.audio.output.

7.8.2.1.類比音訊連接埠

In order to be compatible with the headsets and other audio accessories using the 3.5mm audio plug across the Android ecosystem, if a device implementation includes one or more analog audio ports, at least one of the audio port(s) SHOULD be a 4 conductor 3.5mm audio jack. If a device implementation has a 4 conductor 3.5mm audio jack, it:

  • MUST support audio playback to stereo headphones and stereo headsets with a microphone, and SHOULD support audio recording from stereo headsets with a microphone.
  • MUST support TRRS audio plugs with the CTIA pin-out order, and SHOULD support audio plugs with the OMTP pin-out order.
  • MUST support the detection of microphone on the plugged in audio accessory, if the device implementation supports a microphone, and broadcast the android.intent.action.HEADSET_PLUG with the extra value microphone set as 1.
  • MUST support the detection and mapping to the keycodes for the following 3 ranges of equivalent impedance between the microphone and ground conductors on the audio plug:
    • 70 ohm or less : KEYCODE_HEADSETHOOK
    • 210-290 Ohm : KEYCODE_VOLUME_UP
    • 360-680 Ohm : KEYCODE_VOLUME_DOWN
  • STRONGLY RECOMMENDED to detect and map to the keycode for the following range of equivalent impedance between the microphone and ground conductors on the audio plug:
    • 110-180 Ohm: KEYCODE_VOICE_ASSIST
  • MUST trigger ACTION_HEADSET_PLUG upon a plug insert, but only after all contacts on plug are touching their relevant segments on the jack.
  • MUST be capable of driving at least 150mV ± 10% of output voltage on a 32 Ohm speaker impedance.
  • MUST have a microphone bias voltage between 1.8V ~ 2.9V.

7.8.3。近超音波

近超音波音訊的頻段為 18.5 kHz 至 20 kHz。 Device implementations MUST correctly report the support of near-ultrasound audio capability via the AudioManager.getProperty API as follows:

  • If PROPERTY_SUPPORT_MIC_NEAR_ULTRASOUND is "true", then the following requirements must be met by the VOICE_RECOGNITION and UNPROCESSED audio sources:
    • The microphone's mean power response in the 18.5 kHz to 20 kHz band MUST be no more than 15 dB below the response at 2 kHz.
    • The microphone's unweighted signal to noise ratio over 18.5 kHz to 20 kHz for a 19 kHz tone at -26 dBFS MUST be no lower than 50 dB.
  • If PROPERTY_SUPPORT_SPEAKER_NEAR_ULTRASOUND is "true", then the speaker's mean response in 18.5 kHz - 20 kHz MUST be no lower than 40 dB below the response at 2 kHz.

7.9。虛擬實境

Android 包含用於建立「虛擬實境」(VR) 應用程式(包括高品質行動 VR 體驗)的 API 和工具。設備實作必須正確實作這些 API 和行為,如本節所述。

7.9.1.虛擬實境模式

Android handheld device implementations that support a mode for VR applications that handles stereoscopic rendering of notifications and disable monocular system UI components while a VR application has user focus MUST declare android.software.vr.mode feature. Devices declaring this feature MUST include an application implementing android.service.vr.VrListenerService that can be enabled by VR applications via android.app.Activity#setVrModeEnabled .

7.9.2. Virtual Reality High Performance

Android handheld device implementations MUST identify the support of high performance virtual reality for longer user periods through the android.hardware.vr.high_performance feature flag and meet the following requirements.

  • Device implementations MUST have at least 2 physical cores.
  • Device implementations MUST declare android.software.vr.mode feature.
  • Device implementations MAY provide an exclusive core to the foreground application and MAY support the Process.getExclusiveCores API to return the numbers of the cpu cores that are exclusive to the top foreground application. If exclusive core is supported then the core MUST not allow any other userspace processes to run on it (except device drivers used by the application), but MAY allow some kernel processes to run as necessary.
  • Device implementations MUST support sustained performance mode.
  • Device implementations MUST support OpenGL ES 3.2.
  • Device implementations MUST support Vulkan Hardware Level 0 and SHOULD support Vulkan Hardware Level 1.
  • Device implementations MUST implement EGL_KHR_mutable_render_buffer and EGL_ANDROID_front_buffer_auto_refresh, EGL_ANDROID_create_native_client_buffer, EGL_KHR_fence_sync and EGL_KHR_wait_sync so that they may be used for Shared Buffer Mode, and expose the extensions in the list of available EGL extensions.
  • The GPU and display MUST be able to synchronize access to the shared front buffer such that alternating-eye rendering of VR content at 60fps with two render contexts will be displayed with no visible tearing artifacts.
  • Device implementations MUST implement EGL_IMG_context_priority, and expose the extension in the list of available EGL extensions.
  • Device implementations MUST implement GL_EXT_multisampled_render_to_texture, GL_OVR_multiview, GL_OVR_multiview2 and GL_OVR_multiview_multisampled_render_to_texture, and expose the extensions in the list of available GL extensions.
  • Device implementations MUST implement EGL_EXT_protected_content and GL_EXT_protected_textures so that it may be used for Secure Texture Video Playback, and expose the extensions in the list of available EGL and GL extensions.
  • Device implementations MUST support H.264 decoding at least 3840x2160@30fps-40Mbps (equivalent to 4 instances of 1920x1080@30fps-10Mbps or 2 instances of 1920x1080@60fps-20Mbps).
  • Device implementations MUST support HEVC and VP9, MUST be capable to decode at least 1920x1080@30fps-10Mbps and SHOULD be capable to decode 3840x2160@30fps-20Mbps (equivalent to 4 instances of 1920x1080@30fps-5Mbps).
  • The device implementations are STRONGLY RECOMMENDED to support android.hardware.sensor.hifi_sensors feature and MUST meet the gyroscope, accelerometer, and magnetometer related requirements for android.hardware.hifi_sensors.
  • Device implementations MUST support HardwarePropertiesManager.getDeviceTemperatures API and return accurate values for skin temperature.
  • The device implementation MUST have an embedded screen, and its resolution MUST be at least be FullHD(1080p) and STRONGLY RECOMMENDED TO BE be QuadHD (1440p) or higher.
  • The display MUST measure between 4.7" and 6" diagonal.
  • The display MUST update at least 60 Hz while in VR Mode.
  • The display latency on Gray-to-Gray, White-to-Black, and Black-to-White switching time MUST be ≤ 3 ms.
  • The display MUST support a low-persistence mode with ≤5 ms persistence,persistence being defined as the amount of time for which a pixel is emitting light.
  • Device implementations MUST support Bluetooth 4.2 and Bluetooth LE Data Length Extension section 7.4.3 .

8. 性能和功率

Some minimum performance and power criteria are critical to the user experience and impact the baseline assumptions developers would have when developing an app. Android Watch devices SHOULD and other type of device implementations MUST meet the following criteria.

8.1.使用者體驗一致性

Device implementations MUST provide a smooth user interface by ensuring a consistent frame rate and response times for applications and games. Device implementations MUST meet the following requirements:

  • Consistent frame latency . Inconsistent frame latency or a delay to render frames MUST NOT happen more often than 5 frames in a second, and SHOULD be below 1 frames in a second.
  • User interface latency . Device implementations MUST ensure low latency user experience by scrolling a list of 10K list entries as defined by the Android Compatibility Test Suite (CTS) in less than 36 secs.
  • 任務切換。 When multiple applications have been launched, re-launching an already-running application after it has been launched MUST take less than 1 second.

8.2.文件 I/O 存取效能

Device implementations MUST ensure internal storage file access performance consistency for read and write operations.

  • Sequential write . Device implementations MUST ensure a sequential write performance of at least 5MB/s for a 256MB file using 10MB write buffer.
  • Random write . Device implementations MUST ensure a random write performance of at least 0.5MB/s for a 256MB file using 4KB write buffer.
  • Sequential read . Device implementations MUST ensure a sequential read performance of at least 15MB/s for a 256MB file using 10MB write buffer.
  • Random read . Device implementations MUST ensure a random read performance of at least 3.5MB/s for a 256MB file using 4KB write buffer.

8.3.省電模式

Android 6.0 introduced App Standby and Doze power-saving modes to optimize battery usage. All Apps exempted from these modes MUST be made visible to the end user. Further, the triggering, maintenance, wakeup algorithms and the use of global system settings of these power-saving modes MUST not deviate from the Android Open Source Project.

In addition to the power-saving modes, Android device implementations MAY implement any or all of the 4 sleeping power states as defined by the Advanced Configuration and Power Interface (ACPI), but if it implements S3 and S4 power states, it can only enter these states when closing a lid that is physically part of the device.

8.4.用電核算

更準確的功耗統計和報告為應用程式開發人員提供了優化應用程式功耗模式的激勵和工具。 Therefore, device implementations:

  • MUST be able to track hardware component power usage and attribute that power usage to specific applications. Specifically, implementations:
    • MUST provide a per-component power profile that defines the current consumption value for each hardware component and the approximate battery drain caused by the components over time as documented in the Android Open Source Project site.
    • MUST report all power consumption values in milliampere hours (mAh).
    • SHOULD be attributed to the hardware component itself if unable to attribute hardware component power usage to an application.
    • MUST report CPU power consumption per each process's UID. The Android Open Source Project meets the requirement through the uid_cputime kernel module implementation.
  • MUST make this power usage available via the adb shell dumpsys batterystats shell command to the app developer.
  • MUST honor the android.intent.action.POWER_USAGE_SUMMARY intent and display a settings menu that shows this power usage.

8.5。一致的性能

Performance can fluctuate dramatically for high-performance long-running apps, either because of the other apps running in the background or the CPU throttling due to temperature limits. Android includes programmatic interfaces so that when the device is capable, the top foreground application can request that the system optimize the allocation of the resources to address such fluctuations.

Device implementations SHOULD support Sustained Performance Mode which can provide the top foreground application a consistent level of performance for a prolonged amount of time when requested through the Window.setSustainedPerformanceMode() API method. A Device implementation MUST report the support of Sustained Performance Mode accurately through the PowerManager.isSustainedPerformanceModeSupported() API method.

Device implementations with two or more CPU cores SHOULD provide at least one exclusive core that can be reserved by the top foreground application. If provided, implementations MUST meet the following requirements:

  • Implementations MUST report through the Process.getExclusiveCores() API method the id numbers of the exclusive cores that can be reserved by the top foreground application.
  • Device implementations MUST not allow any user space processes except the device drivers used by the application to run on the exclusive cores, but MAY allow some kernel processes to run as necessary.

If a device implementation does not support an exclusive core, it MUST return an empty list through the Process.getExclusiveCores() API method.

9. 安全模型相容性

Device implementations MUST implement a security model consistent with the Android platform security model as defined in Security and Permissions reference document in the APIs in the Android developer documentation.設備實作必須支援安裝自簽署的應用程序,而無需任何第三方/當局的任何其他權限/憑證。 Specifically, compatible devices MUST support the security mechanisms described in the follow subsections.

9.1.權限

Device implementations MUST support the Android permissions model as defined in the Android developer documentation.具體而言,實施必須執行按照SDK文件中所述的每個許可;無法省略,更改或忽略權限。如果新的權限ID字串不在Android中。*名稱空間,則實作可能會增加其他權限。

Permissions with a protectionLevel of 'PROTECTION_FLAG_PRIVILEGED' MUST only be granted to apps preloaded in the allowlisted privileged path(s) of the system image, such as the system/priv-app path in the AOSP implementation.

Permissions with a protection level of dangerous are runtime permissions. Applications with targetSdkVersion > 22 request them at runtime.設備實現:

  • MUST show a dedicated interface for the user to decide whether to grant the requested runtime permissions and also provide an interface for the user to manage runtime permissions.
  • MUST have one and only one implementation of both user interfaces.
  • MUST NOT grant any runtime permissions to preinstalled apps unless:
    • the user's consent can be obtained before the application uses it
    • the runtime permissions are associated with an intent pattern for which the preinstalled application is set as the default handler

9.2. UID 和進程隔離

Device implementations MUST support the Android application sandbox model, in which each application runs as a unique Unixstyle UID and in a separate process. Device implementations MUST support running multiple applications as the same Linux user ID, provided that the applications are properly signed and constructed, as defined in the Security and Permissions reference .

9.3.檔案系統權限

Device implementations MUST support the Android file access permissions model as defined in the Security and Permissions reference .

9.4.備用執行環境

Device implementations MAY include runtime environments that execute applications using some other software or technology than the Dalvik Executable Format or native code.但是,此類替代執行環境不得妥協,如本節所述,因此安裝了Android應用程式的安全模型或已安裝的Android應用程式的安全性。

Alternate runtimes MUST themselves be Android applications, and abide by the standard Android security model, as described elsewhere in section 9 .

不得授予替代運行時間存取由運行時的AndroidManifest.xml檔案中未要求的權限保護的資源的存取權限。

替代運行時間不得允許應用程式使用受系統應用程式限制的Android權限保護的功能。

替代運行時必須遵守Android沙盒模型。 Specifically, alternate runtimes:

  • SHOULD install apps via the PackageManager into separate Android sandboxes (Linux user IDs, etc.).
  • MAY provide a single Android sandbox shared by all applications using the alternate runtime.
  • Installed applications using an alternate runtime MUST NOT reuse the sandbox of any other app installed on the device, except through the standard Android mechanisms of shared user ID and signing certificate.
  • MUST NOT launch with, grant, or be granted access to the sandboxes corresponding to other Android applications.
  • MUST NOT be launched with, be granted, or grant to other applications any privileges of the superuser (root), or of any other user ID.

備用運行時間的.APK檔案可能包含在裝置實現的系統影像中,但必須以與簽署裝置實作中包含的其他應用程式的金鑰簽署。

安裝應用程式時,替代運行時間必須獲得應用程式使用的Android權限的用戶同意。 If an application needs to make use of a device resource for which there is a corresponding Android permission (such as Camera, GPS, etc.), the alternate runtime MUST inform the user that the application will be able to access that resource.如果運行時環境未以這種方式記錄應用程式功能,則運行時環境必須在使用該運行時安裝任何應用程式時列出運行時本身持有的所有權限。

9.5。多用戶支援

This feature is optional for all device types.

Android includes support for multiple users and provides support for full user isolation. Device implementations MAY enable multiple users, but when enabled MUST meet the following requirements related to multi-user support :

  • Android Automotive device implementations with multi-user support enabled MUST include a guest account that allows all functions provided by the vehicle system without requiring a user to log in.
  • Device implementations that do not declare the android.hardware.telephony feature flag MUST support restricted profiles, a feature that allows device owners to manage additional users and their capabilities on the device. With restricted profiles, device owners can quickly set up separate environments for additional users to work in, with the ability to manage finer-grained restrictions in the apps that are available in those environments.
  • Conversely device implementations that declare the android.hardware.telephony feature flag MUST NOT support restricted profiles but MUST align with the AOSP implementation of controls to enable /disable other users from accessing the voice calls and SMS.
  • Device implementations MUST, for each user, implement a security model consistent with the Android platform security model as defined in Security and Permissions reference document in the APIs.
  • Each user instance on an Android device MUST have separate and isolated external storage directories. Device implementations MAY store multiple users' data on the same volume or filesystem. However, the device implementation MUST ensure that applications owned by and running on behalf a given user cannot list, read, or write to data owned by any other user. Note that removable media, such as SD card slots, can allow one user to access another's data by means of a host PC. For this reason, device implementations that use removable media for the external storage APIs MUST encrypt the contents of the SD card if multiuser is enabled using a key stored only on non-removable media accessible only to the system. As this will make the media unreadable by a host PC, device implementations will be required to switch to MTP or a similar system to provide host PCs with access to the current user's data. Accordingly, device implementations MAY but SHOULD NOT enable multi-user if they use removable media for primary external storage.

9.6.高級簡訊警告

Android includes support for warning users of any outgoing premium SMS message . Premium SMS messages are text messages sent to a service registered with a carrier that may incur a charge to the user. Device implementations that declare support for android.hardware.telephony MUST warn users before sending a SMS message to numbers identified by regular expressions defined in /data/misc/sms/codes.xml file in the device. The upstream Android Open Source Project provides an implementation that satisfies this requirement.

9.7.核心安全特性

The Android Sandbox includes features that use the Security-Enhanced Linux (SELinux) mandatory access control (MAC) system, seccomp sandboxing, and other security features in the Linux kernel. SELinux or any other security features implemented below the Android framework:

  • MUST maintain compatibility with existing applications.
  • MUST NOT have a visible user interface when a security violation is detected and successfully blocked, but MAY have a visible user interface when an unblocked security violation occurs resulting in a successful exploit.
  • SHOULD NOT be user or developer configurable.

If any API for configuration of policy is exposed to an application that can affect another application (such as a Device Administration API), the API MUST NOT allow configurations that break compatibility.

Devices MUST implement SELinux or, if using a kernel other than Linux, an equivalent mandatory access control system. Devices MUST also meet the following requirements, which are satisfied by the reference implementation in the upstream Android Open Source Project.

設備實現:

  • MUST set SELinux to global enforcing mode.
  • MUST configure all domains in enforcing mode. No permissive mode domains are allowed, including domains specific to a device/vendor.
  • MUST NOT modify, omit, or replace the neverallow rules present within the system/sepolicy folder provided in the upstream Android Open Source Project (AOSP) and the policy MUST compile with all neverallow rules present, for both AOSP SELinux domains as well as device/vendor specific domains.
  • MUST split the media framework into multiple processes so that it is possible to more narrowly grant access for each process as described in the Android Open Source Project site.

Device implementations SHOULD retain the default SELinux policy provided in the system/sepolicy folder of the upstream Android Open Source Project and only further add to this policy for their own device-specific configuration. Device implementations MUST be compatible with the upstream Android Open Source Project.

Devices MUST implement a kernel application sandboxing mechanism which allows filtering of system calls using a configurable policy from multithreaded programs. The upstream Android Open Source Project meets this requirement through enabling the seccomp-BPF with threadgroup synchronization (TSYNC) as described in the Kernel Configuration section of source.android.com .

9.8.隱私

If the device implements functionality in the system that captures the contents displayed on the screen and/or records the audio stream played on the device, it MUST continuously notify the user whenever this functionality is enabled and actively capturing/recording.

If a device implementation has a mechanism that routes network data traffic through a proxy server or VPN gateway by default (for example, preloading a VPN service with android.permission.CONTROL_VPN granted), the device implementation MUST ask for the user's consent before enabling that mechanism, unless that VPN is enabled by the Device Policy Controller via the DevicePolicyManager.setAlwaysOnVpnPackage() , in which case the user does not need to provide a separate consent, but MUST only be notified.

Device implementations MUST ship with an empty user-added Certificate Authority (CA) store, and MUST preinstall the same root certificates for the system-trusted CA store as provided in the upstream Android Open Source Project.

When devices are routed through a VPN, or a user root CA is installed, the implementation MUST display a warning indicating the network traffic may be monitored to the user.

If a device implementation has a USB port with USB peripheral mode support, it MUST present a user interface asking for the user's consent before allowing access to the contents of the shared storage over the USB port.

9.9.資料儲存加密

Optional for Android device implementations without a secure lock screen.

If the device implementation supports a secure lock screen as described in section 9.11.1, then the device MUST support data storage encryption of the application private data (/data partition), as well as the application shared storage partition (/sdcard partition) if it is a permanent, non-removable part of the device.

For device implementations supporting data storage encryption and with Advanced Encryption Standard (AES) crypto performance above 50MiB/sec, the data storage encryption MUST be enabled by default at the time the user has completed the out-of-box setup experience. If a device implementation is already launched on an earlier Android version with encryption disabled by default, such a device cannot meet the requirement through a system software update and thus MAY be exempted.

Device implementations SHOULD meet the above data storage encryption requirement via implementing File Based Encryption (FBE).

9.9.1.直接啟動

All devices MUST implement the Direct Boot mode APIs even if they do not support Storage Encryption. In particular, the LOCKED_BOOT_COMPLETED and ACTION_USER_UNLOCKED Intents must still be broadcast to signal Direct Boot aware applications that Device Encrypted (DE) and Credential Encrypted (CE) storage locations are available for user.

9.9.2. File Based Encryption

Device implementations supporting FBE:

  • MUST boot up without challenging the user for credentials and allow Direct Boot aware apps to access to the Device Encrypted (DE) storage after the LOCKED_BOOT_COMPLETED message is broadcasted.
  • MUST only allow access to Credential Encrypted (CE) storage after the user has unlocked the device by supplying their credentials (eg. passcode, pin, pattern or fingerprint) and the ACTION_USER_UNLOCKED message is broadcasted. Device implementations MUST NOT offer any method to unlock the CE protected storage without the user supplied credentials.
  • MUST support Verified Boot and ensure that DE keys are cryptographically bound to the device's hardware root of trust.
  • MUST support encrypting file contents using AES with a key length of 256-bits in XTS mode.
  • MUST support encrypting file name using AES with a key length of 256-bits in CBC-CTS mode.
  • MAY support alternative ciphers, key lengths and modes for file content and file name encryption, but MUST use the mandatorily supported ciphers, key lengths and modes by default.
  • SHOULD make preloaded essential apps (eg Alarm, Phone, Messenger) Direct Boot aware.

The keys protecting CE and DE storage areas:

  • MUST be cryptographically bound to a hardware-backed Keystore. CE keys must be bound to a user's lock screen credentials. If the user has specified no lock screen credentials then the CE keys MUST be bound to a default passcode.
  • MUST be unique and distinct, in other words no user's CE or DE key may match any other user's CE or DE keys.

The upstream Android Open Source project provides a preferred implementation of this feature based on the Linux kernel ext4 encryption feature.

9.9.3。全碟加密

Device implementations supporting full disk encryption (FDE). MUST use AES with a key of 128-bits (or greater) and a mode designed for storage (for example, AES-XTS, AES-CBC-ESSIV). The encryption key MUST NOT be written to storage at any time without being encrypted. The user MUST be provided with the possibility to AES encrypt the encryption key, except when it is in active use, with the lock screen credentials stretched using a slow stretching algorithm (eg PBKDF2 or scrypt). If the user has not specified a lock screen credentials or has disabled use of the passcode for encryption, the system SHOULD use a default passcode to wrap the encryption key. If the device provides a hardware-backed keystore, the password stretching algorithm MUST be cryptographically bound to that keystore. The encryption key MUST NOT be sent off the device (even when wrapped with the user passcode and/or hardware bound key). The upstream Android Open Source project provides a preferred implementation of this feature based on the Linux kernel feature dm-crypt.

9.10。設備完整性

The following requirements ensures there is transparancy to the status of the device integrity.

Device implementations MUST correctly report through the System API method PersistentDataBlockManager.getFlashLockState() whether their bootloader state permits flashing of the system image. The FLASH_LOCK_UNKNOWN state is reserved for device implementations upgrading from an earlier version of Android where this new system API method did not exist.

Verified boot is a feature that guarantees the integrity of the device software. If a device implementation supports the feature, it MUST:

  • Declare the platform feature flag android.software.verified_boot.
  • Perform verification on every boot sequence.
  • Start verification from an immutable hardware key that is the root of trust and go all the way up to the system partition.
  • Implement each stage of verification to check the integrity and authenticity of all the bytes in the next stage before executing the code in the next stage.
  • Use verification algorithms as strong as current recommendations from NIST for hashing algorithms (SHA-256) and public key sizes (RSA-2048).
  • MUST NOT allow boot to complete when system verification fails, unless the user consents to attempt booting anyway, in which case the data from any non-verified storage blocks MUST not be used.
  • MUST NOT allow verified partitions on the device to be modified unless the user has explicitly unlocked the boot loader.

The upstream Android Open Source Project provides a preferred implementation of this feature based on the Linux kernel feature dm-verity.

Starting from Android 6.0, device implementations with Advanced Encryption Standard (AES) crypto performance above 50 MiB/seconds MUST support verified boot for device integrity.

If a device implementation is already launched without supporting verified boot on an earlier version of Android, such a device can not add support for this feature with a system software update and thus are exempted from the requirement.

9.11。金鑰和憑證

The Android Keystore System allows app developers to store cryptographic keys in a container and use them in cryptographic operations through the KeyChain API or the Keystore API .

All Android device implementations MUST meet the following requirements:

  • SHOULD not limit the number of keys that can be generated, and MUST at least allow more than 8,192 keys to be imported.
  • The lock screen authentication MUST rate limit attempts and MUST have an exponential backoff algorithm. Beyond 150 failed attempts, the delay MUST be at least 24 hours per attempt.
  • When the device implementation supports a secure lock screen it MUST back up the keystore implementation with secure hardware and meet following requirements:
    • MUST have implementations of RSA, AES, ECDSA and HMAC cryptographic algorithms and MD5, SHA1, and SHA-2 family hash functions to properly support the Android Keystore system's supported algorithms in an area that is kerbrea that is thekly sional the emr. 。 Secure isolation MUST block all potential mechanisms by which kernel or userspace code might access the internal state of the isolated environment, including DMA. The upstream Android Open Source Project (AOSP) meets this requirement by using the Trusty implementation, but another ARM TrustZone-based solution or a third-party reviewed secure implementation of a proper hypervisor-based isolation are alternative options.
    • MUST perform the lock screen authentication in the isolated execution environment and only when successful, allow the authentication-bound keys to be used. The upstream Android Open Source Project provides the Gatekeeper Hardware Abstraction Layer (HAL) and Trusty, which can be used to satisfy this requirement.

Note that if a device implementation is already launched on an earlier Android version, such a device is exempted from the requirement to have a hardware-backed keystore, unless it declares the android.hardware.fingerprint feature which requires a hardware-backed keystore.

9.11.1。 Secure Lock Screen

Device implementations MAY add or modify the authentication methods to unlock the lock screen, but MUST still meet the following requirements:

  • The authentication method, if based on a known secret, MUST NOT be treated as a secure lock screen unless it meets all following requirements:
    • The entropy of the shortest allowed length of inputs MUST be greater than 10 bits.
    • The maximum entropy of all possible inputs MUST be greater than 18 bits.
    • MUST not replace any of the existing authentication methods (PIN, pattern, password) implemented and provided in AOSP.
    • MUST be disabled when the Device Policy Controller (DPC) application has set the password quality policy via the DevicePolicyManager.setPasswordQuality() method with a more restrictive quality constant than PASSWORD_QUALITY_SOMETHING .
  • The authenticaion method, if based on a physical token or the location, MUST NOT be treated as a secure lock screen unless it meets all following requirements:
  • The authentication method, if based on biometrics, MUST NOT be treated as a secure lock screen unless it meets all following requirements:
    • It MUST have a fall-back mechanism to use one of the primary authentication methods which is based on a known secret and meets the requirements to be treated as a secure lock screen.
    • It MUST be disabled and only allow the primary authentication to unlock the screen when the Device Policy Controller (DPC) application has set the keguard feature policy by calling the method DevicePolicyManager.setKeyguardDisabledFeatures(KEYGUARD_DISABLE_FINGERPRINT) .
    • It MUST have a false acceptance rate that is equal or stronger than what is required for a fingerprint sensor as described in section 7.3.10, or otherwise MUST be disabled and only allow the primary authentication to unlock the screen when the Device Policy Controller (DPC) application has set the password quality policy via the DevicePolicyManager.setPasswordQuality() method with a more restrictive quality constant than PASSWORD_QUALITY_BIOMETRIC_WEAK .
  • If the authentication method can not be treated as a secure lock screen, it:
  • If the authentication method is based on a physical token, the location, or biometrics that has higher false acceptance rate than what is required for fingerprint sensors as described in section 7.3.10, then it:

9.12.資料刪除

Devices MUST provide users with a mechanism to perform a "Factory Data Reset" that allows logical and physical deletion of all data except for the following:

  • The system image
  • Any operating system files required by the system image

All user-generated data MUST be deleted. This MUST satisfy relevant industry standards for data deletion such as NIST SP800-88. This MUST be used for the implementation of the wipeData() API (part of the Android Device Administration API) described in section 3.9 Device Administration .

Devices MAY provide a fast data wipe that conducts a logical data erase.

9.13。 Safe Boot Mode

Android provides a mode enabling users to boot up into a mode where only preinstalled system apps are allowed to run and all third-party apps are disabled. This mode, known as "Safe Boot Mode", provides the user the capability to uninstall potentially harmful third-party apps.

Android device implementations are STRONGLY RECOMENDED to implement Safe Boot Mode and meet following requirements:

  • Device implementations SHOULD provide the user an option to enter Safe Boot Mode from the boot menu which is reachable through a workflow that is different from that of normal boot.

  • Device implementations MUST provide the user an option to enter Safe Boot Mode in such a way that is uninterruptible from third-party apps installed on the device, except for when the third party app is a UserManager.DISALLOW_SAFE_BOOT是真的。

  • Device implementations MUST provide the user the capability to uninstall any third-party apps within Safe Mode.

9.14。 Automotive Vehicle System Isolation

Android Automotive devices are expected to exchange data with critical vehicle subsystems, eg, by using the vehicle HAL to send and receive messages over vehicle networks such as CAN bus. Android Automotive device implementations MUST implement security features below the Android framework layers to prevent malicious or unintentional interaction between the Android framework or third-party apps and vehicle subsystems. These security features are as follows:

  • Gatekeeping messages from Android framework vehicle subsystems, eg, allowlisting permitted message types and message sources.
  • Watchdog against denial of service attacks from the Android framework or third-party apps. This guards against malicious software flooding the vehicle network with traffic, which may lead to malfunctioning vehicle subsystems.

10.軟體相容性測試

Device implementations MUST pass all tests described in this section.

However, note that no software test package is fully comprehensive. For this reason, device implementers are STRONGLY RECOMMENDED to make the minimum number of changes as possible to the reference and preferred implementation of Android available from the Android Open Source Project. This will minimize the risk of introducing bugs that create incompatibilities requiring rework and potential device updates.

10.1.相容性測試套件

Device implementations MUST pass the Android Compatibility Test Suite (CTS) available from the Android Open Source Project, using the final shipping software on the device.此外,設備實施者應盡可能使用Android開源樹中的參考實現,並且必須確保在CTS含糊不清以及參考原始碼部分的任何重新實現的情況下相容。

CTS設計為在實際設備上運作。像任何軟體一樣,CTS本身可能包含錯誤。 The CTS will be versioned independently of this Compatibility Definition, and multiple revisions of the CTS may be released for Android 7.1.設備實作必須傳遞設備軟體完成時可用的最新CTS版本。

10.2. CTS驗證器

Device implementations MUST correctly execute all applicable cases in the CTS Verifier. The CTS Verifier is included with the Compatibility Test Suite, and is intended to be run by a human operator to test functionality that cannot be tested by an automated system, such as correct functioning of a camera and sensors.

The CTS Verifier has tests for many kinds of hardware, including some hardware that is optional. Device implementations MUST pass all tests for hardware that they possess; for instance, if a device possesses an accelerometer, it MUST correctly execute the Accelerometer test case in the CTS Verifier. Test cases for features noted as optional by this Compatibility Definition Document MAY be skipped or omitted.

Every device and every build MUST correctly run the CTS Verifier, as noted above. However, since many builds are very similar, device implementers are not expected to explicitly run the CTS Verifier on builds that differ only in trivial ways. Specifically, device implementations that differ from an implementation that has passed the CTS Verifier only by the set of included locales, branding, etc. MAY omit the CTS Verifier test.

11. 可更新的軟體

設備實現必須包括替換整個系統軟體的機制。 The mechanism need not perform “live” upgrades—that is, a device restart MAY be required.

只要可以替換設備上預先安裝的整個軟體,就可以使用任何方法。例如,以下任何方法都可以滿足此要求:

  • “Over-the-air (OTA)” downloads with offline update via reboot.
  • “Tethered” updates over USB from a host PC.
  • “Offline” updates via a reboot and update from a file on removable storage.

However, if the device implementation includes support for an unmetered data connection such as 802.11 or Bluetooth PAN (Personal Area Network) profile, it MUST support OTA downloads with offline update via reboot.

所使用的更新機制必須支援更新,而無需擦除使用者資料。 That is, the update mechanism MUST preserve application private data and application shared data.請注意,上游Android軟體包括滿足此要求的更新機制。

For device implementations that are launching with Android 6.0 and later, the update mechanism SHOULD support verifying that the system image is binary identical to expected result following an OTA. The block-based OTA implementation in the upstream Android Open Source Project, added since Android 5.1, satisfies this requirement.

Also, device implementations SHOULD support A/B system updates . The AOSP implements this feature using the boot control HAL.

關係 i可根據剛才描述的機制應用的更新。

Android includes features that allow the Device Owner app (if present) to control the installation of system updates. To facilitate this, the system update subsystem for devices that report android.software.device_admin MUST implement the behavior described in the SystemUpdatePolicy class.

12. 文件變更日誌

For a summary of changes to the Compatibility Definition in this release:

For a summary of changes to individuals sections:

  1. 介紹
  2. 設備類型
  3. 軟體
  4. Application Packaging
  5. 多媒體
  6. Developer Tools and Options
  7. 硬體相容性
  8. 性能和功率
  9. 安全模型
  10. Software Compatibility Testing
  11. Updatable Software
  12. 文件變更日誌
  13. 聯絡我們

12.1。 Changelog Viewing Tips

Changes are marked as follows:

  • CDD
    Substantive changes to the compatibility requirements.

  • 文件
    Cosmetic or build related changes.

For best viewing, append the pretty=full and no-merges URL parameters to your changelog URLs.

13. 聯絡我們

您可以加入Android 相容性論壇並要求澄清或提出您認為該文件未涵蓋的任何問題。