SurfaceControlViewHost Input in Android R

In a previous post, I reviewed the basics of how you can use SurfaceControlViewHost in Android R to have the UI from one app be displayed in another app.

The one part that I was missing was user input, as that did not seem to work, though it was advertised as being supported.

Primarily, that was a matter of setting the SurfaceView to be on top from a Z axis standpoint. After that, user input worked just fine, at least for click events — I have not yet experimented with anything more complex. In particular, it will be interesting to see if text input works, given the three-way interaction between the app supplying the UI, the app displaying the Surface, and the input method editor.

This tagged edition of EmbedClient has the revised implementation. The equivalent EmbedServer did not have to change to implement the fix.

Many thanks to the Google engineer who pointed out the problem!


Find out about new posts on the CommonsBlog via the Atom feed, or follow @CommonsWare on Twitter!