summaryrefslogtreecommitdiffstats
path: root/core/java/android/view/Display.java
diff options
context:
space:
mode:
authorJeff Brown <jeffbrown@google.com>2014-04-11 01:21:14 -0700
committerJeff Brown <jeffbrown@google.com>2014-04-11 01:33:20 -0700
commit4e5c089ef3e62e7f658e71c0be262d09bd3e399b (patch)
tree6482287ee4ff25d4f40d8e2fd162c85c2dbbc14e /core/java/android/view/Display.java
parent90b39abaf95640021d15be70b5841abe8366b33e (diff)
parent337e764debde56b1462fb5f2794b3e917d8a42e2 (diff)
downloadframeworks_base-4e5c089ef3e62e7f658e71c0be262d09bd3e399b.zip
frameworks_base-4e5c089ef3e62e7f658e71c0be262d09bd3e399b.tar.gz
frameworks_base-4e5c089ef3e62e7f658e71c0be262d09bd3e399b.tar.bz2
resolved conflicts for merge of 337e764d to master
Change-Id: I8168dbf42b68c2f7b5ccb300e0080dddc627af26
Diffstat (limited to 'core/java/android/view/Display.java')
-rw-r--r--core/java/android/view/Display.java62
1 files changed, 61 insertions, 1 deletions
diff --git a/core/java/android/view/Display.java b/core/java/android/view/Display.java
index d3f63b4..d7a913d 100644
--- a/core/java/android/view/Display.java
+++ b/core/java/android/view/Display.java
@@ -204,6 +204,36 @@ public final class Display {
public static final int TYPE_VIRTUAL = 5;
/**
+ * Display state: The display state is unknown.
+ *
+ * @see #getState
+ */
+ public static final int STATE_UNKNOWN = 0;
+
+ /**
+ * Display state: The display is off.
+ *
+ * @see #getState
+ */
+ public static final int STATE_OFF = 1;
+
+ /**
+ * Display state: The display is on.
+ *
+ * @see #getState
+ */
+ public static final int STATE_ON = 2;
+
+ /**
+ * Display state: The display is dozing in a low-power state; it may be showing
+ * system-provided content while the device is in a non-interactive state.
+ *
+ * @see #getState
+ * @see android.os.PowerManager#isInteractive
+ */
+ public static final int STATE_DOZING = 3;
+
+ /**
* Internal method to create a display.
* Applications should use {@link android.view.WindowManager#getDefaultDisplay()}
* or {@link android.hardware.display.DisplayManager#getDisplay}
@@ -630,6 +660,19 @@ public final class Display {
}
/**
+ * Gets the state of the display, such as whether it is on or off.
+ *
+ * @return The state of the display: one of {@link #STATE_OFF}, {@link #STATE_ON},
+ * {@link #STATE_DOZING}, or {@link #STATE_UNKNOWN}.
+ */
+ public int getState() {
+ synchronized (this) {
+ updateDisplayInfoLocked();
+ return mIsValid ? mDisplayInfo.state : STATE_UNKNOWN;
+ }
+ }
+
+ /**
* Returns true if the specified UID has access to this display.
* @hide
*/
@@ -720,5 +763,22 @@ public final class Display {
return Integer.toString(type);
}
}
-}
+ /**
+ * @hide
+ */
+ public static String stateToString(int state) {
+ switch (state) {
+ case STATE_UNKNOWN:
+ return "UNKNOWN";
+ case STATE_OFF:
+ return "OFF";
+ case STATE_ON:
+ return "ON";
+ case STATE_DOZING:
+ return "DOZING";
+ default:
+ return Integer.toString(state);
+ }
+ }
+}