Loading libs/WindowManager/Shell/src/com/android/wm/shell/windowdecor/CaptionWindowDecoration.java +7 −4 Original line number Diff line number Diff line Loading @@ -194,6 +194,7 @@ public class CaptionWindowDecoration extends WindowDecoration<WindowDecorLinearL @VisibleForTesting static void updateRelayoutParams( RelayoutParams relayoutParams, @NonNull Context context, ActivityManager.RunningTaskInfo taskInfo, boolean applyStartTransactionOnDraw, boolean shouldSetTaskVisibilityPositionAndCrop, Loading @@ -206,9 +207,11 @@ public class CaptionWindowDecoration extends WindowDecoration<WindowDecorLinearL relayoutParams.mRunningTaskInfo = taskInfo; relayoutParams.mLayoutResId = R.layout.caption_window_decor; relayoutParams.mCaptionHeightId = getCaptionHeightIdStatic(taskInfo.getWindowingMode()); relayoutParams.mShadowRadiusId = hasGlobalFocus ? R.dimen.freeform_decor_shadow_focused_thickness : R.dimen.freeform_decor_shadow_unfocused_thickness; relayoutParams.mShadowRadius = hasGlobalFocus ? context.getResources().getDimensionPixelSize( R.dimen.freeform_decor_shadow_focused_thickness) : context.getResources().getDimensionPixelSize( R.dimen.freeform_decor_shadow_unfocused_thickness); relayoutParams.mApplyStartTransactionOnDraw = applyStartTransactionOnDraw; relayoutParams.mSetTaskVisibilityPositionAndCrop = shouldSetTaskVisibilityPositionAndCrop; relayoutParams.mIsCaptionVisible = taskInfo.isFreeform() Loading Loading @@ -251,7 +254,7 @@ public class CaptionWindowDecoration extends WindowDecoration<WindowDecorLinearL final SurfaceControl oldDecorationSurface = mDecorationContainerSurface; final WindowContainerTransaction wct = new WindowContainerTransaction(); updateRelayoutParams(mRelayoutParams, taskInfo, applyStartTransactionOnDraw, updateRelayoutParams(mRelayoutParams, mContext, taskInfo, applyStartTransactionOnDraw, shouldSetTaskVisibilityPositionAndCrop, mIsStatusBarVisible, mIsKeyguardVisibleAndOccluded, mDisplayController.getInsetsState(taskInfo.displayId), hasGlobalFocus, Loading libs/WindowManager/Shell/src/com/android/wm/shell/windowdecor/DesktopModeWindowDecoration.java +9 −4 Original line number Diff line number Diff line Loading @@ -980,10 +980,15 @@ public class DesktopModeWindowDecoration extends WindowDecoration<WindowDecorLin relayoutParams.mInputFeatures |= WindowManager.LayoutParams.INPUT_FEATURE_NO_INPUT_CHANNEL; } if (DesktopModeStatus.useWindowShadow(/* isFocusedWindow= */ hasGlobalFocus)) { relayoutParams.mShadowRadiusId = hasGlobalFocus ? R.dimen.freeform_decor_shadow_focused_thickness : R.dimen.freeform_decor_shadow_unfocused_thickness; if (isAppHeader && DesktopModeStatus.useWindowShadow(/* isFocusedWindow= */ hasGlobalFocus)) { relayoutParams.mShadowRadius = hasGlobalFocus ? context.getResources().getDimensionPixelSize( R.dimen.freeform_decor_shadow_focused_thickness) : context.getResources().getDimensionPixelSize( R.dimen.freeform_decor_shadow_unfocused_thickness); } else { relayoutParams.mShadowRadius = INVALID_SHADOW_RADIUS; } relayoutParams.mApplyStartTransactionOnDraw = applyStartTransactionOnDraw; relayoutParams.mSetTaskVisibilityPositionAndCrop = shouldSetTaskVisibilityPositionAndCrop; Loading libs/WindowManager/Shell/src/com/android/wm/shell/windowdecor/WindowDecoration.java +11 −14 Original line number Diff line number Diff line Loading @@ -17,7 +17,6 @@ package com.android.wm.shell.windowdecor; import static android.app.WindowConfiguration.WINDOWING_MODE_FREEFORM; import static android.app.WindowConfiguration.WINDOWING_MODE_FULLSCREEN; import static android.content.res.Configuration.DENSITY_DPI_UNDEFINED; import static android.view.WindowInsets.Type.captionBar; import static android.view.WindowInsets.Type.mandatorySystemGestures; Loading Loading @@ -110,6 +109,10 @@ public abstract class WindowDecoration<T extends View & TaskFocusStateConsumer> * Invalid corner radius that signifies that corner radius should not be set. */ static final int INVALID_CORNER_RADIUS = -1; /** * Invalid corner radius that signifies that shadow radius should not be set. */ static final int INVALID_SHADOW_RADIUS = -1; /** * System-wide context. Only used to create context with overridden configurations. Loading Loading @@ -439,16 +442,10 @@ public abstract class WindowDecoration<T extends View & TaskFocusStateConsumer> .setPosition(mTaskSurface, taskPosition.x, taskPosition.y); } float shadowRadius; if (mTaskInfo.getWindowingMode() == WINDOWING_MODE_FULLSCREEN) { // Shadow is not needed for fullscreen tasks shadowRadius = 0; } else { shadowRadius = loadDimension(mDecorWindowContext.getResources(), params.mShadowRadiusId); if (params.mShadowRadius != INVALID_SHADOW_RADIUS) { startT.setShadowRadius(mTaskSurface, params.mShadowRadius); finishT.setShadowRadius(mTaskSurface, params.mShadowRadius); } startT.setShadowRadius(mTaskSurface, shadowRadius); finishT.setShadowRadius(mTaskSurface, shadowRadius); if (params.mSetTaskVisibilityPositionAndCrop) { startT.show(mTaskSurface); Loading Loading @@ -851,8 +848,8 @@ public abstract class WindowDecoration<T extends View & TaskFocusStateConsumer> @InsetsSource.Flags int mInsetSourceFlags; final Region mDisplayExclusionRegion = Region.obtain(); int mShadowRadiusId; int mCornerRadius; int mShadowRadius = INVALID_SHADOW_RADIUS; int mCornerRadius = INVALID_CORNER_RADIUS; int mCaptionTopPadding; boolean mIsCaptionVisible; Loading @@ -874,8 +871,8 @@ public abstract class WindowDecoration<T extends View & TaskFocusStateConsumer> mInsetSourceFlags = 0; mDisplayExclusionRegion.setEmpty(); mShadowRadiusId = Resources.ID_NULL; mCornerRadius = 0; mShadowRadius = INVALID_SHADOW_RADIUS; mCornerRadius = INVALID_SHADOW_RADIUS; mCaptionTopPadding = 0; mIsCaptionVisible = false; Loading libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/windowdecor/CaptionWindowDecorationTests.kt +3 −0 Original line number Diff line number Diff line Loading @@ -48,6 +48,7 @@ class CaptionWindowDecorationTests : ShellTestCase() { CaptionWindowDecoration.updateRelayoutParams( relayoutParams, mContext, taskInfo, true, false, Loading @@ -71,6 +72,7 @@ class CaptionWindowDecorationTests : ShellTestCase() { CaptionWindowDecoration.updateRelayoutParams( relayoutParams, mContext, taskInfo, true, false, Loading @@ -90,6 +92,7 @@ class CaptionWindowDecorationTests : ShellTestCase() { val relayoutParams = WindowDecoration.RelayoutParams() CaptionWindowDecoration.updateRelayoutParams( relayoutParams, mContext, taskInfo, true, false, Loading libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/windowdecor/DesktopModeWindowDecorationTests.java +65 −3 Original line number Diff line number Diff line Loading @@ -61,7 +61,6 @@ import android.content.pm.ActivityInfo; import android.content.pm.ApplicationInfo; import android.content.pm.PackageManager; import android.content.pm.ResolveInfo; import android.content.res.Resources; import android.content.res.TypedArray; import android.graphics.PointF; import android.graphics.Rect; Loading Loading @@ -295,8 +294,9 @@ public class DesktopModeWindowDecorationTests extends ShellTestCase { } @Test public void updateRelayoutParams_noSysPropFlagsSet_windowShadowsAreEnabled() { public void updateRelayoutParams_noSysPropFlagsSet_windowShadowsAreSetForFreeform() { final ActivityManager.RunningTaskInfo taskInfo = createTaskInfo(/* visible= */ true); taskInfo.configuration.windowConfiguration.setWindowingMode(WINDOWING_MODE_FREEFORM); RelayoutParams relayoutParams = new RelayoutParams(); DesktopModeWindowDecoration.updateRelayoutParams( Loading @@ -309,7 +309,46 @@ public class DesktopModeWindowDecorationTests extends ShellTestCase { /* hasGlobalFocus= */ true, mExclusionRegion); assertThat(relayoutParams.mShadowRadiusId).isNotEqualTo(Resources.ID_NULL); assertThat(relayoutParams.mShadowRadius) .isNotEqualTo(WindowDecoration.INVALID_SHADOW_RADIUS); } @Test public void updateRelayoutParams_noSysPropFlagsSet_windowShadowsAreNotSetForFullscreen() { final ActivityManager.RunningTaskInfo taskInfo = createTaskInfo(/* visible= */ true); taskInfo.configuration.windowConfiguration.setWindowingMode(WINDOWING_MODE_FULLSCREEN); RelayoutParams relayoutParams = new RelayoutParams(); DesktopModeWindowDecoration.updateRelayoutParams( relayoutParams, mContext, taskInfo, /* applyStartTransactionOnDraw= */ true, /* shouldSetTaskPositionAndCrop */ false, /* isStatusBarVisible */ true, /* isKeyguardVisibleAndOccluded */ false, /* inFullImmersiveMode */ false, new InsetsState(), /* hasGlobalFocus= */ true, mExclusionRegion); assertThat(relayoutParams.mShadowRadius).isEqualTo(WindowDecoration.INVALID_SHADOW_RADIUS); } @Test public void updateRelayoutParams_noSysPropFlagsSet_windowShadowsAreNotSetForSplit() { final ActivityManager.RunningTaskInfo taskInfo = createTaskInfo(/* visible= */ true); taskInfo.configuration.windowConfiguration.setWindowingMode(WINDOWING_MODE_MULTI_WINDOW); RelayoutParams relayoutParams = new RelayoutParams(); DesktopModeWindowDecoration.updateRelayoutParams( relayoutParams, mContext, taskInfo, /* applyStartTransactionOnDraw= */ true, /* shouldSetTaskPositionAndCrop */ false, /* isStatusBarVisible */ true, /* isKeyguardVisibleAndOccluded */ false, /* inFullImmersiveMode */ false, new InsetsState(), /* hasGlobalFocus= */ true, mExclusionRegion); assertThat(relayoutParams.mShadowRadius).isEqualTo(WindowDecoration.INVALID_SHADOW_RADIUS); } @Test Loading Loading @@ -358,6 +397,29 @@ public class DesktopModeWindowDecorationTests extends ShellTestCase { assertThat(relayoutParams.mCornerRadius).isEqualTo(INVALID_CORNER_RADIUS); } @Test public void updateRelayoutParams_noSysPropFlagsSet_roundedCornersNotSetForSplit() { final ActivityManager.RunningTaskInfo taskInfo = createTaskInfo(/* visible= */ true); taskInfo.configuration.windowConfiguration.setWindowingMode(WINDOWING_MODE_MULTI_WINDOW); fillRoundedCornersResources(/* fillValue= */ 30); RelayoutParams relayoutParams = new RelayoutParams(); DesktopModeWindowDecoration.updateRelayoutParams( relayoutParams, mTestableContext, taskInfo, /* applyStartTransactionOnDraw= */ true, /* shouldSetTaskPositionAndCrop */ false, /* isStatusBarVisible */ true, /* isKeyguardVisibleAndOccluded */ false, /* inFullImmersiveMode */ false, new InsetsState(), /* hasGlobalFocus= */ true, mExclusionRegion); assertThat(relayoutParams.mCornerRadius).isEqualTo(INVALID_CORNER_RADIUS); } @Test @EnableFlags(Flags.FLAG_ENABLE_APP_HEADER_WITH_TASK_DENSITY) public void updateRelayoutParams_appHeader_usesTaskDensity() { Loading Loading
libs/WindowManager/Shell/src/com/android/wm/shell/windowdecor/CaptionWindowDecoration.java +7 −4 Original line number Diff line number Diff line Loading @@ -194,6 +194,7 @@ public class CaptionWindowDecoration extends WindowDecoration<WindowDecorLinearL @VisibleForTesting static void updateRelayoutParams( RelayoutParams relayoutParams, @NonNull Context context, ActivityManager.RunningTaskInfo taskInfo, boolean applyStartTransactionOnDraw, boolean shouldSetTaskVisibilityPositionAndCrop, Loading @@ -206,9 +207,11 @@ public class CaptionWindowDecoration extends WindowDecoration<WindowDecorLinearL relayoutParams.mRunningTaskInfo = taskInfo; relayoutParams.mLayoutResId = R.layout.caption_window_decor; relayoutParams.mCaptionHeightId = getCaptionHeightIdStatic(taskInfo.getWindowingMode()); relayoutParams.mShadowRadiusId = hasGlobalFocus ? R.dimen.freeform_decor_shadow_focused_thickness : R.dimen.freeform_decor_shadow_unfocused_thickness; relayoutParams.mShadowRadius = hasGlobalFocus ? context.getResources().getDimensionPixelSize( R.dimen.freeform_decor_shadow_focused_thickness) : context.getResources().getDimensionPixelSize( R.dimen.freeform_decor_shadow_unfocused_thickness); relayoutParams.mApplyStartTransactionOnDraw = applyStartTransactionOnDraw; relayoutParams.mSetTaskVisibilityPositionAndCrop = shouldSetTaskVisibilityPositionAndCrop; relayoutParams.mIsCaptionVisible = taskInfo.isFreeform() Loading Loading @@ -251,7 +254,7 @@ public class CaptionWindowDecoration extends WindowDecoration<WindowDecorLinearL final SurfaceControl oldDecorationSurface = mDecorationContainerSurface; final WindowContainerTransaction wct = new WindowContainerTransaction(); updateRelayoutParams(mRelayoutParams, taskInfo, applyStartTransactionOnDraw, updateRelayoutParams(mRelayoutParams, mContext, taskInfo, applyStartTransactionOnDraw, shouldSetTaskVisibilityPositionAndCrop, mIsStatusBarVisible, mIsKeyguardVisibleAndOccluded, mDisplayController.getInsetsState(taskInfo.displayId), hasGlobalFocus, Loading
libs/WindowManager/Shell/src/com/android/wm/shell/windowdecor/DesktopModeWindowDecoration.java +9 −4 Original line number Diff line number Diff line Loading @@ -980,10 +980,15 @@ public class DesktopModeWindowDecoration extends WindowDecoration<WindowDecorLin relayoutParams.mInputFeatures |= WindowManager.LayoutParams.INPUT_FEATURE_NO_INPUT_CHANNEL; } if (DesktopModeStatus.useWindowShadow(/* isFocusedWindow= */ hasGlobalFocus)) { relayoutParams.mShadowRadiusId = hasGlobalFocus ? R.dimen.freeform_decor_shadow_focused_thickness : R.dimen.freeform_decor_shadow_unfocused_thickness; if (isAppHeader && DesktopModeStatus.useWindowShadow(/* isFocusedWindow= */ hasGlobalFocus)) { relayoutParams.mShadowRadius = hasGlobalFocus ? context.getResources().getDimensionPixelSize( R.dimen.freeform_decor_shadow_focused_thickness) : context.getResources().getDimensionPixelSize( R.dimen.freeform_decor_shadow_unfocused_thickness); } else { relayoutParams.mShadowRadius = INVALID_SHADOW_RADIUS; } relayoutParams.mApplyStartTransactionOnDraw = applyStartTransactionOnDraw; relayoutParams.mSetTaskVisibilityPositionAndCrop = shouldSetTaskVisibilityPositionAndCrop; Loading
libs/WindowManager/Shell/src/com/android/wm/shell/windowdecor/WindowDecoration.java +11 −14 Original line number Diff line number Diff line Loading @@ -17,7 +17,6 @@ package com.android.wm.shell.windowdecor; import static android.app.WindowConfiguration.WINDOWING_MODE_FREEFORM; import static android.app.WindowConfiguration.WINDOWING_MODE_FULLSCREEN; import static android.content.res.Configuration.DENSITY_DPI_UNDEFINED; import static android.view.WindowInsets.Type.captionBar; import static android.view.WindowInsets.Type.mandatorySystemGestures; Loading Loading @@ -110,6 +109,10 @@ public abstract class WindowDecoration<T extends View & TaskFocusStateConsumer> * Invalid corner radius that signifies that corner radius should not be set. */ static final int INVALID_CORNER_RADIUS = -1; /** * Invalid corner radius that signifies that shadow radius should not be set. */ static final int INVALID_SHADOW_RADIUS = -1; /** * System-wide context. Only used to create context with overridden configurations. Loading Loading @@ -439,16 +442,10 @@ public abstract class WindowDecoration<T extends View & TaskFocusStateConsumer> .setPosition(mTaskSurface, taskPosition.x, taskPosition.y); } float shadowRadius; if (mTaskInfo.getWindowingMode() == WINDOWING_MODE_FULLSCREEN) { // Shadow is not needed for fullscreen tasks shadowRadius = 0; } else { shadowRadius = loadDimension(mDecorWindowContext.getResources(), params.mShadowRadiusId); if (params.mShadowRadius != INVALID_SHADOW_RADIUS) { startT.setShadowRadius(mTaskSurface, params.mShadowRadius); finishT.setShadowRadius(mTaskSurface, params.mShadowRadius); } startT.setShadowRadius(mTaskSurface, shadowRadius); finishT.setShadowRadius(mTaskSurface, shadowRadius); if (params.mSetTaskVisibilityPositionAndCrop) { startT.show(mTaskSurface); Loading Loading @@ -851,8 +848,8 @@ public abstract class WindowDecoration<T extends View & TaskFocusStateConsumer> @InsetsSource.Flags int mInsetSourceFlags; final Region mDisplayExclusionRegion = Region.obtain(); int mShadowRadiusId; int mCornerRadius; int mShadowRadius = INVALID_SHADOW_RADIUS; int mCornerRadius = INVALID_CORNER_RADIUS; int mCaptionTopPadding; boolean mIsCaptionVisible; Loading @@ -874,8 +871,8 @@ public abstract class WindowDecoration<T extends View & TaskFocusStateConsumer> mInsetSourceFlags = 0; mDisplayExclusionRegion.setEmpty(); mShadowRadiusId = Resources.ID_NULL; mCornerRadius = 0; mShadowRadius = INVALID_SHADOW_RADIUS; mCornerRadius = INVALID_SHADOW_RADIUS; mCaptionTopPadding = 0; mIsCaptionVisible = false; Loading
libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/windowdecor/CaptionWindowDecorationTests.kt +3 −0 Original line number Diff line number Diff line Loading @@ -48,6 +48,7 @@ class CaptionWindowDecorationTests : ShellTestCase() { CaptionWindowDecoration.updateRelayoutParams( relayoutParams, mContext, taskInfo, true, false, Loading @@ -71,6 +72,7 @@ class CaptionWindowDecorationTests : ShellTestCase() { CaptionWindowDecoration.updateRelayoutParams( relayoutParams, mContext, taskInfo, true, false, Loading @@ -90,6 +92,7 @@ class CaptionWindowDecorationTests : ShellTestCase() { val relayoutParams = WindowDecoration.RelayoutParams() CaptionWindowDecoration.updateRelayoutParams( relayoutParams, mContext, taskInfo, true, false, Loading
libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/windowdecor/DesktopModeWindowDecorationTests.java +65 −3 Original line number Diff line number Diff line Loading @@ -61,7 +61,6 @@ import android.content.pm.ActivityInfo; import android.content.pm.ApplicationInfo; import android.content.pm.PackageManager; import android.content.pm.ResolveInfo; import android.content.res.Resources; import android.content.res.TypedArray; import android.graphics.PointF; import android.graphics.Rect; Loading Loading @@ -295,8 +294,9 @@ public class DesktopModeWindowDecorationTests extends ShellTestCase { } @Test public void updateRelayoutParams_noSysPropFlagsSet_windowShadowsAreEnabled() { public void updateRelayoutParams_noSysPropFlagsSet_windowShadowsAreSetForFreeform() { final ActivityManager.RunningTaskInfo taskInfo = createTaskInfo(/* visible= */ true); taskInfo.configuration.windowConfiguration.setWindowingMode(WINDOWING_MODE_FREEFORM); RelayoutParams relayoutParams = new RelayoutParams(); DesktopModeWindowDecoration.updateRelayoutParams( Loading @@ -309,7 +309,46 @@ public class DesktopModeWindowDecorationTests extends ShellTestCase { /* hasGlobalFocus= */ true, mExclusionRegion); assertThat(relayoutParams.mShadowRadiusId).isNotEqualTo(Resources.ID_NULL); assertThat(relayoutParams.mShadowRadius) .isNotEqualTo(WindowDecoration.INVALID_SHADOW_RADIUS); } @Test public void updateRelayoutParams_noSysPropFlagsSet_windowShadowsAreNotSetForFullscreen() { final ActivityManager.RunningTaskInfo taskInfo = createTaskInfo(/* visible= */ true); taskInfo.configuration.windowConfiguration.setWindowingMode(WINDOWING_MODE_FULLSCREEN); RelayoutParams relayoutParams = new RelayoutParams(); DesktopModeWindowDecoration.updateRelayoutParams( relayoutParams, mContext, taskInfo, /* applyStartTransactionOnDraw= */ true, /* shouldSetTaskPositionAndCrop */ false, /* isStatusBarVisible */ true, /* isKeyguardVisibleAndOccluded */ false, /* inFullImmersiveMode */ false, new InsetsState(), /* hasGlobalFocus= */ true, mExclusionRegion); assertThat(relayoutParams.mShadowRadius).isEqualTo(WindowDecoration.INVALID_SHADOW_RADIUS); } @Test public void updateRelayoutParams_noSysPropFlagsSet_windowShadowsAreNotSetForSplit() { final ActivityManager.RunningTaskInfo taskInfo = createTaskInfo(/* visible= */ true); taskInfo.configuration.windowConfiguration.setWindowingMode(WINDOWING_MODE_MULTI_WINDOW); RelayoutParams relayoutParams = new RelayoutParams(); DesktopModeWindowDecoration.updateRelayoutParams( relayoutParams, mContext, taskInfo, /* applyStartTransactionOnDraw= */ true, /* shouldSetTaskPositionAndCrop */ false, /* isStatusBarVisible */ true, /* isKeyguardVisibleAndOccluded */ false, /* inFullImmersiveMode */ false, new InsetsState(), /* hasGlobalFocus= */ true, mExclusionRegion); assertThat(relayoutParams.mShadowRadius).isEqualTo(WindowDecoration.INVALID_SHADOW_RADIUS); } @Test Loading Loading @@ -358,6 +397,29 @@ public class DesktopModeWindowDecorationTests extends ShellTestCase { assertThat(relayoutParams.mCornerRadius).isEqualTo(INVALID_CORNER_RADIUS); } @Test public void updateRelayoutParams_noSysPropFlagsSet_roundedCornersNotSetForSplit() { final ActivityManager.RunningTaskInfo taskInfo = createTaskInfo(/* visible= */ true); taskInfo.configuration.windowConfiguration.setWindowingMode(WINDOWING_MODE_MULTI_WINDOW); fillRoundedCornersResources(/* fillValue= */ 30); RelayoutParams relayoutParams = new RelayoutParams(); DesktopModeWindowDecoration.updateRelayoutParams( relayoutParams, mTestableContext, taskInfo, /* applyStartTransactionOnDraw= */ true, /* shouldSetTaskPositionAndCrop */ false, /* isStatusBarVisible */ true, /* isKeyguardVisibleAndOccluded */ false, /* inFullImmersiveMode */ false, new InsetsState(), /* hasGlobalFocus= */ true, mExclusionRegion); assertThat(relayoutParams.mCornerRadius).isEqualTo(INVALID_CORNER_RADIUS); } @Test @EnableFlags(Flags.FLAG_ENABLE_APP_HEADER_WITH_TASK_DENSITY) public void updateRelayoutParams_appHeader_usesTaskDensity() { Loading