Don't recreate the surface unnecessarily

Bug: 19896200

The flicker is caused because ViewRootImpl is
requesting a change from OPAQUE to TRANSLUCENT due
to the presence of a GLSurfaceView. However, WindowManager
will use this as a signal to recreate the SurfaceControl.

This is not actually correct, as the underlying format
of the SurfaceControl was *already* TRANSLUCENT due to being
hardware accelerated. Add a fast-path for this step
where the format didn't actually change such that all that is
necessary is for the OPAQUE flag to be flushed through
to SurfaceFlinger.

This doesn't address the larger, more complex issue of a surface
flickering if the pixel format really did need to change, but
this should address the common case.

Change-Id: Ia5275705733123a3d7929bf5951829415753e2b2
2 files changed