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
This commit is contained in:
Ken Sumrall 2011-03-07 23:40:35 -08:00
parent cd235da6fb
commit c290eaf685

View file

@ -35,7 +35,7 @@
#include <openssl/evp.h> #include <openssl/evp.h>
#include <openssl/sha.h> #include <openssl/sha.h>
#include <errno.h> #include <errno.h>
#include <sys/reboot.h> #include <cutils/android_reboot.h>
#include <ext4.h> #include <ext4.h>
#include "cryptfs.h" #include "cryptfs.h"
#define LOG_TAG "Cryptfs" #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); put_crypt_ftr_and_key(real_blkdev, &crypt_ftr, 0, 0);
sleep(2); /* Give the UI a change to show 100% progress */ sleep(2); /* Give the UI a change to show 100% progress */
sync(); android_reboot(ANDROID_RB_RESTART, 0, 0);
reboot(LINUX_REBOOT_CMD_RESTART);
} else { } else {
property_set("vold.encrypt_progress", "error_partially_encrypted"); property_set("vold.encrypt_progress", "error_partially_encrypted");
release_wake_lock(lockid); release_wake_lock(lockid);
@ -1103,8 +1102,7 @@ error_shutting_down:
* vold to restart the system. * vold to restart the system.
*/ */
SLOGE("Error enabling encryption after framework is shutdown, no data changed, restarting system"); SLOGE("Error enabling encryption after framework is shutdown, no data changed, restarting system");
sync(); android_reboot(ANDROID_RB_RESTART, 0, 0);
reboot(LINUX_REBOOT_CMD_RESTART);
/* shouldn't get here */ /* shouldn't get here */
property_set("vold.encrypt_progress", "error_shutting_down"); property_set("vold.encrypt_progress", "error_shutting_down");