Merge "Fix rebuildWebTextView issues"
diff --git a/packages/SystemUI/res/drawable/status_bar_recents_background.xml b/packages/SystemUI/res/drawable/status_bar_recents_background.xml
index 8b22bf1..7831db0 100644
--- a/packages/SystemUI/res/drawable/status_bar_recents_background.xml
+++ b/packages/SystemUI/res/drawable/status_bar_recents_background.xml
@@ -17,9 +17,9 @@
  */
 -->
 <shape xmlns:android="http://schemas.android.com/apk/res/android">
-  <gradient name="status_bar_recents_background"
-            android:startColor="#cc000000"
-            android:endColor="#66000000"
-            android:angle="@integer/status_bar_recents_bg_gradient_degrees"
-	    />
+    <gradient name="status_bar_recents_background"
+        android:startColor="#e6000000"
+        android:endColor="#c0000000"
+        android:angle="@integer/status_bar_recents_bg_gradient_degrees"
+        />
 </shape>
diff --git a/packages/SystemUI/res/values/colors.xml b/packages/SystemUI/res/values/colors.xml
index bce0bc4..ce390a0 100644
--- a/packages/SystemUI/res/values/colors.xml
+++ b/packages/SystemUI/res/values/colors.xml
@@ -29,5 +29,5 @@
     <drawable name="notification_header_bg">#d8000000</drawable>
     <drawable name="notification_tracking_bg">#d8000000</drawable>
     <color name="notification_list_shadow_top">#80000000</color>
-    <drawable name="recents_callout_line">#66ffffff</drawable>
+    <drawable name="recents_callout_line">#99ffffff</drawable>
 </resources>
diff --git a/services/surfaceflinger/Layer.cpp b/services/surfaceflinger/Layer.cpp
index 28552f6..d3b0dbf 100644
--- a/services/surfaceflinger/Layer.cpp
+++ b/services/surfaceflinger/Layer.cpp
@@ -284,8 +284,8 @@
         glMatrixMode(GL_TEXTURE);
         glLoadMatrixf(mTextureMatrix);
         glMatrixMode(GL_MODELVIEW);
-        glEnable(GL_TEXTURE_EXTERNAL_OES);
         glDisable(GL_TEXTURE_2D);
+        glEnable(GL_TEXTURE_EXTERNAL_OES);
     } else {
         glBindTexture(GL_TEXTURE_2D, mFlinger->getProtectedTexName());
         glMatrixMode(GL_TEXTURE);
diff --git a/services/surfaceflinger/SurfaceFlinger.cpp b/services/surfaceflinger/SurfaceFlinger.cpp
index dc47a03..e869ba2 100644
--- a/services/surfaceflinger/SurfaceFlinger.cpp
+++ b/services/surfaceflinger/SurfaceFlinger.cpp
@@ -742,6 +742,8 @@
         }
 
     unlockPageFlip(currentLayers);
+
+    mDirtyRegion.orSelf(getAndClearInvalidateRegion());
     mDirtyRegion.andSelf(screenRegion);
 }
 
@@ -1716,12 +1718,24 @@
 }
 
 void SurfaceFlinger::repaintEverything() {
-    Mutex::Autolock _l(mStateLock);
     const DisplayHardware& hw(graphicPlane(0).displayHardware());
-    mDirtyRegion.set(hw.bounds());
+    const Rect bounds(hw.getBounds());
+    setInvalidateRegion(Region(bounds));
     signalEvent();
 }
 
+void SurfaceFlinger::setInvalidateRegion(const Region& reg) {
+    Mutex::Autolock _l(mInvalidateLock);
+    mInvalidateRegion = reg;
+}
+
+Region SurfaceFlinger::getAndClearInvalidateRegion() {
+    Mutex::Autolock _l(mInvalidateLock);
+    Region reg(mInvalidateRegion);
+    mInvalidateRegion.clear();
+    return reg;
+}
+
 // ---------------------------------------------------------------------------
 
 status_t SurfaceFlinger::renderScreenToTexture(DisplayID dpy,
diff --git a/services/surfaceflinger/SurfaceFlinger.h b/services/surfaceflinger/SurfaceFlinger.h
index 1490dec..ea5bfa7 100644
--- a/services/surfaceflinger/SurfaceFlinger.h
+++ b/services/surfaceflinger/SurfaceFlinger.h
@@ -303,6 +303,9 @@
             void        composeSurfaces(const Region& dirty);
 
 
+            void        setInvalidateRegion(const Region& reg);
+            Region      getAndClearInvalidateRegion();
+
             ssize_t     addClientLayer(const sp<Client>& client,
                     const sp<LayerBaseClient>& lbc);
             status_t    addLayer_l(const sp<LayerBase>& layer);
@@ -348,6 +351,10 @@
                 bool                        mLayersRemoved;
                 DefaultKeyedVector< wp<IBinder>, wp<Layer> > mLayerMap;
 
+                // access must be protected by mInvalidateLock
+    mutable     Mutex                       mInvalidateLock;
+                Region                      mInvalidateRegion;
+
                 // constant members (no synchronization needed for access)
                 sp<IMemoryHeap>             mServerHeap;
                 surface_flinger_cblk_t*     mServerCblk;