Starting March 27, 2025, we recommend using android-latest-release instead of aosp-main to build and contribute to AOSP. For more information, see Changes to AOSP.
Stay organized with collections
Save and categorize content based on your preferences.
This feature enables partners to choose how to synchronize time, whether from the Android
Automotive Operating System (AAOS) or from vehicular systems to Android.
To ensure quality implementations, you can configure AAOS to use one of the two new VHAL properties
described below to propagate the values effectively. Use:
ANDROID_EPOCH_TIME to use Android as the source of truth
for time. The VHAL supports this write-only property, which communicates time changes
from Android to other vehicular systems, such as the Electronic Control Units
(ECU) and the Body Control Module (BCM).
EXTERNAL_CAR_TIME to not use Android as the source
of truth for time. In this case, the VHAL supports the read-onlyEXTERNAL_CAR_TIME property, which communicates time changes from other vehicular
systems (such as ECUs and BCM) to Android.
AAOS also provides a configurable TimeDetectorStrategy to help you prioritize
different time sources within Android.
Android is the source of truth for time
When Android is used as the source of time, OEMs can synchronize other car systems (including
ECUs and a BCM) with Android time.
To do so, the VHAL implementation must support the write-only property
ANDROID_EPOCH_TIME property. Android publishes an update to the property by reading
system time, both at boot time and whenever the time source in Android is changed.
Android is not the source of truth for time
When Android is not used as the source of time, you can synchronize Android time
to be the source of truth for time (for example, with an ECU or the BCM). In this case, the
VHAL implementation must support the read-only property EXTERNAL_CAR_TIME and publish
updates to this property whenever the source of time changes or recalibrates the clock.
OEMs must also ensure that:
The config_autoTimeSourcesPriority values are contained in
core/res/res/values/config.xml.
The config_enableExternalCarTimeToExternalTimeSuggestion property in the
CarServices overlay configs packages/services/Car/service/res/values/config.xml
is set to true.
external time has the appropriate priority in the
TimeDetectorStrategy configuration. To learn more, see
GNSS Time Detection.
For example:
<!-- Specifies priority of automatic time sources. Suggestions from higher entries in the list take precedence over lower ones.
See com.android.server.timedetector.TimeDetectorStrategy for available sources. -->
<string-array name="config_autoTimeSourcesPriority">
<item>external</item>
<item>gnss</item>
<item>network</item>
<item>telephony</item>
</string-array>
Android internal implementation details
The following flow takes place when the ANDROID_EPOCH_TIME VHAL property is
supported:
TimeHalService (in CarServices) receives a broadcast from the Android system for
Intent.ACTION_TIME_CHANGED.
TimeHalService publishes an update to the VHAL Property
ANDROID_EPOCH_TIME.
The VHAL can propagate the time value received to various ECUs and/or BCM units.
The following flow takes place when the EXTERNAL_CAR_TIME VHAL property is
supported:
VHAL updates the EXTERNAL_CAR_TIME property.
TimeHalService (in CarServices) reads the property through a subscription.
TimeHalService creates and sends an ExternalTimeSuggestion to
TimeManager.
TimeManager forwards the suggestion to TimeDetectorService.
TimeDetectorService uses TimeDetectorStrategy to choose a new
system time.
Content and code samples on this page are subject to the licenses described in the Content License. Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.
Last updated 2025-08-29 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-08-29 UTC."],[],[],null,["# Configure AAOS time sources\n\nThis feature enables partners to choose how to synchronize time, whether from the Android\nAutomotive Operating System (AAOS) **or** from vehicular systems to Android.\nTo ensure quality implementations, you can configure AAOS to use one of the two new VHAL properties\ndescribed below to propagate the values effectively. Use:\n\n- `ANDROID_EPOCH_TIME` to **use** Android as the source of truth for time. The VHAL supports this *write-only* property, which communicates time changes from Android to other vehicular systems, such as the Electronic Control Units (ECU) and the Body Control Module (BCM).\n- `EXTERNAL_CAR_TIME` to **not use** Android as the source of truth for time. In this case, the VHAL supports the *read-only* `EXTERNAL_CAR_TIME` property, which communicates time changes from other vehicular systems (such as ECUs and BCM) to Android.\n\n| **Warning:** If you opt to support both properties (not recommended), the VHAL must **never** publish values to `EXTERNAL_CAR_TIME` that are dependent on `ANDROID_EPOCH_TIME`.\n\nAAOS also provides a configurable `TimeDetectorStrategy` to help you prioritize\ndifferent time sources within Android.\n\n### Android is the source of truth for time\n\nWhen Android is used as the source of time, OEMs can synchronize other car systems (including\nECUs and a BCM) with Android time.\n\nTo do so, the VHAL implementation must support the *write-only* property\n`ANDROID_EPOCH_TIME` property. Android publishes an update to the property by reading\nsystem time, both at boot time and whenever the time source in Android is changed.\n\n### Android is not the source of truth for time\n\nWhen Android is **not** used as the source of time, you can synchronize Android time\nto be the source of truth for time (for example, with an ECU or the BCM). In this case, the\nVHAL implementation must support the read-only property `EXTERNAL_CAR_TIME` and publish\nupdates to this property whenever the source of time changes or recalibrates the clock.\n\nOEMs must also ensure that:\n\n- The `config_autoTimeSourcesPriority` values are contained in `core/res/res/values/config.xml`.\n- The `config_enableExternalCarTimeToExternalTimeSuggestion` property in the CarServices overlay configs `packages/services/Car/service/res/values/config.xml` is set to `true`.\n- `external` time has the appropriate priority in the `TimeDetectorStrategy` configuration. To learn more, see [GNSS Time Detection](/devices/tech/connect/time/gnss-time-detection#implement). For example: \n\n ```scdoc\n \u003c!-- Specifies priority of automatic time sources. Suggestions from higher entries in the list take precedence over lower ones.\n See com.android.server.timedetector.TimeDetectorStrategy for available sources. --\u003e\n \u003cstring-array name=\"config_autoTimeSourcesPriority\"\u003e\n \u003citem\u003eexternal\u003c/item\u003e\n \u003citem\u003egnss\u003c/item\u003e\n \u003citem\u003enetwork\u003c/item\u003e\n \u003citem\u003etelephony\u003c/item\u003e\n \u003c/string-array\u003e\n ```\n\n| The VHAL implementation must **not** publish updates for the natural progression of time.\n\nAndroid internal implementation details\n---------------------------------------\n\nThe following flow takes place when the `ANDROID_EPOCH_TIME` VHAL property is\nsupported:\n\n1. `TimeHalService` (in CarServices) receives a broadcast from the Android system for `Intent.ACTION_TIME_CHANGED`.\n2. `TimeHalService` publishes an update to the VHAL Property `ANDROID_EPOCH_TIME`.\n3. The VHAL can propagate the time value received to various ECUs and/or BCM units.\n\nThe following flow takes place when the `EXTERNAL_CAR_TIME` VHAL property is\nsupported:\n\n1. VHAL updates the `EXTERNAL_CAR_TIME` property.\n2. `TimeHalService` (in CarServices) reads the property through a subscription.\n3. `TimeHalService` creates and sends an `ExternalTimeSuggestion` to `TimeManager`.\n4. `TimeManager` forwards the suggestion to `TimeDetectorService`.\n5. `TimeDetectorService` uses `TimeDetectorStrategy` to choose a new system time."]]