diff options
| -rw-r--r-- | services/core/java/com/android/server/wm/BlackFrame.java | 91 |
1 files changed, 12 insertions, 79 deletions
diff --git a/services/core/java/com/android/server/wm/BlackFrame.java b/services/core/java/com/android/server/wm/BlackFrame.java index 727850a087ab..a25aab2d69a8 100644 --- a/services/core/java/com/android/server/wm/BlackFrame.java +++ b/services/core/java/com/android/server/wm/BlackFrame.java @@ -20,7 +20,6 @@ import static com.android.server.wm.WindowManagerDebugConfig.SHOW_SURFACE_ALLOC; import static com.android.server.wm.WindowManagerDebugConfig.SHOW_TRANSACTIONS; import static com.android.server.wm.WindowManagerDebugConfig.TAG_WM; -import android.graphics.Matrix; import android.graphics.Rect; import android.util.Slog; import android.view.Surface.OutOfResourcesException; @@ -33,7 +32,7 @@ import java.util.function.Supplier; * Four black surfaces put together to make a black frame. */ public class BlackFrame { - class BlackSurface { + static class BlackSurface { final int left; final int top; final int layer; @@ -62,43 +61,12 @@ public class BlackFrame { if (SHOW_TRANSACTIONS || SHOW_SURFACE_ALLOC) Slog.i(TAG_WM, " BLACK " + surface + ": CREATE layer=" + layer); } - - void setAlpha(SurfaceControl.Transaction t, float alpha) { - t.setAlpha(surface, alpha); - } - - void setMatrix(SurfaceControl.Transaction t, Matrix matrix) { - mTmpMatrix.setTranslate(left, top); - mTmpMatrix.postConcat(matrix); - mTmpMatrix.getValues(mTmpFloats); - t.setPosition(surface, mTmpFloats[Matrix.MTRANS_X], - mTmpFloats[Matrix.MTRANS_Y]); - t.setMatrix(surface, - mTmpFloats[Matrix.MSCALE_X], mTmpFloats[Matrix.MSKEW_Y], - mTmpFloats[Matrix.MSKEW_X], mTmpFloats[Matrix.MSCALE_Y]); - if (false) { - Slog.i(TAG_WM, "Black Surface @ (" + left + "," + top + "): (" - + mTmpFloats[Matrix.MTRANS_X] + "," - + mTmpFloats[Matrix.MTRANS_Y] + ") matrix=[" - + mTmpFloats[Matrix.MSCALE_X] + "," - + mTmpFloats[Matrix.MSCALE_Y] + "][" - + mTmpFloats[Matrix.MSKEW_X] + "," - + mTmpFloats[Matrix.MSKEW_Y] + "]"); - } - } - - void clearMatrix(SurfaceControl.Transaction t) { - t.setMatrix(surface, 1, 0, 0, 1); - } } - final Rect mOuterRect; - final Rect mInnerRect; - final Matrix mTmpMatrix = new Matrix(); - final float[] mTmpFloats = new float[9]; - final BlackSurface[] mBlackSurfaces = new BlackSurface[4]; + private final Rect mOuterRect; + private final Rect mInnerRect; + private final BlackSurface[] mBlackSurfaces = new BlackSurface[4]; - final boolean mForceDefaultOrientation; private final Supplier<SurfaceControl.Transaction> mTransactionFactory; public void printTo(String prefix, PrintWriter pw) { @@ -121,7 +89,6 @@ public class BlackFrame { boolean success = false; mTransactionFactory = factory; - mForceDefaultOrientation = forceDefaultOrientation; // TODO: Why do we use 4 surfaces instead of just one big one behind the screenshot? // b/68253229 @@ -154,51 +121,17 @@ public class BlackFrame { } public void kill() { - if (mBlackSurfaces != null) { - SurfaceControl.Transaction t = mTransactionFactory.get(); - for (int i=0; i<mBlackSurfaces.length; i++) { - if (mBlackSurfaces[i] != null) { - if (SHOW_TRANSACTIONS || SHOW_SURFACE_ALLOC) Slog.i(TAG_WM, + SurfaceControl.Transaction t = mTransactionFactory.get(); + for (int i = 0; i < mBlackSurfaces.length; i++) { + if (mBlackSurfaces[i] != null) { + if (SHOW_TRANSACTIONS || SHOW_SURFACE_ALLOC) { + Slog.i(TAG_WM, " BLACK " + mBlackSurfaces[i].surface + ": DESTROY"); - t.remove(mBlackSurfaces[i].surface); - mBlackSurfaces[i] = null; } - } - t.apply(); - } - } - - public void hide(SurfaceControl.Transaction t) { - if (mBlackSurfaces != null) { - for (int i=0; i<mBlackSurfaces.length; i++) { - if (mBlackSurfaces[i] != null) { - t.hide(mBlackSurfaces[i].surface); - } - } - } - } - - public void setAlpha(SurfaceControl.Transaction t, float alpha) { - for (int i=0; i<mBlackSurfaces.length; i++) { - if (mBlackSurfaces[i] != null) { - mBlackSurfaces[i].setAlpha(t, alpha); - } - } - } - - public void setMatrix(SurfaceControl.Transaction t, Matrix matrix) { - for (int i=0; i<mBlackSurfaces.length; i++) { - if (mBlackSurfaces[i] != null) { - mBlackSurfaces[i].setMatrix(t, matrix); - } - } - } - - public void clearMatrix(SurfaceControl.Transaction t) { - for (int i=0; i<mBlackSurfaces.length; i++) { - if (mBlackSurfaces[i] != null) { - mBlackSurfaces[i].clearMatrix(t); + t.remove(mBlackSurfaces[i].surface); + mBlackSurfaces[i] = null; } } + t.apply(); } } |