Merge "Remove code to handle non-default file encryption"
diff --git a/fs_mgr/fs_mgr.c b/fs_mgr/fs_mgr.c
index 2ff6273..bd30e94 100644
--- a/fs_mgr/fs_mgr.c
+++ b/fs_mgr/fs_mgr.c
@@ -441,7 +441,7 @@
}
// Check to see if a mountable volume has encryption requirements
-static int handle_encryptable(struct fstab *fstab, const struct fstab_rec* rec)
+static int handle_encryptable(const struct fstab_rec* rec)
{
/* Check for existence of convert_fbe breadcrumb file */
char convert_fbe_name[PATH_MAX];
@@ -472,41 +472,8 @@
// Deal with file level encryption
if ( (rec->fs_mgr_flags & MF_FILEENCRYPTION)
|| ((rec->fs_mgr_flags & MF_FORCEFDEORFBE) && convert_fbe)) {
- // Default or not yet initialized encryption requires no more work here
- if (!e4crypt_non_default_key(rec->mount_point)) {
- INFO("%s is default file encrypted\n", rec->mount_point);
- return FS_MGR_MNTALL_DEV_DEFAULT_FILE_ENCRYPTED;
- }
-
- INFO("%s is non-default file encrypted\n", rec->mount_point);
-
- // Uses non-default key, so must unmount and set up temp file system
- if (umount(rec->mount_point)) {
- ERROR("Failed to umount %s - rebooting\n", rec->mount_point);
- return FS_MGR_MNTALL_FAIL;
- }
-
- if (fs_mgr_do_tmpfs_mount(rec->mount_point) != 0) {
- ERROR("Failed to mount a tmpfs at %s\n", rec->mount_point);
- return FS_MGR_MNTALL_FAIL;
- }
-
- // Mount data temporarily so we can access unencrypted dir
- char tmp_mnt[PATH_MAX];
- strlcpy(tmp_mnt, rec->mount_point, sizeof(tmp_mnt));
- strlcat(tmp_mnt, "/tmp_mnt", sizeof(tmp_mnt));
- if (mkdir(tmp_mnt, 0700)) {
- ERROR("Failed to create temp mount point\n");
- return FS_MGR_MNTALL_FAIL;
- }
-
- if (fs_mgr_do_mount(fstab, rec->mount_point,
- rec->blk_device, tmp_mnt)) {
- ERROR("Error temp mounting encrypted file system\n");
- return FS_MGR_MNTALL_FAIL;
- }
-
- return FS_MGR_MNTALL_DEV_NON_DEFAULT_FILE_ENCRYPTED;
+ INFO("%s is file encrypted\n", rec->mount_point);
+ return FS_MGR_MNTALL_DEV_FILE_ENCRYPTED;
}
return FS_MGR_MNTALL_DEV_NOT_ENCRYPTED;
@@ -584,7 +551,7 @@
/* Deal with encryptability. */
if (!mret) {
- int status = handle_encryptable(fstab, &fstab->recs[attempted_idx]);
+ int status = handle_encryptable(&fstab->recs[attempted_idx]);
if (status == FS_MGR_MNTALL_FAIL) {
/* Fatal error - no point continuing */
diff --git a/fs_mgr/include/fs_mgr.h b/fs_mgr/include/fs_mgr.h
index eb0a7fc..d9a7c4c 100644
--- a/fs_mgr/include/fs_mgr.h
+++ b/fs_mgr/include/fs_mgr.h
@@ -74,8 +74,7 @@
struct fstab *fs_mgr_read_fstab(const char *fstab_path);
void fs_mgr_free_fstab(struct fstab *fstab);
-#define FS_MGR_MNTALL_DEV_NON_DEFAULT_FILE_ENCRYPTED 5
-#define FS_MGR_MNTALL_DEV_DEFAULT_FILE_ENCRYPTED 4
+#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
diff --git a/init/builtins.cpp b/init/builtins.cpp
index e5e64b4..210ce4a 100644
--- a/init/builtins.cpp
+++ b/init/builtins.cpp
@@ -510,7 +510,7 @@
ERROR("fs_mgr_mount_all suggested recovery, so wiping data via recovery.\n");
ret = wipe_data_via_recovery();
/* If reboot worked, there is no return. */
- } else if (ret == FS_MGR_MNTALL_DEV_DEFAULT_FILE_ENCRYPTED) {
+ } else if (ret == FS_MGR_MNTALL_DEV_FILE_ENCRYPTED) {
if (e4crypt_install_keyring()) {
return -1;
}
@@ -520,13 +520,6 @@
// Although encrypted, we have device key, so we do not need to
// do anything different from the nonencrypted case.
ActionManager::GetInstance().QueueEventTrigger("nonencrypted");
- } else if (ret == FS_MGR_MNTALL_DEV_NON_DEFAULT_FILE_ENCRYPTED) {
- if (e4crypt_install_keyring()) {
- 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);
}