diff --git a/api/current.txt b/api/current.txt
index 2cf8969c76018..d8bb56e00fb77 100644
--- a/api/current.txt
+++ b/api/current.txt
@@ -9630,6 +9630,7 @@ package android.content.res {
method public boolean equals(android.content.res.Configuration);
method public int getLayoutDirection();
method public boolean isLayoutSizeAtLeast(int);
+ method public boolean isScreenRound();
method public static boolean needNewResources(int, int);
method public void readFromParcel(android.os.Parcel);
method public void setLayoutDirection(java.util.Locale);
@@ -9672,6 +9673,10 @@ package android.content.res {
field public static final int SCREENLAYOUT_LONG_NO = 16; // 0x10
field public static final int SCREENLAYOUT_LONG_UNDEFINED = 0; // 0x0
field public static final int SCREENLAYOUT_LONG_YES = 32; // 0x20
+ field public static final int SCREENLAYOUT_ROUND_MASK = 768; // 0x300
+ field public static final int SCREENLAYOUT_ROUND_NO = 256; // 0x100
+ field public static final int SCREENLAYOUT_ROUND_UNDEFINED = 0; // 0x0
+ field public static final int SCREENLAYOUT_ROUND_YES = 512; // 0x200
field public static final int SCREENLAYOUT_SIZE_LARGE = 3; // 0x3
field public static final int SCREENLAYOUT_SIZE_MASK = 15; // 0xf
field public static final int SCREENLAYOUT_SIZE_NORMAL = 2; // 0x2
@@ -34536,6 +34541,7 @@ package android.view {
field public static final int DEFAULT_DISPLAY = 0; // 0x0
field public static final int FLAG_PRESENTATION = 8; // 0x8
field public static final int FLAG_PRIVATE = 4; // 0x4
+ field public static final int FLAG_ROUND = 16; // 0x10
field public static final int FLAG_SECURE = 2; // 0x2
field public static final int FLAG_SUPPORTS_PROTECTED_BUFFERS = 1; // 0x1
field public static final int STATE_DOZE = 3; // 0x3
diff --git a/api/system-current.txt b/api/system-current.txt
index 263d17a917604..cd290ec7ead23 100644
--- a/api/system-current.txt
+++ b/api/system-current.txt
@@ -9940,6 +9940,7 @@ package android.content.res {
method public boolean equals(android.content.res.Configuration);
method public int getLayoutDirection();
method public boolean isLayoutSizeAtLeast(int);
+ method public boolean isScreenRound();
method public static boolean needNewResources(int, int);
method public void readFromParcel(android.os.Parcel);
method public void setLayoutDirection(java.util.Locale);
@@ -9982,6 +9983,10 @@ package android.content.res {
field public static final int SCREENLAYOUT_LONG_NO = 16; // 0x10
field public static final int SCREENLAYOUT_LONG_UNDEFINED = 0; // 0x0
field public static final int SCREENLAYOUT_LONG_YES = 32; // 0x20
+ field public static final int SCREENLAYOUT_ROUND_MASK = 768; // 0x300
+ field public static final int SCREENLAYOUT_ROUND_NO = 256; // 0x100
+ field public static final int SCREENLAYOUT_ROUND_UNDEFINED = 0; // 0x0
+ field public static final int SCREENLAYOUT_ROUND_YES = 512; // 0x200
field public static final int SCREENLAYOUT_SIZE_LARGE = 3; // 0x3
field public static final int SCREENLAYOUT_SIZE_MASK = 15; // 0xf
field public static final int SCREENLAYOUT_SIZE_NORMAL = 2; // 0x2
@@ -36798,6 +36803,7 @@ package android.view {
field public static final int DEFAULT_DISPLAY = 0; // 0x0
field public static final int FLAG_PRESENTATION = 8; // 0x8
field public static final int FLAG_PRIVATE = 4; // 0x4
+ field public static final int FLAG_ROUND = 16; // 0x10
field public static final int FLAG_SECURE = 2; // 0x2
field public static final int FLAG_SUPPORTS_PROTECTED_BUFFERS = 1; // 0x1
field public static final int STATE_DOZE = 3; // 0x3
diff --git a/core/java/android/content/res/Configuration.java b/core/java/android/content/res/Configuration.java
index bc6d4cec2b04c..fd6047684eb51 100644
--- a/core/java/android/content/res/Configuration.java
+++ b/core/java/android/content/res/Configuration.java
@@ -156,9 +156,34 @@ public final class Configuration implements Parcelable, ComparableCorresponds to the -round resource qualifier.
+ */
+ public static final int SCREENLAYOUT_ROUND_YES = 0x2 << SCREENLAYOUT_ROUND_SHIFT;
+
/** Constant for {@link #screenLayout}: a value indicating that screenLayout is undefined */
public static final int SCREENLAYOUT_UNDEFINED = SCREENLAYOUT_SIZE_UNDEFINED |
- SCREENLAYOUT_LONG_UNDEFINED | SCREENLAYOUT_LAYOUTDIR_UNDEFINED;
+ SCREENLAYOUT_LONG_UNDEFINED | SCREENLAYOUT_LAYOUTDIR_UNDEFINED |
+ SCREENLAYOUT_ROUND_UNDEFINED;
/**
* Special flag we generate to indicate that the screen layout requires
@@ -174,18 +199,22 @@ public final class Configuration implements Parcelable, ComparableThe {@link #SCREENLAYOUT_SIZE_MASK} bits define the overall size
* of the screen. They may be one of
* {@link #SCREENLAYOUT_SIZE_SMALL}, {@link #SCREENLAYOUT_SIZE_NORMAL},
- * {@link #SCREENLAYOUT_SIZE_LARGE}, or {@link #SCREENLAYOUT_SIZE_XLARGE}.
+ * {@link #SCREENLAYOUT_SIZE_LARGE}, or {@link #SCREENLAYOUT_SIZE_XLARGE}.
*
* The {@link #SCREENLAYOUT_LONG_MASK} defines whether the screen
* is wider/taller than normal. They may be one of
- * {@link #SCREENLAYOUT_LONG_NO} or {@link #SCREENLAYOUT_LONG_YES}.
+ * {@link #SCREENLAYOUT_LONG_NO} or {@link #SCREENLAYOUT_LONG_YES}.
*
* The {@link #SCREENLAYOUT_LAYOUTDIR_MASK} defines whether the screen layout
* is either LTR or RTL. They may be one of
- * {@link #SCREENLAYOUT_LAYOUTDIR_LTR} or {@link #SCREENLAYOUT_LAYOUTDIR_RTL}.
+ * {@link #SCREENLAYOUT_LAYOUTDIR_LTR} or {@link #SCREENLAYOUT_LAYOUTDIR_RTL}.
+ *
+ * The {@link #SCREENLAYOUT_ROUND_MASK} defines whether the screen has a rounded
+ * shape. They may be one of {@link #SCREENLAYOUT_ROUND_NO} or {@link #SCREENLAYOUT_ROUND_YES}.
+ *
*
* See Supporting
- * Multiple Screens for more information.
+ * Multiple Screens for more information.
*/
public int screenLayout;
@@ -1327,6 +1356,16 @@ public final class Configuration implements Parcelable, Comparable
+ * This flag identifies displays that are circular, elliptical or otherwise
+ * do not permit the user to see all the way to the logical corners of the display.
+ *
+ *
+ * @see #getFlags
+ */
+ public static final int FLAG_ROUND = 1 << 4;
+
/**
* Display flag: Indicates that the contents of the display should not be scaled
* to fit the physical screen dimensions. Used for development only to emulate
diff --git a/core/java/android/view/DisplayInfo.java b/core/java/android/view/DisplayInfo.java
index b9fde8a53659f..cf1799040f5f0 100644
--- a/core/java/android/view/DisplayInfo.java
+++ b/core/java/android/view/DisplayInfo.java
@@ -609,6 +609,9 @@ public final class DisplayInfo implements Parcelable {
if ((flags & Display.FLAG_SCALING_DISABLED) != 0) {
result.append(", FLAG_SCALING_DISABLED");
}
+ if ((flags & Display.FLAG_ROUND) != 0) {
+ result.append(", FLAG_ROUND");
+ }
return result.toString();
}
}
diff --git a/core/res/res/values/config.xml b/core/res/res/values/config.xml
index 84e4ca913c49b..a4c7a3e04d824 100755
--- a/core/res/res/values/config.xml
+++ b/core/res/res/values/config.xml
@@ -2151,4 +2151,10 @@
format is UMTS|LTE|... -->
+
+ @bool/config_windowIsRound
diff --git a/core/res/res/values/symbols.xml b/core/res/res/values/symbols.xml
index 9c6887fc0d682..a24d7f3b544c3 100755
--- a/core/res/res/values/symbols.xml
+++ b/core/res/res/values/symbols.xml
@@ -2277,4 +2277,5 @@
+
diff --git a/services/core/java/com/android/server/display/DisplayDeviceInfo.java b/services/core/java/com/android/server/display/DisplayDeviceInfo.java
index 0db3e3f738680..97ada1542466c 100644
--- a/services/core/java/com/android/server/display/DisplayDeviceInfo.java
+++ b/services/core/java/com/android/server/display/DisplayDeviceInfo.java
@@ -87,6 +87,11 @@ final class DisplayDeviceInfo {
*/
public static final int FLAG_OWN_CONTENT_ONLY = 1 << 7;
+ /**
+ * Flag: This display device has a round shape.
+ */
+ public static final int FLAG_ROUND = 1 << 8;
+
/**
* Touch attachment: Display does not receive touch.
*/
@@ -385,6 +390,9 @@ final class DisplayDeviceInfo {
if ((flags & FLAG_OWN_CONTENT_ONLY) != 0) {
msg.append(", FLAG_OWN_CONTENT_ONLY");
}
+ if ((flags & FLAG_ROUND) != 0) {
+ msg.append(", FLAG_ROUND");
+ }
return msg.toString();
}
}
diff --git a/services/core/java/com/android/server/display/LocalDisplayAdapter.java b/services/core/java/com/android/server/display/LocalDisplayAdapter.java
index cc7d848fa113a..e516573a15700 100644
--- a/services/core/java/com/android/server/display/LocalDisplayAdapter.java
+++ b/services/core/java/com/android/server/display/LocalDisplayAdapter.java
@@ -16,6 +16,7 @@
package com.android.server.display;
+import android.content.res.Resources;
import com.android.server.LocalServices;
import com.android.server.lights.Light;
import com.android.server.lights.LightsManager;
@@ -267,10 +268,15 @@ final class LocalDisplayAdapter extends DisplayAdapter {
}
if (mBuiltInDisplayId == SurfaceControl.BUILT_IN_DISPLAY_ID_MAIN) {
- mInfo.name = getContext().getResources().getString(
+ final Resources res = getContext().getResources();
+ mInfo.name = res.getString(
com.android.internal.R.string.display_manager_built_in_display_name);
mInfo.flags |= DisplayDeviceInfo.FLAG_DEFAULT_DISPLAY
| DisplayDeviceInfo.FLAG_ROTATES_WITH_CONTENT;
+ if (res.getBoolean(
+ com.android.internal.R.bool.config_mainBuiltInDisplayIsRound)) {
+ mInfo.flags |= DisplayDeviceInfo.FLAG_ROUND;
+ }
mInfo.type = Display.TYPE_BUILT_IN;
mInfo.densityDpi = (int)(phys.density * 160 + 0.5f);
mInfo.xDpi = phys.xDpi;
diff --git a/services/core/java/com/android/server/display/LogicalDisplay.java b/services/core/java/com/android/server/display/LogicalDisplay.java
index 424b4a00de61b..48237692c3a3f 100644
--- a/services/core/java/com/android/server/display/LogicalDisplay.java
+++ b/services/core/java/com/android/server/display/LogicalDisplay.java
@@ -217,6 +217,9 @@ final class LogicalDisplay {
if ((deviceInfo.flags & DisplayDeviceInfo.FLAG_PRESENTATION) != 0) {
mBaseDisplayInfo.flags |= Display.FLAG_PRESENTATION;
}
+ if ((deviceInfo.flags & DisplayDeviceInfo.FLAG_ROUND) != 0) {
+ mBaseDisplayInfo.flags |= Display.FLAG_ROUND;
+ }
mBaseDisplayInfo.type = deviceInfo.type;
mBaseDisplayInfo.address = deviceInfo.address;
mBaseDisplayInfo.name = deviceInfo.name;
diff --git a/services/core/java/com/android/server/wm/WindowManagerService.java b/services/core/java/com/android/server/wm/WindowManagerService.java
index 36445060b7cc3..e43861c966446 100644
--- a/services/core/java/com/android/server/wm/WindowManagerService.java
+++ b/services/core/java/com/android/server/wm/WindowManagerService.java
@@ -7341,6 +7341,11 @@ public class WindowManagerService extends IWindowManager.Stub
computeSizeRangesAndScreenLayout(displayInfo, rotated, dw, dh, mDisplayMetrics.density,
config);
+ config.screenLayout = (config.screenLayout & ~Configuration.SCREENLAYOUT_ROUND_MASK)
+ | ((displayInfo.flags & Display.FLAG_ROUND) != 0
+ ? Configuration.SCREENLAYOUT_ROUND_YES
+ : Configuration.SCREENLAYOUT_ROUND_NO);
+
config.compatScreenWidthDp = (int)(config.screenWidthDp / mCompatibleScreenScale);
config.compatScreenHeightDp = (int)(config.screenHeightDp / mCompatibleScreenScale);
config.compatSmallestScreenWidthDp = computeCompatSmallestWidth(rotated,