Merge "Set ro.crypto.type even on failure" am: 5350746a2b
Original change: https://android-review.googlesource.com/c/platform/system/core/+/1400948 Change-Id: If30c80f97fbbaf1ba532d45c60d68322acb1fe33
This commit is contained in:
commit
4fd4d4b948
2 changed files with 17 additions and 4 deletions
|
|
@ -976,6 +976,19 @@ static int handle_encryptable(const FstabEntry& entry) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void set_type_property(int status) {
|
||||||
|
switch (status) {
|
||||||
|
case FS_MGR_MNTALL_DEV_MIGHT_BE_ENCRYPTED:
|
||||||
|
SetProperty("ro.crypto.type", "block");
|
||||||
|
break;
|
||||||
|
case FS_MGR_MNTALL_DEV_FILE_ENCRYPTED:
|
||||||
|
case FS_MGR_MNTALL_DEV_IS_METADATA_ENCRYPTED:
|
||||||
|
case FS_MGR_MNTALL_DEV_NEEDS_METADATA_ENCRYPTION:
|
||||||
|
SetProperty("ro.crypto.type", "file");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static bool call_vdc(const std::vector<std::string>& args, int* ret) {
|
static bool call_vdc(const std::vector<std::string>& args, int* ret) {
|
||||||
std::vector<char const*> argv;
|
std::vector<char const*> argv;
|
||||||
argv.emplace_back("/system/bin/vdc");
|
argv.emplace_back("/system/bin/vdc");
|
||||||
|
|
@ -1366,6 +1379,7 @@ int fs_mgr_mount_all(Fstab* fstab, int mount_mode) {
|
||||||
avb_handle = AvbHandle::Open();
|
avb_handle = AvbHandle::Open();
|
||||||
if (!avb_handle) {
|
if (!avb_handle) {
|
||||||
LERROR << "Failed to open AvbHandle";
|
LERROR << "Failed to open AvbHandle";
|
||||||
|
set_type_property(encryptable);
|
||||||
return FS_MGR_MNTALL_FAIL;
|
return FS_MGR_MNTALL_FAIL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1422,6 +1436,7 @@ int fs_mgr_mount_all(Fstab* fstab, int mount_mode) {
|
||||||
attempted_entry.mount_point},
|
attempted_entry.mount_point},
|
||||||
nullptr)) {
|
nullptr)) {
|
||||||
LERROR << "Encryption failed";
|
LERROR << "Encryption failed";
|
||||||
|
set_type_property(encryptable);
|
||||||
return FS_MGR_MNTALL_FAIL;
|
return FS_MGR_MNTALL_FAIL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1519,6 +1534,8 @@ int fs_mgr_mount_all(Fstab* fstab, int mount_mode) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
set_type_property(encryptable);
|
||||||
|
|
||||||
#if ALLOW_ADBD_DISABLE_VERITY == 1 // "userdebug" build
|
#if ALLOW_ADBD_DISABLE_VERITY == 1 // "userdebug" build
|
||||||
fs_mgr_overlayfs_mount_all(fstab);
|
fs_mgr_overlayfs_mount_all(fstab);
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -570,7 +570,6 @@ static Result<void> queue_fs_event(int code, bool userdata_remount) {
|
||||||
trigger_shutdown("reboot,requested-userdata-remount-on-fde-device");
|
trigger_shutdown("reboot,requested-userdata-remount-on-fde-device");
|
||||||
}
|
}
|
||||||
SetProperty("ro.crypto.state", "encrypted");
|
SetProperty("ro.crypto.state", "encrypted");
|
||||||
SetProperty("ro.crypto.type", "block");
|
|
||||||
ActionManager::GetInstance().QueueEventTrigger("defaultcrypto");
|
ActionManager::GetInstance().QueueEventTrigger("defaultcrypto");
|
||||||
return {};
|
return {};
|
||||||
} else if (code == FS_MGR_MNTALL_DEV_NOT_ENCRYPTED) {
|
} else if (code == FS_MGR_MNTALL_DEV_NOT_ENCRYPTED) {
|
||||||
|
|
@ -595,7 +594,6 @@ static Result<void> queue_fs_event(int code, bool userdata_remount) {
|
||||||
return Error() << "FscryptInstallKeyring() failed";
|
return Error() << "FscryptInstallKeyring() failed";
|
||||||
}
|
}
|
||||||
SetProperty("ro.crypto.state", "encrypted");
|
SetProperty("ro.crypto.state", "encrypted");
|
||||||
SetProperty("ro.crypto.type", "file");
|
|
||||||
|
|
||||||
// Although encrypted, we have device key, so we do not need to
|
// Although encrypted, we have device key, so we do not need to
|
||||||
// do anything different from the nonencrypted case.
|
// do anything different from the nonencrypted case.
|
||||||
|
|
@ -606,7 +604,6 @@ static Result<void> queue_fs_event(int code, bool userdata_remount) {
|
||||||
return Error() << "FscryptInstallKeyring() failed";
|
return Error() << "FscryptInstallKeyring() failed";
|
||||||
}
|
}
|
||||||
SetProperty("ro.crypto.state", "encrypted");
|
SetProperty("ro.crypto.state", "encrypted");
|
||||||
SetProperty("ro.crypto.type", "file");
|
|
||||||
|
|
||||||
// Although encrypted, vold has already set the device up, so we do not need to
|
// Although encrypted, vold has already set the device up, so we do not need to
|
||||||
// do anything different from the nonencrypted case.
|
// do anything different from the nonencrypted case.
|
||||||
|
|
@ -617,7 +614,6 @@ static Result<void> queue_fs_event(int code, bool userdata_remount) {
|
||||||
return Error() << "FscryptInstallKeyring() failed";
|
return Error() << "FscryptInstallKeyring() failed";
|
||||||
}
|
}
|
||||||
SetProperty("ro.crypto.state", "encrypted");
|
SetProperty("ro.crypto.state", "encrypted");
|
||||||
SetProperty("ro.crypto.type", "file");
|
|
||||||
|
|
||||||
// Although encrypted, vold has already set the device up, so we do not need to
|
// Although encrypted, vold has already set the device up, so we do not need to
|
||||||
// do anything different from the nonencrypted case.
|
// do anything different from the nonencrypted case.
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue