AIDL Interfaces

شما API سرویس خود را با استفاده از یک AIDL interface اعلام می‌کنید:

birthday_service/aidl/com/example/birthdayservice/IBirthdayService.aidl:

/** Birthday service interface. */ interface IBirthdayService { /** Generate a Happy Birthday message. */ String wishHappyBirthday(String name, int years); }

birthday_service/aidl/Android.bp:

aidl_interface { name: "com.example.birthdayservice", srcs: ["com/example/birthdayservice/*.aidl"], unstable: true, backend: { rust: { // Rust is not enabled by default enabled: true, }, }, }

Speaker Notes

  • توجه داشته باشید که ساختار دایرکتوری زیر دایرکتوری aidl/ باید با نام package استفاده شده در فایل AIDL مطابقت داشته باشد، به‌عنوان‌مثال بسته com.example.birthdayservice بوده و این فایل در aidl/com/example/IBirthdayService.aidl است.