Merge "Fxi initial error popup dialog in TextEdit and refreshed assets." into honeycomb
diff --git a/NOTICE b/NOTICE
index d857ba3..462d5ae 100644
--- a/NOTICE
+++ b/NOTICE
@@ -56,6 +56,16 @@
    =========================================================================
    ==  NOTICE file corresponding to the section 4 d of                    ==
    ==  the Apache License, Version 2.0,                                   ==
+   ==  in this case for Additional Codecs code.                           ==
+   =========================================================================
+
+Additional Codecs
+These files are Copyright 2003-2010 VisualOn, but released under
+the Apache2 License.
+
+   =========================================================================
+   ==  NOTICE file corresponding to the section 4 d of                    ==
+   ==  the Apache License, Version 2.0,                                   ==
    ==  in this case for the TagSoup code.                                 ==
    =========================================================================
 
diff --git a/include/ui/egl/android_natives.h b/include/ui/egl/android_natives.h
index 654d0f3..fdc8105 100644
--- a/include/ui/egl/android_natives.h
+++ b/include/ui/egl/android_natives.h
@@ -315,6 +315,8 @@
  * If all parameters are 0, the normal behavior is restored. That is,
  * dequeued buffers following this call will be sized to the window's size.
  *
+ * Calling this function will reset the window crop to a NULL value, which
+ * disables cropping of the buffers.
  */
 static inline int native_window_set_buffers_geometry(
         ANativeWindow* window,
diff --git a/libs/gui/SurfaceTextureClient.cpp b/libs/gui/SurfaceTextureClient.cpp
index 0ed8be5..50cbdb8 100644
--- a/libs/gui/SurfaceTextureClient.cpp
+++ b/libs/gui/SurfaceTextureClient.cpp
@@ -88,7 +88,7 @@
     int buf = -1;
     status_t err = mSurfaceTexture->dequeueBuffer(&buf);
     if (err < 0) {
-        LOGE("dequeueBuffer: ISurfaceTexture::dequeueBuffer failed: %d", err);
+        LOGV("dequeueBuffer: ISurfaceTexture::dequeueBuffer failed: %d", err);
         return err;
     }
     sp<GraphicBuffer>& gbuf(mSlots[buf]);
@@ -238,13 +238,15 @@
     LOGV("SurfaceTextureClient::setCrop");
     Mutex::Autolock lock(mMutex);
 
-    // empty/invalid rects are not allowed
-    if (rect->isEmpty())
-        return BAD_VALUE;
+    Rect realRect;
+    if (rect == NULL || rect->isEmpty()) {
+        realRect = Rect(0, 0);
+    } else {
+        realRect = *rect;
+    }
 
     status_t err = mSurfaceTexture->setCrop(*rect);
-    LOGE_IF(err, "ISurfaceTexture::setCrop(...) returned %s",
-            strerror(-err));
+    LOGE_IF(err, "ISurfaceTexture::setCrop(...) returned %s", strerror(-err));
 
     return err;
 }
@@ -280,7 +282,10 @@
     mReqHeight = h;
     mReqFormat = format;
 
-    return NO_ERROR;
+    status_t err = mSurfaceTexture->setCrop(Rect(0, 0));
+    LOGE_IF(err, "ISurfaceTexture::setCrop(...) returned %s", strerror(-err));
+
+    return err;
 }
 
 int SurfaceTextureClient::setBuffersTransform(int transform)
diff --git a/libs/surfaceflinger_client/ISurfaceComposer.cpp b/libs/surfaceflinger_client/ISurfaceComposer.cpp
index 2216824..01ae23f 100644
--- a/libs/surfaceflinger_client/ISurfaceComposer.cpp
+++ b/libs/surfaceflinger_client/ISurfaceComposer.cpp
@@ -266,13 +266,13 @@
             int32_t mode = data.readInt32();
             status_t res = turnElectronBeamOff(mode);
             reply->writeInt32(res);
-        }
+        } break;
         case TURN_ELECTRON_BEAM_ON: {
             CHECK_INTERFACE(ISurfaceComposer, data, reply);
             int32_t mode = data.readInt32();
             status_t res = turnElectronBeamOn(mode);
             reply->writeInt32(res);
-        }
+        } break;
         default:
             return BBinder::onTransact(code, data, reply, flags);
     }
diff --git a/libs/surfaceflinger_client/Surface.cpp b/libs/surfaceflinger_client/Surface.cpp
index e21bab7..1e9bd74 100644
--- a/libs/surfaceflinger_client/Surface.cpp
+++ b/libs/surfaceflinger_client/Surface.cpp
@@ -827,13 +827,15 @@
 
 int Surface::crop(Rect const* rect)
 {
-    // empty/invalid rects are not allowed
-    if (rect->isEmpty())
-        return BAD_VALUE;
-
     Mutex::Autolock _l(mSurfaceLock);
     // TODO: validate rect size
-    mNextBufferCrop = *rect;
+
+    if (rect == NULL || rect->isEmpty()) {
+        mNextBufferCrop = Rect(0,0);
+    } else {
+        mNextBufferCrop = *rect;
+    }
+
     return NO_ERROR;
 }
 
@@ -884,6 +886,9 @@
         // EGLConfig validation.
         mFormat = format;
     }
+
+    mNextBufferCrop = Rect(0,0);
+
     return NO_ERROR;
 }
 
diff --git a/libs/utils/ResourceTypes.cpp b/libs/utils/ResourceTypes.cpp
index bbf5093..73ff230 100644
--- a/libs/utils/ResourceTypes.cpp
+++ b/libs/utils/ResourceTypes.cpp
@@ -3703,9 +3703,9 @@
 void ResTable::getLocales(Vector<String8>* locales) const
 {
     Vector<ResTable_config> configs;
-    LOGD("calling getConfigurations");
+    LOGV("calling getConfigurations");
     getConfigurations(&configs);
-    LOGD("called getConfigurations size=%d", (int)configs.size());
+    LOGV("called getConfigurations size=%d", (int)configs.size());
     const size_t I = configs.size();
     for (size_t i=0; i<I; i++) {
         char locale[6];
diff --git a/services/surfaceflinger/Layer.cpp b/services/surfaceflinger/Layer.cpp
index 3730739..f64fd7b 100644
--- a/services/surfaceflinger/Layer.cpp
+++ b/services/surfaceflinger/Layer.cpp
@@ -150,8 +150,7 @@
     // the layer is not on screen anymore. free as much resources as possible
     mFreezeLock.clear();
 
-    EGLDisplay dpy(mFlinger->graphicPlane(0).getEGLDisplay());
-    mBufferManager.destroy(dpy);
+    // Free our own reference to ISurface
     mSurface.clear();
 
     Mutex::Autolock _l(mLock);
diff --git a/services/surfaceflinger/LayerBase.cpp b/services/surfaceflinger/LayerBase.cpp
index 8d83f0b..86057f8 100644
--- a/services/surfaceflinger/LayerBase.cpp
+++ b/services/surfaceflinger/LayerBase.cpp
@@ -498,11 +498,9 @@
 }
 
 void LayerBase::setBufferCrop(const Rect& crop) {
-    if (!crop.isEmpty()) {
-        if (mBufferCrop != crop) {
-            mBufferCrop = crop;
-            mFlinger->invalidateHwcGeometry();
-        }
+    if (mBufferCrop != crop) {
+        mBufferCrop = crop;
+        mFlinger->invalidateHwcGeometry();
     }
 }