Loading core/java/android/view/SurfaceView.java +103 −106 Original line number Diff line number Diff line Loading @@ -724,9 +724,9 @@ public class SurfaceView extends View implements ViewRootImpl.SurfaceChangedCall private void releaseSurfaces(boolean releaseSurfacePackage) { mSurfaceAlpha = 1f; mSurface.destroy(); synchronized (mSurfaceControlLock) { mSurface.destroy(); if (mBlastBufferQueue != null) { mBlastBufferQueue.destroy(); mBlastBufferQueue = null; Loading Loading @@ -775,6 +775,8 @@ public class SurfaceView extends View implements ViewRootImpl.SurfaceChangedCall Transaction surfaceUpdateTransaction) { boolean realSizeChanged = false; mSurfaceLock.lock(); try { mDrawingStopped = !mVisible; if (DEBUG) Log.i(TAG, System.identityHashCode(this) + " " Loading Loading @@ -814,6 +816,7 @@ public class SurfaceView extends View implements ViewRootImpl.SurfaceChangedCall setBufferSize(surfaceUpdateTransaction); } if (sizeChanged || creating || !isHardwareAccelerated()) { // Set a window crop when creating the surface or changing its size to // crop the buffer to the surface size since the buffer producer may // use SCALING_MODE_SCALE and submit a larger size than the surface Loading Loading @@ -851,6 +854,7 @@ public class SurfaceView extends View implements ViewRootImpl.SurfaceChangedCall } applyTransactionOnVriDraw(surfaceUpdateTransaction); updateEmbeddedAccessibilityMatrix(false); mSurfaceFrame.left = 0; mSurfaceFrame.top = 0; if (translator == null) { Loading @@ -867,7 +871,9 @@ public class SurfaceView extends View implements ViewRootImpl.SurfaceChangedCall || mLastSurfaceHeight != surfaceHeight; mLastSurfaceWidth = surfaceWidth; mLastSurfaceHeight = surfaceHeight; } finally { mSurfaceLock.unlock(); } return realSizeChanged; } Loading Loading @@ -1133,30 +1139,21 @@ public class SurfaceView extends View implements ViewRootImpl.SurfaceChangedCall * Surface for compatibility reasons. */ private void copySurface(boolean surfaceControlCreated, boolean bufferSizeChanged) { if (surfaceControlCreated) { mSurface.copyFrom(mBlastBufferQueue); } if (bufferSizeChanged && getContext().getApplicationInfo().targetSdkVersion < Build.VERSION_CODES.O) { // Some legacy applications use the underlying native {@link Surface} object // as a key to whether anything has changed. In these cases, updates to the // existing {@link Surface} will be ignored when the size changes. // Therefore, we must explicitly recreate the {@link Surface} in these // cases. boolean needsWorkaround = bufferSizeChanged && getContext().getApplicationInfo().targetSdkVersion < Build.VERSION_CODES.O; if (!surfaceControlCreated && !needsWorkaround) { return; } mSurfaceLock.lock(); try { if (surfaceControlCreated) { mSurface.copyFrom(mBlastBufferQueue); } if (needsWorkaround) { if (mBlastBufferQueue != null) { mSurface.transferFrom(mBlastBufferQueue.createSurfaceWithHandle()); } } } finally { mSurfaceLock.unlock(); } } private void setBufferSize(Transaction transaction) { Loading Loading
core/java/android/view/SurfaceView.java +103 −106 Original line number Diff line number Diff line Loading @@ -724,9 +724,9 @@ public class SurfaceView extends View implements ViewRootImpl.SurfaceChangedCall private void releaseSurfaces(boolean releaseSurfacePackage) { mSurfaceAlpha = 1f; mSurface.destroy(); synchronized (mSurfaceControlLock) { mSurface.destroy(); if (mBlastBufferQueue != null) { mBlastBufferQueue.destroy(); mBlastBufferQueue = null; Loading Loading @@ -775,6 +775,8 @@ public class SurfaceView extends View implements ViewRootImpl.SurfaceChangedCall Transaction surfaceUpdateTransaction) { boolean realSizeChanged = false; mSurfaceLock.lock(); try { mDrawingStopped = !mVisible; if (DEBUG) Log.i(TAG, System.identityHashCode(this) + " " Loading Loading @@ -814,6 +816,7 @@ public class SurfaceView extends View implements ViewRootImpl.SurfaceChangedCall setBufferSize(surfaceUpdateTransaction); } if (sizeChanged || creating || !isHardwareAccelerated()) { // Set a window crop when creating the surface or changing its size to // crop the buffer to the surface size since the buffer producer may // use SCALING_MODE_SCALE and submit a larger size than the surface Loading Loading @@ -851,6 +854,7 @@ public class SurfaceView extends View implements ViewRootImpl.SurfaceChangedCall } applyTransactionOnVriDraw(surfaceUpdateTransaction); updateEmbeddedAccessibilityMatrix(false); mSurfaceFrame.left = 0; mSurfaceFrame.top = 0; if (translator == null) { Loading @@ -867,7 +871,9 @@ public class SurfaceView extends View implements ViewRootImpl.SurfaceChangedCall || mLastSurfaceHeight != surfaceHeight; mLastSurfaceWidth = surfaceWidth; mLastSurfaceHeight = surfaceHeight; } finally { mSurfaceLock.unlock(); } return realSizeChanged; } Loading Loading @@ -1133,30 +1139,21 @@ public class SurfaceView extends View implements ViewRootImpl.SurfaceChangedCall * Surface for compatibility reasons. */ private void copySurface(boolean surfaceControlCreated, boolean bufferSizeChanged) { if (surfaceControlCreated) { mSurface.copyFrom(mBlastBufferQueue); } if (bufferSizeChanged && getContext().getApplicationInfo().targetSdkVersion < Build.VERSION_CODES.O) { // Some legacy applications use the underlying native {@link Surface} object // as a key to whether anything has changed. In these cases, updates to the // existing {@link Surface} will be ignored when the size changes. // Therefore, we must explicitly recreate the {@link Surface} in these // cases. boolean needsWorkaround = bufferSizeChanged && getContext().getApplicationInfo().targetSdkVersion < Build.VERSION_CODES.O; if (!surfaceControlCreated && !needsWorkaround) { return; } mSurfaceLock.lock(); try { if (surfaceControlCreated) { mSurface.copyFrom(mBlastBufferQueue); } if (needsWorkaround) { if (mBlastBufferQueue != null) { mSurface.transferFrom(mBlastBufferQueue.createSurfaceWithHandle()); } } } finally { mSurfaceLock.unlock(); } } private void setBufferSize(Transaction transaction) { Loading