vold: write bootloader message directly.
Bug: 27176738 Change-Id: I09bfe777e383325809d7ecc2dcb9129fe234053f
This commit is contained in:
parent
8aff854b94
commit
ffa2e09921
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>
|
||||
|
||||
|
@ -3262,14 +3263,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