Only apply rounded-corner animation on TYPE_BUILT_IN displays
Device manufacturers might only know the corner radius of their
devices, but cannot predict which display would be connected later
while configuring rounded_corner_radius. Also, a device might have
multiple built-in displays, so we apply rounded-corner animation on
all built-in displays.
Bug: 131040127
Test: Follow the reproduction steps in the bug.
Change-Id: If7865537aeebc70ac94a095ffdf4c8e2cdc11b50
diff --git a/services/core/java/com/android/server/wm/DisplayPolicy.java b/services/core/java/com/android/server/wm/DisplayPolicy.java
index 3bb3653..cae7670 100644
--- a/services/core/java/com/android/server/wm/DisplayPolicy.java
+++ b/services/core/java/com/android/server/wm/DisplayPolicy.java
@@ -25,6 +25,7 @@
import static android.app.WindowConfiguration.WINDOWING_MODE_UNDEFINED;
import static android.content.res.Configuration.UI_MODE_TYPE_CAR;
import static android.content.res.Configuration.UI_MODE_TYPE_MASK;
+import static android.view.Display.TYPE_BUILT_IN;
import static android.view.InsetsState.TYPE_TOP_BAR;
import static android.view.InsetsState.TYPE_TOP_GESTURES;
import static android.view.InsetsState.TYPE_TOP_TAPPABLE_ELEMENT;
@@ -112,7 +113,6 @@
import android.annotation.Nullable;
import android.annotation.Px;
import android.app.ActivityManager;
-import android.app.ActivityManagerInternal;
import android.app.ActivityThread;
import android.app.LoadedApk;
import android.app.ResourcesManager;
@@ -157,6 +157,7 @@
import com.android.internal.R;
import com.android.internal.annotations.GuardedBy;
import com.android.internal.annotations.VisibleForTesting;
+import com.android.internal.policy.ScreenDecorationsUtils;
import com.android.internal.util.ScreenShapeHelper;
import com.android.internal.util.ScreenshotHelper;
import com.android.internal.util.function.TriConsumer;
@@ -2870,6 +2871,16 @@
- statusBarHeight;
}
+ /**
+ * Return corner radius in pixels that should be used on windows in order to cover the display.
+ * The radius is only valid for built-in displays since the one who configures window corner
+ * radius cannot know the corner radius of non-built-in display.
+ */
+ float getWindowCornerRadius() {
+ return mDisplayContent.getDisplay().getType() == TYPE_BUILT_IN
+ ? ScreenDecorationsUtils.getWindowCornerRadius(mContext.getResources()) : 0f;
+ }
+
boolean isShowingDreamLw() {
return mShowingDream;
}