Fix ordering of SurfaceTexture startup in SurfaceTextureSource.
An asynchronous SurfaceTexture only sends out a frame available
callback the first time a new buffer comes in; if a onFrameAvailable-
listener is not registered at this point, the callback never happens
even when new frames come in.
SurfaceTextureSource was calling its
onSurfaceTextureSourceReady-listener with a newly created
SurfaceTexture before hooking up the SurfaceTexture's
onFrameAvailable-listener. This opened a window of time for the
onSurfaceTextureSourceReady-listener to set up the provider end of the
SurfaceTexture, and for the provider to get buffers into the
SurfaceTexture queue before the onFrameAvailable-listener was
registered.
And as a result, no new frame callback ever fired, and
SurfaceTextureSource eventually times out, or goes into permanent
sleep.
This change simply makes sure the onFrameAvailable-listener is
registered before the onSurfaceTextureSourceReady callback is fired.
Bug:
5614661
Change-Id: I8d6a72444ffc36b5c48952d0b1edd530ecb76478