diff options
| -rw-r--r-- | core/java/android/view/TextureView.java | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/core/java/android/view/TextureView.java b/core/java/android/view/TextureView.java index d70712ac327b..ad7d04e1fe1d 100644 --- a/core/java/android/view/TextureView.java +++ b/core/java/android/view/TextureView.java @@ -730,9 +730,13 @@ public class TextureView extends View { } mSurface = surfaceTexture; - // If the view is visible, update the listener in the new surface to use - // the existing listener in the view. - if (((mViewFlags & VISIBILITY_MASK) == VISIBLE)) { + /* + * If the view is visible and we already made a layer, update the + * listener in the new surface to use the existing listener in the view. + * Otherwise this will be called when the view becomes visible or the + * layer is created + */ + if (((mViewFlags & VISIBILITY_MASK) == VISIBLE) && mLayer != null) { mSurface.setOnFrameAvailableListener(mUpdateListener, mAttachInfo.mHandler); } mUpdateSurface = true; |