This feature allows location access of allowlisted, Android-bundled, driver assistance apps to be controlled separately by the “Use location for driver assistance” switch. This enables these apps to access location even when the "Use location" switch is off.
- Android 12 doesn't provide a public API for this feature. Driver assistance apps should request location updates as usual.
- Android 13 and higher must make a location request
LocationManager.requestLocationUpdates()and pass in a
LocationRequestobject configured with
Use the driver assistance location bypass API
The following sections describe how to use the driver assistance location bypass API. To learn more about the usage policy, see Location Bypass Allowlist Policy.
Check the driver assistance switch status
In Android 13 and higher, you can check driver assistance switch status before requesting location updates.
// Returns the current status of "Use location for driver assistance". locationManager.isAdasGnssLocationEnabled();
Run Android Debug Bridge (ADB) commands
For development and testing, you can quickly check or change the status of the driver assistance toggle without using Location Settings.
- To use ADB commands to check or change status:
// Gets the status of ADAS location. adb shell cmd location is-adas-gnss-location-enabled // Enables ADAS location. adb shell cmd location set-adas-gnss-location-enabled true // Disables ADAS location. adb shell cmd location set-adas-gnss-location-enabled false
See the following for version-specific Android releases:
- In Android 12, driver assistance apps must have the WRITE_SECURE_SETTINGS permission.
- In Android 13 and higher, the
LOCATION_BYPASSpermission is required.
Add an app to the allowlist on your device
- Add the app’s package name in a system configuration XML file:
<!-- In a xml file under etc/sysconfig–> <config> … <allow-adas-location-settings package="PACKAGE-NAME" /> … </config>
To ensure your package appears in the Location Settings UI, add your package name to
AndroidManifest.xml. The name
of the meta-data should be
Remove the "Use location for driver assistance switch"
If you don’t have a location-powered driver assistance app that requests location from Android, you can comment out the code block to remove the switch for Location Settings.
packages/apps/Car/Settings/res/xml/location_settings_fragment.xmland then comment out the following code.
<com.android.car.ui.preference.CarUiTwoActionSwitchPreference android:fragment="com.android.car.settings.location.AdasLocationFragment" android:key="@string/pk_location_driver_assistance_state_switch" android:title="@string/location_driver_assistance_toggle_title" android:summary="@string/location_driver_assistance_toggle_summary" settings:controller="com.android.car.settings.location.AdasLocationSwitchPreferenceController" settings:searchable="true"/> <com.android.car.settings.common.DividerPreference/>
- After removing the switch, set
Run the Automotive test suite
Google provides an Automotive test suite (ATS) test, which ensures that all driver assistance packages on a device have been allowlisted with Google. The test is remotely configured. You needn't wait until the next ATS release to add a new package. You can learn more at Complete Automotive Tests in a Box.