diff options
| author | 2012-10-09 14:47:05 -0700 | |
|---|---|---|
| committer | 2012-10-09 14:47:05 -0700 | |
| commit | 0a19d001c4ffbeec7e4e23b7640fff6bd7f11bc7 (patch) | |
| tree | 8275fc673e5d187640dcf2dfde3ec115ded0453d | |
| parent | c0c0c0e612e1ccf1e55eb2a9338ddfff40d8d7f2 (diff) | |
Fix a segfault when there is no power module.
This can happen in the emulator.
Bug: 7315152
Change-Id: I4a3f547127419fcd4dc4fc1c6f7ee869706cf12e
| -rw-r--r-- | services/jni/com_android_server_power_PowerManagerService.cpp | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/services/jni/com_android_server_power_PowerManagerService.cpp b/services/jni/com_android_server_power_PowerManagerService.cpp index 75f77b9535a5..23c33af2b6a7 100644 --- a/services/jni/com_android_server_power_PowerManagerService.cpp +++ b/services/jni/com_android_server_power_PowerManagerService.cpp @@ -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); + } } } |