diff options
author | Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com> | 2020-03-06 02:38:51 +0000 |
---|---|---|
committer | Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com> | 2020-03-06 02:38:51 +0000 |
commit | 0ef6790f24b327335710d7e78d29f68e6f96ecd0 (patch) | |
tree | d1fec92b4633593f6cf07274176ec2ced4800499 /gsi_service.cpp | |
parent | d39f7d46f1ea805964bf06faf3f5a03d547da0a1 (diff) | |
parent | 0e18806d28f8d8ff72aff4db698afb97f79e3301 (diff) | |
download | gsid-0ef6790f24b327335710d7e78d29f68e6f96ecd0.tar.gz |
Provide oneway method for methods required by system_server am: 0e18806d28
Change-Id: Id1fb87678be56a3fe9949a5d70e1ef30adede5b9
Diffstat (limited to 'gsi_service.cpp')
-rw-r--r-- | gsi_service.cpp | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/gsi_service.cpp b/gsi_service.cpp index 3705c5b..77db54b 100644 --- a/gsi_service.cpp +++ b/gsi_service.cpp @@ -33,6 +33,7 @@ #include <android-base/errors.h> #include <android-base/file.h> #include <android-base/logging.h> +#include <android-base/properties.h> #include <android-base/stringprintf.h> #include <android-base/strings.h> #include <android/gsi/BnImageService.h> @@ -57,6 +58,7 @@ using namespace android::fiemap; using android::base::ReadFileToString; using android::base::ReadFullyAtOffset; using android::base::RemoveFileIfExists; +using android::base::SetProperty; using android::base::StringPrintf; using android::base::unique_fd; using android::base::WriteStringToFd; @@ -278,6 +280,18 @@ binder::Status GsiService::setGsiAshmem(const ::android::os::ParcelFileDescripto return binder::Status::ok(); } +binder::Status GsiService::enableGsiAsync(bool one_shot, const std::string& dsuSlot, + const sp<IGsiServiceCallback>& resultCallback) { + int result; + auto status = enableGsi(one_shot, dsuSlot, &result); + if (!status.isOk()) { + LOG(ERROR) << "Could not enableGsi: " << status.exceptionMessage().string(); + result = IGsiService::INSTALL_ERROR_GENERIC; + } + resultCallback->onResult(result); + return binder::Status::ok(); +} + binder::Status GsiService::enableGsi(bool one_shot, const std::string& dsuSlot, int* _aidl_return) { std::lock_guard<std::mutex> guard(parent_->lock()); @@ -317,6 +331,17 @@ binder::Status GsiService::isGsiEnabled(bool* _aidl_return) { return binder::Status::ok(); } +binder::Status GsiService::removeGsiAsync(const sp<IGsiServiceCallback>& resultCallback) { + bool result; + auto status = removeGsi(&result); + if (!status.isOk()) { + LOG(ERROR) << "Could not removeGsi: " << status.exceptionMessage().string(); + result = IGsiService::INSTALL_ERROR_GENERIC; + } + resultCallback->onResult(result); + return binder::Status::ok(); +} + binder::Status GsiService::removeGsi(bool* _aidl_return) { ENFORCE_SYSTEM_OR_SHELL; std::lock_guard<std::mutex> guard(parent_->lock()); @@ -474,6 +499,7 @@ bool GsiService::CreateInstallStatusFile() { PLOG(ERROR) << "write " << kDsuInstallStatusFile; return false; } + SetProperty(kGsiInstalledProp, "1"); return true; } @@ -904,6 +930,9 @@ bool GsiService::RemoveGsiFiles(const std::string& install_dir) { ok = false; } } + if (ok) { + SetProperty(kGsiInstalledProp, "0"); + } return ok; } |