From c290eaf6852c6318584926c5e39b27672638891f Mon Sep 17 00:00:00 2001 From: Ken Sumrall Date: Mon, 7 Mar 2011 23:40:35 -0800 Subject: [PATCH] Teach vold to use the new android_reboot() function. The new android_reboot() function is a nicer way to reboot. It can optionally sync(2) and remount as read-only writable filesystems. This fixes bug 3350709. Change-Id: I4618bd5e8cccdce08494a7ca3f40ef72b2875e68 --- cryptfs.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/cryptfs.c b/cryptfs.c index 440221e..3c6deb1 100644 --- a/cryptfs.c +++ b/cryptfs.c @@ -35,7 +35,7 @@ #include #include #include -#include +#include #include #include "cryptfs.h" #define LOG_TAG "Cryptfs" @@ -1074,8 +1074,7 @@ int cryptfs_enable(char *howarg, char *passwd) put_crypt_ftr_and_key(real_blkdev, &crypt_ftr, 0, 0); sleep(2); /* Give the UI a change to show 100% progress */ - sync(); - reboot(LINUX_REBOOT_CMD_RESTART); + android_reboot(ANDROID_RB_RESTART, 0, 0); } else { property_set("vold.encrypt_progress", "error_partially_encrypted"); release_wake_lock(lockid); @@ -1103,8 +1102,7 @@ error_shutting_down: * vold to restart the system. */ SLOGE("Error enabling encryption after framework is shutdown, no data changed, restarting system"); - sync(); - reboot(LINUX_REBOOT_CMD_RESTART); + android_reboot(ANDROID_RB_RESTART, 0, 0); /* shouldn't get here */ property_set("vold.encrypt_progress", "error_shutting_down");