From ec4f68276b4e37588736a6681b88f08002abc492 Mon Sep 17 00:00:00 2001 From: Vadim Caen Date: Thu, 12 Sep 2019 14:25:31 +0200 Subject: Clean up BlackFrame class Test: N/A Bug: N/A Change-Id: Icf19aba0b64eac18dd4c8a1fff49670f67f2043d --- .../java/com/android/server/wm/BlackFrame.java | 91 +++------------------- 1 file 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 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