System always contains root dir.
In recovery, system image is mounted to /mnt/system. After the work of
first stage ramdisk, system image always contains the root dir, no
matter what value of ro.build.system_root_image is.
Test: do compat check in recovery
Bug: 112586588
Change-Id: I3890c9c1335b23fd22a8910bca07e59d631bac71
diff --git a/VintfObjectRecovery.cpp b/VintfObjectRecovery.cpp
index a24fc7a..a7bc174 100644
--- a/VintfObjectRecovery.cpp
+++ b/VintfObjectRecovery.cpp
@@ -80,7 +80,7 @@
class RecoveryFileSystem : public FileSystem {
public:
- RecoveryFileSystem(bool systemRootImage) : mSystemRootImage(systemRootImage) {}
+ RecoveryFileSystem() = default;
status_t fetch(const std::string& path, std::string* fetched, std::string* error) const {
return getFileSystem(path).fetch(path, fetched, error);
@@ -92,13 +92,12 @@
}
private:
- const bool mSystemRootImage = false;
FileSystemUnderPath mSystemFileSystem{"/mnt/system"};
FileSystemUnderPath mMntFileSystem{"/mnt"};
const FileSystemUnderPath& getFileSystem(const std::string& path) const {
- // If system_root_image, /system files are under /mnt/system/system.
- if (StartsWith(path, "/system") && mSystemRootImage) {
+ // /system files are under /mnt/system/system because system.img contains the root dir.
+ if (StartsWith(path, "/system")) {
return mSystemFileSystem;
}
return mMntFileSystem;
@@ -113,7 +112,7 @@
auto propertyFetcher = std::make_unique<details::PropertyFetcherImpl>();
bool systemRootImage = propertyFetcher->getBoolProperty("ro.build.system_root_image", false);
auto mounter = std::make_unique<details::RecoveryPartitionMounter>(systemRootImage);
- auto fileSystem = std::make_unique<details::RecoveryFileSystem>(systemRootImage);
+ auto fileSystem = std::make_unique<details::RecoveryFileSystem>();
auto vintfObject = std::make_unique<VintfObject>(std::move(fileSystem), std::move(mounter),
nullptr /* runtime info factory */,
std::move(propertyFetcher));