Merge "Fix issue #3382992: IME close animation stutters from URL bar" into honeycomb
diff --git a/core/java/android/view/View.java b/core/java/android/view/View.java
index 4c40653..2e6664b 100644
--- a/core/java/android/view/View.java
+++ b/core/java/android/view/View.java
@@ -11398,6 +11398,11 @@
         }
     }
 
+    /** @hide */
+    public void hackTurnOffWindowResizeAnim(boolean off) {
+        mAttachInfo.mTurnOffWindowResizeAnim = off;
+    }
+    
     /**
      * Interface definition for a callback to be invoked when a key event is
      * dispatched to this view. The callback will be invoked before the key
@@ -11664,6 +11669,11 @@
         boolean mScalingRequired;
 
         /**
+         * If set, ViewRoot doesn't use its lame animation for when the window resizes.
+         */
+        boolean mTurnOffWindowResizeAnim;
+        
+        /**
          * Left position of this view's window
          */
         int mWindowLeft;
diff --git a/core/java/android/view/ViewRoot.java b/core/java/android/view/ViewRoot.java
index 042095a..41fc6c6 100644
--- a/core/java/android/view/ViewRoot.java
+++ b/core/java/android/view/ViewRoot.java
@@ -772,6 +772,7 @@
                 if (!mAttachInfo.mContentInsets.equals(mPendingContentInsets)) {
                     if (mWidth > 0 && mHeight > 0 &&
                             mSurface != null && mSurface.isValid() &&
+                            !mAttachInfo.mTurnOffWindowResizeAnim &&
                             mAttachInfo.mHardwareRenderer != null &&
                             mAttachInfo.mHardwareRenderer.isEnabled() &&
                             lp != null && !PixelFormat.formatHasAlpha(lp.format)) {
diff --git a/policy/src/com/android/internal/policy/impl/PhoneWindow.java b/policy/src/com/android/internal/policy/impl/PhoneWindow.java
index 88f30ed..8afb53e 100644
--- a/policy/src/com/android/internal/policy/impl/PhoneWindow.java
+++ b/policy/src/com/android/internal/policy/impl/PhoneWindow.java
@@ -2026,6 +2026,14 @@
             }
         }
 
+        @Override
+        public void setBackgroundDrawable(Drawable d) {
+            super.setBackgroundDrawable(d);
+            if (getWindowToken() != null) {
+                updateWindowResizeState();
+            }
+        }
+
         public void setWindowFrame(Drawable drawable) {
             if (getForeground() != drawable) {
                 setForeground(drawable);
@@ -2126,10 +2134,18 @@
             }
         }
 
+        void updateWindowResizeState() {
+            Drawable bg = getBackground();
+            hackTurnOffWindowResizeAnim(bg == null || bg.getOpacity()
+                    != PixelFormat.OPAQUE);
+        }
+        
         @Override
         protected void onAttachedToWindow() {
             super.onAttachedToWindow();
             
+            updateWindowResizeState();
+            
             final Callback cb = getCallback();
             if (cb != null && mFeatureId < 0) {
                 cb.onAttachedToWindow();