To simplify the process of bringing mobile apps to Android Automotive OS devices, certain cars come with a compatibility mode that addresses common issues faced when bringing existing mobile apps into cars.
While this compatibility mode is used by the Car ready mobile apps program, apps that are not part of that program can also run in it.
Understand compatibility mode
Android Automotive OS compatibility mode is a software feature available on some vehicles to improve the user experience of apps built for mobile devices when run on Android Automotive OS.
Back navigation
Unlike other form factors, there is no requirement for Android Automotive OS devices to have a hardware or software back affordance. The compatibility mode addresses this by requiring a system provided back affordance, be it a hardware button, software button, gesture, or something else. This removes the need for apps to ensure navigability solely through their own UI elements.
Safe area rendering
In cars, software and hardware elements such as system bars and display cutouts may break assumptions made by apps developed primarily for mobile devices. The compatibility mode addresses this by ensuring apps are rendered in a safe area.
Density scaling
Because the interaction distance in cars is greater than with other large screen devices, touch targets and font sizes are often smaller than recommended when running on a car. The compatibility mode addresses this by allowing OEMs to specify a DPI scaling factor used when rendering apps.
Activity lifecycle
As described in Build parked apps for Android Automotive OS, the OS blocks your app's activities automatically when the car enters driving mode to reduce distractions for the driver. On devices with compatibility mode, the OEM's blocking UI must not be transparent, so your app is no longer visible and transitions to the Stopped lifecycle state when blocked.
Configure compatibility mode
By default, your app's activities are run in compatibility mode when the device supports it. Activities aren't run in compatibility mode in the following cases:
- When a
<uses-feature>
element for theandroid.hardware.type.automotive
feature is present in the manifest:
<application ...>
...
<uses-feature android:name="android.hardware.type.automotive" ...>
...
</application>
- If there is any
<activity>
manifest element that contains the following<meta-data>
element:
<meta-data android:name="distractionOptimized" android:value="true">
If any of these apply to your app, but you'd prefer for your activities to be
run in display compatibility mode, you can add the following <meta-data>
element in your app's manifest:
<application ...>
...
<meta-data android:name="android.software.car.display_compatibility" android:value="true"/>
...
</application>
Test your app in compatibility mode
To test your app in compatibility mode, you can use the generic system images with compatibility mode.
Determine device support
Devices that support the Android Automotive OS compatibility mode must declare
the android.software.car.display_compatibility
system feature. To discover
which devices support this feature, you can use the Play Console's
Device catalog.