summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohn Reck <jreck@google.com>2015-05-18 15:11:52 -0700
committerJohn Reck <jreck@google.com>2015-05-20 07:21:44 -0700
commit8bc511e4eb2f306350a6710dea5e5ec250fe696c (patch)
treee7713439fba6fdaf53584592b69d236a3a300ec3
parente20b22feb32d82a50a933141ecb8d03457a66f11 (diff)
downloadframeworks_base-8bc511e4eb2f306350a6710dea5e5ec250fe696c.zip
frameworks_base-8bc511e4eb2f306350a6710dea5e5ec250fe696c.tar.gz
frameworks_base-8bc511e4eb2f306350a6710dea5e5ec250fe696c.tar.bz2
Fix NPE in setSurfaceTexure
Bug: 20088412 Change-Id: I9b78636a7d89438c8924bb1bf2adba00e74366eb
-rw-r--r--core/java/android/view/TextureView.java10
1 files changed, 7 insertions, 3 deletions
diff --git a/core/java/android/view/TextureView.java b/core/java/android/view/TextureView.java
index d70712a..ad7d04e 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;