• Home
  • History
  • Annotate
Name Date Size #Lines LOC

..--

api/15-Dec-2024-14,59513,714

generated-prop-config/15-Dec-2024-3,8683,862

native/14-Jan-2024-463258

res/14-Jan-2024-1,870509

src/14-Jan-2024-92,65544,455

Android.bpD15-Dec-20249.9 KiB362336

Android.mkD15-Dec-20241.5 KiB4317

AndroidManifest.xmlD15-Dec-20241.4 KiB309

OWNERSD15-Dec-20241.9 KiB4835

README.mdD14-Jan-20242.9 KiB6742

README.md

1<!--
2  Copyright (C) 2021 The Android Open Source Project
3
4  Licensed under the Apache License, Version 2.0 (the "License");
5  you may not use this file except in compliance with the License.
6  You may obtain a copy of the License at
7
8       http://www.apache.org/licenses/LICENSE-2.0
9
10  Unless required by applicable law or agreed to in writing, software
11  distributed under the License is distributed on an "AS IS" BASIS,
12  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  See the License for the specific language governing permissions and
14  limitations under the License
15  -->
16
17# Android Automotive OS API
18
19NOTE: car-lib directory will be replaced with car-lib-module.
20
21This directory contains Car services API. All the vendor or app code should use the API defined
22here. The APIs also released to the final Android Automotive OS SDK as part of the Android SDK. The
23actual services implementation are located under `packages/services/Car/service`.
24
25Some vendor services use AIDL/HIDL interfaces located in `hardware/interfaces/automotive/` and
26`frameworks/hardware/interfaces/automotive/`, see
27https://source.android.com/devices/architecture/hidl/interfaces to learn more.
28
29Car API documentation is available at https://developer.android.com/reference/android/car/packages.
30See https://source.android.com/devices/automotive to learn how to use AAOS SDK.
31
32## Structure
33
34```
35api/                       - Generated API signature
36src/
37  android/car/             - All the available Car API
38    Car.java               - Top level Car API
39    *.aidl                 - Internal AIDL declarations
40  com/android/car/internal - Internal helper classes used in Car API
41```
42
43## Adding a New API
44
451. Declare an AIDL under `src/android/car/...`
462. Create a manager for the new API
47   * Handle binder exceptions
48   * If adding callbacks, create a callback interface for users and define Executor argument
49     to allow users provide their own executors to run callbacks in
50   * The new manager class should be thread-safe, use locks when necessary
513. Define the manager in Car.java
524. Add service implementation under `p/s/Car/service/`
53   * Add permission checks to make sure only the apps with permissions can use it
54   * Implement `dump()` method for access the state of the service using
55     `adb shell dumpsys car_service --services <CLASS_NAME>`
565. Optionally create a fake manager for testing under src/android/car/testapi/ and add it to
57   FakeCar.java
586. Optionally create an item in `EmbeddedKitchenSinkApp` for exercising the API manually
597. Optionally create an item in `p/s/Car/service/.../CarShellCommand.java` for
60   `adb shell cmd car_service`, it's useful for debugging
618. Add API tests and unit tests under `p/s/Car/tests/`, see the `tests/README.md` to learn
62   where to add the tests
639. Generate new API signature:
64    * `m android.car-stubs-docs-update-current-api`
65    * `m android.car-system-stubs-docs-update-current-api`
66    * `m android.car-test-stubs-docs-update-current-api`
67