2025 年 3 月 27 日より、AOSP のビルドとコントリビューションには aosp-main
ではなく android-latest-release
を使用することをおすすめします。詳細については、AOSP の変更をご覧ください。
Automotive Location Bypass API
コレクションでコンテンツを整理
必要に応じて、コンテンツの保存と分類を行います。
この機能により、許可リストに登録された Android バンドルのドライバー サポート アプリによる位置情報へのアクセスを、「位置情報をドライバー サポートで使用する」スイッチによって個別に制御できます。これにより、「位置情報を使用する」スイッチがオフの場合でも、これらのアプリは位置情報にアクセスできます。
- Android 12 では、この機能の公開 API は提供されていません。ドライバー サポート アプリは、通常どおり位置情報の更新をリクエストする必要があります。
- Android 13 以降では、
LocationManager.requestLocationUpdates()
を使用して位置情報リクエストを行い、LocationRequest.setAdasGnssBypass(true)
で構成された LocationRequest
オブジェクトを渡す必要があります。
Driver Assistance Location Bypass API を使用する
次のセクションでは Driver Assistance Location Bypass API の使用方法について説明します。使用ポリシーの詳細については、位置情報バイパス許可リストポリシーを参照してください。
ドライバー サポート スイッチのステータスを確認する
Android 13 以降では、位置情報の更新をリクエストする前に、ドライバー サポート スイッチのステータスを確認できます。
// Returns the current status of "Use location for driver assistance".
locationManager.isAdasGnssLocationEnabled();
Android Debug Bridge(ADB)コマンドを実行する
開発とテストでは、位置情報設定を使用せずに、ドライバー サポート トグルのステータスをすばやく確認または変更できます。
- ADB コマンドを使用してステータスを確認または変更するには:
// 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
権限を設定する
バージョン固有の Android リリースについては、以下を参照してください。
- Android 12 では、ドライバー サポート アプリに WRITE_SECURE_SETTINGS 権限が必要です。
- Android 13 以降では、
LOCATION_BYPASS
権限が必要です。
デバイスの許可リストにアプリを追加する
etc/sysconfig
ディレクトリで:
- システム構成 XML ファイルにアプリのパッケージ名を追加します。
<!-- In a xml file under etc/sysconfig–>
<config>
…
<allow-adas-location-settings package="PACKAGE-NAME" />
…
</config>
パッケージが位置情報の設定 UI に表示されるようにするには、パッケージ名を config_locationDriverAssistancePackageNames
に追加します。
アプリのプライバシー ポリシー開示に関する URL を AndroidManifest.xml
に追加します。メタデータの名前は privacy_policy
にする必要があります。
<meta-data android:name="privacy_policy" android:value= privacy policy URL/>
「位置情報をドライバー サポートで使用する」スイッチを削除する
Android から位置情報を要求する、位置情報を利用したドライバー サポート アプリがない場合は、コードブロックをコメントアウトして、位置情報設定のスイッチを削除できます。
packages/apps/Car/Settings/res/xml/location_settings_fragment.xml
を開き、次のコードをコメントアウトします。<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/>
- スイッチを削除した後、
config_defaultAdasGnssLocationEnabled
を false
に設定します。
自動車用テストスイートを実行する
Google は自動車用テストスイート(ATS)テストを提供し、デバイス上のすべてのドライバー サポート パッケージが Google の許可リストに登録されていることを確認できるようにしています。テストはリモートで構成されます。新しいパッケージを追加するために、次の ATS リリースまで待つ必要はありません。詳しくは、Complete Automotive Tests in a Box をご覧ください。
このページのコンテンツやコードサンプルは、コンテンツ ライセンスに記載のライセンスに従います。Java および OpenJDK は Oracle および関連会社の商標または登録商標です。
最終更新日 2025-08-08 UTC。
[[["わかりやすい","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-08-08 UTC。"],[],[],null,["# Automotive Location Bypass API\n\nThis feature allows location access of allowlisted, Android-bundled, driver\nassistance apps to be controlled separately by the \"Use location for driver\nassistance\" switch. This enables these apps to access location even when the \"Use location\"\nswitch is off.\n\n- Android 12 doesn't provide a public API for this feature. Driver assistance apps should request location updates as usual.\n- Android 13 and higher must make a location request to use `LocationManager.requestLocationUpdates()` and pass in a `LocationRequest` object configured with `LocationRequest.setAdasGnssBypass(true)`.\n\nUse the driver assistance location bypass API\n---------------------------------------------\n\nThe following sections describe how to use the driver assistance location bypass API. To learn\nmore about the usage policy, see\n[Location Bypass Allowlist Policy](/docs/automotive/location_bypass/location_bypass_policy).\n\n### Check the driver assistance switch status\n\nIn Android 13 and higher, you can check driver assistance switch status\nbefore requesting location updates.\n\n```scilab\n// Returns the current status of \"Use location for driver assistance\".\nlocationManager.isAdasGnssLocationEnabled();\n```\n\n### Run Android Debug Bridge (ADB) commands\n\nFor development and testing, you can quickly check or change the status of the driver assistance\ntoggle without using Location Settings.\n\n1. To use ADB commands to check or change status: \n\n ```scilab\n // Gets the status of ADAS location.\n adb shell cmd location is-adas-gnss-location-enabled\n\n // Enables ADAS location.\n adb shell cmd location set-adas-gnss-location-enabled true\n\n // Disables ADAS location.\n adb shell cmd location set-adas-gnss-location-enabled false\n ```\n\n### Set permission\n\nSee the following for version-specific Android releases:\n\n1. In Android 12, driver assistance apps must have the [WRITE_SECURE_SETTINGS](https://developer.android.com/reference/android/Manifest.permission#WRITE_SECURE_SETTINGS) permission.\n2. In Android 13 and higher, the `LOCATION_BYPASS` permission is required.\n\n### Add an app to the allowlist on your device\n\nIn the `etc/sysconfig` directory:\n\n1. Add the app's package name in a system configuration XML file: \n\n```carbon\n\u003c!-- In a xml file under etc/sysconfig--\u003e\n\u003cconfig\u003e\n...\n\u003callow-adas-location-settings package=\"PACKAGE-NAME\" /\u003e\n...\n\u003c/config\u003e\n```\n\nTo ensure your package appears in the Location Settings UI, add your package name to\n`config_locationDriverAssistancePackageNames`.\n\nAdd the app's URL of privacy policy disclosure to `AndroidManifest.xml`. The name\nof the meta-data should be `privacy_policy`. \n\n```scdoc\n\u003cmeta-data android:name=\"privacy_policy\" android:value= privacy policy URL/\u003e\n```\n\n### Remove the \"Use location for driver assistance switch\"\n\nIf you don't have a location-powered driver assistance app that requests location from Android,\nyou can comment out the code block to remove the switch for Location Settings.\n\n1. Open `packages/apps/Car/Settings/res/xml/location_settings_fragment.xml` and then comment out the following code. \n\n ```transact-sql\n \u003ccom.android.car.ui.preference.CarUiTwoActionSwitchPreference\n\n android:fragment=\"com.android.car.settings.location.AdasLocationFragment\"\n\n android:key=\"@string/pk_location_driver_assistance_state_switch\"\n\n android:title=\"@string/location_driver_assistance_toggle_title\"\n\n android:summary=\"@string/location_driver_assistance_toggle_summary\"\n\n\n settings:controller=\"com.android.car.settings.location.AdasLocationSwitchPreferenceController\"\n\n settings:searchable=\"true\"/\u003e\n\n \u003ccom.android.car.settings.common.DividerPreference/\u003e\n ```\n2. After removing the switch, set `config_defaultAdasGnssLocationEnabled` to `false`.\n\nRun the Automotive test suite\n-----------------------------\n\nGoogle provides an Automotive test suite (ATS) test, which ensures that all driver assistance\npackages on a device have been allowlisted with Google. The test is remotely configured. You\nneedn't wait until the next ATS release to add a new package. You can learn more at\n[Complete Automotive Tests in a Box.](/docs/automotive/tools/catbox)\n[](/docs/automotive/tools/catbox)"]]