API de Serviço Gerada

Binder gera um trait correspondente à definição da interface. trait para falar com o serviço.

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

/** Interface de serviço de aniversário. */ interface IBirthdayService { /** Gera uma mensagem de feliz aniversário. */ String wishHappyBirthday(String name, int years); }

Trait gerado:

trait IBirthdayService { fn wishHappyBirthday(&self, name: &str, years: i32) -> binder::Result<String>; }

Seu serviço precisará implementar este trait, e seu cliente usará este trait para falar com o serviço.

Speaker Notes

  • Os vínculos gerados podem ser encontrados em out/soong/.intermediates/<caminho para o módulo>/.
  • Aponte como a assinatura da função gerada, especificamente os tipos de argumento e retorno, correspondem à definição da interface.
    • String para um argumento resulta em um tipo Rust diferente de String como um tipo de retorno.