自 2025 年 3 月 27 日起,我們建議您使用 android-latest-release
而非 aosp-main
建構及貢獻 AOSP。詳情請參閱「Android 開放原始碼計畫變更」。
駕駛人分心指南
透過集合功能整理內容
你可以依據偏好儲存及分類內容。
當 Android Automotive 應用程式遵循下方所述的駕駛人分心指南時,應用程式可以在車輛行駛時在車用主機上執行。DDG 包含 Google 提供的基準建議,旨在減少駕駛人分心情形。
符合《駕駛人分心程度指南》的應用程式可標示為「已針對分心程度進行最佳化」。本頁面詳細說明應用程式如何必須標示為「最佳化分心程度」,以便 Android 平台啟用應用程式在「使用者體驗受限」狀態下執行。如要進一步瞭解:
分心因素已排除的應用程式
應用程式可以標記特定活動,以便進行分心因素最佳化。如要將整個應用程式指定為「已排除分心因素」,所有活動都必須遵循駕駛人分心指南。當車輛的駕駛狀態變更為啟用使用者體驗限制的狀態時:
- 只有在資訊清單中標示為「分心程度最佳化」時,目前的前景活動才能繼續執行。
- 啟動新活動時,只有在資訊清單中標示為「Distraction Optimized」時,系統才會允許新活動。
平台負責檢查資訊清單,並只允許「不受干擾」最佳化活動在受限制的狀態下執行。
注意:平台無法偵測或強制執行應用程式是否確實遵守限制條件,只能檢查應用程式在資訊清單中的宣告。在 Google Play 審查程序中,我們會強制要求遵守這些駕駛人分心指南。
並非所有應用程式活動都需要進行分心因素最佳化。應用程式可針對無限制狀態 (例如車輛停車時) 和限制較嚴格的狀態,提供不同的使用者體驗。因此,應用程式可以將下列中繼資料新增至應用程式 AndroidManifest.xml
檔案中的 <activity>
元素,為特定活動加上標記,以便進行分心程度最佳化:
<activity android:name=".DistractionOptimizedMainActivity"....>
....
<meta-data android:name="distractionOptimized" android:value="true"/>
</activity>
提供活動的應用程式如果設計為在受限狀態下執行,則必須在資訊清單中宣告該資訊。平台只會查看宣告的資訊,然後判斷是否允許活動在受限狀態下執行。
這個頁面中的內容和程式碼範例均受《內容授權》中的授權所規範。Java 與 OpenJDK 是 Oracle 和/或其關係企業的商標或註冊商標。
上次更新時間:2025-07-27 (世界標準時間)。
[[["容易理解","easyToUnderstand","thumb-up"],["確實解決了我的問題","solvedMyProblem","thumb-up"],["其他","otherUp","thumb-up"]],[["缺少我需要的資訊","missingTheInformationINeed","thumb-down"],["過於複雜/步驟過多","tooComplicatedTooManySteps","thumb-down"],["過時","outOfDate","thumb-down"],["翻譯問題","translationIssue","thumb-down"],["示例/程式碼問題","samplesCodeIssue","thumb-down"],["其他","otherDown","thumb-down"]],["上次更新時間:2025-07-27 (世界標準時間)。"],[],[],null,["# Driver Distraction Guidelines\n\nWhen Android Automotive apps follow the *Driver Distraction Guidelines* described\nbelow, the apps can run on the HU when a vehicle is moving. DDG consists of baseline\nrecommendations provided by Google and are intended to reduce driver distraction.\n\nApps that meet the Driver Distraction Guidelines can be tagged as\n*Distraction Optimized* . This page details how apps *must* be tagged\nas Distraction Optimized so that the Android platform can enable the apps to run in the User\nExperience Restricted state. To learn more about:\n\n- Car user experience restrictions, see [Car User Experience\n Restrictions](/docs/automotive/driver_distraction/car_uxr).\n- Using car driving state, see [Consuming Car Driving State and\n UX Restrictions](/docs/automotive/driver_distraction/consume).\n\nDistraction Optimized apps\n--------------------------\n\nAn app can tag a specific activity to be Distraction Optimized. For an entire app to\nbe designated as Distraction Optimized, all its activities must adhere to the driver distraction\nguidelines. When the driving state of a vehicle changes to a state in which the UX restrictions are\nactive:\n\n- Current foreground activity can continue to run only when it is tagged as Distraction Optimized in the manifest.\n- When launching a new activity, the new activity is permitted only when it is tagged as Distraction Optimized in the manifest.\n\nThe platform is responsible for checking the manifest and allowing only Distraction Optimized\nactivities to run in a restricted state.\n\n**Note:** The platform can't detect or enforce an app's actual\nadherence to the restrictions; it can only check an app's declaration in the manifest. Adherence to\nthese driver distraction guidelines is enforced during the Google Play review process.\n\nNot all app activities need be Distraction Optimized. An app can provide\ndifferent user experiences for an unrestricted state (for example, when the vehicle is parked)\nversus a more restricted state. As a result, an app can tag a specific activity to be\nDistraction Optimized by adding the following metadata to the `\u003cactivity\u003e` element\nin the `AndroidManifest.xml` file for the app: \n\n```\n\u003cactivity android:name=\".DistractionOptimizedMainActivity\"....\u003e\n....\n\u003cmeta-data android:name=\"distractionOptimized\" android:value=\"true\"/\u003e\n\u003c/activity\u003e\n```\n\nApps that offer activities designed to run in a restricted state must declare that information in\nthe manifest. The platform looks only at the declared information before determining if the activity\ncan be permitted to run (or not) in the restricted state."]]