Recreate TextureView's display list on attach
Bug #9425270 When a TextureView is detached from its window and immediately re-attached, the display list is not destroyed but reused as is. TextureView will however destroy the layer and surface texture reference by the display list. The solution is to force TextureView to invalidate its display list on re-attach if it previously had a surface/layer pair. Change-Id: I475096ffa7e5709155c4c943bf1bfaaaedbd4a1d
This commit is contained in:
@@ -108,6 +108,7 @@ public class TextureView extends View {
|
||||
private HardwareLayer mLayer;
|
||||
private SurfaceTexture mSurface;
|
||||
private SurfaceTextureListener mListener;
|
||||
private boolean mHadSurface;
|
||||
|
||||
private boolean mOpaque = true;
|
||||
|
||||
@@ -202,6 +203,11 @@ public class TextureView extends View {
|
||||
Log.w(LOG_TAG, "A TextureView or a subclass can only be "
|
||||
+ "used with hardware acceleration enabled.");
|
||||
}
|
||||
|
||||
if (mHadSurface) {
|
||||
invalidate(true);
|
||||
mHadSurface = false;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -241,6 +247,8 @@ public class TextureView extends View {
|
||||
if (shouldRelease) mSurface.release();
|
||||
mSurface = null;
|
||||
mLayer = null;
|
||||
|
||||
mHadSurface = true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user