diff options
| author | 2024-09-17 04:04:56 +0000 | |
|---|---|---|
| committer | 2024-09-17 04:04:56 +0000 | |
| commit | 24c37642cefb93295ebf7a61abfdab1f6e91818f (patch) | |
| tree | 435affba4ecab5ae1de8e9d6bd9bdcbe445008f1 | |
| parent | 5de1b1554f19eb42f17411221a4ce26aee364e45 (diff) | |
| parent | 2cf79281e7929f1c5d7ad929008c37312aed961f (diff) | |
Merge "Revert^2 "Fix rounded corners in transitions on non-internal displays"" into main
| -rw-r--r-- | core/java/com/android/internal/policy/ScreenDecorationsUtils.java | 10 | ||||
| -rw-r--r-- | packages/SystemUI/tests/src/com/android/systemui/accessibility/FullscreenMagnificationControllerTest.java | 2 |
2 files changed, 11 insertions, 1 deletions
diff --git a/core/java/com/android/internal/policy/ScreenDecorationsUtils.java b/core/java/com/android/internal/policy/ScreenDecorationsUtils.java index 067e5e8813a7..b23515aa51f3 100644 --- a/core/java/com/android/internal/policy/ScreenDecorationsUtils.java +++ b/core/java/com/android/internal/policy/ScreenDecorationsUtils.java @@ -37,6 +37,8 @@ public class ScreenDecorationsUtils { * * Note that if the context is not an UI context(not associated with Display), it will use * default display. + * + * If the associated display is not internal, will return 0. */ public static float getWindowCornerRadius(Context context) { final Resources resources = context.getResources(); @@ -44,7 +46,13 @@ public class ScreenDecorationsUtils { return 0f; } // Use Context#getDisplayNoVerify() in case the context is not an UI context. - final String displayUniqueId = context.getDisplayNoVerify().getUniqueId(); + final Display display = context.getDisplayNoVerify(); + // The radius is only valid for internal displays, since the corner radius of external or + // virtual displays is not known when window corners are configured or are not supported. + if (display.getType() != Display.TYPE_INTERNAL) { + return 0f; + } + final String displayUniqueId = display.getUniqueId(); // Radius that should be used in case top or bottom aren't defined. float defaultRadius = RoundedCorners.getRoundedCornerRadius(resources, displayUniqueId) - RoundedCorners.getRoundedCornerRadiusAdjustment(resources, displayUniqueId); diff --git a/packages/SystemUI/tests/src/com/android/systemui/accessibility/FullscreenMagnificationControllerTest.java b/packages/SystemUI/tests/src/com/android/systemui/accessibility/FullscreenMagnificationControllerTest.java index 530ae158cf43..5e9f2a2fbe97 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/accessibility/FullscreenMagnificationControllerTest.java +++ b/packages/SystemUI/tests/src/com/android/systemui/accessibility/FullscreenMagnificationControllerTest.java @@ -104,6 +104,7 @@ public class FullscreenMagnificationControllerTest extends SysuiTestCase { mContext = spy(mContext); Display display = mock(Display.class); when(display.getUniqueId()).thenReturn(UNIQUE_DISPLAY_ID_PRIMARY); + when(display.getType()).thenReturn(Display.TYPE_INTERNAL); when(mContext.getDisplayNoVerify()).thenReturn(display); // Override the resources to Display Primary @@ -360,6 +361,7 @@ public class FullscreenMagnificationControllerTest extends SysuiTestCase { Display newDisplay = mock(Display.class); when(newDisplay.getUniqueId()).thenReturn(UNIQUE_DISPLAY_ID_SECONDARY); + when(newDisplay.getType()).thenReturn(Display.TYPE_INTERNAL); when(mContext.getDisplayNoVerify()).thenReturn(newDisplay); // Override the resources to Display Secondary mContext.getOrCreateTestableResources() |