diff options
| author | Chet Haase <chet@google.com> | 2011-01-27 10:41:26 -0800 |
|---|---|---|
| committer | Android (Google) Code Review <android-gerrit@google.com> | 2011-01-27 10:41:26 -0800 |
| commit | 246bf85aaacbadf4e892270d714efcdb280a3de8 (patch) | |
| tree | 3d37f82be5422d4b92b65a864183294a2616927d | |
| parent | eea200a96a561d8eb9e26831aa6aaf7ddf6ad5a5 (diff) | |
| parent | f4ac547f868db7c8a358e1f6e3d8fcebb02dbd49 (diff) | |
| download | frameworks_base-246bf85aaacbadf4e892270d714efcdb280a3de8.zip frameworks_base-246bf85aaacbadf4e892270d714efcdb280a3de8.tar.gz frameworks_base-246bf85aaacbadf4e892270d714efcdb280a3de8.tar.bz2 | |
Merge "Fix NPE with display lists when view not attached" into honeycomb
| -rw-r--r-- | core/java/android/view/View.java | 17 | ||||
| -rw-r--r-- | core/java/android/view/ViewGroup.java | 2 |
2 files changed, 17 insertions, 2 deletions
diff --git a/core/java/android/view/View.java b/core/java/android/view/View.java index c64f564..5e8f31a 100644 --- a/core/java/android/view/View.java +++ b/core/java/android/view/View.java @@ -8227,6 +8227,21 @@ public class View implements Drawable.Callback, KeyEvent.Callback, Accessibility * @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 @@ -8237,7 +8252,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback, Accessibility * @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 1313b78..d0509b2 100644 --- a/core/java/android/view/ViewGroup.java +++ b/core/java/android/view/ViewGroup.java @@ -2381,7 +2381,7 @@ public abstract class ViewGroup extends View implements ViewParent, ViewManager } 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(); } } } |
