Improve drawing cache speed by selecting the correct opacity and keeping a 32 bits
format when the window is 32 bits.

Change-Id: I46762def67fa7d6a331a75fa8660c6422394ccf2
diff --git a/core/java/android/view/ViewRoot.java b/core/java/android/view/ViewRoot.java
index dba2e04..a6d644b 100644
--- a/core/java/android/view/ViewRoot.java
+++ b/core/java/android/view/ViewRoot.java
@@ -408,7 +408,7 @@
                 }
 
                 boolean restore = false;
-                if (attrs != null && mTranslator != null) {
+                if (mTranslator != null) {
                     restore = true;
                     attrs.backup();
                     mTranslator.translateWindowLayout(attrs);
@@ -422,7 +422,7 @@
                 mSoftInputMode = attrs.softInputMode;
                 mWindowAttributesChanged = true;
                 mAttachInfo.mRootView = view;
-                mAttachInfo.mScalingRequired = mTranslator == null ? false : true;
+                mAttachInfo.mScalingRequired = mTranslator != null;
                 mAttachInfo.mApplicationScale =
                         mTranslator == null ? 1.0f : mTranslator.applicationScale;
                 if (panelParentView != null) {
@@ -680,6 +680,7 @@
             // object is not initialized to its backing store, but soon it
             // will be (assuming the window is visible).
             attachInfo.mSurface = mSurface;
+            attachInfo.mTranslucentWindow = lp.format != PixelFormat.OPAQUE;
             attachInfo.mHasWindowFocus = false;
             attachInfo.mWindowVisibility = viewVisibility;
             attachInfo.mRecomputeGlobalAttributes = false;