When Android Automotive applications follow the Driver Distraction Guidelines described below, the applications can run on the HU when a vehicle is moving. DDG consists of baseline recommendations provided by Google and are intended to reduce driver distraction.
Applications that meet the Driver Distraction Guidelines can be tagged as Distraction Optimized. This article details how applications must be tagged as Distraction Optimized so that the Android platform can enable the apps to run in the User Experience Restricted state. To learn more about:
- Car user experience restrictions, see Car User Experience Restrictions.
- Using car driving state, see Consuming Car Driving State and UX Restrictions.
Distraction Optimized Applications
An application can tag a specific activity to be Distraction Optimized. For an entire app to be designated as Distraction Optimized, all its activities must adhere to the driver distraction guidelines. When the driving state of a vehicle changes to a state in which the UX restrictions are active:
- Current foreground activity can continue to run only when it is tagged as Distraction Optimized in the manifest.
- When launching a new activity, the new activity is permitted only when it is tagged as Distraction Optimized in the manifest.
The platform is responsible for checking the manifest and allowing only Distraction Optimized activities to run in a restricted state.
Note: The platform cannot detect or enforce an app's actual adherence to the restrictions; it can only check an app's declaration in the manifest. Adherence to these driver distraction guidelines is enforced during the Play Store review process.
Not all application activities need be Distraction Optimized. An application can provide
different user experiences for an unrestricted state (for example, when the vehicle is parked)
versus a more restricted state. As a result, an application can tag a specific activity to be
Distraction Optimized by adding the following metadata to the
AndroidManifest.xml file for the application:
<activity android:name=".DistractionOptimizedMainActivity"....> .... <meta-data android:name="distractionOptimized" android:value="true"/> </activity>
Apps that offer activities designed to run in a restricted state must declare that information in the manifest. The platform looks only at the declared information before determining if the activity can be permitted to run (or not) in the restricted state.