Merge "vold: Use the new method of rebooting by asking init to do it"

gugelfrei
Ken Sumrall 11 years ago committed by Android (Google) Code Review
commit 558830c38a

@ -35,15 +35,14 @@
#include <openssl/evp.h> #include <openssl/evp.h>
#include <openssl/sha.h> #include <openssl/sha.h>
#include <errno.h> #include <errno.h>
#include <cutils/android_reboot.h>
#include <ext4.h> #include <ext4.h>
#include <linux/kdev_t.h> #include <linux/kdev_t.h>
#include <fs_mgr.h> #include <fs_mgr.h>
#include "cryptfs.h" #include "cryptfs.h"
#define LOG_TAG "Cryptfs" #define LOG_TAG "Cryptfs"
#include "cutils/android_reboot.h"
#include "cutils/log.h" #include "cutils/log.h"
#include "cutils/properties.h" #include "cutils/properties.h"
#include "cutils/android_reboot.h"
#include "hardware_legacy/power.h" #include "hardware_legacy/power.h"
#include "VolumeManager.h" #include "VolumeManager.h"
#include "VoldUtil.h" #include "VoldUtil.h"
@ -72,6 +71,19 @@ static struct crypt_persist_data *persist_data = NULL;
extern struct fstab *fstab; extern struct fstab *fstab;
static void cryptfs_reboot(int recovery)
{
if (recovery) {
property_set(ANDROID_RB_PROPERTY, "reboot,recovery");
} else {
property_set(ANDROID_RB_PROPERTY, "reboot");
}
sleep(20);
/* Shouldn't get here, reboot should happen before sleep times out */
return;
}
static void ioctl_init(struct dm_ioctl *io, size_t dataSize, const char *name, unsigned flags) static void ioctl_init(struct dm_ioctl *io, size_t dataSize, const char *name, unsigned flags)
{ {
memset(io, 0, dataSize); memset(io, 0, dataSize);
@ -1803,7 +1815,7 @@ int cryptfs_enable(char *howarg, char *passwd)
put_crypt_ftr_and_key(&crypt_ftr); put_crypt_ftr_and_key(&crypt_ftr);
sleep(2); /* Give the UI a chance to show 100% progress */ sleep(2); /* Give the UI a chance to show 100% progress */
android_reboot(ANDROID_RB_RESTART, 0, 0); cryptfs_reboot(0);
} else { } else {
char value[PROPERTY_VALUE_MAX]; char value[PROPERTY_VALUE_MAX];
@ -1819,7 +1831,7 @@ int cryptfs_enable(char *howarg, char *passwd)
} else { } else {
SLOGE("could not open /cache/recovery/command\n"); SLOGE("could not open /cache/recovery/command\n");
} }
android_reboot(ANDROID_RB_RESTART2, 0, "recovery"); cryptfs_reboot(1);
} else { } else {
/* set property to trigger dialog */ /* set property to trigger dialog */
property_set("vold.encrypt_progress", "error_partially_encrypted"); property_set("vold.encrypt_progress", "error_partially_encrypted");
@ -1850,7 +1862,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");
android_reboot(ANDROID_RB_RESTART, 0, 0); cryptfs_reboot(0);
/* shouldn't get here */ /* shouldn't get here */
property_set("vold.encrypt_progress", "error_shutting_down"); property_set("vold.encrypt_progress", "error_shutting_down");

Loading…
Cancel
Save