Merge "Distinguish between unencrypted and unencryptable" into nyc-dev
This commit is contained in:
commit
72d2e06f4e
|
@ -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");
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
|
@ -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 */
|
||||
|
|
Loading…
Reference in New Issue