AIDL Interfaces
You declare the API of your service using an AIDL interface:
birthday_service/aidl/com/example/birthdayservice/IBirthdayService.aidl:
1. package com.example.birthdayservice;
3. /** Birthday service interface. */
4. interface IBirthdayService {
5. /** Generate a Happy Birthday message. */
6. String wishHappyBirthday(String name, int years);
7. }
birthday_service/aidl/Android.bp:
1. aidl_interface {
2. name: "com.example.birthdayservice",
3. srcs: ["com/example/birthdayservice/*.aidl"],
4. unstable: true,
5. backend: {
6. rust: { // Rust is not enabled by default
7. enabled: true,
8. },
9. },
10. }
- Note that the directory structure under the
aidl/directory needs to match the package name used in the AIDL file, i.e. the package iscom.example.birthdayserviceand the file is ataidl/com/example/IBirthdayService.aidl.
