AI 143415: am: CL 143414 am: CL 143413 Fix issue #1742588 (Crash phone while switching between keyboard settings and Gmail)
  Original author: hackbod
  Merged from: //branches/cupcake/...
  Original author: android-build
  Merged from: //branches/donutburger/...

Automated import of CL 143415
diff --git a/policy/com/android/internal/policy/impl/PhoneWindowManager.java b/policy/com/android/internal/policy/impl/PhoneWindowManager.java
index bf0f815..cc0588d 100644
--- a/policy/com/android/internal/policy/impl/PhoneWindowManager.java
+++ b/policy/com/android/internal/policy/impl/PhoneWindowManager.java
@@ -245,6 +245,7 @@
 
         public void update() {
             ContentResolver resolver = mContext.getContentResolver();
+            boolean updateRotation = false;
             synchronized (mLock) {
                 mEndcallBehavior = Settings.System.getInt(resolver,
                         Settings.System.END_BUTTON_BEHAVIOR, DEFAULT_ENDCALL_BEHAVIOR);
@@ -261,9 +262,12 @@
                 boolean hasSoftInput = imId != null && imId.length() > 0;
                 if (mHasSoftInput != hasSoftInput) {
                     mHasSoftInput = hasSoftInput;
-                    updateRotation(0);
+                    updateRotation = true;
                 }
             }
+            if (updateRotation) {
+                updateRotation(0);
+            }
         }
     }