summaryrefslogtreecommitdiffstats
path: root/core/java/android/view
diff options
context:
space:
mode:
authorJeff Brown <jeffbrown@google.com>2012-08-31 15:49:11 -0700
committerAndroid (Google) Code Review <android-gerrit@google.com>2012-08-31 15:49:17 -0700
commitf83ec838915c13158ddfda0cf4da5865b260b9c6 (patch)
tree81d0e7f24330cd5a28d5bfd6e899acee6388b562 /core/java/android/view
parent3b9a4160c99b2375b4874ccabf92eac68be06af6 (diff)
parent4ed8fe75e1dde1a2b9576f3862aecc5a572c56b5 (diff)
downloadframeworks_base-f83ec838915c13158ddfda0cf4da5865b260b9c6.zip
frameworks_base-f83ec838915c13158ddfda0cf4da5865b260b9c6.tar.gz
frameworks_base-f83ec838915c13158ddfda0cf4da5865b260b9c6.tar.bz2
Merge "More improvements to the display manager." into jb-mr1-dev
Diffstat (limited to 'core/java/android/view')
-rw-r--r--core/java/android/view/Display.java18
-rw-r--r--core/java/android/view/DisplayInfo.java56
-rw-r--r--core/java/android/view/Surface.java46
3 files changed, 110 insertions, 10 deletions
diff --git a/core/java/android/view/Display.java b/core/java/android/view/Display.java
index ec635a2..8ac84f7 100644
--- a/core/java/android/view/Display.java
+++ b/core/java/android/view/Display.java
@@ -53,6 +53,8 @@ public final class Display {
private final DisplayManagerGlobal mGlobal;
private final int mDisplayId;
+ private final int mLayerStack;
+ private final String mName;
private final CompatibilityInfoHolder mCompatibilityInfo;
private DisplayInfo mDisplayInfo; // never null
@@ -90,6 +92,8 @@ public final class Display {
mGlobal = global;
mDisplayId = displayId;
mDisplayInfo = displayInfo;
+ mLayerStack = displayInfo.layerStack; // can never change as long as the display is valid
+ mName = displayInfo.name; // cannot change as long as the display is valid
mCompatibilityInfo = compatibilityInfo;
mIsValid = true;
}
@@ -146,13 +150,11 @@ public final class Display {
* Each display has its own independent layer stack upon which surfaces
* are placed to be managed by surface flinger.
*
- * @return The layer stack number.
+ * @return The display's layer stack number.
* @hide
*/
public int getLayerStack() {
- // Note: This is the current convention but there is no requirement that
- // the display id and layer stack id be the same.
- return mDisplayId;
+ return mLayerStack;
}
/**
@@ -166,6 +168,14 @@ public final class Display {
}
/**
+ * Gets the name of the display.
+ * @return The display's name.
+ */
+ public String getName() {
+ return mName;
+ }
+
+ /**
* Gets the size of the display, in pixels.
* <p>
* Note that this value should <em>not</em> be used for computing layouts,
diff --git a/core/java/android/view/DisplayInfo.java b/core/java/android/view/DisplayInfo.java
index 593e8c4..b728d71 100644
--- a/core/java/android/view/DisplayInfo.java
+++ b/core/java/android/view/DisplayInfo.java
@@ -21,12 +21,24 @@ import android.os.Parcel;
import android.os.Parcelable;
import android.util.DisplayMetrics;
+import libcore.util.Objects;
+
/**
* Describes the characteristics of a particular logical display.
* @hide
*/
public final class DisplayInfo implements Parcelable {
/**
+ * The surface flinger layer stack associated with this logical display.
+ */
+ public int layerStack;
+
+ /**
+ * The human-readable name of the display.
+ */
+ public String name;
+
+ /**
* The width of the portion of the display that is available to applications, in pixels.
* Represents the size of the display minus any system decorations.
*/
@@ -147,11 +159,37 @@ public final class DisplayInfo implements Parcelable {
}
@Override
- public int describeContents() {
- return 0;
+ public boolean equals(Object o) {
+ return o instanceof DisplayInfo && equals((DisplayInfo)o);
+ }
+
+ public boolean equals(DisplayInfo other) {
+ return other != null
+ && layerStack == other.layerStack
+ && Objects.equal(name, other.name)
+ && appWidth == other.appWidth
+ && appHeight == other.appHeight
+ && smallestNominalAppWidth == other.smallestNominalAppWidth
+ && smallestNominalAppHeight == other.smallestNominalAppHeight
+ && largestNominalAppWidth == other.largestNominalAppWidth
+ && largestNominalAppHeight == other.largestNominalAppHeight
+ && logicalWidth == other.logicalWidth
+ && logicalHeight == other.logicalHeight
+ && rotation == other.rotation
+ && refreshRate == other.refreshRate
+ && logicalDensityDpi == other.logicalDensityDpi
+ && physicalXDpi == other.physicalXDpi
+ && physicalYDpi == other.physicalYDpi;
+ }
+
+ @Override
+ public int hashCode() {
+ return 0; // don't care
}
public void copyFrom(DisplayInfo other) {
+ layerStack = other.layerStack;
+ name = other.name;
appWidth = other.appWidth;
appHeight = other.appHeight;
smallestNominalAppWidth = other.smallestNominalAppWidth;
@@ -168,6 +206,8 @@ public final class DisplayInfo implements Parcelable {
}
public void readFromParcel(Parcel source) {
+ layerStack = source.readInt();
+ name = source.readString();
appWidth = source.readInt();
appHeight = source.readInt();
smallestNominalAppWidth = source.readInt();
@@ -185,6 +225,8 @@ public final class DisplayInfo implements Parcelable {
@Override
public void writeToParcel(Parcel dest, int flags) {
+ dest.writeInt(layerStack);
+ dest.writeString(name);
dest.writeInt(appWidth);
dest.writeInt(appHeight);
dest.writeInt(smallestNominalAppWidth);
@@ -200,6 +242,11 @@ public final class DisplayInfo implements Parcelable {
dest.writeFloat(physicalYDpi);
}
+ @Override
+ public int describeContents() {
+ return 0;
+ }
+
public void getAppMetrics(DisplayMetrics outMetrics, CompatibilityInfoHolder cih) {
getMetricsWithSize(outMetrics, cih, appWidth, appHeight);
}
@@ -231,13 +278,14 @@ public final class DisplayInfo implements Parcelable {
// For debugging purposes
@Override
public String toString() {
- return "app " + appWidth + " x " + appHeight
+ return "DisplayInfo{\"" + name + "\", app " + appWidth + " x " + appHeight
+ ", real " + logicalWidth + " x " + logicalHeight
+ ", largest app " + largestNominalAppWidth + " x " + largestNominalAppHeight
+ ", smallest app " + smallestNominalAppWidth + " x " + smallestNominalAppHeight
+ ", " + refreshRate + " fps"
+ ", rotation " + rotation
+ ", density " + logicalDensityDpi
- + ", " + physicalXDpi + " x " + physicalYDpi + " dpi";
+ + ", " + physicalXDpi + " x " + physicalYDpi + " dpi"
+ + ", layerStack " + layerStack + "}";
}
}
diff --git a/core/java/android/view/Surface.java b/core/java/android/view/Surface.java
index cf1767d..6616894 100644
--- a/core/java/android/view/Surface.java
+++ b/core/java/android/view/Surface.java
@@ -743,17 +743,59 @@ public class Surface implements Parcelable {
}
/**
- * Describes the properties of a physical display.
+ * Describes the properties of a physical display known to surface flinger.
* @hide
*/
public static final class PhysicalDisplayInfo {
- // TODO: redesign this
public int width;
public int height;
public float refreshRate;
public float density;
public float xDpi;
public float yDpi;
+
+ public PhysicalDisplayInfo() {
+ }
+
+ public PhysicalDisplayInfo(PhysicalDisplayInfo other) {
+ copyFrom(other);
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ return o instanceof PhysicalDisplayInfo && equals((PhysicalDisplayInfo)o);
+ }
+
+ public boolean equals(PhysicalDisplayInfo other) {
+ return other != null
+ && width == other.width
+ && height == other.height
+ && refreshRate == other.refreshRate
+ && density == other.density
+ && xDpi == other.xDpi
+ && yDpi == other.yDpi;
+ }
+
+ @Override
+ public int hashCode() {
+ return 0; // don't care
+ }
+
+ public void copyFrom(PhysicalDisplayInfo other) {
+ width = other.width;
+ height = other.height;
+ refreshRate = other.refreshRate;
+ density = other.density;
+ xDpi = other.xDpi;
+ yDpi = other.yDpi;
+ }
+
+ // For debugging purposes
+ @Override
+ public String toString() {
+ return "PhysicalDisplayInfo{" + width + " x " + height + ", " + refreshRate + " fps, "
+ + "density " + density + ", " + xDpi + " x " + yDpi + " dpi}";
+ }
}
/**