Place GSI files into subfolders.
This moves /data/gsi to /data/gsi/dsu and /metadata/gsi to
/metadata/gsi/dsu.
Bug: 133435561
Test: adb shell gsi_tool install
Change-Id: I6ca999f8e7ae8ea294766f40c806b8822935e1b8
diff --git a/gsi_service.cpp b/gsi_service.cpp
index 24a741b..4dc703f 100644
--- a/gsi_service.cpp
+++ b/gsi_service.cpp
@@ -385,9 +385,11 @@
}
int GsiService::ValidateInstallParams(GsiInstallParams* params) {
- // If no install path was specified, use the default path.
- if (params->installDir.empty()) {
- params->installDir = kGsiDataFolder;
+ // If no install path was specified, use the default path. We also allow
+ // specifying the top-level folder, and then we choose the correct location
+ // underneath.
+ if (params->installDir.empty() || params->installDir == "/data/gsi") {
+ params->installDir = kDefaultGsiImageFolder;
}
// Normalize the path and add a trailing slash.
@@ -418,7 +420,7 @@
LOG(ERROR) << "cannot install GSIs to external media if verity uses check_at_most_once";
return INSTALL_ERROR_GENERIC;
}
- } else if (params->installDir != kGsiDataFolder) {
+ } else if (params->installDir != kDefaultGsiImageFolder) {
LOG(ERROR) << "cannot install GSI to " << params->installDir;
return INSTALL_ERROR_GENERIC;
}
@@ -450,7 +452,7 @@
if (android::base::ReadFileToString(kGsiInstallDirFile, &dir)) {
return dir;
}
- return kGsiDataFolder;
+ return kDefaultGsiImageFolder;
}
std::string GsiService::GetInstalledImagePath(const std::string& name) {