Only use one SurfaceControlWithBackground per AppToken.

In the past, if an app never renders to a SurfaceView, it will be
invisible despite having FLAG_OPAQUE. This means an app could leave a
totally empty SurfaceView (never drawing in to it) on top of a second
SurfaceView, and expect the second one to be visible. This is probably
buggy app behavior because FLAG_OPAQUE means if they ever draw anything at all
in to the top SurfaceView the bottom one will become totally invisible.
However this has worked in the past, so we have to preserve things for
apps. To accomplish this we ensure only the bottom most visible
SurfaceView for a given AppToken will receive a background. We achieve
this by synchronizing through the app token whenever visibility or
layering of a SurfaceView changes.

Bug: 29580298
Change-Id: I0023326323cb961b56404fd49093384e7b72aa54
2 files changed