summaryrefslogtreecommitdiffstats
path: root/services/jni
diff options
context:
space:
mode:
authorJeff Brown <jeffbrown@google.com>2012-10-08 19:17:06 -0700
committerJeff Brown <jeffbrown@google.com>2012-10-08 19:23:15 -0700
commit9e316a1a2a8d734315bbd56a85308f9657a92913 (patch)
treeff72f3b90a0e585ef183ff4339a9450ebdd5b174 /services/jni
parent2aac1a0fe8fe5dea1185374ed914f95101de16ed (diff)
downloadframeworks_base-9e316a1a2a8d734315bbd56a85308f9657a92913.zip
frameworks_base-9e316a1a2a8d734315bbd56a85308f9657a92913.tar.gz
frameworks_base-9e316a1a2a8d734315bbd56a85308f9657a92913.tar.bz2
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
Diffstat (limited to 'services/jni')
-rw-r--r--services/jni/com_android_server_power_PowerManagerService.cpp56
1 files changed, 19 insertions, 37 deletions
diff --git a/services/jni/com_android_server_power_PowerManagerService.cpp b/services/jni/com_android_server_power_PowerManagerService.cpp
index dcc2b58..75f77b9 100644
--- a/services/jni/com_android_server_power_PowerManagerService.cpp
+++ b/services/jni/com_android_server_power_PowerManagerService.cpp
@@ -26,7 +26,6 @@
#include <limits.h>
#include <android_runtime/AndroidRuntime.h>
-#include <gui/ISurfaceComposer.h>
#include <utils/Timers.h>
#include <utils/misc.h>
#include <utils/String8.h>
@@ -36,8 +35,6 @@
#include <cutils/android_reboot.h>
#include <suspend/autosuspend.h>
-#include <private/gui/ComposerService.h>
-
#include "com_android_server_power_PowerManagerService.h"
namespace android {
@@ -170,40 +167,23 @@ static void nativeReleaseSuspendBlocker(JNIEnv *env, jclass clazz, jstring nameS
release_wake_lock(name.c_str());
}
-static void nativeSetScreenState(JNIEnv *env, jclass clazz, jboolean on) {
- sp<ISurfaceComposer> s(ComposerService::getComposerService());
- if (on) {
- {
- ALOGD_IF_SLOW(100, "Excessive delay in autosuspend_disable() while turning screen on");
- autosuspend_disable();
- }
-
- if (gPowerModule) {
- ALOGD_IF_SLOW(20, "Excessive delay in setInteractive(true) while turning screen on");
- gPowerModule->setInteractive(gPowerModule, true);
- }
-
- const sp<IBinder>& display = s->getBuiltInDisplay(0); // TODO: support multiple displays
- {
- ALOGD_IF_SLOW(100, "Excessive delay in unblank() while turning screen on");
- s->unblank(display);
- }
+static void nativeSetInteractive(JNIEnv *env, jclass clazz, jboolean enable) {
+ if (enable) {
+ ALOGD_IF_SLOW(20, "Excessive delay in setInteractive(true) while turning screen on");
+ gPowerModule->setInteractive(gPowerModule, true);
} else {
- const sp<IBinder>& display = s->getBuiltInDisplay(0); // TODO: support multiple displays
- {
- ALOGD_IF_SLOW(100, "Excessive delay in blank() while turning screen off");
- s->blank(display);
- }
-
- if (gPowerModule) {
- ALOGD_IF_SLOW(20, "Excessive delay in setInteractive(false) while turning screen off");
- gPowerModule->setInteractive(gPowerModule, false);
- }
+ ALOGD_IF_SLOW(20, "Excessive delay in setInteractive(false) while turning screen off");
+ gPowerModule->setInteractive(gPowerModule, false);
+ }
+}
- {
- ALOGD_IF_SLOW(100, "Excessive delay in autosuspend_enable() while turning screen off");
- autosuspend_enable();
- }
+static void nativeSetAutoSuspend(JNIEnv *env, jclass clazz, jboolean enable) {
+ if (enable) {
+ ALOGD_IF_SLOW(100, "Excessive delay in autosuspend_enable() while turning screen off");
+ autosuspend_enable();
+ } else {
+ ALOGD_IF_SLOW(100, "Excessive delay in autosuspend_disable() while turning screen on");
+ autosuspend_disable();
}
}
@@ -235,8 +215,10 @@ static JNINativeMethod gPowerManagerServiceMethods[] = {
(void*) nativeAcquireSuspendBlocker },
{ "nativeReleaseSuspendBlocker", "(Ljava/lang/String;)V",
(void*) nativeReleaseSuspendBlocker },
- { "nativeSetScreenState", "(Z)V",
- (void*) nativeSetScreenState },
+ { "nativeSetInteractive", "(Z)V",
+ (void*) nativeSetInteractive },
+ { "nativeSetAutoSuspend", "(Z)V",
+ (void*) nativeSetAutoSuspend },
{ "nativeShutdown", "()V",
(void*) nativeShutdown },
{ "nativeReboot", "(Ljava/lang/String;)V",