Stop using transparent region for computing visible regions

The transparent region hint is computed only from view layout
locations, ignoring post-layout translation. If a SurfaceView is layed
out with no other views above it, but a view is moved above it
post-layout, that view's layout bounds would be subtracted from the
window's transparent region instead of its drawing bounds. Prior to
this change, the view would not be visible (except where its layout
bounds and drawing bounds overlap).

With this change, composition uses visible regions computed without
regard to the transparent regions. However, if all of a layer's
visible region is transparent, it will be removed from the list of
layers to composite. This doesn't fix the root problem of incorrect
transparent regions, and doesn't prevent bad composition in all cases.
But it does avoid it for some existing apps, whiel still allowing the
transparent region hint to save power in the important
fullscreen-video-in-a-SurfaceView case.

Bug: 7179570
Change-Id: I47cf939e12129b167afa344b8b036e8827103ac8
diff --git a/services/surfaceflinger/LayerBase.h b/services/surfaceflinger/LayerBase.h
index 0df41ca..00c4ffe 100644
--- a/services/surfaceflinger/LayerBase.h
+++ b/services/surfaceflinger/LayerBase.h
@@ -60,6 +60,7 @@
             // regions below are in window-manager space
             Region      visibleRegion;
             Region      coveredRegion;
+            Region      visibleNonTransparentRegion;
             int32_t     sequence;
             
             struct Geometry {
@@ -110,7 +111,7 @@
             bool setSize(uint32_t w, uint32_t h);
             bool setAlpha(uint8_t alpha);
             bool setMatrix(const layer_state_t::matrix22_t& matrix);
-            bool setTransparentRegionHint(const Region& opaque);
+            bool setTransparentRegionHint(const Region& transparent);
             bool setFlags(uint8_t flags, uint8_t mask);
             bool setCrop(const Rect& crop);
             bool setLayerStack(uint32_t layerStack);
@@ -177,6 +178,13 @@
     virtual void setCoveredRegion(const Region& coveredRegion);
 
     /**
+     * setVisibleNonTransparentRegion - called when the visible and
+     * non-transparent region changes.
+     */
+    virtual void setVisibleNonTransparentRegion(const Region&
+            visibleNonTransparentRegion);
+
+    /**
      * latchBuffer - called each time the screen is redrawn and returns whether
      * the visible regions need to be recomputed (this is a fairly heavy
      * operation, so this should be set only if needed). Typically this is used