Merge "Distinguish between unencrypted and unencryptable" into nyc-dev

This commit is contained in:
Paul Lawrence 2016-03-07 16:48:46 +00:00 committed by Android (Google) Code Review
commit 72d2e06f4e
3 changed files with 15 additions and 12 deletions

View File

@ -477,8 +477,10 @@ static int handle_encryptable(const struct fstab_rec* rec)
// Deal with file level encryption
INFO("%s is file encrypted\n", rec->mount_point);
return FS_MGR_MNTALL_DEV_FILE_ENCRYPTED;
} else {
} else if (fs_mgr_is_encryptable(rec)) {
return FS_MGR_MNTALL_DEV_NOT_ENCRYPTED;
} else {
return FS_MGR_MNTALL_DEV_NOT_ENCRYPTABLE;
}
}
@ -490,7 +492,7 @@ static int handle_encryptable(const struct fstab_rec* rec)
int fs_mgr_mount_all(struct fstab *fstab)
{
int i = 0;
int encryptable = FS_MGR_MNTALL_DEV_NOT_ENCRYPTED;
int encryptable = FS_MGR_MNTALL_DEV_NOT_ENCRYPTABLE;
int error_count = 0;
int mret = -1;
int mount_errno = 0;
@ -561,8 +563,8 @@ int fs_mgr_mount_all(struct fstab *fstab)
return status;
}
if (status != FS_MGR_MNTALL_DEV_NOT_ENCRYPTED) {
if (encryptable != FS_MGR_MNTALL_DEV_NOT_ENCRYPTED) {
if (status != FS_MGR_MNTALL_DEV_NOT_ENCRYPTABLE) {
if (encryptable != FS_MGR_MNTALL_DEV_NOT_ENCRYPTABLE) {
// Log and continue
ERROR("Only one encryptable/encrypted partition supported\n");
}

View File

@ -74,11 +74,12 @@ typedef void (*fs_mgr_verity_state_callback)(struct fstab_rec *fstab,
struct fstab *fs_mgr_read_fstab(const char *fstab_path);
void fs_mgr_free_fstab(struct fstab *fstab);
#define FS_MGR_MNTALL_DEV_FILE_ENCRYPTED 4
#define FS_MGR_MNTALL_DEV_NEEDS_RECOVERY 3
#define FS_MGR_MNTALL_DEV_NEEDS_ENCRYPTION 2
#define FS_MGR_MNTALL_DEV_MIGHT_BE_ENCRYPTED 1
#define FS_MGR_MNTALL_DEV_NOT_ENCRYPTED 0
#define FS_MGR_MNTALL_DEV_FILE_ENCRYPTED 5
#define FS_MGR_MNTALL_DEV_NEEDS_RECOVERY 4
#define FS_MGR_MNTALL_DEV_NEEDS_ENCRYPTION 3
#define FS_MGR_MNTALL_DEV_MIGHT_BE_ENCRYPTED 2
#define FS_MGR_MNTALL_DEV_NOT_ENCRYPTED 1
#define FS_MGR_MNTALL_DEV_NOT_ENCRYPTABLE 0
#define FS_MGR_MNTALL_FAIL -1
int fs_mgr_mount_all(struct fstab *fstab);

View File

@ -501,9 +501,9 @@ static int do_mount_all(const std::vector<std::string>& args) {
property_set("vold.decrypt", "trigger_default_encryption");
} else if (ret == FS_MGR_MNTALL_DEV_NOT_ENCRYPTED) {
property_set("ro.crypto.state", "unencrypted");
/* If fs_mgr determined this is an unencrypted device, then trigger
* that action.
*/
ActionManager::GetInstance().QueueEventTrigger("nonencrypted");
} else if (ret == FS_MGR_MNTALL_DEV_NOT_ENCRYPTABLE) {
property_set("ro.crypto.state", "unsupported");
ActionManager::GetInstance().QueueEventTrigger("nonencrypted");
} else if (ret == FS_MGR_MNTALL_DEV_NEEDS_RECOVERY) {
/* Setup a wipe via recovery, and reboot into recovery */