summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorandroid-build-team Robot <android-build-team-robot@google.com>2021-02-25 02:09:10 +0000
committerandroid-build-team Robot <android-build-team-robot@google.com>2021-02-25 02:09:10 +0000
commit434d6e9c139b9157e44e8d9cd1fb9bbfd1abfa5b (patch)
treeb3d7d5886ca1e332e85438e54febb7e9c02aa72c
parent075c2e1848d6030fc5ab959f12d494add3d2b33e (diff)
parent244559007327293d09f667618ac29c3673e42823 (diff)
downloadgsid-434d6e9c139b9157e44e8d9cd1fb9bbfd1abfa5b.tar.gz
Snap for 7168754 from 244559007327293d09f667618ac29c3673e42823 to sc-release
Change-Id: I04786c5e25834524e925c46e036e35dc0182c1b1
-rw-r--r--gsi_service.cpp17
1 files changed, 8 insertions, 9 deletions
diff --git a/gsi_service.cpp b/gsi_service.cpp
index e4052b2..002c51f 100644
--- a/gsi_service.cpp
+++ b/gsi_service.cpp
@@ -130,15 +130,6 @@ binder::Status GsiService::openInstall(const std::string& install_dir, int* _aid
*_aidl_return = status;
return binder::Status::ok();
}
- if (access(install_dir_.c_str(), F_OK) != 0 && errno == ENOENT) {
- if (IsExternalStoragePath(install_dir_)) {
- if (mkdir(install_dir_.c_str(), 0755) != 0) {
- PLOG(ERROR) << "Failed to create " << install_dir_;
- *_aidl_return = IGsiService::INSTALL_ERROR_GENERIC;
- return binder::Status::ok();
- }
- }
- }
std::string message;
auto dsu_slot = GetDsuSlot(install_dir_);
if (!RemoveFileIfExists(GetCompleteIndication(dsu_slot), &message)) {
@@ -845,6 +836,14 @@ int GsiService::ValidateInstallParams(std::string& install_dir) {
install_dir = kDefaultDsuImageFolder;
}
+ if (access(install_dir.c_str(), F_OK) != 0 && (errno == ENOENT)) {
+ if (android::base::StartsWith(install_dir, kDsuSDPrefix)) {
+ if (mkdir(install_dir.c_str(), 0755) != 0) {
+ PLOG(ERROR) << "Failed to create " << install_dir;
+ return INSTALL_ERROR_GENERIC;
+ }
+ }
+ }
// Normalize the path and add a trailing slash.
std::string origInstallDir = install_dir;
if (!android::base::Realpath(origInstallDir, &install_dir)) {