summaryrefslogtreecommitdiffstats
path: root/services/core/java/com/android/server
diff options
context:
space:
mode:
authorAdam Powell <adamp@google.com>2015-05-14 16:18:53 -0700
committerAdam Powell <adamp@google.com>2015-05-18 14:13:33 -0700
commit49e7ff9647e6547c2b852944a5435a05794b9951 (patch)
tree7f58ae2e1e3128b3f1864a29162aaa1716919e2b /services/core/java/com/android/server
parent855d5495ffbd9d0e2dfbd22def462247a1a4e61b (diff)
downloadframeworks_base-49e7ff9647e6547c2b852944a5435a05794b9951.zip
frameworks_base-49e7ff9647e6547c2b852944a5435a05794b9951.tar.gz
frameworks_base-49e7ff9647e6547c2b852944a5435a05794b9951.tar.bz2
Add Configuration data for round displays
Add round values to the screenLayout field for Configuration and a convenience method to check roundness. Plumb this through the DisplayManager, making roundness the property of a DisplayAdapter. The built-in main display will read the configuration resource config_mainBuiltInDisplayIsRound to determine its roundness. Device-specific resource overlays should set this to true for devices with round primary displays. By default, this config resource inherits from the existing config_windowIsRound value currently used by some Android Wear device configurations. This change awaits another for aapt/native resources code to make the resource filtering system aware of this property. Change-Id: I1daced7ca6d6e172789e7c32bebfd43753bfa2ae
Diffstat (limited to 'services/core/java/com/android/server')
-rw-r--r--services/core/java/com/android/server/display/DisplayDeviceInfo.java8
-rw-r--r--services/core/java/com/android/server/display/LocalDisplayAdapter.java8
-rw-r--r--services/core/java/com/android/server/display/LogicalDisplay.java3
-rw-r--r--services/core/java/com/android/server/wm/WindowManagerService.java5
4 files changed, 23 insertions, 1 deletions
diff --git a/services/core/java/com/android/server/display/DisplayDeviceInfo.java b/services/core/java/com/android/server/display/DisplayDeviceInfo.java
index 0db3e3f..97ada15 100644
--- a/services/core/java/com/android/server/display/DisplayDeviceInfo.java
+++ b/services/core/java/com/android/server/display/DisplayDeviceInfo.java
@@ -88,6 +88,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.
*/
public static final int TOUCH_NONE = 0;
@@ -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 cc7d848..e516573 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 424b4a0..4823769 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 3644506..e43861c 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,