summaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
authorJeff Brown <jeffbrown@google.com>2012-10-09 00:02:46 -0700
committerAndroid (Google) Code Review <android-gerrit@google.com>2012-10-09 00:02:46 -0700
commit8f4baad387d8ad63efbc05cfa8c4e4c472793deb (patch)
treec89bd3f628670255edb945b9f4074bc49b9d440c /core
parent434f8172332f0abf02499f33846c6042ed628b0c (diff)
parent9e316a1a2a8d734315bbd56a85308f9657a92913 (diff)
downloadframeworks_base-8f4baad387d8ad63efbc05cfa8c4e4c472793deb.zip
frameworks_base-8f4baad387d8ad63efbc05cfa8c4e4c472793deb.tar.gz
frameworks_base-8f4baad387d8ad63efbc05cfa8c4e4c472793deb.tar.bz2
Merge "Blank or unblank all displays as need." into jb-mr1-dev
Diffstat (limited to 'core')
-rw-r--r--core/java/android/view/Surface.java18
-rw-r--r--core/jni/android_view_Surface.cpp21
2 files changed, 39 insertions, 0 deletions
diff --git a/core/java/android/view/Surface.java b/core/java/android/view/Surface.java
index 8f4626f..07bb8f9 100644
--- a/core/java/android/view/Surface.java
+++ b/core/java/android/view/Surface.java
@@ -266,6 +266,8 @@ public class Surface implements Parcelable {
IBinder displayToken, int orientation, Rect layerStackRect, Rect displayRect);
private static native boolean nativeGetDisplayInfo(
IBinder displayToken, PhysicalDisplayInfo outInfo);
+ private static native void nativeBlankDisplay(IBinder displayToken);
+ private static native void nativeUnblankDisplay(IBinder displayToken);
private native void nativeCopyFrom(Surface other);
private native void nativeTransferFrom(Surface other);
@@ -638,6 +640,22 @@ public class Surface implements Parcelable {
return nativeGetDisplayInfo(displayToken, outInfo);
}
+ /** @hide */
+ public static void blankDisplay(IBinder displayToken) {
+ if (displayToken == null) {
+ throw new IllegalArgumentException("displayToken must not be null");
+ }
+ nativeBlankDisplay(displayToken);
+ }
+
+ /** @hide */
+ public static void unblankDisplay(IBinder displayToken) {
+ if (displayToken == null) {
+ throw new IllegalArgumentException("displayToken must not be null");
+ }
+ nativeUnblankDisplay(displayToken);
+ }
+
/**
* Copy another surface to this one. This surface now holds a reference
* to the same data as the original surface, and is -not- the owner.
diff --git a/core/jni/android_view_Surface.cpp b/core/jni/android_view_Surface.cpp
index fc04cd1..4982f31 100644
--- a/core/jni/android_view_Surface.cpp
+++ b/core/jni/android_view_Surface.cpp
@@ -48,6 +48,7 @@
#include <android_runtime/android_view_SurfaceSession.h>
#include <android_runtime/android_graphics_SurfaceTexture.h>
#include <utils/misc.h>
+#include <utils/Log.h>
#include <ScopedUtfChars.h>
@@ -710,6 +711,22 @@ static jboolean nativeGetDisplayInfo(JNIEnv* env, jclass clazz,
return JNI_TRUE;
}
+static void nativeBlankDisplay(JNIEnv* env, jclass clazz, jobject tokenObj) {
+ sp<IBinder> token(ibinderForJavaObject(env, tokenObj));
+ if (token == NULL) return;
+
+ ALOGD_IF_SLOW(100, "Excessive delay in blankDisplay() while turning screen off");
+ SurfaceComposerClient::blankDisplay(token);
+}
+
+static void nativeUnblankDisplay(JNIEnv* env, jclass clazz, jobject tokenObj) {
+ sp<IBinder> token(ibinderForJavaObject(env, tokenObj));
+ if (token == NULL) return;
+
+ ALOGD_IF_SLOW(100, "Excessive delay in unblankDisplay() while turning screen on");
+ SurfaceComposerClient::unblankDisplay(token);
+}
+
// ----------------------------------------------------------------------------
static void nativeCopyFrom(JNIEnv* env, jobject surfaceObj, jobject otherObj) {
@@ -832,6 +849,10 @@ static JNINativeMethod gSurfaceMethods[] = {
(void*)nativeSetDisplayProjection },
{"nativeGetDisplayInfo", "(Landroid/os/IBinder;Landroid/view/Surface$PhysicalDisplayInfo;)Z",
(void*)nativeGetDisplayInfo },
+ {"nativeBlankDisplay", "(Landroid/os/IBinder;)V",
+ (void*)nativeBlankDisplay },
+ {"nativeUnblankDisplay", "(Landroid/os/IBinder;)V",
+ (void*)nativeUnblankDisplay },
{"nativeCopyFrom", "(Landroid/view/Surface;)V",
(void*)nativeCopyFrom },
{"nativeTransferFrom", "(Landroid/view/Surface;)V",