summaryrefslogtreecommitdiffstats
path: root/fs_mgr
diff options
context:
space:
mode:
authorLeo Wang <leozwang@google.com>2015-01-09 02:01:31 +0000
committerAndroid Git Automerger <android-git-automerger@android.com>2015-01-09 02:01:31 +0000
commit8e9407506f5e805175488993e699be0703275feb (patch)
tree31bf60edf519a544315b32e9de41c65d4602ceac /fs_mgr
parentfda1bb9e11244d263364fcaa47375348aaba5bcf (diff)
parentf2bd3fdd190fc1234913febfe254f8bcc4e675da (diff)
downloadsystem_core-8e9407506f5e805175488993e699be0703275feb.zip
system_core-8e9407506f5e805175488993e699be0703275feb.tar.gz
system_core-8e9407506f5e805175488993e699be0703275feb.tar.bz2
am f2bd3fdd: Merge "Provide a way to select force encryption from vendor partition" into lmp-mr1-dev
* commit 'f2bd3fdd190fc1234913febfe254f8bcc4e675da': Provide a way to select force encryption from vendor partition
Diffstat (limited to 'fs_mgr')
-rw-r--r--fs_mgr/fs_mgr.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/fs_mgr/fs_mgr.c b/fs_mgr/fs_mgr.c
index d1e92f2..ad02922 100644
--- a/fs_mgr/fs_mgr.c
+++ b/fs_mgr/fs_mgr.c
@@ -256,6 +256,15 @@ static int device_is_secure() {
return strcmp(value, "0") ? 1 : 0;
}
+static int device_is_force_encrypted() {
+ int ret = -1;
+ char value[PROP_VALUE_MAX];
+ ret = __system_property_get("ro.vold.forceencryption", value);
+ if (ret < 0)
+ return 0;
+ return strcmp(value, "1") ? 0 : 1;
+}
+
/*
* Tries to mount any of the consecutive fstab entries that match
* the mountpoint of the one given by fstab->recs[start_idx].
@@ -378,7 +387,9 @@ int fs_mgr_mount_all(struct fstab *fstab)
/* Deal with encryptability. */
if (!mret) {
/* If this is encryptable, need to trigger encryption */
- if ((fstab->recs[attempted_idx].fs_mgr_flags & MF_FORCECRYPT)) {
+ if ( (fstab->recs[attempted_idx].fs_mgr_flags & MF_FORCECRYPT)
+ || (device_is_force_encrypted()
+ && fs_mgr_is_encryptable(&fstab->recs[attempted_idx]))) {
if (umount(fstab->recs[attempted_idx].mount_point) == 0) {
if (encryptable == FS_MGR_MNTALL_DEV_NOT_ENCRYPTED) {
ERROR("Will try to encrypt %s %s\n", fstab->recs[attempted_idx].mount_point,