Merge "vold: write bootloader message directly." into nyc-dev am: cbedcc3
am: 008c7dd
* commit '008c7ddb1fe7743f780801c1cf219a3c25445401':
vold: write bootloader message directly.
Change-Id: I10a098025619c4f32db3ce551a4b85e14a9558a8
This commit is contained in:
commit
baeb3b4816
2 changed files with 4 additions and 8 deletions
|
@ -60,6 +60,7 @@ common_shared_libraries := \
|
|||
libkeymaster_messages \
|
||||
|
||||
common_static_libraries := \
|
||||
libbootloader_message_writer \
|
||||
libfs_mgr \
|
||||
libfec \
|
||||
libfec_rs \
|
||||
|
|
11
cryptfs.c
11
cryptfs.c
|
@ -62,6 +62,7 @@
|
|||
#include "CheckBattery.h"
|
||||
#include "Process.h"
|
||||
|
||||
#include <bootloader_message_writer.h>
|
||||
#include <hardware/keymaster0.h>
|
||||
#include <hardware/keymaster1.h>
|
||||
|
||||
|
@ -3267,14 +3268,8 @@ int cryptfs_enable_internal(char *howarg, int crypt_type, char *passwd,
|
|||
if (!strcmp(value, "1")) {
|
||||
/* wipe data if encryption failed */
|
||||
SLOGE("encryption failed - rebooting into recovery to wipe data\n");
|
||||
mkdir("/cache/recovery", 0700);
|
||||
int fd = open("/cache/recovery/command", O_RDWR|O_CREAT|O_TRUNC|O_CLOEXEC, 0600);
|
||||
if (fd >= 0) {
|
||||
write(fd, "--wipe_data\n", strlen("--wipe_data\n") + 1);
|
||||
write(fd, "--reason=cryptfs_enable_internal\n", strlen("--reason=cryptfs_enable_internal\n") + 1);
|
||||
close(fd);
|
||||
} else {
|
||||
SLOGE("could not open /cache/recovery/command\n");
|
||||
if (!write_bootloader_message("--wipe_data\n--reason=cryptfs_enable_internal\n")) {
|
||||
SLOGE("could not write bootloader message\n");
|
||||
}
|
||||
cryptfs_reboot(recovery);
|
||||
} else {
|
||||
|
|
Loading…
Reference in a new issue