summaryrefslogtreecommitdiff
path: root/gsi_service.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'gsi_service.cpp')
-rw-r--r--gsi_service.cpp17
1 files changed, 14 insertions, 3 deletions
diff --git a/gsi_service.cpp b/gsi_service.cpp
index 3392a1d..2caa445 100644
--- a/gsi_service.cpp
+++ b/gsi_service.cpp
@@ -87,10 +87,10 @@ GsiService::GsiService() {
progress_ = {};
}
-void GsiService::Register() {
+void GsiService::Register(const std::string& name) {
auto lazyRegistrar = LazyServiceRegistrar::getInstance();
android::sp<GsiService> service = new GsiService();
- auto ret = lazyRegistrar.registerService(service, kGsiServiceName);
+ auto ret = lazyRegistrar.registerService(service, name);
if (ret != android::OK) {
LOG(FATAL) << "Could not register gsi service: " << ret;
@@ -343,7 +343,7 @@ binder::Status GsiService::isGsiEnabled(bool* _aidl_return) {
}
binder::Status GsiService::removeGsiAsync(const sp<IGsiServiceCallback>& resultCallback) {
- bool result;
+ bool result = false;
auto status = removeGsi(&result);
if (!status.isOk()) {
LOG(ERROR) << "Could not removeGsi: " << status.exceptionMessage().string();
@@ -577,6 +577,7 @@ class ImageService : public BinderService<ImageService>, public BnImageService {
int32_t* _aidl_return) override;
binder::Status zeroFillNewImage(const std::string& name, int64_t bytes) override;
binder::Status removeAllImages() override;
+ binder::Status disableImage(const std::string& name) override;
binder::Status removeDisabledImages() override;
binder::Status getMappedImageDevice(const std::string& name, std::string* device) override;
binder::Status isImageDisabled(const std::string& name, bool* _aidl_return) override;
@@ -740,6 +741,16 @@ binder::Status ImageService::removeAllImages() {
return binder::Status::ok();
}
+binder::Status ImageService::disableImage(const std::string& name) {
+ if (!CheckUid()) return UidSecurityError();
+
+ std::lock_guard<std::mutex> guard(service_->lock());
+ if (!impl_->DisableImage(name)) {
+ return BinderError("Failed to disable image: " + name);
+ }
+ return binder::Status::ok();
+}
+
binder::Status ImageService::removeDisabledImages() {
if (!CheckUid()) return UidSecurityError();