Ensure view size gets updated after phone decors change.

Bug: 11661906
Change-Id: I63234a94b5a0bbd0cc6aa62ccd2642de09208403
diff --git a/src/com/android/camera/ui/CameraRootView.java b/src/com/android/camera/ui/CameraRootView.java
index 505549c..daaefc0 100644
--- a/src/com/android/camera/ui/CameraRootView.java
+++ b/src/com/android/camera/ui/CameraRootView.java
@@ -37,7 +37,7 @@
     private int mBottomMargin = 0;
     private int mLeftMargin = 0;
     private int mRightMargin = 0;
-    private Rect mCurrentInsets;
+    private final Rect mCurrentInsets = new Rect(0, 0, 0, 0);
     private int mOffset = 0;
     private Object mDisplayListener;
     private MyDisplayListener mListener;
@@ -53,19 +53,24 @@
 
     @Override
     protected boolean fitSystemWindows(Rect insets) {
-        mCurrentInsets = insets;
         // insets include status bar, navigation bar, etc
         // In this case, we are only concerned with the size of nav bar
-        if (mOffset > 0) {
-            return true;
+        if (mCurrentInsets.equals(insets)) {
+            // Local copy of the insets is up to date. No need to do anything.
+            return false;
         }
 
-        if (insets.bottom > 0) {
-            mOffset = insets.bottom;
-        } else if (insets.right > 0) {
-            mOffset = insets.right;
+        if (mOffset == 0) {
+            if (insets.bottom > 0) {
+                mOffset = insets.bottom;
+            } else if (insets.right > 0) {
+                mOffset = insets.right;
+            }
         }
-        return true;
+        mCurrentInsets.set(insets);
+        // Make sure onMeasure will be called to adapt to the new insets.
+        requestLayout();
+        return false;
     }
 
     public void initDisplayListener() {