recovery: Don't print mount errors when checking for encryption
Change-Id: Ibd57b8bdb9c942edb16fa5b9e4664ed66864b180
volume_manager: Move bind/mount failure from ERROR to WARN
* Prevents users from seeing this message on FBE devices:
`failed to bind mount /mnt/staging/emulated/media/0 to /storage/emulated`
* FDE users already have the workaround in line 75.
Change-Id: I47d1aaf1a5a85a46fd52dc924a91b378cd800b2d
diff --git a/recovery_main.cpp b/recovery_main.cpp
index 600f409..7597418 100644
--- a/recovery_main.cpp
+++ b/recovery_main.cpp
@@ -198,6 +198,7 @@
}
static void copy_userdata_files() {
+ android::base::SetLogger(android::base::StdioLogger);
if (ensure_path_mounted("/data") == 0) {
if (access(adb_keys_root, F_OK) != 0) {
if (access(adb_keys_data, R_OK) == 0) {
@@ -209,6 +210,7 @@
}
ensure_path_unmounted("/data");
}
+ android::base::SetLogger(UiLogger);
}
// Sets the usb config to 'state'.
diff --git a/volume_manager/EmulatedVolume.cpp b/volume_manager/EmulatedVolume.cpp
index d0e0dcf..2d35c20 100644
--- a/volume_manager/EmulatedVolume.cpp
+++ b/volume_manager/EmulatedVolume.cpp
@@ -25,6 +25,7 @@
#include <cutils/fs.h>
#include <private/android_filesystem_config.h>
+#include <iostream>
#include <fcntl.h>
#include <stdlib.h>
#include <sys/mount.h>
@@ -70,11 +71,13 @@
if (::mount(mDevPath.c_str(), kStagingPath.c_str(), mFsType.c_str(), mFlags,
mFsOptions.c_str()) != 0) {
- PLOG(ERROR) << getId() << " failed to mount " << mDevPath << " on " << kStagingPath;
+ // It's ok to fail mounting if we're encrytped, so avoid printing to recovery's UiLogger
+ std::cout << getId() << " failed to mount " << mDevPath << " on " << kStagingPath
+ << ": " << std::strerror(errno);
return -EIO;
}
if (BindMount(bindPath, getPath()) != OK) {
- PLOG(ERROR) << getId() << " failed to bind mount " << bindPath << " on " << getPath();
+ PLOG(WARNING) << getId() << " failed to bind mount " << bindPath << " on " << getPath();
ForceUnmount(kStagingPath);
return -EIO;
}