Only run vold command when file encryption enabled

Avod slowing other boot times

Change-Id: I4862312ea90d8a1e67d9a755a75f708f5e82cbc5
This commit is contained in:
Paul Lawrence 2015-04-14 13:06:58 -07:00
parent 4bf1887c78
commit efe190e023
1 changed files with 13 additions and 4 deletions

View File

@ -440,6 +440,7 @@ int do_mount_all(int nargs, char **args)
property_set("vold.decrypt", "trigger_encryption");
} else if (ret == FS_MGR_MNTALL_DEV_MIGHT_BE_ENCRYPTED) {
property_set("ro.crypto.state", "encrypted");
property_set("ro.crypto.type", "block");
property_set("vold.decrypt", "trigger_default_encryption");
} else if (ret == FS_MGR_MNTALL_DEV_NOT_ENCRYPTED) {
property_set("ro.crypto.state", "unencrypted");
@ -457,6 +458,7 @@ int do_mount_all(int nargs, char **args)
return -1;
}
property_set("ro.crypto.state", "encrypted");
property_set("ro.crypto.type", "file");
// Although encrypted, we have device key, so we do not need to
// do anything different from the nonencrypted case.
@ -466,6 +468,7 @@ int do_mount_all(int nargs, char **args)
return -1;
}
property_set("ro.crypto.state", "encrypted");
property_set("ro.crypto.type", "file");
property_set("vold.decrypt", "trigger_restart_min_framework");
} else if (ret > 0) {
ERROR("fs_mgr_mount_all returned unexpected error %d\n", ret);
@ -835,10 +838,16 @@ static int do_installkeys_ensure_dir_exists(const char* dir)
int do_installkey(int nargs, char **args)
{
if (nargs == 2) {
return e4crypt_create_device_key(args[1],
do_installkeys_ensure_dir_exists);
if (nargs != 2) {
return -1;
}
return -1;
char prop_value[PROP_VALUE_MAX] = {0};
property_get("ro.crypto.type", prop_value);
if (strcmp(prop_value, "file")) {
return 0;
}
return e4crypt_create_device_key(args[1],
do_installkeys_ensure_dir_exists);
}