Flip TextureView's layer after calling setSurfaceTexture()
Bug #6531172
Changing the surface texture would not update the layer properties
nor its transform matrix.
Change-Id: I54e155a410d7e72f1a8edf3a4ab0034bf764ae28
diff --git a/core/java/android/view/TextureView.java b/core/java/android/view/TextureView.java
index 411aed3..a719a01 100644
--- a/core/java/android/view/TextureView.java
+++ b/core/java/android/view/TextureView.java
@@ -374,6 +374,14 @@
// tell mLayer about it and set the SurfaceTexture to use the
// current view size.
mUpdateSurface = false;
+
+ // Since we are updating the layer, force an update to ensure its
+ // parameters are correct (width, height, transform, etc.)
+ synchronized (mLock) {
+ mUpdateLayer = true;
+ }
+ mMatrixChanged = true;
+
mAttachInfo.mHardwareRenderer.setSurfaceTexture(mLayer, mSurface);
nSetDefaultBufferSize(mSurface, getWidth(), getHeight());
}
@@ -471,7 +479,7 @@
}
private void applyTransformMatrix() {
- if (mMatrixChanged) {
+ if (mMatrixChanged && mLayer != null) {
mLayer.setTransform(mMatrix);
mMatrixChanged = false;
}