From 9e316a1a2a8d734315bbd56a85308f9657a92913 Mon Sep 17 00:00:00 2001 From: Jeff Brown Date: Mon, 8 Oct 2012 19:17:06 -0700 Subject: Blank or unblank all displays as need. Ensures that both the internal display and HDMI are blanked or unblanked in tandem. Bug: 7309812 Change-Id: Ie8b96d393e8bb20d23c92f3320142d9f7cf42aff --- core/jni/android_view_Surface.cpp | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'core/jni/android_view_Surface.cpp') 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 #include #include +#include #include @@ -710,6 +711,22 @@ static jboolean nativeGetDisplayInfo(JNIEnv* env, jclass clazz, return JNI_TRUE; } +static void nativeBlankDisplay(JNIEnv* env, jclass clazz, jobject tokenObj) { + sp 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 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", -- cgit v1.1