Android 4.4 兼容性定義

透過集合功能整理內容 你可以依據偏好儲存及分類內容。

修訂版 1
最後更新:2013 年 11 月 27 日

版權所有 © 2013,谷歌公司。保留所有權利。
兼容性@android.com

目錄

一、簡介
2. 資源
3. 軟件
4. 應用打包兼容性
5. 多媒體兼容性
6. 開發者工具和選項兼容性
7. 硬件兼容性
7.1。顯示和圖形
7.2.輸入設備
7.3.傳感器
7.4.數據連接
7.5。相機
7.6.內存和存儲
7.7. USB
8. 性能兼容性
9. 安全模型兼容性
10. 軟件兼容性測試
11. 可更新軟件
12. 文檔變更日誌
13. 聯繫我們

一、簡介

本文檔列舉了設備與 Android 4.4 兼容必須滿足的要求。

“必須”、“不得”、“要求”、“應”、“不應”、“應該”、“不應”、“推薦”、“可能”和“可選”的使用符合 IETF 標準在 RFC2119 [資源,1 ] 中定義。

本文檔中使用的“設備實施者”或“實施者”是指開發運行 Android 4.4 的硬件/軟件解決方案的個人或組織。 “設備實現”或“實現”是這樣開發的硬件/軟件解決方案。

要被視為與 Android 4.4 兼容,設備實現必須滿足本兼容性定義中提出的要求,包括通過引用併入的任何文檔。

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

出於這個原因,Android 開源項目 [ Resources, 3 ] 既是 Android 的參考實現,也是首選實現。強烈建議設備實施者盡可能將其實施基於 Android 開源項目提供的“上游”源代碼。雖然假設某些組件可以替換為替代實現,但強烈建議不要這樣做,因為通過軟件測試將變得更加困難。實施者有責任確保與標準 Android 實施的行為完全兼容,包括和超越兼容性測試套件。最後,請注意,本文檔明確禁止某些組件替換和修改。

2. 資源

  1. IETF RFC2119 要求級別: http ://www.ietf.org/rfc/rfc2119.txt
  2. Android 兼容性計劃概述:http: //source.android.com/compatibility/index.html
  3. Android 開源項目:http: //source.android.com/
  4. API 定義和文檔:http: //developer.android.com/reference/packages.html
  5. Android 權限參考:http: //developer.android.com/reference/android/Manifest.permission.html
  6. android.os.Build 參考:http: //developer.android.com/reference/android/os/Build.html
  7. Android 4.4 允許的版本字符串:http: //source.android.com/compatibility/4.4/versions.html
  8. 渲染腳本:http: //developer.android.com/guide/topics/graphics/renderscript.html
  9. 硬件加速:http: //developer.android.com/guide/topics/graphics/hardware-accel.html
  10. android.webkit.WebView 類:http: //developer.android.com/reference/android/webkit/WebView.html
  11. HTML5:http: //www.whatwg.org/specs/web-apps/current-work/multipage/
  12. HTML5 離線功能: http ://dev.w3.org/html5/spec/Overview.html#offline
  13. HTML5 視頻標籤: http ://dev.w3.org/html5/spec/Overview.html#video
  14. HTML5/W3C 地理定位 API: http ://www.w3.org/TR/geolocation-API/
  15. HTML5/W3C 網絡存儲 API: http ://www.w3.org/TR/webstorage/
  16. HTML5/W3C IndexedDB API: http ://www.w3.org/TR/IndexedDB/
  17. Dalvik 虛擬機規範:可在 Android 源代碼中找到,位於 dalvik/docs
  18. AppWidgets:http: //developer.android.com/guide/practices/ui_guidelines/widget_design.html
  19. 通知:http: //developer.android.com/guide/topics/ui/notifiers/notifications.html
  20. 應用資源: http ://code.google.com/android/reference/available-resources.html
  21. 狀態欄圖標樣式指南:http: //developer.android.com/guide/practices/ui_guidelines/icon_design_status_bar.html
  22. 搜索管理器:http: //developer.android.com/reference/android/app/SearchManager.html
  23. 祝酒詞:http: //developer.android.com/reference/android/widget/Toast.html
  24. 主題:http: //developer.android.com/guide/topics/ui/themes.html
  25. R.style 類:http: //developer.android.com/reference/android/R.style.html
  26. 動態壁紙:http: //developer.android.com/resources/articles/live-wallpapers.html
  27. Android 設備管理:http: //developer.android.com/guide/topics/admin/device-admin.html
  28. DevicePolicyManager 參考:http: //developer.android.com/reference/android/app/admin/DevicePolicyManager.html
  29. Android 無障礙服務 API:http: //developer.android.com/reference/android/accessibilityservice/package-summary.html
  30. Android 無障礙 API:http: //developer.android.com/reference/android/view/accessibility/package-summary.html
  31. 眼睛免費項目: http ://code.google.com/p/eyes-free
  32. 文字轉語音 API:http: //developer.android.com/reference/android/speech/tts/package-summary.html
  33. 參考工具文檔(用於 adb、aapt、ddms、systrace):http: //developer.android.com/guide/developing/tools/index.html
  34. Android apk 文件說明:http: //developer.android.com/guide/topics/fundamentals.html
  35. 清單文件:http: //developer.android.com/guide/topics/manifest/manifest-intro.html
  36. 猴子測試工具:http: //developer.android.com/guide/developing/tools/monkey.html
  37. Android android.content.pm.PackageManager 類和硬件特性列表:http: //developer.android.com/reference/android/content/pm/PackageManager.html
  38. 支持多屏:http: //developer.android.com/guide/practices/screens_support.html
  39. android.util.DisplayMetrics:http: //developer.android.com/reference/android/util/DisplayMetrics.html
  40. android.content.res.Configuration:http: //developer.android.com/reference/android/content/res/Configuration.html
  41. android.hardware.SensorEvent:http: //developer.android.com/reference/android/hardware/SensorEvent.html
  42. 藍牙 API:http: //developer.android.com/reference/android/bluetooth/package-summary.html
  43. NDEF 推送協議:http: //source.android.com/compatibility/ndef-push-protocol.pdf
  44. MIFARE MF1S503X: http ://www.nxp.com/documents/data_sheet/MF1S503x.pdf
  45. MIFARE MF1S703X: http ://www.nxp.com/documents/data_sheet/MF1S703x.pdf
  46. MIFARE MF0ICU1: http ://www.nxp.com/documents/data_sheet/MF0ICU1.pdf
  47. MIFARE MF0ICU2: http ://www.nxp.com/documents/short_data_sheet/MF0ICU2_SDS.pdf
  48. MIFARE AN130511: http ://www.nxp.com/documents/application_note/AN130511.pdf
  49. MIFARE AN130411: http ://www.nxp.com/documents/application_note/AN130411.pdf
  50. 相機方向 API:http: //developer.android.com/reference/android/hardware/Camera.html#setDisplayOrientation(int)
  51. 相機:http: //developer.android.com/reference/android/hardware/Camera.html
  52. Android 打開附件:http: //developer.android.com/guide/topics/usb/accessory.html
  53. USB 主機 API:http: //developer.android.com/guide/topics/usb/host.html
  54. Android 安全和權限參考:http: //developer.android.com/guide/topics/security/permissions.html
  55. 適用於 Android 的應用程序: http ://code.google.com/p/apps-for-android
  56. 安卓下載管理器:http: //developer.android.com/reference/android/app/DownloadManager.html
  57. 安卓文件傳輸: http ://www.android.com/filetransfer
  58. Android 媒體格式:http: //developer.android.com/guide/appendix/media-formats.html
  59. HTTP 直播流協議草案: http ://tools.ietf.org/html/draft-pantos-http-live-streaming-03
  60. NFC 連接切換: http ://www.nfc-forum.org/specs/spec_list/#conn_handover
  61. 使用 NFC 的藍牙安全簡單配對: http ://www.nfc-forum.org/resources/AppDocs/NFCForum_AD_BTSSP_1_0.pdf
  62. Wi-Fi 組播 API:http: //developer.android.com/reference/android/net/wifi/WifiManager.MulticastLock.html
  63. 動作輔助:http: //developer.android.com/reference/android/content/Intent.html#ACTION_ASSIST
  64. USB 充電規範: http ://www.usb.org/developers/devclass_docs/USB_Battery_Charging_1.2.pdf
  65. Android Beam:http: //developer.android.com/guide/topics/nfc/nfc.html
  66. Android USB 音頻:http: //developer.android.com/reference/android/hardware/usb/UsbConstants.html#USB_CLASS_AUDIO
  67. Android NFC 共享設置:http: //developer.android.com/reference/android/provider/Settings.html#ACTION_NFCSHARING_SETTINGS
  68. Wi-Fi 直連(Wi-Fi P2P):http: //developer.android.com/reference/android/net/wifi/p2p/WifiP2pManager.html
  69. 鎖定和主屏幕小部件:http: //developer.android.com/reference/android/appwidget/AppWidgetProviderInfo.html
  70. 用戶管理器參考:http: //developer.android.com/reference/android/os/UserManager.html
  71. 外部存儲參考:http: //source.android.com/devices/tech/storage
  72. 外部存儲 API:http: //developer.android.com/reference/android/os/Environment.html
  73. 短信短代碼: http ://en.wikipedia.org/wiki/Short_code
  74. 媒體遠程控制客戶端:http: //developer.android.com/reference/android/media/RemoteControlClient.html
  75. 顯示管理器:http: //developer.android.com/reference/android/hardware/display/DisplayManager.html
  76. 夢想:http: //developer.android.com/reference/android/service/dreams/DreamService.html
  77. Android 應用程序開發相關設置:http: //developer.android.com/reference/android/provider/Settings.html#ACTION_APPLICATION_DEVELOPMENT_SETTINGS
  78. 相機:http: //developer.android.com/reference/android/hardware/Camera.Parameters.html
  79. EGL 擴展-EGL_ANDROID_RECORDABLE: http ://www.khronos.org/registry/egl/extensions/ANDROID/EGL_ANDROID_recordable.txt
  80. 運動事件 API:http: //developer.android.com/reference/android/view/MotionEvent.html
  81. 觸摸輸入配置:http: //source.android.com/devices/tech/input/touch-devices.html
  82. Unicode 6.1.0: http ://www.unicode.org/versions/Unicode6.1.0/
  83. WebView 兼容性:http: //www.chromium.org/
  84. Android 設備所有者應用程序:http: //developer.android.com/reference/android/app/admin/DevicePolicyManager.html#isDeviceOwnerApp(java.lang.String)
  85. WifiManager API:http: //developer.android.com/reference/android/net/wifi/WifiManager.html
  86. RTC 硬件編碼要求: http ://www.webmproject.org/hardware/rtc-coding-requirements/
  87. Settings.Secure LOCATION_MODE:http: //developer.android.com/reference/android/provider/Settings.Secure.html#LOCATION_MODE
  88. 內容解析器:http: //developer.android.com/reference/android/content/ContentResolver.html
  89. SettingInjectorService:http: //developer.android.com/reference/android/location/SettingInjectorService.html
  90. 基於主機的卡模擬:http: //developer.android.com/guide/topics/connectivity/nfc/hce.html
  91. 電話服務提供商:http: //developer.android.com/reference/android/provider/Telephony.html

其中許多資源直接或間接從 Android SDK 派生,並且在功能上與該 SDK 文檔中的信息相同。在此兼容性定義或兼容性測試套件與 SDK 文檔不一致的任何情況下,SDK 文檔被視為權威。上述參考文獻中提供的任何技術細節都被視為包含在本兼容性定義中。

3. 軟件

3.1。託管 API 兼容性

託管(基於 Dalvik)的執行環境是 Android 應用程序的主要工具。 Android 應用程序編程接口 (API) 是向在託管 VM 環境中運行的應用程序公開的一組 Android 平台接口。設備實現必須提供 Android SDK [資源,4 ] 公開的任何文檔化 API 的完整實現,包括所有文檔化行為。

設備實現不得省略任何託管 API、更改 API 接口或簽名、偏離記錄的行為或包含無操作,除非此兼容性定義特別允許。

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

3.2.軟 API 兼容性

除了第 3.1 節中的託管 API 之外,Android 還包括一個重要的僅運行時“軟”API,其形式為諸如 Intent、權限和 Android 應用程序的類似方面等無法在應用程序編譯時強制執行的方面。

3.2.1。權限

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

3.2.2.構建參數

Android API 在android.os.Build類 [ Resources, 6 ] 上包含許多常量,用於描述當前設備。為了在設備實現中提供一致、有意義的值,下表包含了對設備實現必須遵守的這些值的格式的額外限制。

範圍註釋
版本.發布當前執行的 Android 系統的版本,採用人類可讀的格式。該字段必須具有 [ Resources, 7 ] 中定義的字符串值之一。
版本.SDK當前執行的 Android 系統的版本,採用第三方應用程序代碼可訪問的格式。對於 Android 4.4,此字段必須具有整數值 19。
VERSION.SDK_INT當前執行的 Android 系統的版本,採用第三方應用程序代碼可訪問的格式。對於 Android 4.4,此字段必須具有整數值 19。
版本.增量設備實現者選擇的值,以人類可讀的格式指定當前執行的 Android 系統的特定構建。此值不得重新用於最終用戶可用的不同構建。此字段的典型用途是指示使用哪個構建號或源代碼控制更改標識符來生成構建。該字段的具體格式沒有要求,但不能為空或空字符串(“”)。
木板設備實現者選擇的一個值,用於標識設備使用的特定內部硬件,採用人類可讀的格式。該字段的一個可能用途是指示為設備供電的電路板的特定版本。此字段的值必須可編碼為 7 位 ASCII 並匹配正則表達式"^[a-zA-Z0-9.,_-]+$"
反映與最終用戶所知的設備關聯的品牌名稱的值。必須採用人類可讀的格式,並且應該代表設備的製造商或銷售該設備的公司品牌。此字段的值必須可編碼為 7 位 ASCII 並匹配正則表達式"^[a-zA-Z0-9.,_-]+$"
CPU_ABI本機代碼的指令集名稱(CPU 類型 + ABI 約定)。請參閱第 3.3 節:本機 API 兼容性
CPU_ABI2本機代碼的第二個指令集(CPU 類型 + ABI 約定)的名稱。請參閱第 3.3 節:本機 API 兼容性
設備由設備實現者選擇的一個值,包含標識硬件功能配置和設備工業設計的開發名稱或代號。此字段的值必須可編碼為 7 位 ASCII 並匹配正則表達式"^[a-zA-Z0-9.,_-]+$"
指紋唯一標識此構建的字符串。它應該是合理的人類可讀的。它必須遵循這個模板:
$(BRAND)/$(PRODUCT)/$(DEVICE):$(VERSION.RELEASE)/$(ID)/$(VERSION.INCREMENTAL):$(TYPE)/$(TAGS)
例如:
acme/myproduct/mydevice:4.4/KRT16/3359:userdebug/test-keys
指紋不得包含空格字符。如果上面模板中包含的其他字段包含空格字符,則必須在構建指紋中將它們替換為另一個字符,例如下劃線(“_”)字符。該字段的值必須可編碼為 7 位 ASCII。
硬件硬件的名稱(來自內核命令行或 /proc)。它應該是合理的人類可讀的。此字段的值必須可編碼為 7 位 ASCII 並匹配正則表達式"^[a-zA-Z0-9.,_-]+$"
主持人一個字符串,以人類可讀的格式唯一標識構建所基於的主機。該字段的具體格式沒有要求,但不能為空或空字符串(“”)。
ID設備實現者選擇的標識符,用於引用特定版本,採用人類可讀的格式。此字段可以與 android.os.Build.VERSION.INCREMENTAL 相同,但應該是一個足以讓最終用戶區分軟件構建的值。此字段的值必須可編碼為 7 位 ASCII 並匹配正則表達式"^[a-zA-Z0-9.,_-]+$"
製造商產品的原始設備製造商 (OEM) 的商品名稱。該字段的具體格式沒有要求,但不能為空或空字符串(“”)。
模型由設備實現者選擇的一個值,其中包含最終用戶已知的設備名稱。這應該與設備銷售和銷售給最終用戶的名稱相同。該字段的具體格式沒有要求,但不能為空或空字符串(“”)。
產品設備實施者選擇的一個值,其中包含特定產品 (SKU) 的開發名稱或代碼名稱,在同一品牌中應該是唯一的。必須是人類可讀的,但不一定供最終用戶查看。此字段的值必須可編碼為 7 位 ASCII 並匹配正則表達式"^[a-zA-Z0-9.,_-]+$"
串行硬件序列號,必須可用。此字段的值必須可編碼為 7 位 ASCII 並匹配正則表達式"^([a-zA-Z0-9]{6,20})$"
標籤由設備實現者選擇的以逗號分隔的標籤列表,用於進一步區分構建。例如,“未簽名,調試”。此字段的值必須可編碼為 7 位 ASCII 並匹配正則表達式"^[a-zA-Z0-9.,_-]+$"
時間表示構建發生時間的時間戳的值。
類型設備實現者選擇的值,指定構建的運行時配置。該字段應該具有對應於三個典型 Android 運行時配置的值之一:“user”、“userdebug”或“eng”。此字段的值必須可編碼為 7 位 ASCII 並匹配正則表達式"^[a-zA-Z0-9.,_-]+$"
用戶生成構建的用戶(或自動用戶)的名稱或用戶 ID。該字段的具體格式沒有要求,但不能為空或空字符串(“”)。

3.2.3。意圖兼容性

設備實現必須遵循 Android 的鬆散耦合 Intent 系統,如下節所述。 “尊敬”是指設備實現者必須提供一個 Android 活動或服務,該活動或服務指定一個匹配的 Intent 過濾器,並綁定到每個指定的 Intent 模式並實現正確的行為。

3.2.3.1。核心應用意圖

Android 上游項目定義了一些核心應用,如聯繫人、日曆、相冊、音樂播放器等。設備實施者可以用替代版本替換這些應用程序。

但是,任何此類替代版本都必須遵循上游項目提供的相同 Intent 模式。例如,如果設備包含替代音樂播放器,它仍必須遵循第三方應用程序發布的 Intent 模式來挑選歌曲。

以下應用程序被視為核心 Android 系統應用程序:

  • 台鐘
  • 瀏覽器
  • 日曆
  • 聯繫人
  • 畫廊
  • 全球搜索
  • 啟動器
  • 音樂
  • 設置

核心 Android 系統應用程序包括各種被視為“公共”的 Activity 或 Service 組件。也就是說,屬性“android:exported”可能不存在,或者可能具有值“true”。

對於在核心 Android 系統應用之一中定義的每個 Activity 或 Service,如果沒有通過值為“false”的 android:exported 屬性標記為非公共,設備實現必須包含實現相同 Intent 過濾器的相同類型的組件模式作為核心的Android系統應用程序。

換句話說,設備實現可能會取代核心的 Android 系統應用程序;但是,如果支持,設備實現必須支持每個被替換的核心 Android 系統應用程序定義的所有 Intent 模式。

3.2.3.2。意圖覆蓋

由於 Android 是一個可擴展的平台,設備實現必須允許第 3.2.3.1 節中引用的每個 Intent 模式被第三方應用程序覆蓋。上游 Android 開源實現默認允許這樣做;設備實現者不得將特殊權限附加到系統應用程序對這些 Intent 模式的使用,或阻止第三方應用程序綁定並控制這些模式。該禁止具體包括但不限於禁用“選擇器”用戶界面,該界面允許用戶在所有處理相同意圖模式的多個應用程序之間進行選擇。

但是,如果默認活動為數據 URI 提供更具體的過濾器,則設備實現可以為特定 URI 模式(例如 http://play.google.com)提供默認活動。例如,指定數據 URI“http://www.android.com”的意圖過濾器比“http://”的瀏覽器過濾器更具體。設備實現必須為用戶提供一個用戶界面來修改意圖的默認活動。

3.2.3.3。意圖命名空間

設備實現不得包含任何使用 android.* 或 com.android.* 命名空間中的 ACTION、CATEGORY 或其他鍵字符串來支持任何新 Intent 或 Broadcast Intent 模式的 Android 組件。設備實施者不得在屬於另一個組織的包空間中包含任何使用 ACTION、CATEGORY 或其他鍵字符串來尊重任何新 Intent 或 Broadcast Intent 模式的 Android 組件。設備實現者不得更改或擴展第 3.2.3.1 節中列出的核心應用程序使用的任何 Intent 模式。設備實現可能包括使用名稱空間的 Intent 模式,這些名稱空間與它們自己的組織相關聯。

這種禁止類似於第 3.6 節中為 Java 語言類指定的禁止。

3.2.3.4。廣播意圖

第三方應用程序依靠平台廣播某些 Intent 來通知他們硬件或軟件環境的變化。 Android 兼容設備必須廣播公共廣播 Intent 以響應適當的系統事件。廣播意圖在 SDK 文檔中進行了描述。

3.2.3.5。默認應用設置

Android 4.4 添加了允許用戶選擇其默認 Home 和 SMS 應用程序的設置。設備實現必須為每個提供類似的用戶設置菜單,與 SDK 文檔 [資源,91 ] 中描述的 Intent 過濾器模式和 API 方法兼容。

3.3.原生 API 兼容性

3.3.1 應用二進制接口

在 Dalvik 中運行的託管代碼可以調用應用程序 .apk 文件中提供的本機代碼,作為為適當的設備硬件架構編譯的 ELF .so 文件。由於本機代碼高度依賴於底層處理器技術,Android 在文件docs/CPU-ARCH-ABIS.html中的 Android NDK 中定義了許多應用程序二進制接口 (ABI)。如果設備實現與一個或多個定義的 ABI 兼容,它應該實現與 Android NDK 的兼容性,如下所示。

如果設備實現包括對 Android ABI 的支持,它:

  • 必須包括對在託管環境中運行的代碼的支持,以調用本機代碼,使用標準 Java 本機接口 (JNI) 語義
  • 必須與以下列表中的每個所需庫兼容源代碼(即標頭兼容)和二進制兼容(對於 ABI)
  • 必須通過android.os.Build.CPU_ABI API 和android.os.Build.CPU_ABI2參數準確報告設備支持的本機應用二進制接口 (ABI)。
  • 必須通過android.os.Build.CPU_ABI2僅在文件docs/CPU-ARCH-ABIS.html中報告最新版本的 Android NDK 中記錄的 ABI
  • 必須通過android.os.Build.CPU_ABI僅報告下列 ABI 之一
    • armeabi-v7a
    • x86
    • mips
  • 應該使用上游 Android 開源項目中可用的源代碼和頭文件構建

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

  • libc(C 庫)
  • libm(數學庫)
  • 對 C++ 的最低支持
  • JNI接口
  • liblog(Android 日誌記錄)
  • libz(Zlib 壓縮)
  • libdl(動態鏈接器)
  • libGLESv1_CM.so (OpenGL ES 1.0)
  • libGLESv2.so (OpenGL ES 2.0)
  • libGLESv3.so (OpenGL ES 3.0)
  • libEGL.so(原生 OpenGL 表面管理)
  • libjnigraphics.so
  • libOpenSLES.so(OpenSL ES 1.0.1 音頻支持)
  • libOpenMAXAL.so(OpenMAX AL 1.0.1 支持)
  • libandroid.so(原生 Android 活動支持)
  • 支持 OpenGL,如下所述

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

請注意,設備實現必須包含 libGLESv3.so,並且必須符號鏈接(符號)鏈接到 libGLESv2.so。在聲明支持 OpenGL ES 3.0 的設備實現上,除了 OpenGL ES 2.0 函數符號之外,libGLESv2.so 還必須導出 OpenGL ES 3.0 函數符號。

本機代碼兼容性具有挑戰性。出於這個原因,應該重申的是,強烈鼓勵設備實現者使用上面列出的庫的上游實現,以幫助確保兼容性。

3.4.網絡兼容性

3.4.1。 Web 視圖兼容性

Android 開源實現使用來自 Chromium 項目的代碼來實現android.webkit.WebView [資源,10 ]。因為為 Web 渲染系統開發全面的測試套件是不可行的,所以設備實現者必須在 WebView 實現中使用 Chromium 的特定上游構建。具體來說:

  • 設備android.webkit.WebView實現必須基於來自上游 Android 開源項目 for Android 4.4 的 Chromium 構建。此版本包括一組特定的 WebView 功能和安全修復程序。 [資源,83 ]
  • WebView 報告的用戶代理字符串必須採用以下格式:
    Mozilla/5.0 (Linux; Android $(VERSION); $(LOCALE); $(MODEL) Build/$(BUILD)) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 $(CHROMIUM_VER) Mobile Safari/537.36
    • $(VERSION) 字符串的值必須與android.os.Build.VERSION.RELEASE的值相同。
    • $(LOCALE) 字符串的值是可選的,應該遵循國家代碼和語言的 ISO 約定,並且應該參考設備當前配置的區域設置。如果省略,尾隨分號也必須被刪除。
    • $(MODEL) 字符串的值必須與android.os.Build.MODEL的值相同。
    • $(BUILD) 字符串的值必須與android.os.Build.ID的值相同。
    • $(CHROMIUM_VER) 字符串的值必須是上游 Android 開源項目中 Chromium 的版本。
    • 設備實現可以在用戶代理字符串中省略Mobile

WebView 組件應該盡可能多地支持 HTML5 [參考資料,11 ]。

3.4.2.瀏覽器兼容性

設備實現必須包含用於一般用戶網頁瀏覽的獨立瀏覽器應用程序。獨立瀏覽器可能基於 WebKit 以外的瀏覽器技術。但是,即使使用備用瀏覽器應用程序,提供給第三方應用程序的android.webkit.WebView組件也必須基於 WebKit,如第 3.4.1 節所述。

實現可以在獨立的瀏覽器應用程序中提供自定義用戶代理字符串。

獨立的瀏覽器應用程序(無論是基於上游 WebKit 瀏覽器應用程序還是第三方替代品)應該盡可能多地支持 HTML5 [參考資料,11 ]。最低限度,設備實現必須支持與 HTML5 相關的這些 API:

此外,設備實現必須支持 HTML5/W3C webstorage API [資源,15 ],並且應該支持 HTML5/W3C IndexedDB API [資源,16 ]。請注意,隨著 Web 開發標準機構正在轉變為偏愛 IndexedDB 而不是 webstorage,IndexedDB 有望成為未來版本 Android 的必需組件。

3.5. API 行為兼容性

每種 API 類型(託管、軟、原生和 Web)的行為必須與上游 Android 開源項目 [資源,3 ] 的首選實現一致。一些特定的兼容性領域是:

  • 設備不得更改標準 Intent 的行為或語義
  • 設備不得改變特定類型的系統組件(如服務、活動、內容提供者等)的生命週期或生命週期語義
  • 設備不得更改標準權限的語義

上面的列表並不全面。兼容性測試套件 (CTS) 測試平台的重要部分的行為兼容性,但不是全部。實施者有責任確保與 Android 開源項目的行為兼容性。出於這個原因,設備實現者應該盡可能使用通過 Android 開源項目提供的源代碼,而不是重新實現系統的重要部分。

3.6. API 命名空間

Android 遵循 Java 編程語言定義的包和類命名空間約定。為確保與第三方應用程序的兼容性,設備實施者不得對這些包命名空間進行任何禁止的修改(見下文):

  • 爪哇。*
  • javax.*
  • 太陽。*
  • 安卓。*
  • com.android.*

禁止的修改包括:

  • 設備實現不得通過更改任何方法或類簽名或刪除類或類字段來修改 Android 平台上公開的 API。
  • 設備實現者可以修改 API 的底層實現,但此類修改不得影響任何公開公開的 API 的聲明行為和 Java 語言簽名。
  • 設備實現者不得將任何公開暴露的元素(例如類或接口,或現有類或接口的字段或方法)添加到上述 API。

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

設備實現者可以添加自定義 API,但任何此類 API 不得位於其他組織擁有或引用的命名空間中。例如,設備實現者不得將 API 添加到 com.google.* 或類似命名空間;只有谷歌可以這樣做。同樣,Google 不得將 API 添加到其他公司的命名空間。此外,如果設備實現包含標準 Android 命名空間之外的自定義 API,則這些 API 必須打包在 Android 共享庫中,以便只有顯式使用它們的應用程序(通過<uses-library>機制)會受到內存使用量增加的影響此類 API。

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

請注意,上述限制對應於 Java 編程語言中命名 API 的標準約定;本節旨在通過包含在此兼容性定義中來加強這些約定並使其具有約束力。

3.7.虛擬機兼容性

設備實現必須支持完整的 Dalvik Executable (DEX) 字節碼規範和 Dalvik 虛擬機語義 [資源,17 ]。

設備實現必須配置 Dalvik 以根據上游 Android 平台分配內存,並由下表指定。 (有關屏幕尺寸和屏幕密度的定義,請參見第 7.1.1 節。)

請注意,下面指定的內存值被認為是最小值,設備實現可以為每個應用程序分配更多內存。

屏幕尺寸屏幕密度應用內存
小/正常/大ldpi/mdpi 16MB
小/正常/大tvdpi / hdpi 32MB
小/正常/大xhdpi 64MB
小/正常/大400dpi 96MB
小/正常/大xxhdpi 128MB
小/正常/大xxxhdpi 256MB
超大mdpi 32MB
超大tvdpi / hdpi 64MB
超大xhdpi 128MB
超大400dpi 192MB
超大xxhdpi 256MB
超大xxxhdpi 512MB

3.8.用戶界面兼容性

3.8.1.啟動器(主屏幕)

Android 包括一個啟動器應用程序(主屏幕)並支持第三方應用程序來替換設備啟動器(主屏幕)。允許第三方應用程序替換設備主屏幕的設備實現必須聲明平台功能android.software.home_screen

3.8.2.小部件

Android 定義了一個組件類型和相應的 API 和生命週期,允許應用程序向最終用戶公開一個“AppWidget”[參考資料,18 ]。支持在主屏幕上嵌入小部件的設備實現必須滿足以下要求並聲明支持平台功能android.software.app_widgets

  • 設備啟動器必須包含對 AppWidgets 的內置支持,並公開用戶界面功能以直接在啟動器中添加、配置、查看和刪除 AppWidgets。
  • 設備實現必須能夠以標準網格大小呈現 4 x 4 的小部件。 (有關詳細信息,請參閱 Android SDK 文檔 [ Resources, 18 ] 中的 App Widget Design Guidelines。
  • 支持鎖定屏幕的設備實現必須支持鎖定屏幕上的應用程序小部件。

3.8.3.通知

Android 包括允許開發人員使用設備的硬件和軟件功能通知用戶值得注意的事件 [參考資料,19 ] 的 API。

一些 API 允許應用程序使用硬件(特別是聲音、振動和光)執行通知或吸引註意力。設備實現必須支持使用硬件功能的通知,如 SDK 文檔中所述,並儘可能支持設備實現硬件。例如,如果設備實現包括振動器,它必須正確實現振動 API。如果設備實現缺少硬件,則必須將相應的 API 實現為無操作。請注意,此行為在第 7 節中進一步詳細說明。

此外,實現必須正確呈現 API [資源,20 ] 或狀態/系統欄圖標樣式指南 [資源,21 ] 中提供的所有資源(圖標、聲音文件等)。設備實現者可以為通知提供一種替代的用戶體驗,而不是參考 Android 開源實現提供的體驗;然而,這樣的替代通知系統必須支持現有的通知資源,如上所述。

Android 包括對豐富通知的支持,例如用於持續通知的交互式視圖。設備實現必須正確顯示和執行豐富的通知,如 Android API 中所述。

3.8.4.搜索

Android 包括 API [資源, 22 ],允許開發人員將搜索合併到他們的應用程序中,並將他們的應用程序數據公開到全局系統搜索中。一般而言,此功能由一個單一的、系統範圍的用戶界面組成,允許用戶輸入查詢、在用戶鍵入時顯示建議並顯示結果。 Android API 允許開發人員重用此接口以在他們自己的應用程序中提供搜索,並允許開發人員將結果提供給通用的全局搜索用戶界面。

設備實現必須包括一個單一的、共享的、系統範圍的搜索用戶界面,該界面能夠響應用戶輸入提供實時建議。設備實現必須實現允許開發人員重用此用戶界面以在他們自己的應用程序中提供搜索的 API。設備實現必須實現允許第三方應用程序在全局搜索模式下運行時向搜索框添加建議的 API。如果沒有安裝使用此功能的第三方應用程序,則默認行為應該是顯示網絡搜索引擎結果和建議。

3.8.5。敬酒

應用程序可以使用“Toast”API(在 [參考資料,23 ] 中定義)向最終用戶顯示簡短的非模態字符串,這些字符串會在短暫的一段時間後消失。設備實現必須以某種高可見度的方式從應用程序向最終用戶顯示 Toast。

3.8.6。主題

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

Android 包含一個“Holo”主題系列,作為一組定義的樣式供應用程序開發人員使用,如果他們想要匹配 Android SDK [參考資料,24 ] 定義的 Holo 主題外觀和感覺。設備實現不得更改任何公開給應用程序的 Holo 主題屬性 [資源,25 ]。

Android 還包括一個“設備默認”主題系列作為一組定義的樣式,供應用程序開發人員使用,如果他們想要匹配設備實現者定義的設備主題的外觀和感覺。設備實現可以修改暴露給應用程序的 DeviceDefault 主題屬性 [資源,25 ]。

從 4.4 版開始,Android 現在支持帶有半透明系統欄的新變體主題,允許應用程序開發人員用他們的應用程序內容填充狀態和導航欄後面的區域。為了在此配置中實現一致的開發人員體驗,在不同的設備實現中保持狀態欄圖標樣式非常重要。因此,Android 設備實現必須為系統狀態圖標(例如信號強度和電池電量)和系統發出的通知使用白色,除非該圖標指示有問題的狀態 [資源,25 ]。

3.8.7。動態壁紙

Android 定義了一種組件類型和相應的 API 和生命週期,允許應用程序向最終用戶公開一個或多個“動態壁紙”[參考資料,26 ]。動態壁紙是具有有限輸入功能的動畫、圖案或類似圖像,在其他應用程序後面顯示為壁紙。

如果硬件能夠以合理的幀速率運行所有動態壁紙,並且沒有功能限制,並且對其他應用程序沒有不利影響,則認為硬件能夠可靠地運行動態壁紙。如果硬件限制導致壁紙和/或應用程序崩潰、故障、消耗過多的 CPU 或電池電量,或以不可接受的低幀速率運行,則認為硬件無法運行動態壁紙。例如,一些動態壁紙可能使用 Open GL 1.0 或 2.0 上下文來呈現其內容。動態壁紙無法在不支持多個 OpenGL 上下文的硬件上可靠運行,因為使用 OpenGL 上下文的動態壁紙可能與也使用 OpenGL 上下文的其他應用程序發生衝突。

如上所述,能夠可靠運行動態壁紙的設備實現應該實現動態壁紙。如上所述確定不能可靠運行動態壁紙的設備實現不得實現動態壁紙。

3.8.8。最近的應用程序顯示

上游 Android 源代碼包括一個用戶界面,用於顯示最近的應用程序,使用用戶上次離開應用程序時應用程序圖形狀態的縮略圖。設備實現可能會改變或消除此用戶界面;但是,計劃在未來的 Android 版本中更廣泛地使用此功能。強烈建議設備實現對最近的應用程序使用上游 Android 用戶界面(或類似的基於縮略圖的界面),否則它們可能與未來版本的 Android 不兼容。

3.8.9。輸入管理

Android 包括對輸入管理的支持和對第三方輸入法編輯器的支持。允許用戶在設備上使用第三方輸入法的設備實現必須聲明平台功能android.software.input_methods並支持 Android SDK 文檔中定義的 IME API。

聲明android.software.input_methods功能的設備實現必須提供用戶可訪問的機制來添加和配置第三方輸入法。設備實現必須顯示設置界面以響應android.settings.INPUT_METHOD_SETTINGS Intent。

3.8.10。鎖屏媒體遙控器

Android 包括對遠程控制 API 的支持,它允許媒體應用程序與在遠程視圖中顯示的播放控件集成,例如設備鎖定屏幕 [資源,74 ]。在設備中支持鎖定屏幕並允許用戶在主屏幕上添加小部件的設備實現必須包括對在設備鎖定屏幕中嵌入遠程控制的支持 [資源,69 ]。

3.8.11。夢想

Android 包括對名為 Dreams [資源, 76 ] 的交互式屏幕保護程序的支持。 Dreams 允許用戶在充電設備空閒或停靠在桌面底座時與應用程序進行交互。設備實現必須包括對 Dreams 的支持,並為用戶提供配置 Dreams 的設置選項。

3.8.12。地點

位置模式必須顯示在設置 [資源,87 ] 內的位置菜單中。通過 Android 4.4 中引入的SettingInjectorService提供的定位服務必須顯示在同一個 Location 菜單中 [ Resources, 89 ]。

3.8.13。統一碼

Android 4.4 包括對彩色表情符號字符的支持。 Android 設備實現必須為 Unicode 6.1 [ Resources, 82 ] 中定義的表情符號字符向用戶提供輸入方法,並且必須能夠以顏色字形呈現這些表情符號字符。

3.9.設備管理

Android 包括允許具有安全意識的應用程序通過 Android 設備管理 API [參考資料,27 ] 在系統級別執行設備管理功能的功能,例如強制執行密碼策略或執行遠程擦除。設備實現必須提供DevicePolicyManager類的實現 [ Resources, 28 ]。包括對鎖定屏幕的支持的設備實現必須支持 Android SDK 文檔 [參考資料,27 ] 中定義的所有設備管理策略。

設備實現可能具有執行設備管理功能的預安裝應用程序,但不得將此應用程序設置為開箱即用的默認設備所有者應用程序 [資源,84 ]。

3.10。可訪問性

Android 提供了一個輔助功能層,可幫助殘障用戶更輕鬆地瀏覽他們的設備。此外,Android 提供平台 API,使無障礙服務實現能夠接收用戶和系統事件的回調並生成備用反饋機制,例如文本到語音、觸覺反饋和軌跡球/d-pad 導航 [參考資料,29 ]。設備實現必須提供與默認 Android 實現一致的 Android 無障礙框架實現。具體來說,設備實現必須滿足以下要求。

  • 設備實現必須通過android.accessibilityservice API [資源,30 ] 支持第三方無障礙服務實現。
  • 設備實現必須生成AccessibilityEvents並將這些事件以與默認 Android 實現一致的方式傳遞給所有已註冊的AccessibilityService實現。
  • 設備實現必須提供用戶可訪問的機制來啟用和禁用無障礙服務,並且必須顯示此界面以響應android.provider.Settings.ACTION_ACCESSIBILITY_SETTINGS意圖。

此外,設備實現應該在設備上提供無障礙服務的實現,並且應該為用戶提供在設備設置期間啟用無障礙服務的機制。 Eyes Free 項目 [ Resources, 31 ] 提供了無障礙服務的開源實現。

3.11。文字轉語音

Android 包括允許應用程序使用文本轉語音 (TTS) 服務的 API,並允許服務提供商提供 TTS 服務的實現 [參考資料,32 ]。設備實現必須滿足與 Android TTS 框架相關的以下要求:

  • 設備實現必須支持 Android TTS 框架 API,並且應該包含支持設備上可用語言的 TTS 引擎。請注意,上游 Android 開源軟件包括一個功能齊全的 TTS 引擎實現。
  • 設備實現必須支持安裝第三方 TTS 引擎。
  • 設備實現必須提供用戶可訪問的界面,允許用戶選擇在系統級別使用的 TTS 引擎。

4. 應用打包兼容性

設備實現必須安裝並運行由官方 Android SDK [資源,33 ] 中包含的“aapt”工俱生成的 Android“.apk”文件。

設備實現不得擴展 .apk [ Resources, 34 ]、Android Manifest [ Resources, 35 ]、Dalvik 字節碼 [ Resources, 17 ] 或 renderscript 字節碼格式,以防止這些文件在其上正確安裝和運行其他兼容設備。設備實現者應該使用 Dalvik 的參考上游實現,以及參考實現的包管理系統。

5. 多媒體兼容性

設備實現必須包括至少一種形式的音頻輸出,例如揚聲器、耳機插孔、外部揚聲器連接等。

5.1。媒體編解碼器

設備實現必須支持 Android SDK 文檔 [資源,58 ] 中指定的核心媒體格式,除非本文檔明確允許。具體來說,設備實現必須支持下表中定義的媒體格式、編碼器、解碼器、文件類型和容器格式。所有這些編解碼器都作為軟件實現在 Android 開源項目的首選 Android 實現中提供。

請注意,Google 和開放手機聯盟均未聲明這些編解碼器不受第三方專利的約束。建議那些打算在硬件或軟件產品中使用此源代碼的人,此代碼的實現(包括在開源軟件或共享軟件中)可能需要相關專利持有人的專利許可。

請注意,這些表並未列出大多數視頻編解碼器的特定比特率要求,因為當前設備硬件不一定支持精確映射到相關標準指定的所需比特率的比特率。相反,設備實現應該支持硬件上實際的最高比特率,達到規範定義的限制。

類型格式/編解碼器編碼器解碼器細節文件類型/容器格式
聲音的MPEG-4 AAC 配置文件 (AAC LC)對於包含麥克風硬件並定義android.hardware.microphone的設備實現是必需的。必需的支持標准採樣率從 8 到 48 kHz 的單聲道/立體聲/5.0/5.1* 內容。
  • 3GPP (.3gp)
  • MPEG-4 (.mp4, .m4a)
  • ADTS 原始 AAC(.aac,在 Android 3.1+ 中解碼,在 Android 4.0+ 中編碼,不支持 ADIF)
  • MPEG-TS(.ts,不可搜索,Android 3.0+)
MPEG-4 HE AAC 配置文件 (AAC+)需要包含麥克風硬件並定義 android.hardware.microphone 的設備實現必需的支持標准採樣率從 16 到 48 kHz 的單聲道/立體聲/5.0/5.1* 內容。
MPEG-4 HE AAC v2 配置文件(增強型 AAC+)必需的支持標准採樣率從 16 到 48 kHz 的單聲道/立體聲/5.0/5.1* 內容。
MPEG-4 音頻對像類型 ER AAC ELD(增強型低延遲 AAC)需要包含麥克風硬件並定義 android.hardware.microphone 的設備實現必需的支持標准採樣率從 16 到 48 kHz 的單聲道/立體聲內容。
AMR-NB對於包含麥克風硬件並定義android.hardware.microphone的設備實現是必需的。必需的4.75 至 12.2 kbps 採樣率 @ 8kHz 3GPP (.3gp)
AMR-WB對於包含麥克風硬件並定義android.hardware.microphone的設備實現是必需的。必需的從 6.60 kbit/s 到 23.85 kbit/s 的 9 種速率在 16kHz 下採樣3GPP (.3gp)
FLAC必需的
(安卓 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 和移動 XMF。支持鈴聲格式 RTTTL/RTX、OTA 和 iMelody
  • 類型 0 和 1(.mid、.xmf、.mxmf)
  • RTTTL/RTX (.rtttl, .rtx)
  • OTA (.ota)
  • iMelody (.imy)
沃爾比斯必需的
  • 奧格 (.ogg)
  • 馬特羅斯卡 (.mkv)
PCM/波必需的必需的8 位和 16 位線性 PCM**(達到硬件限制的速率)。設備必須支持 8000、16000 和 44100 Hz 頻率的原始 PCM 記錄的採樣率波 (.wav)
圖片JPEG必需的必需的基礎+漸進式JPEG (.jpg)
動圖必需的GIF (.gif)
PNG必需的必需的PNG (.png)
BMP必需的BMP (.bmp)
WEBP必需的必需的WebP (.webp)
視頻H.263需要用於包含相機硬件並定義android.hardware.cameraandroid.hardware.camera.front的設備實現。必需的
  • 3GPP (.3gp)
  • MPEG-4 (.mp4)
H.264 AVC需要用於包含相機硬件並定義android.hardware.cameraandroid.hardware.camera.front的設備實現。必需的基線資料 (BP)
  • 3GPP (.3gp)
  • MPEG-4 (.mp4)
  • MPEG-TS(.ts,僅限 AAC 音頻,不可搜索,Android 3.0+)
MPEG-4 SP必需的3GPP (.3gp)
副總裁8****必需的
(安卓 4.3+)
必需的
(安卓 2.3.3+)
WebM (.webm) 和 Matroska (.mkv, Android 4.0+)***
VP9必需的
(安卓 4.4+)
WebM (.webm) 和 Matroska (.mkv, Android 4.0+)***
  • *注:只需要縮混 5.0/5.1 的內容;錄製或渲染超過 2 個通道是可選的。
  • **注意:16 位線性 PCM 捕獲是強制性的。 8 位線性 PCM 捕獲不是強制性的。
  • ***注意:設備實現應該支持編寫 Matroska WebM 文件。
  • ****注意:對於可接受的網絡視頻流和視頻會議服務質量,設備實現應該使用滿足 [資源,86 ] 中要求的硬件 VP8 編解碼器。

5.2.視頻編碼

包含後置攝像頭並聲明android.hardware.camera的 Android 設備實現應支持以下 H.264 視頻編碼配置文件。

標清(低質量)標清(高品質)高清(硬件支持時)
視頻分辨率176 x 144 像素480 x 360 像素1280 x 720 像素
視頻幀率12 幀/秒30 幀/秒30 幀/秒
視頻比特率56 Kbps 500 Kbps 或更高2 Mbps 或更高
音頻編解碼器AAC-LC AAC-LC AAC-LC
音頻通道1(單聲道) 2(立體聲) 2(立體聲)
音頻比特率24 Kbps 128 Kbps 192 Kbps

包含後置攝像頭並聲明android.hardware.camera的 Android 設備實現應支持以下 VP8 視頻編碼配置文件

標清(低質量)標清(高品質)高清 720p
(當硬件支持時)
高清 1080p
(當硬件支持時)
視頻分辨率320 x 180 像素640 x 360 像素1280 x 720 像素1920 x 1080 像素
視頻幀率30 幀/秒30 幀/秒30 幀/秒30 幀/秒
視頻比特率800 Kbps 2 Mbps 4 Mbps 10 Mbps

5.3.視頻解碼

Android 設備實現應支持以下 VP8、VP9 和 H.264 視頻解碼配置文件。設備實現還應支持在同一流中為 VP8、VP9 和 H.264 編解碼器進行動態視頻分辨率切換。

標清(低質量)標清(高品質)高清 720p
(當硬件支持時)
高清 1080p
(當硬件支持時)
視頻分辨率320 x 180 像素640 x 360 像素1280 x 720 像素1920 x 1080 像素
視頻幀率30 幀/秒30 幀/秒30 幀/秒30 幀/秒
視頻比特率800 Kbps 2 Mbps 8 Mbps 20 Mbps

5.4.聲音錄製

當應用程序使用android.media.AudioRecord API 開始錄製音頻流時,包含麥克風硬件並聲明android.hardware.microphone的設備實現必須對具有以下每種行為的音頻進行採樣和錄製:

  • 設備應表現出近似平坦的幅度與頻率特性;具體來說,±3 dB,從 100 Hz 到 4000 Hz
  • 應設置音頻輸入靈敏度,以使 1000 Hz 的 90 dB 聲功率級 (SPL) 源對 16 位樣本產生 2500 的 RMS。
  • PCM 幅度電平應該線性跟踪麥克風的輸入 SPL 變化,範圍從 -18 dB 到 +12 dB,再到 90 dB SPL。
  • 對於 1Khz 和 90 dB SPL 輸入電平,總諧波失真應小於 1%。

除了上述錄製規範外,當應用程序開始使用android.media.MediaRecorder.AudioSource.VOICE_RECOGNITION音頻源錄製音頻流時:

  • 如果存在降噪處理,則必須禁用。
  • 如果存在自動增益控制,則必須禁用。

從 Android 4.4 開始, android.media.MediaRecorder.AudioSource類有一個新的音頻源: REMOTE_SUBMIX 。設備必須正確實現REMOTE_SUBMIX音頻源,以便當應用程序使用android.media.AudioRecord API 從該音頻源錄製時,它可以捕獲所有音頻流的混合,以下除外:

  • STREAM_RING
  • STREAM_ALARM
  • STREAM_NOTIFICATION

注意:雖然自 Android 4.3 起,上述某些要求被聲明為“應該”,但未來版本的兼容性定義計劃將這些要求更改為“必須”。也就是說,這些要求在 Android 4.4 中是可選的,但將來的版本會要求強烈建議運行 Android 的現有設備和新設備滿足這些要求,否則在升級到未來版本時將無法獲得 Android 兼容性。

如果平台支持針對語音識別調整的噪聲抑制技術,則效果必須可以通過android.media.audiofx.NoiseSuppressor API 進行控制。此外,噪聲抑制器效果描述符的“uuid”字段必須唯一標識噪聲抑制技術的每個實現。

5.5.音頻延遲

音頻延遲是音頻信號通過系統時的時間延遲。許多類別的應用程序依靠短延遲來實現實時聲音效果。

為本節的目的:

  • “輸出延遲”定義為應用程序寫入一幀 PCM 編碼數據到相應聲音可以被外部收聽者聽到或被換能器觀察到的時間間隔
  • “冷輸出延遲”定義為第一幀的輸出延遲,此時音頻輸出系統在請求之前已空閒並斷電
  • “連續輸出延遲”定義為設備已經在播放音頻後後續幀的輸出延遲
  • “輸入延遲”是向設備呈現外部聲音到應用程序讀取相應幀的 PCM 編碼數據之間的時間間隔
  • “冷輸入延遲”定義為丟失的輸入時間和第一幀的輸入延遲之和,當音頻輸入系統在請求之前已經空閒並斷電時
  • “連續輸入延遲”定義為後續幀的輸入延遲,而設備已經在捕獲音頻
  • “OpenSL ES PCM 緩衝區隊列 API”是 Android NDK 中與 PCM 相關的 OpenSL ES API 集合;請參閱NDK_root /docs/opensles/index.html

根據第 5 節,所有兼容的設備實現必須包括至少一種形式的音頻輸出。設備實現應該滿足或超過這些輸出延遲要求:

  • 100 毫秒或更短的冷輸出延遲
  • 連續輸出延遲為 45 毫秒或更短

如果設備實現在使用 OpenSL ES PCM 緩衝區隊列 API 進行任何初始校准後滿足本節的要求,對於至少一個受支持的音頻輸出設備的連續輸出延遲和冷輸出延遲,它可以報告對低延遲音頻的支持,通過android.content.pm.PackageManager類報告功能“android.hardware.audio.low-latency”。 [ Resources, 37 ] 相反,如果設備實現不滿足這些要求,則不得報告對低延遲音頻的支持。

根據第 7.2.5 節,設備實現可以省略麥克風硬件。

包含麥克風硬件並聲明android.hardware.microphone的設備實現應該滿足以下輸入音頻延遲要求:

  • 100 毫秒或更短的冷輸入延遲
  • 50毫秒或更短的連續輸入延遲

5.6.網絡協議

設備必須支持 Android SDK 文檔 [資源,58 ] 中指定的用於音頻和視頻播放的媒體網絡協議。具體來說,設備必須支持以下媒體網絡協議:

  • RTSP(RTP、SDP)
  • HTTP(S) 漸進式流式傳輸
  • HTTP(S) 直播流協議草案,版本 3 [資源,59 ]

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

6.1。開發者工具

設備實現必須支持 Android SDK 中提供的 Android 開發者工具。具體來說,Android 兼容設備必須兼容:

  • Android 調試橋(稱為 adb) [資源,33 ]
    設備實現必須支持 Android SDK 中記錄的所有adb函數。默認情況下,設備端adb守護程序必須處於非活動狀態,並且必須有一個用戶可訪問的機制來打開 Android 調試橋。
  • Android 包括對安全 adb 的支持。安全 adb 在已知的經過身份驗證的主機上啟用 adb。設備實現必須支持安全 adb。
  • Dalvik 調試監視器服務(稱為 ddms) [資源,33 ]
    設備實現必須支持 Android SDK 中記錄的所有ddms功能。由於ddms使用adb ,因此默認情況下對ddms的支持應該是不活動的,但只要用戶激活了 Android 調試橋,就必須支持,如上所述。
  • 猴子[資源,36 ]
    設備實現必須包含 Monkey 框架,並使其可供應用程序使用。
  • SysTrace [資源,33 ]
    設備實現必須支持 Android SDK 中記錄的 systrace 工具。 Systrace 必須在默認情況下處於非活動狀態,並且必須有一個用戶可訪問的機制來打開 Systrace。

大多數基於 Linux 的系統和 Apple Macintosh 系統使用標準 Android SDK 工具識別 Android 設備,無需額外支持;但是,Microsoft Windows 系統通常需要用於新 Android 設備的驅動程序。 (例如,新的供應商 ID 和有時新的設備 ID 需要為 Windows 系統定制 USB 驅動程序。)如果標準 Android SDK 中提供的adb工具無法識別設備實現,則設備實現者必須提供允許開發人員連接到的 Windows 驅動程序使用adb協議的設備。必須為 32 位和 64 位版本的 Windows XP、Windows Vista、Windows 7 和 Windows 8 提供這些驅動程序。

6.2.開發人員選項

Android 包括對開發人員配置應用程序開發相關設置的支持。設備實現必須遵守 android.settings.APPLICATION_DEVELOPMENT_SETTINGS 意圖以顯示與應用程序開發相關的設置 [資源,77 ]。上游 Android 實現默認隱藏“開發者選項”菜單,並允許用戶在“設置”>“關於設備”>“內部版本號”菜單項上按七 (7) 次後啟動開發者選項。設備實現必須為開發者選項提供一致的體驗。具體來說,設備實現必須默認隱藏開發者選項,並且必須提供一種機制來啟用與上游 Android 實現一致的開發者選項。

6.2.1.實驗性的

Android 4.4 引入了 ART,這是一個實驗性的 Android 運行時,可在 Developer Options 菜單中訪問以進行預覽。設備實現應包括 ART (libart.so) 並支持從開發人員選項進行雙啟動,但必須將 Dalvik (libdvm.so) 保留為默認運行時。

7. 硬件兼容性

如果設備包含具有相應 API 的特定硬件組件供第三方開發人員使用,則設備實現必須按照 Android SDK 文檔中的說明實現該 API。如果 SDK 中的 API 與聲明為可選的硬件組件交互,並且設備實現不擁有該組件:

  • 組件 API 的完整類定義(由 SDK 記錄)必須仍然存在
  • API 的行為必須以某種合理的方式實現為無操作
  • API 方法必須在 SDK 文檔允許的情況下返回空值
  • API 方法必須返回 SDK 文檔不允許空值的類的無操作實現
  • API 方法不得拋出 SDK 文檔未記錄的異常

應用這些要求的場景的一個典型示例​​是電話 API:即使在非電話設備上,這些 API 也必須作為合理的無操作來實現。

設備實現必須通過android.content.pm.PackageManager類的getSystemAvailableFeatures()hasSystemFeature(String)方法準確報告準確的硬件配置信息。 [資源,37 ]

7.1。顯示和圖形

Android 包括自動為設備適當調整應用程序資產和 UI 佈局的工具,以確保第三方應用程序在各種硬件配置上運行良好 [參考資料,38 ]。設備必須正確實現這些 API 和行為,如本節所述。

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

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

7.1.1.屏幕配置

屏幕尺寸

Android UI 框架支持各種不同的屏幕尺寸,並允許應用程序通過android.content.res.Configuration.screenLayoutSCREENLAYOUT_SIZE_MASK查詢設備屏幕尺寸(又名“屏幕佈局”)。設備實現必須報告 Android SDK 文檔 [資源, 38 ] 中定義並由上游 Android 平台確定的正確屏幕尺寸。具體來說,設備實現必鬚根據以下邏輯密度無關像素 (dp) 屏幕尺寸報告正確的屏幕尺寸。

  • 設備的屏幕尺寸必須至少為 426 dp x 320 dp(“小”)
  • 報告屏幕尺寸“正常”的設備的屏幕尺寸必須至少為 480 dp x 320 dp
  • 報告屏幕尺寸“大”的設備的屏幕尺寸必須至少為 640 dp x 480 dp
  • 報告屏幕尺寸“xlarge”的設備的屏幕尺寸必須至少為 960 dp x 720 dp

此外,設備的屏幕尺寸必須至少為 2.5 英寸(物理對角線尺寸)。

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

應用程序可以通過 AndroidManifest.xml 文件中的<supports-screens>屬性選擇性地指示它們支持的屏幕尺寸。如 Android SDK 文檔中所述,設備實現必須正確遵守應用程序聲明的對小、普通、大和超大屏幕的支持。

屏幕縱橫比

縱橫比必須是從 1.3333 (4:3) 到 1.86(大約 16:9)的值

屏幕密度

Android UI 框架定義了一組標準邏輯密度,以幫助應用程序開發人員定位應用程序資源。設備實現必須通過android.util.DisplayMetrics API 報告以下邏輯 Android 框架密度之一,並且必須以該標準密度執行應用程序。

  • 120 dpi,稱為“ldpi”
  • 160 dpi,稱為“mdpi”
  • 213 dpi,稱為“tvdpi”
  • 240 dpi,稱為“hdpi”
  • 320 dpi,稱為“xhdpi”
  • 400 dpi,稱為“400dpi”
  • 480 dpi,稱為“xxhdpi”
  • 640 dpi,稱為“xxxhdpi”
設備實現應該定義在數值上最接近屏幕物理密度的標準 Android 框架密度,除非該邏輯密度將報告的屏幕尺寸推到支持的最小值以下。如果在數值上最接近物理密度的標準 Android 框架密度導致屏幕尺寸小於支持的最小兼容屏幕尺寸(320 dp 寬度),則設備實現應報告下一個最低的標準 Android 框架密度。

7.1.2.顯示指標

Device implementations MUST report correct values for all display metrics defined in android.util.DisplayMetrics [ Resources, 39 ].

7.1.3. Screen Orientation

Devices MUST support dynamic orientation by applications to either portrait or landscape screen orientation. That is, the device must respect the application's request for a specific screen orientation. Device implementations MAY select either portrait or landscape orientation as the default.

Devices MUST report the correct value for the device's current orientation, whenever queried via the android.content.res.Configuration.orientation, android.view.Display.getOrientation(), or other APIs.

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

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, MUST only report android.hardware.screen.landscape .

7.1.4. 2D and 3D Graphics Acceleration

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 on devices capable of supporting OpenGL ES 3.0. Device implementations MUST also support Android Renderscript, as detailed in the Android SDK documentation [ Resources, 8 ].

Device implementations MUST also correctly identify themselves as supporting OpenGL ES 1.0, OpenGL ES 2.0, or OpenGL ES 3.0. That is:

  • 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 (that is, those 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 MUST support OpenGL ES 3.0 managed APIs and include support for native C/C++ APIs.在聲明支持 OpenGL ES 3.0 的設備實現上,除了 OpenGL ES 2.0 函數符號之外,libGLESv2.so 還必須導出 OpenGL ES 3.0 函數符號。

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 includes a mechanism for applications to declare that they wanted to enable hardware acceleration for 2D graphics at the Application, Activity, Window or View level through the use of a manifest tag android:hardwareAccelerated or direct API calls [ Resources, 9 ].

In Android 4.4, 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 [ Resources, 9 ].

Android includes a TextureView object that lets developers directly integrate hardware-accelerated OpenGL ES textures as rendering targets in a UI hierarchy. Device implementations MUST support the TextureView API, and MUST exhibit consistent behavior with the upstream Android implementation.

Android includes support for EGL_ANDROID_RECORDABLE , a 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 [ Resources, 79 ].

7.1.5. Legacy Application Compatibility Mode

Android specifies a "compatibility mode" in which the framework operates in an '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. 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. Screen Types

Device implementation screens are classified as one of two types:

  • Fixed-pixel display implementations: the screen is a single panel that supports only a single pixel width and height. Typically the screen is physically integrated with the device. Examples include mobile phones, tablets, and so on.
  • Variable-pixel display implementations: the device implementation either has no embedded screen and includes a video output port such as VGA, HDMI or a wireless port for display, or has an embedded screen that can change pixel dimensions. Examples include televisions, set-top boxes, and so on.

Fixed-Pixel Device Implementations

Fixed-pixel device implementations MAY use screens of any pixel dimensions, provided that they meet the requirements defined this Compatibility Definition.

Fixed-pixel implementations MAY include a video output port for use with an external display. However, if that display is ever used for running apps, the device MUST meet the following requirements:

  • The device MUST report the same screen configuration and display metrics, as detailed in Sections 7.1.1 and 7.1.2, as the fixed-pixel display.
  • The device MUST report the same logical density as the fixed-pixel display.
  • The device MUST report screen dimensions that are the same as, or very close to, the fixed-pixel display.

For example, a tablet that is 7" diagonal size with a 1024x600 pixel resolution is considered a fixed-pixel large mdpi display implementation. If it contains a video output port that displays at 720p or 1080p the device implementation MUST scale the output so that applications are only executed in a large mdpi window, regardless of whether the fixed-pixel display or video output port is in use.

Variable-Pixel Device Implementations

Variable-pixel device implementations MUST support at least one of 1280x720, 1920x1080, or 3840x2160 (that is, 720p, 1080p, or 4K). Device implementations with variable-pixel displays MUST NOT support any other screen configuration or mode. Device implementations with variable-pixel screens MAY change screen configuration or mode at runtime or boot-time. For example, a user of a set-top box may replace a 720p display with a 1080p display, and the device implementation may adjust accordingly.

Additionally, variable-pixel device implementations MUST report the following configuration buckets for these pixel dimensions:

  • 1280x720 (also known as 720p): 'large' screen size, 'tvdpi' (213 dpi) density
  • 1920x1080 (also known as 1080p): 'large' screen size, 'xhdpi' (320 dpi) density
  • 3840x2160 (also known as 4K): 'large' screen size, 'xxxhdpi' (640 dpi) density

For clarity, device implementations with variable pixel dimensions are restricted to 720p, 1080p, or 4K in Android 4.4, and MUST be configured to report screen size and density buckets as noted above.

7.1.7. Screen Technology

The Android platform includes APIs that allow applications to render rich graphics to the display. Devices MUST support all of these APIs as defined by the Android SDK unless specifically allowed in this document.具體來說:

  • 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.1. That is, the pixel aspect ratio MUST be near square (1.0) with a 10% tolerance.

7.1.8. External Displays

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 [ Resources, 75 ]. Device implementations that support secure video output and are capable of supporting secure surfaces MUST declare support for Display.FLAG_SECURE . Specifically, device implementations that declare support for Display.FLAG_SECURE , MUST support HDCP 2.x or higher for Miracast wireless displays or HDCP 1.2 or higher for wired displays. The upstream Android open source implementation includes support for wireless (Miracast) and wired (HDMI) displays that satisfies this requirement.

7.2. Input Devices

7.2.1. Keyboard

設備實現:

  • MUST include support for the Input Management Framework (which allows third party developers to create Input Management Engines - 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)
  • 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 [ Resources, 40 ] (that is, QWERTY, or 12-key)

7.2.2. Non-touch Navigation

設備實現:

  • MAY omit a non-touch navigation option (that is, may omit a trackball, d-pad, or wheel)
  • MUST report the correct value for android.content.res.Configuration.navigation [ Resources, 40 ]
  • 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. Navigation keys

The Home, Recents and Back functions are essential to the Android navigation paradigm. Device implementations MUST make these functions available to the user at all times when running applications. 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.

The Back and Recents functions SHOULD have a visible button or icon unless hidden together with other navigation functions in full-screen mode. The Home function MUST have a visible button or icon unless hidden together with other navigation functions in full-screen mode.

The Menu function is deprecated in favor of action bar since Android 4.0. Device implementations SHOULD NOT implement a dedicated physical button for the Menu function. If the physical Menu button is implemented and the device is running applications with targetSdkVersion > 10, the device implementation:

  • for a device launching with Android 4.4, MUST display the action overflow button on the action bar when the action bar is visible and the resulting action overflow menu popu is not empty.
  • for an existing device launched with an earlier version but upgrading to Android 4.4, SHOULD display the action overflow button on the action bar when the action bar is visible and the resulting action overflow menu popup is not empty.
  • 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 available the Menu function to applications when targetSdkVersion <= 10, either by a phsyical button, a software key or gestures. This Menu function should be presented unless hidden together with other navigation functions.

Android supports Assist action [ Resources, 63 ]. Device implementations MUST make the Assist action available to the user at all times when running applications. The Assist action SHOULD be implemented as a long-press on the Home button or a swipe-up gesture on the software Home key. This function MAY be implemented via another physical button, software key or gestures, but MUST be accessible with a single action (eg tap, double-click or gesture) when other navigation keys are visible.

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. 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 [ Resources, 40 ] corresponding to the type of the specific touchscreen on the device

Android includes support for a variety of touch screens, touch pads, and fake touch input devices. Touch screen based device implementations are associated with a display [ Resources, 81 ] such that the user has the impression of directly manipulating items on screen. Since the user is directly touching the screen, the system does not require any additional affordances to indicate the objects being manipulated. 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 4.0 includes the feature constant android.hardware.faketouch , which corresponds to a high-fidelity non-touch (that is, 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. Fake touch input

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 [ Resources, 80 ]
  • MUST report touch event with the action code [ Resources, 80 ] that specifies the state change that occurs on the pointer going down or up on the screen [ Resources, 80 ]
  • 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 [ Resources, 80 ]
  • 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.麥克風

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 as no-ops, per Section 7 . Conversely, device implementations that do possess a microphone:

  • MUST report the android.hardware.microphone feature constant
  • SHOULD meet the audio quality requirements in Section 5.4
  • SHOULD meet the audio latency requirements in Section 5.5

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. For example, device implementations:

  • MUST accurately report the presence or absence of sensors per the android.content.pm.PackageManager class. [ Resources, 37 ]
  • 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 (ie metric) values for each sensor type as defined in the Android SDK documentation [ Resources, 41 ]

The list above is not comprehensive; the documented behavior of the Android SDK is to be considered authoritative.

Some sensor types are synthetic, 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.

Android includes a notion of a "streaming" sensor, which is one that returns data continuously, rather than only when the data changes. Device implementations MUST continuously provide periodic data samples for any API indicated by the Android SDK documentation to be a streaming sensor. Note that the device implementations MUST ensure that the sensor stream must not prevent the device CPU from entering a suspend state or waking up from a suspend state.

7.3.1.加速度計

Device implementations SHOULD include a 3-axis accelerometer. If a device implementation does include a 3-axis accelerometer, it:

  • SHOULD be able to deliver events at 120 Hz or greater. Note that while the accelerometer frequency above is stated as "SHOULD" for Android 4.4, the Compatibility Definition for a future version is planned to change these to "MUST". That is, these standards are optional in Android but will be required in future versions. Existing and new devices that run Android are very strongly encouraged to meet these requirements in Android so they will be able to upgrade to the future platform releases
  • MUST comply with the Android sensor coordinate system as detailed in the Android APIs (see [ Resources, 41 ])
  • MUST be capable of measuring from freefall up to twice gravity (2g) or more on any three-dimensional vector
  • MUST have 8-bits of accuracy or more
  • MUST have a standard deviation no greater than 0.05 m/s^2

7.3.2. Magnetometer

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

  • MUST be able to deliver events at 10 Hz or greater
  • MUST comply with the Android sensor coordinate system as detailed in the Android APIs (see [ Resources, 41 ]).
  • MUST be capable of sampling a range of field strengths adequate to cover the geomagnetic field
  • MUST have 8-bits of accuracy or more
  • MUST have a standard deviation no greater than 0.5 µT

7.3.3.全球定位系統

Device implementations SHOULD include a GPS receiver. If a device implementation does include a GPS receiver, it SHOULD include some form of "assisted GPS" technique to minimize GPS lock-on time.

7.3.4. Gyroscope

Device implementations SHOULD include a gyroscope (ie 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 be temperature compensated.
  • MUST be capable of measuring orientation changes up to 5.5*Pi radians/second (that is, approximately 1,000 degrees per second).
  • SHOULD be able to deliver events at 200 Hz or greater. Note that while the gyroscope frequency above is stated as "SHOULD" for Android 4.4, the Compatibility Definition for a future version is planned to change these to "MUST". That is, these standards are optional in Android but will be required in future versions. Existing and new devices that run Android are very strongly encouraged to meet these requirements so they will be able to upgrade to the future platform releases.
  • MUST have 12-bits of accuracy or more
  • 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 have timestamps as close to when the hardware event happened as possible. The constant latency must be removed.

7.3.5. Barometer

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

  • 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. Thermometer

Device implementations MAY include an ambient thermometer (ie 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.

7.3.7. Photometer

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

7.3.8. Proximity Sensor

Device implementations MAY 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. If a device implementation has a proximity sensor, it MUST be have 1-bit of accuracy or more.

7.4. Data Connectivity

7.4.1. Telephony

"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 sub-features, 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. Device implementations that do not include telephony hardware MUST implement the full APIs as no-ops.

7.4.2. IEEE 802.11 (Wi-Fi)

Android device implementations SHOULD include support for one or more forms of 802.11 (b/g/a/n, etc.) If a device implementation does include support for 802.11, it MUST implement the corresponding Android API.

Device implementations MUST implement the multicast API as described in the SDK documentation [ Resources, 62 ]. Device implementations that do include Wi-Fi support MUST support multicast DNS (mDNS). Device implementations MUST NOT filter mDNS packets (224.0.0.251) at any time of operation including when the screen is not in an active state.

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 [ Resources, 68 ]. If a device implementation includes support for Wi-Fi direct, then it:

  • MUST support regular Wi-Fi operation
  • SHOULD support concurrent Wi-Fi and Wi-Fi Direct operation

7.4.2.2. Wi-Fi Tunneled Direct Link Setup

Device implementations SHOULD include support for Wi-Fi Tunneled Direct Link Setup (TDLS) as described in the Android SDK Documentation [ Resources, 85 ]. 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.藍牙

Device implementations SHOULD include a Bluetooth transceiver. Device implementations that do include a Bluetooth transceiver MUST enable the RFCOMM-based Bluetooth API as described in the SDK documentation and declare hardware feature android.hardware.bluetooth [ Resources, 42 ]. Device implementations SHOULD implement relevant Bluetooth profiles, such as A2DP, AVRCP, OBEX, etc. as appropriate for the device.

Device implementations that do include support for Bluetooth GATT (generic attribute profile) to enable communication with Bluetooth Smart or Smart Ready devices MUST enable the GATT-based Bluetooth API as described in the SDK documentation and declare hardware feature android.hardware.bluetooth_le [ Resources, 42 ].

7.4.4. Near-Field Communications

Device implementations SHOULD include a transceiver and related hardware for Near-Field Communications (NFC). If a device implementation does include NFC hardware, then it:

  • MUST report the android.hardware.nfc feature from the android.content.pm.PackageManager.hasSystemFeature() method. [ Resources, 37 ]
  • 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 6319-4)
      • IsoDep (ISO 14443-4)
      • NFC Forum Tag Types 1, 2, 3, 4 (defined by the NFC Forum)
  • SHOULD be capable of reading and writing NDEF messages via the following NFC standards. Note that while the NFC standards below are stated as "SHOULD", the Compatibility Definition for a future version is planned to change these to "MUST". That is, 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)
  • MUST be capable of transmitting and receiving data via the following peer-to-peer standards and protocols:
    • ISO 18092
    • LLCP 1.0 (defined by the NFC Forum)
    • SDP 1.0 (defined by the NFC Forum)
    • NDEF Push Protocol [ Resources, 43 ]
    • SNEP 1.0 (defined by the NFC Forum)
  • MUST include support for Android Beam [ Resources, 65 ]:
    • 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.
    • Device implementations MUST honor the android.settings.NFCSHARING_SETTINGS intent to show NFC sharing settings [ Resources, 67 ].
    • 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
    • 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" [ Resources, 60 ] and "Bluetooth Secure Simple Pairing Using NFC version 1.0" [ Resources, 61 ] 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 4.4 introduces support for NFC Host Card Emulation (HCE) mode. If a device implementation does include an NFC controller capable of HCE and 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 [ Resources, 90 ]

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

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. [ Resources, 37 ] Note that this is not a standard Android feature, and as such does not appear as a constant on the 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 [ Resources, 37 ], 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. Minimum Network Capability

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, 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.

7.4.6. Sync Settings

Device implementations MUST have the master auto-sync setting on by default so that the method getMasterSyncAutomatically() returns "true" [ Resources, 88 ].

7.5. Cameras

Device implementations SHOULD include a rear-facing camera, and MAY include a front-facing camera. A rear-facing camera is a camera located on the side of the device opposite the display; that is, it images scenes on the far side of the device, like a traditional 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.

7.5.1. Rear-Facing Camera

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

  • MUST have a resolution of at least 2 megapixels
  • SHOULD have either hardware auto-focus, or software auto-focus implemented in the camera driver (transparent to application software)
  • MAY have fixed-focus or EDOF (extended depth of field) hardware
  • MAY include a flash. If the Camera includes a flash, the flash lamp MUST NOT be lit while an android.hardware.Camera.PreviewCallback instance has been registered on a Camera preview surface, unless the application has explicitly enabled the flash by enabling the FLASH_MODE_AUTO or FLASH_MODE_ON attributes of a Camera.Parameters object. 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. Front-Facing Camera

Device implementations MAY include a front-facing camera. If a device implementation includes a front-facing camera, it:

  • MUST have a resolution of at least VGA (that is, 640x480 pixels)
  • MUST NOT use a front-facing camera as the default for the Camera API. That is, 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() [ Resources, 50 ] 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. Camera API Behavior

Device implementations MUST implement the following behaviors for the camera-related APIs, for both front- and rear-facing cameras:

  1. If an application has never called android.hardware.Camera.Parameters.setPreviewFormat(int) , then the device MUST use android.hardware.PixelFormat.YCbCr_420_SP for preview data provided to application callbacks.
  2. If an application registers an android.hardware.Camera.PreviewCallback instance and the system calls the onPreviewFrame() method when the preview format is YCbCr_420_SP, the data in the byte[] passed into onPreviewFrame() must further be in the NV21 encoding format. That is, NV21 MUST be the default.
  3. 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.)

Device implementations MUST implement the full Camera API included in the Android SDK documentation [ Resources, 51 ]), 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; for instance, even though most front-facing cameras do not support autofocus, the API callbacks must still be "faked" as described.

Device implementations MUST recognize and honor each parameter name defined as a constant on the android.hardware.Camera.Parameters class, if the underlying hardware supports the feature. If the device hardware does not support a feature, the API must behave as documented. 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 . That is, device implementations MUST support all standard Camera parameters if the hardware allows, and MUST NOT support custom Camera parameter types. For instance, device implementations that support image capture using high dynamic range (HDR) imaging techniques MUST support camera parameter Camera.SCENE_MODE_HDR [ Resources, 78 ]).

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.4. Camera Orientation

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. That is, when the device is held in the landscape orientation, cameras MUST capture images in the landscape orientation. This applies regardless of the device's natural orientation; that is, it applies to landscape-primary devices as well as portrait-primary devices.

7.6. Memory and Storage

7.6.1. Minimum Memory and Storage

Device implementations MUST have at least 340MB of memory available to the kernel and userspace. The 340MB MUST be in addition to any memory 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 MUST return the value "true" for ActivityManager.isLowRamDevice() .

Device implementations MUST have at least 1GB of non-volatile storage available for application private data. That is, the /data partition MUST be at least 1GB. Device implementations that run Android are very strongly encouraged to have at least 2GB 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 [ Resources, 56 ]. 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. Shared External Storage

Device implementations MUST offer shared storage for applications. The shared storage provided MUST be at least 1GB in size.

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

Device implementations MUST enforce as documented the android.permission.WRITE_EXTERNAL_STORAGE permission on this shared storage. Shared storage MUST otherwise be writable by any application that obtains that permission.

Device implementations MAY have hardware for user-accessible removable storage, such as a Secure Digital card. Alternatively, device implementations MAY allocate internal (non-removable) storage as shared storage for apps. The upstream Android Open Source Project includes an implementation that uses internal device storage for shared external storage APIs; device implementations SHOULD use this configuration and software implementation.

Regardless of the form of shared storage used, device implementations MUST provide some mechanism to access the contents of shared storage from a host computer, such as USB mass storage (UMS) or Media Transfer Protocol (MTP). Device implementations MAY use USB mass storage, but SHOULD use Media Transfer Protocol. If the device implementation supports Media Transfer Protocol:

  • The device implementation SHOULD be compatible with the reference Android MTP host, Android File Transfer [ Resources, 57 ].
  • The device implementation SHOULD report a USB device class of 0x00 .
  • The device implementation SHOULD report a USB interface name of 'MTP'.

If the device implementation lacks USB ports, it MUST provide a host computer with access to the contents of shared storage by some other means, such as a network file system.

It is illustrative to consider two common examples. If a device implementation includes an SD card slot to satisfy the shared storage requirement, a FAT-formatted SD card 1GB in size or larger MUST be included with the device as sold to users, and MUST be mounted by default. Alternatively, if a device implementation uses internal fixed storage to satisfy this requirement, that storage MUST be 1GB in size or larger and mounted on /sdcard (or /sdcard MUST be a symbolic link to the physical location if it is mounted elsewhere.)

Device implementations that include multiple shared storage paths (such as both an SD card slot and shared internal storage) MUST NOT allow Android applications to write to the secondary external storage, except for their package-specific directories on the secondary external storage, but SHOULD expose content from both storage paths transparently through Android's media scanner service and android.provider.MediaStore.

7.7. USB

Device implementations SHOULD include a USB client port, and SHOULD include a USB host port.

If a device implementation includes a USB client port:

  • the port MUST be connectable to a USB host with a standard USB-A port
  • the port SHOULD use the micro USB form factor on the device side. Existing and new devices that run Android are very strongly encouraged to meet these requirements in Android so they will be able to upgrade to the future platform releases
  • the port SHOULD be centered in the middle of an edge. Device implementations SHOULD either locate the port 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. Existing and new devices that run Androidare very strongly encouraged to meet these requirements in Android so they will be able to upgrade to future platform releases.
  • if the device has other ports (such as a non-USB charging port) it SHOULD be on the same edge as the micro-USB port
  • it MUST allow a host connected to the device to access the contents of the shared storage volume using either USB mass storage or Media Transfer Protocol
  • it MUST implement the Android Open Accessory API and specification as documented in the Android SDK documentation, and MUST declare support for the hardware feature android.hardware.usb.accessory [ Resources, 52 ]
  • it MUST implement the USB audio class as documented in the Android SDK documentation [ Resources, 66 ]
  • it SHOULD implement support for USB battery charging specification [ Resources, 64 ] Existing and new devices that run Android are very strongly encouraged to meet these requirements so they will be able to upgrade to the future platform releases
  • The value of iSerialNumber in USB standard device descriptor MUST be equal to the value of android.os.Build.SERIAL.

If a device implementation includes a USB host port:

  • it MAY use a non-standard port form factor, but if so MUST ship with a cable or cables adapting the port to standard USB-A
  • it 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 [ Resources, 53 ]

Device implementations MUST implement the Android Debug Bridge. If a device implementation omits a USB client port, it MUST implement the Android Debug Bridge via local-area network (such as Ethernet or 802.11)

8. Performance Compatibility

Device implementations MUST meet the key performance metrics of an Android- compatible device defined in the table below:

Metric Performance Threshold註釋
Application Launch Time The following applications should launch within the specified time.
  • Browser: less than 1300ms
  • Contacts: less than 700ms
  • Settings: less than 700ms
The launch time is measured as the total time to complete loading the default activity for the application, including the time it takes to start the Linux process, load the Android package into the Dalvik VM, and call onCreate.
Simultaneous Applications When multiple applications have been launched, re-launching an already-running application after it has been launched must take less than the original launch time.

9. Security Model Compatibility

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 [ Resources, 54 ] in the Android developer documentation. Device implementations MUST support installation of self-signed applications without requiring any additional permissions/certificates from any third parties/authorities. Specifically, compatible devices MUST support the security mechanisms described in the follow sub-sections.

9.1.權限

Device implementations MUST support the Android permissions model as defined in the Android developer documentation [ Resources, 54 ]. Specifically, implementations MUST enforce each permission defined as described in the SDK documentation; no permissions may be omitted, altered, or ignored. Implementations MAY add additional permissions, provided the new permission ID strings are not in the android.* namespace.

9.2. UID and Process Isolation

Device implementations MUST support the Android application sandbox model, in which each application runs as a unique Unix-style 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 [ Resources, 54 ].

9.3. Filesystem Permissions

Device implementations MUST support the Android file access permissions model as defined in the Security and Permissions reference [ Resources, 54 ].

9.4. Alternate Execution Environments

Device implementations MAY include runtime environments that execute applications using some other software or technology than the Dalvik virtual machine or native code. However, such alternate execution environments MUST NOT compromise the Android security model or the security of installed Android applications, as described in this section.

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

Alternate runtimes MUST NOT be granted access to resources protected by permissions not requested in the runtime's AndroidManifest.xml file via the <uses-permission> mechanism.

Alternate runtimes MUST NOT permit applications to make use of features protected by Android permissions restricted to system applications.

Alternate runtimes MUST abide by the Android sandbox model.具體來說:

  • Alternate runtimes SHOULD install apps via the PackageManager into separate Android sandboxes (that is, Linux user IDs, etc.)
  • Alternate runtimes MAY provide a single Android sandbox shared by all applications using the alternate runtime
  • Alternate runtimes and 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
  • Alternate runtimes MUST NOT launch with, grant, or be granted access to the sandboxes corresponding to other Android applications

Alternate runtimes MUST NOT be launched with, be granted, or grant to other applications any privileges of the superuser (root), or of any other user ID.

The .apk files of alternate runtimes MAY be included in the system image of a device implementation, but MUST be signed with a key distinct from the key used to sign other applications included with the device implementation.

When installing applications, alternate runtimes MUST obtain user consent for the Android permissions used by the application. That is, 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. If the runtime environment does not record application capabilities in this manner, the runtime environment MUST list all permissions held by the runtime itself when installing any application using that runtime.

9.5. Multi-User Support

Android includes support for multiple users and provides support for full user isolation [ Resources, 70 ].

Device implementations MUST meet these requirements related to multi-user support [ Resources, 71 ]:

  • As the behavior of the telephony APIs on devices with multiple users is currently undefined, device implementations that declare android.hardware.telephony MUST NOT enable multi-user support.
  • 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 [Resources, 54]
  • Android includes support for 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. Device implementations that include support for multiple users MUST include support for restricted profiles. The upstream Android Open Source Project includes an implementation that satisfies this requirement.

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 multi-user 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 [ Resources, 72 ] for primary external storage.

9.6. Premium SMS Warning

Android includes support for warning users for any outgoing premium SMS message [ Resources, 73 ] . 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. Kernel Security Features

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

  • MUST maintain compatibility with existing applications
  • MUST not have a visible user interface, even when violations are detected
  • 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 and meet the following requirements, which are satisfied by the reference implementation in the upstream Android Open Source Project.

  • it MUST support a SELinux policy that allows the SELinux mode to be set on a per-domain basis with:
    • domains that are in enforcing mode in the upstream Android Open Source implementation (such as installd, netd, and vold) MUST be in enforcing mode
    • domain(s) for third-party applications SHOULD remain in permissive mode to ensure continued compatibility
  • it SHOULD load policy from /sepolicy file on the device
  • it MUST support dynamic updates of the SELinux policy file without requiring a system image update
  • it MUST log any policy violations without breaking applications or affecting system behavior

Device implementations SHOULD retain the default SELinux policy provided in the upstream Android Open Source Project, until they have first audited their additions to the SELinux policy. Device implementations MUST be compatible with the upstream Android Open Source Project.

9.8. Privacy

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.

9.9. Full-Disk Encryption

IF the device has lockscreen, the device MUST support full-disk encryption.

10. Software Compatibility Testing

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 very strongly encouraged 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. Compatibility Test Suite

Device implementations MUST pass the Android Compatibility Test Suite (CTS) [ Resources, 2 ] available from the Android Open Source Project, using the final shipping software on the device. Additionally, device implementers SHOULD use the reference implementation in the Android Open Source tree as much as possible, and MUST ensure compatibility in cases of ambiguity in CTS and for any reimplementations of parts of the reference source code.

The CTS is designed to be run on an actual device. Like any software, the CTS may itself contain bugs. The CTS will be versioned independently of this Compatibility Definition, and multiple revisions of the CTS may be released for Android 4.4. Device implementations MUST pass the latest CTS version available at the time the device software is completed.

10.2. CTS Verifier

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 which 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.

10.3. Reference Applications

Device implementers MUST test implementation compatibility using the following open source applications:

  • The "Apps for Android" applications [ Resources, 55 ]
  • Replica Island (available in Google Play Store)

Each app above MUST launch and behave correctly on the implementation, for the implementation to be considered compatible.

11. Updatable Software

Device implementations MUST include a mechanism to replace the entirety of the system software. The mechanism need not perform "live" upgrades - that is, a device restart MAY be required.

Any method can be used, provided that it can replace the entirety of the software preinstalled on the device. For instance, any of the following approaches will satisfy this requirement:

  • 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

The update mechanism used MUST support updates without wiping user data. That is, the update mechanism MUST preserve application private data and application shared data. Note that the upstream Android software includes an update mechanism that satisfies this requirement.

If an error is found in a device implementation after it has been released but within its reasonable product lifetime that is determined in consultation with the Android Compatibility Team to affect the compatibility of third-party applications, the device implementer MUST correct the error via a software update available that can be applied per the mechanism just described.

12. Document Changelog

The following table contains a summary of the changes to the Compatibility Definition in this release.

Section(s) Summary of change
3.2.2.構建參數Revised descriptions of BRAND, DEVICE, and PRODUCT. SERIAL is now required.
3.2.3.5。默認應用設置New section that adds requirement to comply with new default application settings
3.3.1 應用二進制接口Clarified allowed values for the android.os.Build.CPU_ABI and android.os.Build.CPU_ABI2 parameters.
3.4.1。 Web 視圖兼容性Added Chromium as required WebView implementation.
3.7.虛擬機兼容性Added requirement for xxhdpi and 400dpi screen densities.
3.8.6。主題Updated to reflect use of translucent system bars.
3.8.12. Location New section that adds requirement location settings be centralized.
3.8.13. Unicode New section that adds requirement for emoji support.
3.9. Device Administration Noted preinstalled administrative applications cannot be the default Device Owner application.
5.1. Media Codecs Added VP9 decoder requirement. Added recommended specification for hardware VP8 codecs.
5.3. Video Decoding Added VP9. Added recommendation for dynamic resolution switching.
5.4. Audio Recording Added REMOTE_SUBMIX as new required audio source. Made use of android.media.audiofx.NoiseSuppressor API a requirement.
6.2.1 Experimental New section that introduces the ART runtime and requires Dalvik as the default runtime.
7.1.1. Screen Configuration Replaced 1.85 aspect ratio with 1.86. Added 400dpi screen density.
7.1.6. Screen Types Added 640 dpi (4K) resolution configuration.
7.2.3. Navigation keys Added Recents function as essential; demoted Menu function in priority.
7.3.6. Thermometer Added SENSOR_TYPE_AMBIENT_TEMPERATURE as recommended thermometer.
7.4.2.2. Wi-Fi Tunneled Direct Link Setup New section that adds support for Wi-Fi Tunneled Direct Link Setup (TDLS).
7.4.4. Near-Field Communications Added Host Card Emulation (HCE) as a requirement. Replaced SNEP GET with Logical Link Control Protocol (LLCP) and added the Bluetooth Object Push Profile as a requirement.
7.4.6. Sync Settings New section that adds requirement auto-sync data be enabled by default.
7.6.1. Minimum Memory and Storage Added ActivityManager.isLowRamDevice() setting requirement for devices with less than 512MB of memory. Increased storage requirements from 512MB and 1GB to 1GB and 2GB, respectively.
7.6.2. Shared "External" Storage Editorial fixes such as change of section name, and moved text that fits in this section from section 9.5. Noted applications may write to their package-specific directories on secondary external storage.
7.7. USB Added requirement all devices report a USB serial number.
9.5. Multi-User Support Moved non multi-user specific text to section 7.6.2.
9.7. Kernel Security Features Rewritten to note switch of SELinux to enforcing mode and requirement SELinux output not be rendered in the user interface.
9.8. Privacy New section that adds requirement audio and video recording must trigger continuous notifications to the user.
9.9. Full-Disk Encryption New section that adds requirement devices with lockscreen support full-disk encryption.
12. Document Changelog New section that summarizes changes in the CDD by section.

13. Contact Us

You can contact the document authors at compatibility@android.com for clarifications and to bring up any issues that you think the document does not cover.