AIDL インターフェース

サービスの API を宣言するには、AIDL インターフェースを使用します。

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

package com.example.birthdayservice; /** 誕生日サービスのインターフェース。*/ interface IBirthdayService { /** 「お誕生日おめでとう」というメッセージを生成します。*/ 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 はデフォルトでは無効です。 enabled: true, }, }, }

Speaker Notes

  • Note that the directory structure under the aidl/ directory needs to match the package name used in the AIDL file, i.e. the package is com.example.birthdayservice and the file is at aidl/com/example/IBirthdayService.aidl.