Loading core/java/android/view/TextureView.java +30 −18 Original line number Diff line number Diff line Loading @@ -218,15 +218,32 @@ public class TextureView extends View { /** @hide */ @Override protected void onDetachedFromWindowInternal() { destroySurface(); destroyHardwareLayer(); releaseSurfaceTexture(); super.onDetachedFromWindowInternal(); } private void destroySurface() { /** * @hide */ @Override protected void destroyHardwareResources() { destroyHardwareLayer(); mUpdateSurface = mSurface != null; } private void destroyHardwareLayer() { if (mLayer != null) { mLayer.detachSurfaceTexture(); mLayer.destroy(); mLayer = null; mMatrixChanged = true; } } private void releaseSurfaceTexture() { boolean shouldRelease = true; if (mListener != null) { shouldRelease = mListener.onSurfaceTextureDestroyed(mSurface); } Loading @@ -235,17 +252,12 @@ public class TextureView extends View { nDestroyNativeWindow(); } mLayer.destroy(); if (shouldRelease) mSurface.release(); if (shouldRelease) { mSurface.release(); } mSurface = null; mLayer = null; // Make sure if/when new layer gets re-created, transform matrix will // be re-applied. mMatrixChanged = true; mHadSurface = true; } } /** * The layer type of a TextureView is ignored since a TextureView is always Loading Loading @@ -366,9 +378,9 @@ public class TextureView extends View { // Create a new SurfaceTexture for the layer. mSurface = new SurfaceTexture(false); mLayer.setSurfaceTexture(mSurface); nCreateNativeWindow(mSurface); } mSurface.setDefaultBufferSize(getWidth(), getHeight()); nCreateNativeWindow(mSurface); mSurface.setOnFrameAvailableListener(mUpdateListener, mAttachInfo.mHandler); Loading Loading
core/java/android/view/TextureView.java +30 −18 Original line number Diff line number Diff line Loading @@ -218,15 +218,32 @@ public class TextureView extends View { /** @hide */ @Override protected void onDetachedFromWindowInternal() { destroySurface(); destroyHardwareLayer(); releaseSurfaceTexture(); super.onDetachedFromWindowInternal(); } private void destroySurface() { /** * @hide */ @Override protected void destroyHardwareResources() { destroyHardwareLayer(); mUpdateSurface = mSurface != null; } private void destroyHardwareLayer() { if (mLayer != null) { mLayer.detachSurfaceTexture(); mLayer.destroy(); mLayer = null; mMatrixChanged = true; } } private void releaseSurfaceTexture() { boolean shouldRelease = true; if (mListener != null) { shouldRelease = mListener.onSurfaceTextureDestroyed(mSurface); } Loading @@ -235,17 +252,12 @@ public class TextureView extends View { nDestroyNativeWindow(); } mLayer.destroy(); if (shouldRelease) mSurface.release(); if (shouldRelease) { mSurface.release(); } mSurface = null; mLayer = null; // Make sure if/when new layer gets re-created, transform matrix will // be re-applied. mMatrixChanged = true; mHadSurface = true; } } /** * The layer type of a TextureView is ignored since a TextureView is always Loading Loading @@ -366,9 +378,9 @@ public class TextureView extends View { // Create a new SurfaceTexture for the layer. mSurface = new SurfaceTexture(false); mLayer.setSurfaceTexture(mSurface); nCreateNativeWindow(mSurface); } mSurface.setDefaultBufferSize(getWidth(), getHeight()); nCreateNativeWindow(mSurface); mSurface.setOnFrameAvailableListener(mUpdateListener, mAttachInfo.mHandler); Loading