liiir1985 7f62dcda9f | ||
---|---|---|
.. | ||
api | ||
native | ||
src | ||
Android.bp | ||
Android.mk | ||
AndroidManifest.xml | ||
OWNERS | ||
README.md |
README.md
Android Automotive OS API
NOTE: car-lib directory will be replaced with car-lib-module.
This directory contains Car services API. All the vendor or app code should use the API defined
here. The APIs also released to the final Android Automotive OS SDK as part of the Android SDK. The
actual services implementation are located under packages/services/Car/service
.
Some vendor services use AIDL/HIDL interfaces located in hardware/interfaces/automotive/
and
frameworks/hardware/interfaces/automotive/
, see
https://source.android.com/devices/architecture/hidl/interfaces to learn more.
Car API documentation is available at https://developer.android.com/reference/android/car/packages. See https://source.android.com/devices/automotive to learn how to use AAOS SDK.
Structure
api/ - Generated API signature
src/
android/car/ - All the available Car API
Car.java - Top level Car API
*.aidl - Internal AIDL declarations
com/android/car/internal - Internal helper classes used in Car API
Adding a New API
- Declare an AIDL under
src/android/car/...
- Create a manager for the new API
- Handle binder exceptions
- If adding callbacks, create a callback interface for users and define Executor argument to allow users provide their own executors to run callbacks in
- The new manager class should be thread-safe, use locks when necessary
- Define the manager in Car.java
- Add service implementation under
p/s/Car/service/
- Add permission checks to make sure only the apps with permissions can use it
- Implement
dump()
method for access the state of the service usingadb shell dumpsys car_service --services <CLASS_NAME>
- Optionally create a fake manager for testing under src/android/car/testapi/ and add it to FakeCar.java
- Optionally create an item in
EmbeddedKitchenSinkApp
for exercising the API manually - Optionally create an item in
p/s/Car/service/.../CarShellCommand.java
foradb shell cmd car_service
, it's useful for debugging - Add API tests and unit tests under
p/s/Car/tests/
, see thetests/README.md
to learn where to add the tests - Generate new API signature:
m android.car-stubs-docs-update-current-api
m android.car-system-stubs-docs-update-current-api
m android.car-test-stubs-docs-update-current-api