Android Brillo Internals

Introduction
Before going through this documentation it is crucial to understand the difference between Brillo (https://developers.google.com/brillo/?hl=en) and Weave (https://developers.google.com/weave/?hl=en). Have a read first to understand it before continuing with this article as it can get confusing sometimes. This document is by no means a tutorial rather this is just a research document and as of Jan 4, 2016 there isn't that much information from Google regarding Brillo or Weave. The findings that are documented here are based on available source code from Google repository and sample application to understand how the whole stack works together.

This document created and maintained by Nanik Tolaram. You can reach me via email (nanikjava @ gmail dot com)

Sample App
Google has released sample Weave application which can be downloaded from https://github.com/googlesamples/android-WeaveLedToggler. Weave is the stack that takes care of the way Brillo device communicates with other devices either via – WiFi (cloud), mDNS or Bluetooth. The sample application shows how to tun ON/OFF led on a Brillo device which currently is a development board (either from Marvell, Intel or other Brillo partners). On looking inside the sample there is a jar file inside third_party library which contains classes used inside the sample to communicate with Brillo devices.

Following shows how the sample app should look like when run. The screenshot below was taken from screenshot directory of the source code (due to error encountered explained below)

The library that is included for the sample app takes care of few things such as device discovery, authentication and communication. There is a dependency on an .apk that need to be downloaded from the Google Play Store, which as of today (4/January/2016) is not available. Tested on a device with Google Play Store the app run with error shown below

 01-04 00:12:20.062 4694  4694 W MainActivity: Could not create RequestAccessIntent, trying resolution intent: WeaveError (code: 1004, reason: null, message: null) 01-04 00:12:20.127  483  1200 I ActivityManager: START u0 {act=android.intent.action.VIEW dat=market://details?id=com.google.android.weave cmp=com.android.vending/com.google.android.finsky.activities.LaunchUrlHandlerActivity} from uid 10097 on display 0 01-04 00:12:22.443  483   802 I ActivityManager: START u0 {act=android.intent.action.VIEW dat=http://market.android.com/details?id=com.google.android.weave cmp=com.android.vending/com.google.android.finsky.activities.MainActivity (has extras)} from uid 10016 on display 0 01-04 00:12:28.108 2978  2978 D Finsky  : [1] ExternalReferrer$1.run: Capture referrer for com.google.android.weave (empty) 01-04 00:12:28.524 2978  3014 E Volley  : [287] BasicNetwork.performRequest: Unexpected response code 404 for https://android.clients.google.com/fdfe/details?doc=com.google.android.weave

This means that either Google has removed the apk from the Play Store or it has not been uploaded

Brillo Hardware
The sample app requires Brillo enabled devices which at the moment are only available using development board. Here are list of the development boads that are supported by Brillo.

Brillo Source Code
The source code for Brillo are available in https://android.googlesource.com/brillo/manifest/ however the board that are currently supported by Google are Intel Edison and Qualcomm Dragonboard 410c. The Brillo application that can be built from the source code are also mostly created using Qualcomm Dragonboard.

To setup and compile Brillo images for the development boards follow the instruction for setting up Android build http://source.android.com/source/requirements.html as the whole build process for Brillo is the same as Android. The following screenshot shows the different directories containing the Brillo source code (using brillo-m7-release tag)

Dissecting Android Library
There is only 1 jar file called weave_android_lib_20151124.jar. Decompiling the jar file look as follows

There are no native library (.so) found inside the jar file.

Findings
There are few things found inside the library that worth documenting

UML Diagrams
The UML diagram is available in one single page in this link https://www.gliffy.com/go/publish/image/9726891/L.png