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