Loading core/java/android/view/InsetsAnimationControlImpl.java +8 −4 Original line number Original line Diff line number Diff line Loading @@ -282,10 +282,14 @@ public class InsetsAnimationControlImpl implements WindowInsetsAnimationControll if (leash != null) { if (leash != null) { // TODO: use a better interpolation for fade. // TODO: use a better interpolation for fade. alpha = mFade ? ((float) inset / maxInset * 0.3f + 0.7f) : alpha; alpha = mFade ? ((float) inset / maxInset * 0.3f + 0.7f) : alpha; surfaceParams.add(new SurfaceParams(leash, side == ISIDE_FLOATING ? 1 : alpha, SurfaceParams params = new SurfaceParams.Builder(leash) mTmpMatrix, null /* windowCrop */, 0 /* layer */, 0f /* cornerRadius*/, .withAlpha(side == ISIDE_FLOATING ? 1 : alpha) side == ISIDE_FLOATING ? state.getSource(source.getType()).isVisible() .withMatrix(mTmpMatrix) : inset != 0 /* visible */)); .withVisibility(side == ISIDE_FLOATING ? state.getSource(source.getType()).isVisible() : inset != 0 /* visible */) .build(); surfaceParams.add(params); } } } } } } Loading core/java/android/view/SyncRtSurfaceTransactionApplier.java +24 −32 Original line number Original line Diff line number Diff line Loading @@ -36,7 +36,8 @@ public class SyncRtSurfaceTransactionApplier { public static final int FLAG_WINDOW_CROP = 1 << 2; public static final int FLAG_WINDOW_CROP = 1 << 2; public static final int FLAG_LAYER = 1 << 3; public static final int FLAG_LAYER = 1 << 3; public static final int FLAG_CORNER_RADIUS = 1 << 4; public static final int FLAG_CORNER_RADIUS = 1 << 4; public static final int FLAG_VISIBILITY = 1 << 5; public static final int FLAG_BACKGROUND_BLUR_RADIUS = 1 << 5; public static final int FLAG_VISIBILITY = 1 << 6; private SurfaceControl mTargetSc; private SurfaceControl mTargetSc; private final ViewRootImpl mTargetViewRootImpl; private final ViewRootImpl mTargetViewRootImpl; Loading Loading @@ -108,6 +109,9 @@ public class SyncRtSurfaceTransactionApplier { if ((params.flags & FLAG_CORNER_RADIUS) != 0) { if ((params.flags & FLAG_CORNER_RADIUS) != 0) { t.setCornerRadius(params.surface, params.cornerRadius); t.setCornerRadius(params.surface, params.cornerRadius); } } if ((params.flags & FLAG_BACKGROUND_BLUR_RADIUS) != 0) { t.setBackgroundBlurRadius(params.surface, params.backgroundBlurRadius); } if ((params.flags & FLAG_VISIBILITY) != 0) { if ((params.flags & FLAG_VISIBILITY) != 0) { if (params.visible) { if (params.visible) { t.show(params.surface); t.show(params.surface); Loading Loading @@ -153,6 +157,7 @@ public class SyncRtSurfaceTransactionApplier { int flags; int flags; float alpha; float alpha; float cornerRadius; float cornerRadius; int backgroundBlurRadius; Matrix matrix; Matrix matrix; Rect windowCrop; Rect windowCrop; int layer; int layer; Loading Loading @@ -215,6 +220,16 @@ public class SyncRtSurfaceTransactionApplier { return this; return this; } } /** * @param radius the Radius for blur to apply to the background surfaces. * @return this Builder */ public Builder withBackgroundBlur(int radius) { this.backgroundBlurRadius = radius; flags |= FLAG_BACKGROUND_BLUR_RADIUS; return this; } /** /** * @param visible The visibility to apply to the surface. * @param visible The visibility to apply to the surface. * @return this Builder * @return this Builder Loading @@ -230,12 +245,13 @@ public class SyncRtSurfaceTransactionApplier { */ */ public SurfaceParams build() { public SurfaceParams build() { return new SurfaceParams(surface, flags, alpha, matrix, windowCrop, layer, return new SurfaceParams(surface, flags, alpha, matrix, windowCrop, layer, cornerRadius, visible); cornerRadius, backgroundBlurRadius, visible); } } } } private SurfaceParams(SurfaceControl surface, int params, float alpha, Matrix matrix, private SurfaceParams(SurfaceControl surface, int params, float alpha, Matrix matrix, Rect windowCrop, int layer, float cornerRadius, boolean visible) { Rect windowCrop, int layer, float cornerRadius, int backgroundBlurRadius, boolean visible) { this.flags = params; this.flags = params; this.surface = surface; this.surface = surface; this.alpha = alpha; this.alpha = alpha; Loading @@ -243,34 +259,7 @@ public class SyncRtSurfaceTransactionApplier { this.windowCrop = new Rect(windowCrop); this.windowCrop = new Rect(windowCrop); this.layer = layer; this.layer = layer; this.cornerRadius = cornerRadius; this.cornerRadius = cornerRadius; this.visible = visible; this.backgroundBlurRadius = backgroundBlurRadius; } /** * Constructs surface parameters to be applied when the current view state gets pushed to * RenderThread. * * @param surface The surface to modify. * @param alpha Alpha to apply. * @param matrix Matrix to apply. * @param windowCrop Crop to apply. * @param layer The layer to apply. * @param cornerRadius The corner radius to apply. * @param visible The visibility to apply. * * @deprecated Use {@link SurfaceParams.Builder} to create an instance. */ @Deprecated public SurfaceParams(SurfaceControl surface, float alpha, Matrix matrix, Rect windowCrop, int layer, float cornerRadius, boolean visible) { this.flags = FLAG_ALL; this.surface = surface; this.alpha = alpha; this.matrix = new Matrix(matrix); this.windowCrop = windowCrop != null ? new Rect(windowCrop) : null; this.layer = layer; this.cornerRadius = cornerRadius; this.visible = visible; this.visible = visible; } } Loading @@ -283,7 +272,10 @@ public class SyncRtSurfaceTransactionApplier { public final float alpha; public final float alpha; @VisibleForTesting @VisibleForTesting final float cornerRadius; public final float cornerRadius; @VisibleForTesting public final int backgroundBlurRadius; @VisibleForTesting @VisibleForTesting public final Matrix matrix; public final Matrix matrix; Loading packages/SystemUI/shared/src/com/android/systemui/shared/system/SurfaceControlCompat.java +14 −1 Original line number Original line Diff line number Diff line Loading @@ -17,11 +17,24 @@ package com.android.systemui.shared.system; package com.android.systemui.shared.system; import android.view.SurfaceControl; import android.view.SurfaceControl; import android.view.View; import android.view.ViewRootImpl; public class SurfaceControlCompat { public class SurfaceControlCompat { SurfaceControl mSurfaceControl; final SurfaceControl mSurfaceControl; public SurfaceControlCompat(SurfaceControl surfaceControl) { public SurfaceControlCompat(SurfaceControl surfaceControl) { mSurfaceControl = surfaceControl; mSurfaceControl = surfaceControl; } } public SurfaceControlCompat(View v) { ViewRootImpl viewRootImpl = v.getViewRootImpl(); mSurfaceControl = viewRootImpl != null ? viewRootImpl.getSurfaceControl() : null; } public boolean isValid() { return mSurfaceControl != null && mSurfaceControl.isValid(); } } } packages/SystemUI/shared/src/com/android/systemui/shared/system/SyncRtSurfaceTransactionApplierCompat.java +143 −7 Original line number Original line Diff line number Diff line Loading @@ -38,6 +38,15 @@ import java.util.function.Consumer; */ */ public class SyncRtSurfaceTransactionApplierCompat { public class SyncRtSurfaceTransactionApplierCompat { public static final int FLAG_ALL = 0xffffffff; public static final int FLAG_ALPHA = 1; public static final int FLAG_MATRIX = 1 << 1; public static final int FLAG_WINDOW_CROP = 1 << 2; public static final int FLAG_LAYER = 1 << 3; public static final int FLAG_CORNER_RADIUS = 1 << 4; public static final int FLAG_BACKGROUND_BLUR_RADIUS = 1 << 5; public static final int FLAG_VISIBILITY = 1 << 6; private static final int MSG_UPDATE_SEQUENCE_NUMBER = 0; private static final int MSG_UPDATE_SEQUENCE_NUMBER = 0; private final SurfaceControl mBarrierSurfaceControl; private final SurfaceControl mBarrierSurfaceControl; Loading Loading @@ -143,14 +152,31 @@ public class SyncRtSurfaceTransactionApplierCompat { public static void applyParams(TransactionCompat t, public static void applyParams(TransactionCompat t, SyncRtSurfaceTransactionApplierCompat.SurfaceParams params) { SyncRtSurfaceTransactionApplierCompat.SurfaceParams params) { if ((params.flags & FLAG_MATRIX) != 0) { t.setMatrix(params.surface, params.matrix); t.setMatrix(params.surface, params.matrix); if (params.windowCrop != null) { } if ((params.flags & FLAG_WINDOW_CROP) != 0) { t.setWindowCrop(params.surface, params.windowCrop); t.setWindowCrop(params.surface, params.windowCrop); } } if ((params.flags & FLAG_ALPHA) != 0) { t.setAlpha(params.surface, params.alpha); t.setAlpha(params.surface, params.alpha); } if ((params.flags & FLAG_LAYER) != 0) { t.setLayer(params.surface, params.layer); t.setLayer(params.surface, params.layer); } if ((params.flags & FLAG_CORNER_RADIUS) != 0) { t.setCornerRadius(params.surface, params.cornerRadius); t.setCornerRadius(params.surface, params.cornerRadius); } if ((params.flags & FLAG_BACKGROUND_BLUR_RADIUS) != 0) { t.setBackgroundBlurRadius(params.surface, params.backgroundBlurRadius); } if ((params.flags & FLAG_VISIBILITY) != 0) { if (params.visible) { t.show(params.surface); t.show(params.surface); } else { t.hide(params.surface); } } } } /** /** Loading Loading @@ -183,6 +209,102 @@ public class SyncRtSurfaceTransactionApplierCompat { } } public static class SurfaceParams { public static class SurfaceParams { public static class Builder { final SurfaceControlCompat surface; int flags; float alpha; float cornerRadius; int backgroundBlurRadius; Matrix matrix; Rect windowCrop; int layer; boolean visible; /** * @param surface The surface to modify. */ public Builder(SurfaceControlCompat surface) { this.surface = surface; } /** * @param alpha The alpha value to apply to the surface. * @return this Builder */ public Builder withAlpha(float alpha) { this.alpha = alpha; flags |= FLAG_ALPHA; return this; } /** * @param matrix The matrix to apply to the surface. * @return this Builder */ public Builder withMatrix(Matrix matrix) { this.matrix = matrix; flags |= FLAG_MATRIX; return this; } /** * @param windowCrop The window crop to apply to the surface. * @return this Builder */ public Builder withWindowCrop(Rect windowCrop) { this.windowCrop = windowCrop; flags |= FLAG_WINDOW_CROP; return this; } /** * @param layer The layer to assign the surface. * @return this Builder */ public Builder withLayer(int layer) { this.layer = layer; flags |= FLAG_LAYER; return this; } /** * @param radius the Radius for rounded corners to apply to the surface. * @return this Builder */ public Builder withCornerRadius(float radius) { this.cornerRadius = radius; flags |= FLAG_CORNER_RADIUS; return this; } /** * @param radius the Radius for blur to apply to the background surfaces. * @return this Builder */ public Builder withBackgroundBlur(int radius) { this.backgroundBlurRadius = radius; flags |= FLAG_BACKGROUND_BLUR_RADIUS; return this; } /** * @param visible The visibility to apply to the surface. * @return this Builder */ public Builder withVisibility(boolean visible) { this.visible = visible; flags |= FLAG_VISIBILITY; return this; } /** * @return a new SurfaceParams instance */ public SurfaceParams build() { return new SurfaceParams(surface, flags, alpha, matrix, windowCrop, layer, cornerRadius, backgroundBlurRadius, visible); } } /** /** * Constructs surface parameters to be applied when the current view state gets pushed to * Constructs surface parameters to be applied when the current view state gets pushed to Loading @@ -195,19 +317,33 @@ public class SyncRtSurfaceTransactionApplierCompat { */ */ public SurfaceParams(SurfaceControlCompat surface, float alpha, Matrix matrix, public SurfaceParams(SurfaceControlCompat surface, float alpha, Matrix matrix, Rect windowCrop, int layer, float cornerRadius) { Rect windowCrop, int layer, float cornerRadius) { this(surface, FLAG_ALL & ~(FLAG_VISIBILITY | FLAG_BACKGROUND_BLUR_RADIUS), alpha, matrix, windowCrop, layer, cornerRadius, 0 /* backgroundBlurRadius */, true); } private SurfaceParams(SurfaceControlCompat surface, int flags, float alpha, Matrix matrix, Rect windowCrop, int layer, float cornerRadius, int backgroundBlurRadius, boolean visible) { this.flags = flags; this.surface = surface; this.surface = surface; this.alpha = alpha; this.alpha = alpha; this.matrix = new Matrix(matrix); this.matrix = new Matrix(matrix); this.windowCrop = windowCrop != null ? new Rect(windowCrop) : null; this.windowCrop = windowCrop != null ? new Rect(windowCrop) : null; this.layer = layer; this.layer = layer; this.cornerRadius = cornerRadius; this.cornerRadius = cornerRadius; this.backgroundBlurRadius = backgroundBlurRadius; this.visible = visible; } } private final int flags; public final SurfaceControlCompat surface; public final SurfaceControlCompat surface; public final float alpha; public final float alpha; final float cornerRadius; public final float cornerRadius; public final int backgroundBlurRadius; public final Matrix matrix; public final Matrix matrix; public final Rect windowCrop; public final Rect windowCrop; public final int layer; public final int layer; public final boolean visible; } } } } packages/SystemUI/shared/src/com/android/systemui/shared/system/TransactionCompat.java +6 −0 Original line number Original line Diff line number Diff line Loading @@ -87,6 +87,12 @@ public class TransactionCompat { return this; return this; } } public TransactionCompat setBackgroundBlurRadius(SurfaceControlCompat surfaceControl, int radius) { mTransaction.setBackgroundBlurRadius(surfaceControl.mSurfaceControl, radius); return this; } public TransactionCompat deferTransactionUntil(SurfaceControlCompat surfaceControl, public TransactionCompat deferTransactionUntil(SurfaceControlCompat surfaceControl, SurfaceControl barrier, long frameNumber) { SurfaceControl barrier, long frameNumber) { mTransaction.deferTransactionUntil(surfaceControl.mSurfaceControl, barrier, mTransaction.deferTransactionUntil(surfaceControl.mSurfaceControl, barrier, Loading Loading
core/java/android/view/InsetsAnimationControlImpl.java +8 −4 Original line number Original line Diff line number Diff line Loading @@ -282,10 +282,14 @@ public class InsetsAnimationControlImpl implements WindowInsetsAnimationControll if (leash != null) { if (leash != null) { // TODO: use a better interpolation for fade. // TODO: use a better interpolation for fade. alpha = mFade ? ((float) inset / maxInset * 0.3f + 0.7f) : alpha; alpha = mFade ? ((float) inset / maxInset * 0.3f + 0.7f) : alpha; surfaceParams.add(new SurfaceParams(leash, side == ISIDE_FLOATING ? 1 : alpha, SurfaceParams params = new SurfaceParams.Builder(leash) mTmpMatrix, null /* windowCrop */, 0 /* layer */, 0f /* cornerRadius*/, .withAlpha(side == ISIDE_FLOATING ? 1 : alpha) side == ISIDE_FLOATING ? state.getSource(source.getType()).isVisible() .withMatrix(mTmpMatrix) : inset != 0 /* visible */)); .withVisibility(side == ISIDE_FLOATING ? state.getSource(source.getType()).isVisible() : inset != 0 /* visible */) .build(); surfaceParams.add(params); } } } } } } Loading
core/java/android/view/SyncRtSurfaceTransactionApplier.java +24 −32 Original line number Original line Diff line number Diff line Loading @@ -36,7 +36,8 @@ public class SyncRtSurfaceTransactionApplier { public static final int FLAG_WINDOW_CROP = 1 << 2; public static final int FLAG_WINDOW_CROP = 1 << 2; public static final int FLAG_LAYER = 1 << 3; public static final int FLAG_LAYER = 1 << 3; public static final int FLAG_CORNER_RADIUS = 1 << 4; public static final int FLAG_CORNER_RADIUS = 1 << 4; public static final int FLAG_VISIBILITY = 1 << 5; public static final int FLAG_BACKGROUND_BLUR_RADIUS = 1 << 5; public static final int FLAG_VISIBILITY = 1 << 6; private SurfaceControl mTargetSc; private SurfaceControl mTargetSc; private final ViewRootImpl mTargetViewRootImpl; private final ViewRootImpl mTargetViewRootImpl; Loading Loading @@ -108,6 +109,9 @@ public class SyncRtSurfaceTransactionApplier { if ((params.flags & FLAG_CORNER_RADIUS) != 0) { if ((params.flags & FLAG_CORNER_RADIUS) != 0) { t.setCornerRadius(params.surface, params.cornerRadius); t.setCornerRadius(params.surface, params.cornerRadius); } } if ((params.flags & FLAG_BACKGROUND_BLUR_RADIUS) != 0) { t.setBackgroundBlurRadius(params.surface, params.backgroundBlurRadius); } if ((params.flags & FLAG_VISIBILITY) != 0) { if ((params.flags & FLAG_VISIBILITY) != 0) { if (params.visible) { if (params.visible) { t.show(params.surface); t.show(params.surface); Loading Loading @@ -153,6 +157,7 @@ public class SyncRtSurfaceTransactionApplier { int flags; int flags; float alpha; float alpha; float cornerRadius; float cornerRadius; int backgroundBlurRadius; Matrix matrix; Matrix matrix; Rect windowCrop; Rect windowCrop; int layer; int layer; Loading Loading @@ -215,6 +220,16 @@ public class SyncRtSurfaceTransactionApplier { return this; return this; } } /** * @param radius the Radius for blur to apply to the background surfaces. * @return this Builder */ public Builder withBackgroundBlur(int radius) { this.backgroundBlurRadius = radius; flags |= FLAG_BACKGROUND_BLUR_RADIUS; return this; } /** /** * @param visible The visibility to apply to the surface. * @param visible The visibility to apply to the surface. * @return this Builder * @return this Builder Loading @@ -230,12 +245,13 @@ public class SyncRtSurfaceTransactionApplier { */ */ public SurfaceParams build() { public SurfaceParams build() { return new SurfaceParams(surface, flags, alpha, matrix, windowCrop, layer, return new SurfaceParams(surface, flags, alpha, matrix, windowCrop, layer, cornerRadius, visible); cornerRadius, backgroundBlurRadius, visible); } } } } private SurfaceParams(SurfaceControl surface, int params, float alpha, Matrix matrix, private SurfaceParams(SurfaceControl surface, int params, float alpha, Matrix matrix, Rect windowCrop, int layer, float cornerRadius, boolean visible) { Rect windowCrop, int layer, float cornerRadius, int backgroundBlurRadius, boolean visible) { this.flags = params; this.flags = params; this.surface = surface; this.surface = surface; this.alpha = alpha; this.alpha = alpha; Loading @@ -243,34 +259,7 @@ public class SyncRtSurfaceTransactionApplier { this.windowCrop = new Rect(windowCrop); this.windowCrop = new Rect(windowCrop); this.layer = layer; this.layer = layer; this.cornerRadius = cornerRadius; this.cornerRadius = cornerRadius; this.visible = visible; this.backgroundBlurRadius = backgroundBlurRadius; } /** * Constructs surface parameters to be applied when the current view state gets pushed to * RenderThread. * * @param surface The surface to modify. * @param alpha Alpha to apply. * @param matrix Matrix to apply. * @param windowCrop Crop to apply. * @param layer The layer to apply. * @param cornerRadius The corner radius to apply. * @param visible The visibility to apply. * * @deprecated Use {@link SurfaceParams.Builder} to create an instance. */ @Deprecated public SurfaceParams(SurfaceControl surface, float alpha, Matrix matrix, Rect windowCrop, int layer, float cornerRadius, boolean visible) { this.flags = FLAG_ALL; this.surface = surface; this.alpha = alpha; this.matrix = new Matrix(matrix); this.windowCrop = windowCrop != null ? new Rect(windowCrop) : null; this.layer = layer; this.cornerRadius = cornerRadius; this.visible = visible; this.visible = visible; } } Loading @@ -283,7 +272,10 @@ public class SyncRtSurfaceTransactionApplier { public final float alpha; public final float alpha; @VisibleForTesting @VisibleForTesting final float cornerRadius; public final float cornerRadius; @VisibleForTesting public final int backgroundBlurRadius; @VisibleForTesting @VisibleForTesting public final Matrix matrix; public final Matrix matrix; Loading
packages/SystemUI/shared/src/com/android/systemui/shared/system/SurfaceControlCompat.java +14 −1 Original line number Original line Diff line number Diff line Loading @@ -17,11 +17,24 @@ package com.android.systemui.shared.system; package com.android.systemui.shared.system; import android.view.SurfaceControl; import android.view.SurfaceControl; import android.view.View; import android.view.ViewRootImpl; public class SurfaceControlCompat { public class SurfaceControlCompat { SurfaceControl mSurfaceControl; final SurfaceControl mSurfaceControl; public SurfaceControlCompat(SurfaceControl surfaceControl) { public SurfaceControlCompat(SurfaceControl surfaceControl) { mSurfaceControl = surfaceControl; mSurfaceControl = surfaceControl; } } public SurfaceControlCompat(View v) { ViewRootImpl viewRootImpl = v.getViewRootImpl(); mSurfaceControl = viewRootImpl != null ? viewRootImpl.getSurfaceControl() : null; } public boolean isValid() { return mSurfaceControl != null && mSurfaceControl.isValid(); } } }
packages/SystemUI/shared/src/com/android/systemui/shared/system/SyncRtSurfaceTransactionApplierCompat.java +143 −7 Original line number Original line Diff line number Diff line Loading @@ -38,6 +38,15 @@ import java.util.function.Consumer; */ */ public class SyncRtSurfaceTransactionApplierCompat { public class SyncRtSurfaceTransactionApplierCompat { public static final int FLAG_ALL = 0xffffffff; public static final int FLAG_ALPHA = 1; public static final int FLAG_MATRIX = 1 << 1; public static final int FLAG_WINDOW_CROP = 1 << 2; public static final int FLAG_LAYER = 1 << 3; public static final int FLAG_CORNER_RADIUS = 1 << 4; public static final int FLAG_BACKGROUND_BLUR_RADIUS = 1 << 5; public static final int FLAG_VISIBILITY = 1 << 6; private static final int MSG_UPDATE_SEQUENCE_NUMBER = 0; private static final int MSG_UPDATE_SEQUENCE_NUMBER = 0; private final SurfaceControl mBarrierSurfaceControl; private final SurfaceControl mBarrierSurfaceControl; Loading Loading @@ -143,14 +152,31 @@ public class SyncRtSurfaceTransactionApplierCompat { public static void applyParams(TransactionCompat t, public static void applyParams(TransactionCompat t, SyncRtSurfaceTransactionApplierCompat.SurfaceParams params) { SyncRtSurfaceTransactionApplierCompat.SurfaceParams params) { if ((params.flags & FLAG_MATRIX) != 0) { t.setMatrix(params.surface, params.matrix); t.setMatrix(params.surface, params.matrix); if (params.windowCrop != null) { } if ((params.flags & FLAG_WINDOW_CROP) != 0) { t.setWindowCrop(params.surface, params.windowCrop); t.setWindowCrop(params.surface, params.windowCrop); } } if ((params.flags & FLAG_ALPHA) != 0) { t.setAlpha(params.surface, params.alpha); t.setAlpha(params.surface, params.alpha); } if ((params.flags & FLAG_LAYER) != 0) { t.setLayer(params.surface, params.layer); t.setLayer(params.surface, params.layer); } if ((params.flags & FLAG_CORNER_RADIUS) != 0) { t.setCornerRadius(params.surface, params.cornerRadius); t.setCornerRadius(params.surface, params.cornerRadius); } if ((params.flags & FLAG_BACKGROUND_BLUR_RADIUS) != 0) { t.setBackgroundBlurRadius(params.surface, params.backgroundBlurRadius); } if ((params.flags & FLAG_VISIBILITY) != 0) { if (params.visible) { t.show(params.surface); t.show(params.surface); } else { t.hide(params.surface); } } } } /** /** Loading Loading @@ -183,6 +209,102 @@ public class SyncRtSurfaceTransactionApplierCompat { } } public static class SurfaceParams { public static class SurfaceParams { public static class Builder { final SurfaceControlCompat surface; int flags; float alpha; float cornerRadius; int backgroundBlurRadius; Matrix matrix; Rect windowCrop; int layer; boolean visible; /** * @param surface The surface to modify. */ public Builder(SurfaceControlCompat surface) { this.surface = surface; } /** * @param alpha The alpha value to apply to the surface. * @return this Builder */ public Builder withAlpha(float alpha) { this.alpha = alpha; flags |= FLAG_ALPHA; return this; } /** * @param matrix The matrix to apply to the surface. * @return this Builder */ public Builder withMatrix(Matrix matrix) { this.matrix = matrix; flags |= FLAG_MATRIX; return this; } /** * @param windowCrop The window crop to apply to the surface. * @return this Builder */ public Builder withWindowCrop(Rect windowCrop) { this.windowCrop = windowCrop; flags |= FLAG_WINDOW_CROP; return this; } /** * @param layer The layer to assign the surface. * @return this Builder */ public Builder withLayer(int layer) { this.layer = layer; flags |= FLAG_LAYER; return this; } /** * @param radius the Radius for rounded corners to apply to the surface. * @return this Builder */ public Builder withCornerRadius(float radius) { this.cornerRadius = radius; flags |= FLAG_CORNER_RADIUS; return this; } /** * @param radius the Radius for blur to apply to the background surfaces. * @return this Builder */ public Builder withBackgroundBlur(int radius) { this.backgroundBlurRadius = radius; flags |= FLAG_BACKGROUND_BLUR_RADIUS; return this; } /** * @param visible The visibility to apply to the surface. * @return this Builder */ public Builder withVisibility(boolean visible) { this.visible = visible; flags |= FLAG_VISIBILITY; return this; } /** * @return a new SurfaceParams instance */ public SurfaceParams build() { return new SurfaceParams(surface, flags, alpha, matrix, windowCrop, layer, cornerRadius, backgroundBlurRadius, visible); } } /** /** * Constructs surface parameters to be applied when the current view state gets pushed to * Constructs surface parameters to be applied when the current view state gets pushed to Loading @@ -195,19 +317,33 @@ public class SyncRtSurfaceTransactionApplierCompat { */ */ public SurfaceParams(SurfaceControlCompat surface, float alpha, Matrix matrix, public SurfaceParams(SurfaceControlCompat surface, float alpha, Matrix matrix, Rect windowCrop, int layer, float cornerRadius) { Rect windowCrop, int layer, float cornerRadius) { this(surface, FLAG_ALL & ~(FLAG_VISIBILITY | FLAG_BACKGROUND_BLUR_RADIUS), alpha, matrix, windowCrop, layer, cornerRadius, 0 /* backgroundBlurRadius */, true); } private SurfaceParams(SurfaceControlCompat surface, int flags, float alpha, Matrix matrix, Rect windowCrop, int layer, float cornerRadius, int backgroundBlurRadius, boolean visible) { this.flags = flags; this.surface = surface; this.surface = surface; this.alpha = alpha; this.alpha = alpha; this.matrix = new Matrix(matrix); this.matrix = new Matrix(matrix); this.windowCrop = windowCrop != null ? new Rect(windowCrop) : null; this.windowCrop = windowCrop != null ? new Rect(windowCrop) : null; this.layer = layer; this.layer = layer; this.cornerRadius = cornerRadius; this.cornerRadius = cornerRadius; this.backgroundBlurRadius = backgroundBlurRadius; this.visible = visible; } } private final int flags; public final SurfaceControlCompat surface; public final SurfaceControlCompat surface; public final float alpha; public final float alpha; final float cornerRadius; public final float cornerRadius; public final int backgroundBlurRadius; public final Matrix matrix; public final Matrix matrix; public final Rect windowCrop; public final Rect windowCrop; public final int layer; public final int layer; public final boolean visible; } } } }
packages/SystemUI/shared/src/com/android/systemui/shared/system/TransactionCompat.java +6 −0 Original line number Original line Diff line number Diff line Loading @@ -87,6 +87,12 @@ public class TransactionCompat { return this; return this; } } public TransactionCompat setBackgroundBlurRadius(SurfaceControlCompat surfaceControl, int radius) { mTransaction.setBackgroundBlurRadius(surfaceControl.mSurfaceControl, radius); return this; } public TransactionCompat deferTransactionUntil(SurfaceControlCompat surfaceControl, public TransactionCompat deferTransactionUntil(SurfaceControlCompat surfaceControl, SurfaceControl barrier, long frameNumber) { SurfaceControl barrier, long frameNumber) { mTransaction.deferTransactionUntil(surfaceControl.mSurfaceControl, barrier, mTransaction.deferTransactionUntil(surfaceControl.mSurfaceControl, barrier, Loading