From 49e7ff9647e6547c2b852944a5435a05794b9951 Mon Sep 17 00:00:00 2001
From: Adam Powell
Date: Thu, 14 May 2015 16:18:53 -0700
Subject: 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
---
core/java/android/content/res/Configuration.java | 65 ++++++++++++++++++++++--
1 file changed, 60 insertions(+), 5 deletions(-)
(limited to 'core/java/android/content/res')
diff --git a/core/java/android/content/res/Configuration.java b/core/java/android/content/res/Configuration.java
index bc6d4ce..fd60476 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;
@@ -1328,6 +1357,16 @@ public final class Configuration implements Parcelable, Comparable