Loading core/java/android/view/SurfaceControl.java +31 −6 Original line number Diff line number Diff line Loading @@ -322,6 +322,14 @@ public final class SurfaceControl implements Parcelable { */ public static final int CURSOR_WINDOW = 0x00002000; /** * Surface creation flag: Indicates the effect layer will not have a color fill on * creation. * * @hide */ public static final int NO_COLOR_FILL = 0x00004000; /** * Surface creation flag: Creates a normal surface. * This is the default. Loading Loading @@ -577,7 +585,7 @@ public final class SurfaceControl implements Parcelable { throw new IllegalStateException( "width and height must be positive or unset"); } if ((mWidth > 0 || mHeight > 0) && (isColorLayerSet() || isContainerLayerSet())) { if ((mWidth > 0 || mHeight > 0) && (isEffectLayer() || isContainerLayer())) { throw new IllegalStateException( "Only buffer layers can set a valid buffer size."); } Loading Loading @@ -749,10 +757,27 @@ public final class SurfaceControl implements Parcelable { } /** * Indicate whether a 'ColorLayer' is to be constructed. * Indicate whether an 'EffectLayer' is to be constructed. * * An effect layer behaves like a container layer by default but it can support * color fill, shadows and/or blur. These layers will not have an associated buffer. * When created, this layer has no effects set and will be transparent but the caller * can render an effect by calling: * - {@link Transaction#setColor(SurfaceControl, float[])} * - {@link Transaction#setBackgroundBlurRadius(SurfaceControl, int)} * - {@link Transaction#setShadowRadius(SurfaceControl, float)} * * Color layers will not have an associated BufferQueue and will instead always render a * solid color (that is, solid before plane alpha). Currently that color is black. * @hide */ public Builder setEffectLayer() { mFlags |= NO_COLOR_FILL; unsetBufferSize(); return setFlags(FX_SURFACE_EFFECT, FX_SURFACE_MASK); } /** * A convenience function to create an effect layer with a default color fill * applied to it. Currently that color is black. * * @hide */ Loading @@ -761,7 +786,7 @@ public final class SurfaceControl implements Parcelable { return setFlags(FX_SURFACE_EFFECT, FX_SURFACE_MASK); } private boolean isColorLayerSet() { private boolean isEffectLayer() { return (mFlags & FX_SURFACE_EFFECT) == FX_SURFACE_EFFECT; } Loading @@ -786,7 +811,7 @@ public final class SurfaceControl implements Parcelable { return setFlags(FX_SURFACE_CONTAINER, FX_SURFACE_MASK); } private boolean isContainerLayerSet() { private boolean isContainerLayer() { return (mFlags & FX_SURFACE_CONTAINER) == FX_SURFACE_CONTAINER; } Loading services/core/java/com/android/server/wm/SurfaceAnimator.java +8 −11 Original line number Diff line number Diff line Loading @@ -388,18 +388,15 @@ class SurfaceAnimator { final SurfaceControl.Builder builder = animatable.makeAnimationLeash() .setParent(animatable.getAnimationLeashParent()) .setName(surface + " - animation-leash") .setColorLayer(); final SurfaceControl leash = builder.build(); if (!hidden) { // TODO(b/151665759) Defer reparent calls // We want the leash to be visible immediately but we want to set the effects on // the layer. Since the transaction used in this function may be deferred, we apply // another transaction immediately with the correct visibility and effects. // If this doesn't work, you will can see the 2/3 button nav bar flicker during // seamless rotation. transactionFactory.get().unsetColor(leash).show(leash).apply(); } t.unsetColor(leash); // We want the leash to be visible immediately because the transaction which shows // the leash may be deferred but the reparent will not. This will cause the leashed // surface to be invisible until the deferred transaction is applied. If this // doesn't work, you will can see the 2/3 button nav bar flicker during seamless // rotation. .setHidden(hidden) .setEffectLayer(); final SurfaceControl leash = builder.build(); t.setWindowCrop(leash, width, height); t.setPosition(leash, x, y); t.show(leash); Loading services/core/java/com/android/server/wm/Task.java +1 −7 Original line number Diff line number Diff line Loading @@ -3202,15 +3202,9 @@ class Task extends WindowContainer<WindowContainer> { return true; } @Override void onSurfaceShown(SurfaceControl.Transaction t) { super.onSurfaceShown(t); t.unsetColor(mSurfaceControl); } @Override void setInitialSurfaceControlProperties(SurfaceControl.Builder b) { b.setColorLayer().setMetadata(METADATA_TASK_ID, mTaskId); b.setEffectLayer().setMetadata(METADATA_TASK_ID, mTaskId); super.setInitialSurfaceControlProperties(b); } Loading Loading
core/java/android/view/SurfaceControl.java +31 −6 Original line number Diff line number Diff line Loading @@ -322,6 +322,14 @@ public final class SurfaceControl implements Parcelable { */ public static final int CURSOR_WINDOW = 0x00002000; /** * Surface creation flag: Indicates the effect layer will not have a color fill on * creation. * * @hide */ public static final int NO_COLOR_FILL = 0x00004000; /** * Surface creation flag: Creates a normal surface. * This is the default. Loading Loading @@ -577,7 +585,7 @@ public final class SurfaceControl implements Parcelable { throw new IllegalStateException( "width and height must be positive or unset"); } if ((mWidth > 0 || mHeight > 0) && (isColorLayerSet() || isContainerLayerSet())) { if ((mWidth > 0 || mHeight > 0) && (isEffectLayer() || isContainerLayer())) { throw new IllegalStateException( "Only buffer layers can set a valid buffer size."); } Loading Loading @@ -749,10 +757,27 @@ public final class SurfaceControl implements Parcelable { } /** * Indicate whether a 'ColorLayer' is to be constructed. * Indicate whether an 'EffectLayer' is to be constructed. * * An effect layer behaves like a container layer by default but it can support * color fill, shadows and/or blur. These layers will not have an associated buffer. * When created, this layer has no effects set and will be transparent but the caller * can render an effect by calling: * - {@link Transaction#setColor(SurfaceControl, float[])} * - {@link Transaction#setBackgroundBlurRadius(SurfaceControl, int)} * - {@link Transaction#setShadowRadius(SurfaceControl, float)} * * Color layers will not have an associated BufferQueue and will instead always render a * solid color (that is, solid before plane alpha). Currently that color is black. * @hide */ public Builder setEffectLayer() { mFlags |= NO_COLOR_FILL; unsetBufferSize(); return setFlags(FX_SURFACE_EFFECT, FX_SURFACE_MASK); } /** * A convenience function to create an effect layer with a default color fill * applied to it. Currently that color is black. * * @hide */ Loading @@ -761,7 +786,7 @@ public final class SurfaceControl implements Parcelable { return setFlags(FX_SURFACE_EFFECT, FX_SURFACE_MASK); } private boolean isColorLayerSet() { private boolean isEffectLayer() { return (mFlags & FX_SURFACE_EFFECT) == FX_SURFACE_EFFECT; } Loading @@ -786,7 +811,7 @@ public final class SurfaceControl implements Parcelable { return setFlags(FX_SURFACE_CONTAINER, FX_SURFACE_MASK); } private boolean isContainerLayerSet() { private boolean isContainerLayer() { return (mFlags & FX_SURFACE_CONTAINER) == FX_SURFACE_CONTAINER; } Loading
services/core/java/com/android/server/wm/SurfaceAnimator.java +8 −11 Original line number Diff line number Diff line Loading @@ -388,18 +388,15 @@ class SurfaceAnimator { final SurfaceControl.Builder builder = animatable.makeAnimationLeash() .setParent(animatable.getAnimationLeashParent()) .setName(surface + " - animation-leash") .setColorLayer(); final SurfaceControl leash = builder.build(); if (!hidden) { // TODO(b/151665759) Defer reparent calls // We want the leash to be visible immediately but we want to set the effects on // the layer. Since the transaction used in this function may be deferred, we apply // another transaction immediately with the correct visibility and effects. // If this doesn't work, you will can see the 2/3 button nav bar flicker during // seamless rotation. transactionFactory.get().unsetColor(leash).show(leash).apply(); } t.unsetColor(leash); // We want the leash to be visible immediately because the transaction which shows // the leash may be deferred but the reparent will not. This will cause the leashed // surface to be invisible until the deferred transaction is applied. If this // doesn't work, you will can see the 2/3 button nav bar flicker during seamless // rotation. .setHidden(hidden) .setEffectLayer(); final SurfaceControl leash = builder.build(); t.setWindowCrop(leash, width, height); t.setPosition(leash, x, y); t.show(leash); Loading
services/core/java/com/android/server/wm/Task.java +1 −7 Original line number Diff line number Diff line Loading @@ -3202,15 +3202,9 @@ class Task extends WindowContainer<WindowContainer> { return true; } @Override void onSurfaceShown(SurfaceControl.Transaction t) { super.onSurfaceShown(t); t.unsetColor(mSurfaceControl); } @Override void setInitialSurfaceControlProperties(SurfaceControl.Builder b) { b.setColorLayer().setMetadata(METADATA_TASK_ID, mTaskId); b.setEffectLayer().setMetadata(METADATA_TASK_ID, mTaskId); super.setInitialSurfaceControlProperties(b); } Loading