Fix a segfault when there is no power module.

This can happen in the emulator.

Bug: 7315152
Change-Id: I4a3f547127419fcd4dc4fc1c6f7ee869706cf12e
This commit is contained in:
Jeff Brown
2012-10-09 14:47:05 -07:00
parent c0c0c0e612
commit 0a19d001c4

View File

@@ -168,12 +168,14 @@ static void nativeReleaseSuspendBlocker(JNIEnv *env, jclass clazz, jstring nameS
}
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 {
ALOGD_IF_SLOW(20, "Excessive delay in setInteractive(false) while turning screen off");
gPowerModule->setInteractive(gPowerModule, false);
if (gPowerModule) {
if (enable) {
ALOGD_IF_SLOW(20, "Excessive delay in setInteractive(true) while turning screen on");
gPowerModule->setInteractive(gPowerModule, true);
} else {
ALOGD_IF_SLOW(20, "Excessive delay in setInteractive(false) while turning screen off");
gPowerModule->setInteractive(gPowerModule, false);
}
}
}