Merge "Teach the framework to use the new android_reboot() function." into honeycomb-mr1
This commit is contained in:
@@ -20,7 +20,7 @@
|
|||||||
#include "android_runtime/AndroidRuntime.h"
|
#include "android_runtime/AndroidRuntime.h"
|
||||||
#include <utils/misc.h>
|
#include <utils/misc.h>
|
||||||
#include <hardware_legacy/power.h>
|
#include <hardware_legacy/power.h>
|
||||||
#include <sys/reboot.h>
|
#include <cutils/android_reboot.h>
|
||||||
|
|
||||||
namespace android
|
namespace android
|
||||||
{
|
{
|
||||||
@@ -77,25 +77,26 @@ setScreenState(JNIEnv *env, jobject clazz, jboolean on)
|
|||||||
|
|
||||||
static void android_os_Power_shutdown(JNIEnv *env, jobject clazz)
|
static void android_os_Power_shutdown(JNIEnv *env, jobject clazz)
|
||||||
{
|
{
|
||||||
sync();
|
|
||||||
#ifdef HAVE_ANDROID_OS
|
#ifdef HAVE_ANDROID_OS
|
||||||
reboot(RB_POWER_OFF);
|
android_reboot(ANDROID_RB_POWEROFF, 0, 0);
|
||||||
|
#else
|
||||||
|
sync();
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
static void android_os_Power_reboot(JNIEnv *env, jobject clazz, jstring reason)
|
static void android_os_Power_reboot(JNIEnv *env, jobject clazz, jstring reason)
|
||||||
{
|
{
|
||||||
sync();
|
|
||||||
#ifdef HAVE_ANDROID_OS
|
#ifdef HAVE_ANDROID_OS
|
||||||
if (reason == NULL) {
|
if (reason == NULL) {
|
||||||
reboot(RB_AUTOBOOT);
|
android_reboot(ANDROID_RB_RESTART, 0, 0);
|
||||||
} else {
|
} else {
|
||||||
const char *chars = env->GetStringUTFChars(reason, NULL);
|
const char *chars = env->GetStringUTFChars(reason, NULL);
|
||||||
__reboot(LINUX_REBOOT_MAGIC1, LINUX_REBOOT_MAGIC2,
|
android_reboot(ANDROID_RB_RESTART2, 0, (char *) chars);
|
||||||
LINUX_REBOOT_CMD_RESTART2, (char*) chars);
|
|
||||||
env->ReleaseStringUTFChars(reason, chars); // In case it fails.
|
env->ReleaseStringUTFChars(reason, chars); // In case it fails.
|
||||||
}
|
}
|
||||||
jniThrowIOException(env, errno);
|
jniThrowIOException(env, errno);
|
||||||
|
#else
|
||||||
|
sync();
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user