| 1 |
This directory contains sample code to test the use of virtual |
| 2 |
displays created over an Android Open Accessories Protocol link. |
| 3 |
|
| 4 |
--- DESCRIPTION --- |
| 5 |
|
| 6 |
There are two applications with two distinct roles: a sink |
| 7 |
and a source. |
| 8 |
|
| 9 |
1. Sink Application |
| 10 |
|
| 11 |
The role of the sink is to emulate an external display that happens |
| 12 |
to be connected using the USB accessory protocol. Think of it as |
| 13 |
a monitor or video dock that the user will want to plug a phone into. |
| 14 |
|
| 15 |
The sink application uses the UsbDevice APIs to receive connections |
| 16 |
from the source device over USB. The sink acts as a USB host |
| 17 |
in this arrangement and will provide power to the source. |
| 18 |
|
| 19 |
The sink application decodes encoded video from the source and |
| 20 |
displays it in a SurfaceView. The sink also injects passes touch |
| 21 |
events to the source over USB HID. |
| 22 |
|
| 23 |
2. Source Application |
| 24 |
|
| 25 |
The role of the source is to present some content onto an external |
| 26 |
display that happens to be attached over USB. This is the typical |
| 27 |
role that a phone or tablet might have when the user is trying to |
| 28 |
play content to an external monitor. |
| 29 |
|
| 30 |
The source application uses the UsbAccessory APIs to connect |
| 31 |
to the sink device over USB. The source acts as a USB peripheral |
| 32 |
in this arrangement and will receive power from the sink. |
| 33 |
|
| 34 |
The source application uses the DisplayManager APIs to create |
| 35 |
a private virtual display which passes the framebuffer through |
| 36 |
an encoder and streams the output to the sink over USB. Then |
| 37 |
the application opens a Presentation on the new virtual display |
| 38 |
and shows a silly cube animation. |
| 39 |
|
| 40 |
--- USAGE --- |
| 41 |
|
| 42 |
These applications should be installed on two separate Android |
| 43 |
devices which are then connected using a USB OTG cable. |
| 44 |
Remember that the sink device is functioning as the USB host |
| 45 |
so the USB OTG cable should be plugged directly into it. |
| 46 |
|
| 47 |
When connected, the applications should automatically launch |
| 48 |
on each device. The source will then begin to project display |
| 49 |
contents to the sink. |
| 50 |
|