Merge "Workaround for re-applying transform on new surface texuture" into gb-ub-photos-carlsbad
diff --git a/src/com/android/camera/PhotoUI.java b/src/com/android/camera/PhotoUI.java
index 3b4d04d..58751ef 100644
--- a/src/com/android/camera/PhotoUI.java
+++ b/src/com/android/camera/PhotoUI.java
@@ -126,13 +126,6 @@
                 int bottom, int oldLeft, int oldTop, int oldRight, int oldBottom) {
             int width = right - left;
             int height = bottom - top;
-            // Full-screen preview
-            int w = width;
-            int h = height;
-            if (CameraUtil.getDisplayRotation(mActivity) % 180 != 0) {
-                w = height;
-                h = width;
-            }
             if (mPreviewWidth != width || mPreviewHeight != height) {
                 mPreviewWidth = width;
                 mPreviewHeight = height;
@@ -266,6 +259,11 @@
         Log.v(TAG, "SurfaceTexture ready.");
         mSurfaceTexture = surface;
         mController.onPreviewUIReady();
+        // Workaround for b/11168275, see b/10981460 for more details
+        if (mPreviewWidth != 0 && mPreviewHeight != 0) {
+            // Re-apply transform matrix for new surface texture
+            setTransformMatrix(mPreviewWidth, mPreviewHeight);
+        }
     }
 
     @Override