diff options
author | Paul Lawrence <paullawrence@google.com> | 2015-04-28 15:24:10 +0000 |
---|---|---|
committer | Gerrit Code Review <noreply-gerritcodereview@google.com> | 2015-04-28 15:24:10 +0000 |
commit | a71ef0d5b5c0e304d947f3782603890294d06ee2 (patch) | |
tree | 0a2fe3940bac768f1499470badb2e92e9c1b4d1a /init | |
parent | 06d2128f8729f3349f5ba588829c6f992a793c22 (diff) | |
parent | efe190e02387de382bb6d187ce62aec0fe9cfb44 (diff) | |
download | core-a71ef0d5b5c0e304d947f3782603890294d06ee2.tar.gz core-a71ef0d5b5c0e304d947f3782603890294d06ee2.tar.bz2 core-a71ef0d5b5c0e304d947f3782603890294d06ee2.zip |
Merge "Only run vold command when file encryption enabled"
Diffstat (limited to 'init')
-rw-r--r-- | init/builtins.cpp | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/init/builtins.cpp b/init/builtins.cpp index c03968990..d7723838e 100644 --- a/init/builtins.cpp +++ b/init/builtins.cpp @@ -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); @@ -826,10 +829,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); } |