Skip to content
Snippets Groups Projects
Commit 6ec2f915 authored by Tracy Zhou's avatar Tracy Zhou
Browse files

Add relative layer to SurfaceParams

Bug: 160361464
Test: the added API is not called
Change-Id: Ie4b90d8747a6183f91c114cf7d32ab7933b3cb28
parent 84c1b0d1
No related branches found
No related tags found
No related merge requests found
......@@ -46,6 +46,7 @@ public class SyncRtSurfaceTransactionApplierCompat {
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;
public static final int FLAG_RELATIVE_LAYER = 1 << 7;
private static final int MSG_UPDATE_SEQUENCE_NUMBER = 0;
......@@ -192,6 +193,8 @@ public class SyncRtSurfaceTransactionApplierCompat {
Matrix matrix;
Rect windowCrop;
int layer;
SurfaceControl relativeTo;
int relativeLayer;
boolean visible;
/**
......@@ -248,6 +251,18 @@ public class SyncRtSurfaceTransactionApplierCompat {
return this;
}
/**
* @param relativeTo The surface that's set relative layer to.
* @param relativeLayer The relative layer.
* @return this Builder
*/
public Builder withRelativeLayerTo(SurfaceControl relativeTo, int relativeLayer) {
this.relativeTo = relativeTo;
this.relativeLayer = relativeLayer;
flags |= FLAG_RELATIVE_LAYER;
return this;
}
/**
* @param radius the Radius for rounded corners to apply to the surface.
* @return this Builder
......@@ -283,7 +298,7 @@ public class SyncRtSurfaceTransactionApplierCompat {
*/
public SurfaceParams build() {
return new SurfaceParams(surface, flags, alpha, matrix, windowCrop, layer,
cornerRadius, backgroundBlurRadius, visible);
relativeTo, relativeLayer, cornerRadius, backgroundBlurRadius, visible);
}
}
......@@ -297,21 +312,25 @@ public class SyncRtSurfaceTransactionApplierCompat {
* @param windowCrop Crop to apply, only applied if not {@code null}
*/
public SurfaceParams(SurfaceControlCompat surface, float alpha, Matrix matrix,
Rect windowCrop, int layer, float cornerRadius) {
Rect windowCrop, int layer, SurfaceControl relativeTo, int relativeLayer,
float cornerRadius) {
this(surface.mSurfaceControl,
FLAG_ALL & ~(FLAG_VISIBILITY | FLAG_BACKGROUND_BLUR_RADIUS), alpha,
matrix, windowCrop, layer, cornerRadius, 0 /* backgroundBlurRadius */, true);
matrix, windowCrop, layer, relativeTo, relativeLayer, cornerRadius,
0 /* backgroundBlurRadius */, true);
}
private SurfaceParams(SurfaceControl surface, int flags, float alpha, Matrix matrix,
Rect windowCrop, int layer, float cornerRadius, int backgroundBlurRadius,
boolean visible) {
Rect windowCrop, int layer, SurfaceControl relativeTo, int relativeLayer,
float cornerRadius, int backgroundBlurRadius, boolean visible) {
this.flags = flags;
this.surface = surface;
this.alpha = alpha;
this.matrix = new Matrix(matrix);
this.windowCrop = windowCrop != null ? new Rect(windowCrop) : null;
this.layer = layer;
this.relativeTo = relativeTo;
this.relativeLayer = relativeLayer;
this.cornerRadius = cornerRadius;
this.backgroundBlurRadius = backgroundBlurRadius;
this.visible = visible;
......@@ -327,6 +346,8 @@ public class SyncRtSurfaceTransactionApplierCompat {
public final Matrix matrix;
public final Rect windowCrop;
public final int layer;
public final SurfaceControl relativeTo;
public final int relativeLayer;
public final boolean visible;
public void applyTo(SurfaceControl.Transaction t) {
......@@ -355,6 +376,9 @@ public class SyncRtSurfaceTransactionApplierCompat {
t.hide(surface);
}
}
if ((flags & FLAG_RELATIVE_LAYER) != 0) {
t.setRelativeLayer(surface, relativeTo, relativeLayer);
}
}
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment