Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit e5335d50 authored by Cairn Overturf's avatar Cairn Overturf Committed by Android (Google) Code Review
Browse files

Merge "Disable elevation shadows when box shadows are enabled" into main

parents 9d6781a8 2fd2d700
Loading
Loading
Loading
Loading
+9 −0
Original line number Diff line number Diff line
@@ -332,6 +332,15 @@ public class PipSurfaceTransactionHelper {
    public PipSurfaceTransactionHelper shadow(SurfaceControl.Transaction tx, SurfaceControl leash,
            boolean applyShadowRadius) {
        if (Flags.enablePipBoxShadows()) {
            // Override and disable elevation shadows set by freeform transition.
            //
            // PiP uses box shadows but freeform windows use
            // elevation shadows (i.e. setShadowRadius).
            // To avoid having double shadows applied, disable the shadows set by freeform.
            //
            // TODO(b/367464660): Remove this once freeform box shadows are enabled
            tx.setShadowRadius(leash, 0);

            if (applyShadowRadius) {
                tx.setBoxShadowSettings(leash, mBoxShadowSettings);
                tx.setBorderSettings(leash, mBorderSettings);
+9 −0
Original line number Diff line number Diff line
@@ -221,6 +221,15 @@ public class PipSurfaceTransactionHelper implements PipDisplayLayoutState.Displa
    public PipSurfaceTransactionHelper shadow(SurfaceControl.Transaction tx, SurfaceControl leash,
            boolean applyShadowRadius) {
        if (Flags.enablePipBoxShadows()) {
            // Override and disable elevation shadows set by freeform transition.
            //
            // PiP uses box shadows but freeform windows use
            // elevation shadows (i.e. setShadowRadius).
            // To avoid having double shadows applied, disable the shadows set by freeform.
            //
            // TODO(b/367464660): Remove this once freeform box shadows are enabled
            tx.setShadowRadius(leash, 0);

            if (applyShadowRadius) {
                tx.setBoxShadowSettings(leash, mBoxShadowSettings);
                tx.setBorderSettings(leash, mBorderSettings);
+6 −4
Original line number Diff line number Diff line
@@ -22,7 +22,6 @@ import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.anyFloat;
import static org.mockito.ArgumentMatchers.eq;
import static org.mockito.ArgumentMatchers.intThat;
import static org.mockito.Mockito.never;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;

@@ -208,7 +207,8 @@ public class PipSurfaceTransactionHelperTest {

        verify(mMockTransaction).setBoxShadowSettings(eq(mTestLeash), boxShadow.capture());
        verify(mMockTransaction).setBorderSettings(eq(mTestLeash), border.capture());
        verify(mMockTransaction, never()).setShadowRadius(any(), anyFloat());
        // Ensure that box shadow clears elevation shadow which may be set by window decorations.
        verify(mMockTransaction).setShadowRadius(eq(mTestLeash), eq(0.0f));

        assertEquals(0, boxShadow.getValue().boxShadows.length);
        assertEquals(0, border.getValue().strokeWidth, 0.0);
@@ -227,7 +227,8 @@ public class PipSurfaceTransactionHelperTest {
        verify(mMockTransaction).setBoxShadowSettings(eq(mTestLeash),
                eq(mDarkBoxShadowSettings));
        verify(mMockTransaction).setBorderSettings(eq(mTestLeash), eq(mDarkBorderSettings));
        verify(mMockTransaction, never()).setShadowRadius(any(), anyFloat());
        // Ensure that box shadow clears elevation shadow which may be set by window decorations.
        verify(mMockTransaction).setShadowRadius(eq(mTestLeash), eq(0.0f));
    }


@@ -243,7 +244,8 @@ public class PipSurfaceTransactionHelperTest {
        verify(mMockTransaction).setBoxShadowSettings(eq(mTestLeash),
                eq(mLightBoxShadowSettings));
        verify(mMockTransaction).setBorderSettings(eq(mTestLeash), eq(mLightBorderSettings));
        verify(mMockTransaction, never()).setShadowRadius(any(), anyFloat());
        // Ensure that box shadow clears elevation shadow which may be set by window decorations.
        verify(mMockTransaction).setShadowRadius(eq(mTestLeash), eq(0.0f));
    }

    @Test