summaryrefslogtreecommitdiff
path: root/gsi_service.cpp
diff options
context:
space:
mode:
authorDavid Anderson <dvander@google.com>2019-11-26 16:30:40 -0800
committerDavid Anderson <dvander@google.com>2019-11-26 18:09:16 -0800
commit86846bdfbb5134019e2c6ec633fd1a3bca2129bd (patch)
treefe1727cd4e70e524fce96dc79bcfab6ec87e6786 /gsi_service.cpp
parent52d8d2a3b1c39a3991edace22f155db5ea8b9aab (diff)
downloadgsid-86846bdfbb5134019e2c6ec633fd1a3bca2129bd.tar.gz
Expose ImageManager::RemoveAllImages via binder.
Bug: N/A Test: manual test Change-Id: I9429ed49f57caab054c6c3418d4da351a21a8131
Diffstat (limited to 'gsi_service.cpp')
-rw-r--r--gsi_service.cpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/gsi_service.cpp b/gsi_service.cpp
index dbf0ea6..2916c74 100644
--- a/gsi_service.cpp
+++ b/gsi_service.cpp
@@ -359,6 +359,7 @@ class ImageService : public BinderService<ImageService>, public BnImageService {
binder::Status backingImageExists(const std::string& name, bool* _aidl_return) override;
binder::Status isImageMapped(const std::string& name, bool* _aidl_return) override;
binder::Status zeroFillNewImage(const std::string& name, int64_t bytes) override;
+ binder::Status removeAllImages() override;
private:
bool CheckUid();
@@ -454,6 +455,16 @@ binder::Status ImageService::zeroFillNewImage(const std::string& name, int64_t b
return binder::Status::ok();
}
+binder::Status ImageService::removeAllImages() {
+ if (!CheckUid()) return UidSecurityError();
+
+ std::lock_guard<std::mutex> guard(parent_->lock());
+ if (!impl_->RemoveAllImages()) {
+ return BinderError("Failed to remove all images");
+ }
+ return binder::Status::ok();
+}
+
bool ImageService::CheckUid() {
return uid_ == IPCThreadState::self()->getCallingUid();
}