Loading core/jni/android_os_Power.cpp +3 −10 Original line number Diff line number Diff line Loading @@ -21,6 +21,7 @@ #include <utils/misc.h> #include <hardware_legacy/power.h> #include <sys/reboot.h> #include <cutils/properties.h> namespace android { Loading Loading @@ -79,7 +80,7 @@ static void android_os_Power_shutdown(JNIEnv *env, jobject clazz) { sync(); #ifdef HAVE_ANDROID_OS reboot(RB_POWER_OFF); property_set("ctl.start", "poweroff"); #endif } Loading @@ -87,15 +88,7 @@ static void android_os_Power_reboot(JNIEnv *env, jobject clazz, jstring reason) { sync(); #ifdef HAVE_ANDROID_OS if (reason == NULL) { reboot(RB_AUTOBOOT); } else { const char *chars = env->GetStringUTFChars(reason, NULL); __reboot(LINUX_REBOOT_MAGIC1, LINUX_REBOOT_MAGIC2, LINUX_REBOOT_CMD_RESTART2, (char*) chars); env->ReleaseStringUTFChars(reason, chars); // In case it fails. } jniThrowIOException(env, errno); property_set("ctl.start", "reboot"); #endif } Loading Loading
core/jni/android_os_Power.cpp +3 −10 Original line number Diff line number Diff line Loading @@ -21,6 +21,7 @@ #include <utils/misc.h> #include <hardware_legacy/power.h> #include <sys/reboot.h> #include <cutils/properties.h> namespace android { Loading Loading @@ -79,7 +80,7 @@ static void android_os_Power_shutdown(JNIEnv *env, jobject clazz) { sync(); #ifdef HAVE_ANDROID_OS reboot(RB_POWER_OFF); property_set("ctl.start", "poweroff"); #endif } Loading @@ -87,15 +88,7 @@ static void android_os_Power_reboot(JNIEnv *env, jobject clazz, jstring reason) { sync(); #ifdef HAVE_ANDROID_OS if (reason == NULL) { reboot(RB_AUTOBOOT); } else { const char *chars = env->GetStringUTFChars(reason, NULL); __reboot(LINUX_REBOOT_MAGIC1, LINUX_REBOOT_MAGIC2, LINUX_REBOOT_CMD_RESTART2, (char*) chars); env->ReleaseStringUTFChars(reason, chars); // In case it fails. } jniThrowIOException(env, errno); property_set("ctl.start", "reboot"); #endif } Loading