Fix camera preview being squished

Bug: 8585407
Change-Id: Ie9a3a44c58599f4cccfa0017d48749e9883af6cd
diff --git a/src/com/android/camera/PhotoModule.java b/src/com/android/camera/PhotoModule.java
index 7c0c15a..8759c19 100644
--- a/src/com/android/camera/PhotoModule.java
+++ b/src/com/android/camera/PhotoModule.java
@@ -590,6 +590,7 @@
         if (mFocusManager != null) mFocusManager.setPreviewSize(width, height);
         ((CameraScreenNail) mActivity.mCameraScreenNail).setPreviewFrameLayoutSize(
                 previewWidth, previewHeight);
+        mActivity.notifyScreenNailChanged();
     }
 
     private void resetExposureCompensation() {
diff --git a/src/com/android/camera/PhotoUI.java b/src/com/android/camera/PhotoUI.java
index 29ebd6a..53fdc96 100644
--- a/src/com/android/camera/PhotoUI.java
+++ b/src/com/android/camera/PhotoUI.java
@@ -144,7 +144,6 @@
             }
         }
 
-        mRootView.addOnLayoutChangeListener(mLayoutListener);
     }
 
     public View getRootView() {
@@ -259,6 +258,7 @@
         mShutterButton.setImageResource(R.drawable.btn_new_shutter);
         mShutterButton.setOnShutterButtonListener(mController);
         mShutterButton.setVisibility(View.VISIBLE);
+        mRootView.addOnLayoutChangeListener(mLayoutListener);
     }
 
     // called from onResume every other time
@@ -270,6 +270,7 @@
         if (mMenu != null) {
             mMenu.reloadPreferences();
         }
+        mRootView.addOnLayoutChangeListener(mLayoutListener);
     }
 
     public void initializeZoom(Camera.Parameters params) {