diff options
| author | Robert Carr <racarr@google.com> | 2020-02-21 12:04:31 -0800 |
|---|---|---|
| committer | Valerie Hau <vhau@google.com> | 2020-02-24 15:56:07 +0000 |
| commit | 6d16c8c340eace35b0ea40496918edae47082f85 (patch) | |
| tree | a0fd699117cc2c862022753bd1d5addd7c8cb9dc /core/java/android/view/SurfaceView.java | |
| parent | 14ebab3b195446eabadc8eafe30005c5cf5bb4d8 (diff) | |
RESTRICT AUTOMERGE - Explicitly disable BLAST for SurfaceControlViewHost surfaces
Right now it crashes because the ViewRoot expects to receive a
BLAST surface but the WindowlessWindowManager doesn't support it.
Adding support should be relatively trivial (coming in a follow-up)
but we haven't tested it yet so suggesting merging this patch for
today.
Bug: 150000636
Test: Existing tests pass
Change-Id: I4b36d190c8f4f022dada656e02452034113a4000
(cherry picked from commit b4727e0f55a83dae0dff09dcdcde92d9eabc71a5)
Diffstat (limited to 'core/java/android/view/SurfaceView.java')
| -rw-r--r-- | core/java/android/view/SurfaceView.java | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/core/java/android/view/SurfaceView.java b/core/java/android/view/SurfaceView.java index 341cf397a38f..fb7c04afeab0 100644 --- a/core/java/android/view/SurfaceView.java +++ b/core/java/android/view/SurfaceView.java @@ -392,7 +392,7 @@ public class SurfaceView extends View implements ViewRootImpl.SurfaceChangedCall * This gets called on a RenderThread worker thread, so members accessed here must * be protected by a lock. */ - final boolean useBLAST = WindowManagerGlobal.useBLAST(); + final boolean useBLAST = viewRoot.useBLAST(); viewRoot.registerRtFrameCallback(frame -> { try { final SurfaceControl.Transaction t = useBLAST ? @@ -930,7 +930,7 @@ public class SurfaceView extends View implements ViewRootImpl.SurfaceChangedCall mSurfaceHeight); } } else if ((layoutSizeChanged || positionChanged) && - WindowManagerGlobal.useBLAST()) { + viewRoot.useBLAST()) { viewRoot.setUseBLASTSyncTransaction(); } mTmpTransaction.setCornerRadius(mSurfaceControl, mCornerRadius); @@ -1132,9 +1132,8 @@ public class SurfaceView extends View implements ViewRootImpl.SurfaceChangedCall private void applySurfaceTransforms(SurfaceControl surface, SurfaceControl.Transaction t, Rect position, long frameNumber) { - if (frameNumber > 0 && !WindowManagerGlobal.useBLAST()) { - final ViewRootImpl viewRoot = getViewRootImpl(); - + final ViewRootImpl viewRoot = getViewRootImpl(); + if (frameNumber > 0 && viewRoot != null && !viewRoot.useBLAST()) { t.deferTransactionUntil(surface, viewRoot.getRenderSurfaceControl(), frameNumber); } @@ -1150,8 +1149,8 @@ public class SurfaceView extends View implements ViewRootImpl.SurfaceChangedCall } private void setParentSpaceRectangle(Rect position, long frameNumber) { - final boolean useBLAST = WindowManagerGlobal.useBLAST(); final ViewRootImpl viewRoot = getViewRootImpl(); + final boolean useBLAST = viewRoot.useBLAST(); final SurfaceControl.Transaction t = useBLAST ? viewRoot.getBLASTSyncTransaction() : mRtTransaction; @@ -1211,7 +1210,8 @@ public class SurfaceView extends View implements ViewRootImpl.SurfaceChangedCall @Override public void positionLost(long frameNumber) { - boolean useBLAST = WindowManagerGlobal.useBLAST(); + final ViewRootImpl viewRoot = getViewRootImpl(); + boolean useBLAST = viewRoot != null && viewRoot.useBLAST(); if (DEBUG) { Log.d(TAG, String.format("%d windowPositionLost, frameNr = %d", System.identityHashCode(this), frameNumber)); @@ -1222,8 +1222,6 @@ public class SurfaceView extends View implements ViewRootImpl.SurfaceChangedCall return; } - final ViewRootImpl viewRoot = getViewRootImpl(); - final SurfaceControl.Transaction t = useBLAST ? (viewRoot != null ? viewRoot.getBLASTSyncTransaction() : mRtTransaction) : mRtTransaction; |
