Android Core - Felipe Silveira · RIL API (RILJ) android.telephony.gsm.* Baseband RIL. RILD - Radio...

29
Android Core Felipe Silveira felipesilveira.com.br Aula 5

Transcript of Android Core - Felipe Silveira · RIL API (RILJ) android.telephony.gsm.* Baseband RIL. RILD - Radio...

Page 1: Android Core - Felipe Silveira · RIL API (RILJ) android.telephony.gsm.* Baseband RIL. RILD - Radio Interface Layer Daemon O termo RILD se refere ao componente responsável por ...

Android Core

Felipe Silveirafelipesilveira.com.br Aula 5

Page 2: Android Core - Felipe Silveira · RIL API (RILJ) android.telephony.gsm.* Baseband RIL. RILD - Radio Interface Layer Daemon O termo RILD se refere ao componente responsável por ...

RIL (Radio Interface Layer)

Page 3: Android Core - Felipe Silveira · RIL API (RILJ) android.telephony.gsm.* Baseband RIL. RILD - Radio Interface Layer Daemon O termo RILD se refere ao componente responsável por ...

RIL: Radio Interface LayerO que é RIL?

● Camada de abstração entre os serviços de telefonia de android (android.telephony) e o hardware de rádio.

● 2 principais componentes:- RIL Daemon (rild)- Vendor RIL

Page 4: Android Core - Felipe Silveira · RIL API (RILJ) android.telephony.gsm.* Baseband RIL. RILD - Radio Interface Layer Daemon O termo RILD se refere ao componente responsável por ...

RIL: Radio Interface LayerApplications (Phone, Messaging, Contacts, etc.)

Page 5: Android Core - Felipe Silveira · RIL API (RILJ) android.telephony.gsm.* Baseband RIL. RILD - Radio Interface Layer Daemon O termo RILD se refere ao componente responsável por ...

RIL: Radio Interface Layer

Packet DriverPPP, for exampleLinux IP stack

Vendor RILsystem/libs/libril-vendor.so

Radio Daemon (rild)commands/rild

Phoneandroid.telephony.*

Applications (Phone, Messaging, Contacts, etc.)

RIL API (RILJ)android.telephony.gsm.*

Baseband

Page 6: Android Core - Felipe Silveira · RIL API (RILJ) android.telephony.gsm.* Baseband RIL. RILD - Radio Interface Layer Daemon O termo RILD se refere ao componente responsável por ...

RIL: Radio Interface Layer

Packet DriverPPP, for exampleLinux IP stack

Vendor RILsystem/libs/libril-vendor.so

Radio Daemon (rild)commands/rild

Phoneandroid.telephony.*

Applications (Phone, Messaging, Contacts, etc.)

RIL API (RILJ)android.telephony.gsm.*

Baseband

Page 7: Android Core - Felipe Silveira · RIL API (RILJ) android.telephony.gsm.* Baseband RIL. RILD - Radio Interface Layer Daemon O termo RILD se refere ao componente responsável por ...

RIL: Radio Interface Layer

Packet DriverPPP, for exampleLinux IP stack

Vendor RILsystem/libs/libril-vendor.so

Radio Daemon (rild)commands/rild

Phoneandroid.telephony.*

Applications (Phone, Messaging, Contacts, etc.)

RIL API (RILJ)android.telephony.gsm.*

Baseband

Page 8: Android Core - Felipe Silveira · RIL API (RILJ) android.telephony.gsm.* Baseband RIL. RILD - Radio Interface Layer Daemon O termo RILD se refere ao componente responsável por ...

RIL: Radio Interface Layer

Packet DriverPPP, for exampleLinux IP stack

Vendor RILsystem/libs/libril-vendor.so

Radio Daemon (rild)commands/rild

Phoneandroid.telephony.*

Applications (Phone, Messaging, Contacts, etc.)

RIL API (RILJ)android.telephony.gsm.*

Baseband

Page 9: Android Core - Felipe Silveira · RIL API (RILJ) android.telephony.gsm.* Baseband RIL. RILD - Radio Interface Layer Daemon O termo RILD se refere ao componente responsável por ...

RIL: Radio Interface Layer

Packet DriverPPP, for exampleLinux IP stack

Vendor RILsystem/libs/libril-vendor.so

Radio Daemon (rild)commands/rild

Phoneandroid.telephony.*

Applications (Phone, Messaging, Contacts, etc.)

RIL API (RILJ)android.telephony.gsm.*

Baseband

Page 10: Android Core - Felipe Silveira · RIL API (RILJ) android.telephony.gsm.* Baseband RIL. RILD - Radio Interface Layer Daemon O termo RILD se refere ao componente responsável por ...

RIL: Radio Interface Layer

Packet DriverPPP, for exampleLinux IP stack

Vendor RILsystem/libs/libril-vendor.so

Radio Daemon (rild)commands/rild

Phoneandroid.telephony.*

Applications (Phone, Messaging, Contacts, etc.)

RIL API (RILJ)android.telephony.gsm.*

Baseband

RIL

Page 11: Android Core - Felipe Silveira · RIL API (RILJ) android.telephony.gsm.* Baseband RIL. RILD - Radio Interface Layer Daemon O termo RILD se refere ao componente responsável por ...

RILD - Radio Interface Layer DaemonO termo RILD se refere ao componente responsável por controlar as tarefas de telefonia.

A abreviação terminada em D indica que ele é um daemon, componente comum em sistemas linux.

Page 12: Android Core - Felipe Silveira · RIL API (RILJ) android.telephony.gsm.* Baseband RIL. RILD - Radio Interface Layer Daemon O termo RILD se refere ao componente responsável por ...

RILD - Radio Interface Layer DaemonEm linux, daemons são softwares responsáveis por receber comandos que serão executados em background.

Este software é executado em um processo que nunca é terminado.

Exemplos: sshd, ftpd, httpd, etc

Em android o conceito é o mesmo.

Page 13: Android Core - Felipe Silveira · RIL API (RILJ) android.telephony.gsm.* Baseband RIL. RILD - Radio Interface Layer Daemon O termo RILD se refere ao componente responsável por ...

RILD - Radio Interface layer daemon

● Responsável por inicializar o Vendor RIL

● Faz o processamento de toda comunicação entre os serviços de telefonia android e dispara chamadas para o Vendor RIL através dos Solicited Commands. Por exemplo: send SMS, dial, etc.

Page 14: Android Core - Felipe Silveira · RIL API (RILJ) android.telephony.gsm.* Baseband RIL. RILD - Radio Interface Layer Daemon O termo RILD se refere ao componente responsável por ...

Estrutura interna do RILD

Page 15: Android Core - Felipe Silveira · RIL API (RILJ) android.telephony.gsm.* Baseband RIL. RILD - Radio Interface Layer Daemon O termo RILD se refere ao componente responsável por ...

RILC

● Escrito em C● hardware/lib/ril● Event Scheduler

responsável por processar as requisições solicitadas e não-solicitadas.

Page 16: Android Core - Felipe Silveira · RIL API (RILJ) android.telephony.gsm.* Baseband RIL. RILD - Radio Interface Layer Daemon O termo RILD se refere ao componente responsável por ...

Vendor RIL

● hardware/ril/reference-ril

● Lib proprietária, responsável por acessar o BP para serviços de voz/mensagens/controle e a IP stack para dados

Page 17: Android Core - Felipe Silveira · RIL API (RILJ) android.telephony.gsm.* Baseband RIL. RILD - Radio Interface Layer Daemon O termo RILD se refere ao componente responsável por ...

RILD StartupInicialização do RIL daemon é feita pelo init.rc:

service ril-daemon /system/bin/rild

class main

socket rild stream 660 root radio

socket rild-debug stream 660 radio system

user root

group radio cache inet misc audio log

Page 18: Android Core - Felipe Silveira · RIL API (RILJ) android.telephony.gsm.* Baseband RIL. RILD - Radio Interface Layer Daemon O termo RILD se refere ao componente responsável por ...

RILD StartupApós a inicialização do rild, este executa a seguinte sequência para inicializar toda a stack de telefonia e o Vendor RIL:

1) O rild lê as system properties rild.libpath e rild.libargspara determinar qual será o Vendor RIL utilizado e quais são os parâmetros necessários. Por exemplo:

rild.libpath=/system/lib/libreference-ril.so

rild.libargs=-d /dev/pts/0

Page 19: Android Core - Felipe Silveira · RIL API (RILJ) android.telephony.gsm.* Baseband RIL. RILD - Radio Interface Layer Daemon O termo RILD se refere ao componente responsável por ...

RILD Startup

2) O rild então carrega o Vendor RIL e invoca o seu método RIL_Init para obter uma referência para as funções da interface do RIL.

Page 20: Android Core - Felipe Silveira · RIL API (RILJ) android.telephony.gsm.* Baseband RIL. RILD - Radio Interface Layer Daemon O termo RILD se refere ao componente responsável por ...

RILD Startup

3) O rild invoca o método RIL_register para obter uma referência para as funções da interface do Vendor RIL.

Page 21: Android Core - Felipe Silveira · RIL API (RILJ) android.telephony.gsm.* Baseband RIL. RILD - Radio Interface Layer Daemon O termo RILD se refere ao componente responsável por ...

Interações com o RILO RIL interage com os outros componentes de um telefone android através de dois mecanismos:

● Comandos solicitadosComandos originados da RIL lib (RILJ)

● Comandos não solicitadosComandos originados da camada Baseband

Page 22: Android Core - Felipe Silveira · RIL API (RILJ) android.telephony.gsm.* Baseband RIL. RILD - Radio Interface Layer Daemon O termo RILD se refere ao componente responsável por ...

Comandos SolicitadosRequisições solicitadas são aquelas que se originam da RIL API, na maioria das vezes a partir de alguma ação do usuário.

Exemplos:

DIAL

HANGUP

Page 23: Android Core - Felipe Silveira · RIL API (RILJ) android.telephony.gsm.* Baseband RIL. RILD - Radio Interface Layer Daemon O termo RILD se refere ao componente responsável por ...

Comandos SolicitadosInterface de tratamento de requisições solicitadas:

void RIL_OnRequest (int request_id, void *data,

size_t datalen, RIL_Token t);

void RIL_OnRequestComplete (RIL_Token t,

RIL_Error e, void *response, size_t

responselen);

Page 24: Android Core - Felipe Silveira · RIL API (RILJ) android.telephony.gsm.* Baseband RIL. RILD - Radio Interface Layer Daemon O termo RILD se refere ao componente responsável por ...

Comandos SolicitadosMais de 60 comandos disponíveis, divididos nos seguintes grupos:

SIM PIN, IO, and IMSI/IMEI (11)

Call status and handling (dial, answer, mute…) (16)

Network status query (4)

Network setting (barring, forwarding, selection…) (12)

SMS (3)

PDP connection (4)

Power and reset (2)

Supplementary Services (5)

Vendor defined and support (4)

Page 25: Android Core - Felipe Silveira · RIL API (RILJ) android.telephony.gsm.* Baseband RIL. RILD - Radio Interface Layer Daemon O termo RILD se refere ao componente responsável por ...

Comandos Solicitados

Page 26: Android Core - Felipe Silveira · RIL API (RILJ) android.telephony.gsm.* Baseband RIL. RILD - Radio Interface Layer Daemon O termo RILD se refere ao componente responsável por ...

Comandos Não Solicitados

As requisições não solicitadas, por sua vez, são aquelas que ocorrem a partir de um evento na camada de Baseband.

Exemplos:CALL_STATE_CHANGEDNEW_SMS

Page 27: Android Core - Felipe Silveira · RIL API (RILJ) android.telephony.gsm.* Baseband RIL. RILD - Radio Interface Layer Daemon O termo RILD se refere ao componente responsável por ...

Comandos Não Solicitados

Interface de tratamento de requisições não solicitadas:

void OnUnsolicitedResponse (int unsolResponse,

void *data, size_t datalen);

Page 28: Android Core - Felipe Silveira · RIL API (RILJ) android.telephony.gsm.* Baseband RIL. RILD - Radio Interface Layer Daemon O termo RILD se refere ao componente responsável por ...

Comandos Não SolicitadosMais de 10 comandos disponíveis, divididos nos seguintes

grupos:

Network status changed (4)

New SMS notify (3)

New USSD notify (2)

Signal strength or time changed (2)

Page 29: Android Core - Felipe Silveira · RIL API (RILJ) android.telephony.gsm.* Baseband RIL. RILD - Radio Interface Layer Daemon O termo RILD se refere ao componente responsável por ...

Comandos Não Solicitados