am 19312cfe: am 246bf85a: Merge "Fix NPE with display lists when view not attached" into honeycomb

* commit '19312cfef15608fca2c8403dc240e8ec4f54d6b7':
  Fix NPE with display lists when view not attached
diff --git a/core/java/android/view/View.java b/core/java/android/view/View.java
index fc999b0..6d2292f 100644
--- a/core/java/android/view/View.java
+++ b/core/java/android/view/View.java
@@ -8268,6 +8268,21 @@
      * @hide
      */
     protected void dispatchGetDisplayList() {}
+
+    /**
+     * A view that is not attached or hardware accelerated cannot create a display list.
+     * This method checks these conditions and returns the appropriate result.
+     *
+     * @return true if view has the ability to create a display list, false otherwise.
+     *
+     * @hide
+     */
+    public boolean canHaveDisplayList() {
+        if (mAttachInfo == null || mAttachInfo.mHardwareRenderer == null) {
+            return false;
+        }
+        return true;
+    }
     
     /**
      * <p>Returns a display list that can be used to draw this view again
@@ -8278,7 +8293,7 @@
      * @hide
      */
     public DisplayList getDisplayList() {
-        if (mAttachInfo == null || mAttachInfo.mHardwareRenderer == null) {
+        if (!canHaveDisplayList()) {
             return null;
         }
 
diff --git a/core/java/android/view/ViewGroup.java b/core/java/android/view/ViewGroup.java
index 08a3272..58d4f49 100644
--- a/core/java/android/view/ViewGroup.java
+++ b/core/java/android/view/ViewGroup.java
@@ -2394,7 +2394,7 @@
                 } else if (layerType == LAYER_TYPE_NONE) {
                     // Delay getting the display list until animation-driven alpha values are
                     // set up and possibly passed on to the view
-                    hasDisplayList = true;
+                    hasDisplayList = child.canHaveDisplayList();
                 }
             }
         }