22
An Overview of Brillo Bin Chen, GDG DevFest Sydney 12/2016 1 / 22

Overview of Brillo (Android Things)

Embed Size (px)

Citation preview

Page 1: Overview of Brillo (Android Things)

An Overview of BrilloBin Chen, GDG DevFest Sydney 12/2016

1 / 22

Page 2: Overview of Brillo (Android Things)

About meSenior Engineer at Linaro.org

Working on Android OS

2 / 22

Page 3: Overview of Brillo (Android Things)

BrilloMinimized Android

Same architecture

Security

OTA update

IoT related core Services

Ability to access Low level interface

Http server

Weave: A device­phone­cloud communication protocol

3 / 22

Page 4: Overview of Brillo (Android Things)

Brillo Architecture +--------------------------------------------------+ | C/C++ Applications | +--------------------------------------------------+ | Binder +--------------------------------------------------+ | C/C++ Library & Services | | (update_engine firewalld media | | bionic camera PIO webservd Weaved ) | +--------------------------------------------------+ +--------------------------------------------------+ | Hardware Abstraction Layer | | (BT WIFI NFC Sensors Camera Audio | | I2C GPIO PWM LED) | +--------------------------------------------------+ +--------------------------------------------------+ | Linux Kernel / Device Drivers | +--------------------------------------------------+ +--------------------------------------------------+ | Hardware | +--------------------------------------------------+

4 / 22

Page 5: Overview of Brillo (Android Things)

SecurityOne top of Linux kernel security

UID/GID based sandboxing

SELinux: default­deny, must be explicit allowed by policy

Secure Boot

Full Disk Encryption

Firewall (new in Brillo)

OAuth2 authentication

SSL

Hardware­backed Crypto

5 / 22

Page 6: Overview of Brillo (Android Things)

OTA Updatepush new update to your device over­the­air

Background

reduced downtime with extra partitions

be able to rollback; redeclared possibility of a bricked device

secure end to end

6 / 22

Page 7: Overview of Brillo (Android Things)

Media - Graphic, Display, CameraNo Graphics (e.g OpenGL)

No Display (SurfaceFlinger,HWC)

Support Camera with NDK API

Support Audio

7 / 22

Page 8: Overview of Brillo (Android Things)

SensorsUse Sensor with NDK API

all sensors supported by Android will be supported

8 / 22

Page 9: Overview of Brillo (Android Things)

ConnectivityBluetooth, BLE (central & peripheral)

Wifi

NFC

No 802.15.4(LR­WPAN:Zigbee, Thread)

No LPWAN (LoRa, Sigfox, NB­IOT)

9 / 22

Page 10: Overview of Brillo (Android Things)

HW I/O - Peripheral ManagerProvide platform independent API for accessing hardware I/O.

New Services added by Brillo

Client/Server, peripheralman daemon, Binder as IPC

C client API (create binding for your favourite languages)

Supported Protocols: GPIO, I2c, LED, SPI, UART

10 / 22

Page 11: Overview of Brillo (Android Things)

WebServerdA web server deamon build on top of libmicrohttpd

Weave is one of the client

11 / 22

Page 12: Overview of Brillo (Android Things)

show me the CODE!// 1. create your handlerconst char PingRequestHandler::kMethods[] = ""; // all methodsconst char PingRequestHandler::kUrl[] = "/webservd-test-client/ping";class PingRequestHandler : public RequestHandlerInterface void HandleRequest(std::unique_ptr<Request> /* request */, std::unique_ptr<Response> response) override response->ReplyWithText(200, "Hello World", brillo::mime::text::kPlain); ; // class PingRequestHandler

// 2. register it to webservdwebserver_ = Server::ConnectToServerViaBinder(ProtocolHandler* http_handler = webserver_->GetDefaultHttpHandler();http_handler->AddHandler( PingRequestHandler::kUrl, PingRequestHandler::kMethods, std::unique_ptr<RequestHandlerInterface>(new PingRequestHandler())););

// 3. call it$ curl http://localhost:8080/webservd-test-client/pingHello World!

12 / 22

Page 13: Overview of Brillo (Android Things)

Weave"A communications platform for IoT devices that enables device setup, phone­to­device­to­cloudcommunication, and user interaction from mobile devices and the web"

+-------------+ | | +-----------+ Cloud +------+ | | | | | +-------------+ | Weave Weave | |+------+------+ +--------+------+| | | || Device +----Weave-------+ Phone || | | |+-------------+ +---------------+

Interoperability : schema

Device Management & Cloud : privet

13 / 22

Page 14: Overview of Brillo (Android Things)

Weave - Schema: Interoperability

Device, Components, Trait, Command, State

Bluetooth: "Profile, Service, Characteristic":

Device +-------------------------+ | | | Component(s) | +---------+ | +-------------+ | | Command | Write | | +--------+ | | | |------------------>|Trait(s)| | | +---------+ | | +---+----+ | | +---------+ | | | | | | | Read | +-------------+ | | State |<----------------------+ | +---------+ | | +-------------------------+

Weave will manage those Components

14 / 22

Page 15: Overview of Brillo (Android Things)

Schema : An example

const char kTraits[] = R"( "onOff": "commands": "setConfig": "minimalRole": "user", "parameters": "state": "type": "string", "enum": [ "on", "off" ] , "state": "state": "isRequired": true, "type": "string", "enum": [ "on", "off" ] )";

15 / 22

Page 16: Overview of Brillo (Android Things)

Weave - Privet: Device Management & Google Cloud

Device <­> Cloud: REST API

Device Information

Pairing

Authentication

Access Control

Manage Components & Commands

CheckForUpdate

16 / 22

Page 17: Overview of Brillo (Android Things)

show me the CODE!

AddHandler("/privet/info"); AddHandler("/privet/v3/pairing/start", AddHandler("/privet/v3/pairing/confirm", AddHandler("/privet/v3/pairing/cancel", AddSecureHandler("/privet/v3/auth", AddSecureHandler("/privet/v3/accessControl/claim", AddSecureHandler("/privet/v3/accessControl/confirm", AddSecureHandler("/privet/v3/setup/start", AddSecureHandler("/privet/v3/commands/execute", AddSecureHandler("/privet/v3/commands/status", AddSecureHandler("/privet/v3/commands/cancel", AddSecureHandler("/privet/v3/commands/list", AddSecureHandler("/privet/v3/checkForUpdates", AddSecureHandler("/privet/v3/traits", AddSecureHandler("/privet/v3/components",

17 / 22

Page 18: Overview of Brillo (Android Things)

Brillo Developer Kit (BDK)Three parts:

1. The initial bdk contains common code all products need

2. Board support package (BSP) for a particular board

bootloader, drivers, hals and firmware

brunch bsp install

1. Your service/product code

brunch product

18 / 22

Page 19: Overview of Brillo (Android Things)

Support Platforms and TargetsAcrosss different hardware platforms: Intel X86, ARM, MIPS

Storage : 128M

RAM : 32M

19 / 22

Page 20: Overview of Brillo (Android Things)

Development EnvironmentExactly the same as Android Platform Development.

Language : C++/C

IDE : do we need one??

Build : Android.mk/Android.bp

Flash : fastboot

Debug : adb, logcat, gdb, printf/k!

20 / 22

Page 21: Overview of Brillo (Android Things)

Get started and Get involved.Checkout, Build and Run!

# Checkoutrepo init -u https://android.googlesource.com/brillo/manifest -b masterrepo sync# Buildsource build/envsetup.sh; lunch brilloemulator_x86-engmake# Run the simulatorout/host/linux-x86/bin/brilloemulator-x86

Next, submit a patch. It is open source.

21 / 22

Page 22: Overview of Brillo (Android Things)

Discussion?Thank you.

22 / 22