Merge "Create translucent hardware renderer if surface insets are non-zero" into lmp-mr1-dev
diff --git a/core/java/android/view/ViewRootImpl.java b/core/java/android/view/ViewRootImpl.java
index 81fc966..7e3e348 100644
--- a/core/java/android/view/ViewRootImpl.java
+++ b/core/java/android/view/ViewRootImpl.java
@@ -727,7 +727,10 @@
                     mAttachInfo.mHardwareRenderer.destroy();
                 }
 
-                final boolean translucent = attrs.format != PixelFormat.OPAQUE;
+                final Rect insets = attrs.surfaceInsets;
+                final boolean hasSurfaceInsets = insets.left == 0 || insets.right == 0
+                        || insets.top == 0 || insets.bottom == 0;
+                final boolean translucent = attrs.format != PixelFormat.OPAQUE || hasSurfaceInsets;
                 mAttachInfo.mHardwareRenderer = HardwareRenderer.create(mContext, translucent);
                 if (mAttachInfo.mHardwareRenderer != null) {
                     mAttachInfo.mHardwareRenderer.setName(attrs.getTitle().toString());