Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Интерфейсы 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,
        },
    },
}
  • Обратите внимание, что структура каталогов под aidl/ должна соответствовать имени пакета, используемому в файле AIDL: то есть пакет — com.example.birthdayservice, а файл лежит в aidl/com/example/IBirthdayService.aidl.