diff options
author | David Anderson <dvander@google.com> | 2019-12-16 22:06:47 -0800 |
---|---|---|
committer | David Anderson <dvander@google.com> | 2019-12-18 13:44:39 -0800 |
commit | 7016a0dec67c472f82da6319be882aa23b35a94a (patch) | |
tree | 28c1e72f007ad4087e3d3cb2e5168756b8b2f5af /gsi_service.cpp | |
parent | 227301b9d0666d3831778f42053782bc8cde0c88 (diff) | |
download | gsid-7016a0dec67c472f82da6319be882aa23b35a94a.tar.gz |
Add removeDisabledImages to IImageService.
This wraps ImageManager::RemoveDisabledImages.
Bug: 134949511
Test: adb remount; fastboot flash system
Change-Id: Ib288c356bd1a9bba2068b7c8f59990fa0d8a89f9
Diffstat (limited to 'gsi_service.cpp')
-rw-r--r-- | gsi_service.cpp | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/gsi_service.cpp b/gsi_service.cpp index 5ef4914..0498966 100644 --- a/gsi_service.cpp +++ b/gsi_service.cpp @@ -449,6 +449,7 @@ class ImageService : public BinderService<ImageService>, public BnImageService { 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; + binder::Status removeDisabledImages() override; private: bool CheckUid(); @@ -554,6 +555,16 @@ binder::Status ImageService::removeAllImages() { return binder::Status::ok(); } +binder::Status ImageService::removeDisabledImages() { + if (!CheckUid()) return UidSecurityError(); + + std::lock_guard<std::mutex> guard(parent_->lock()); + if (!impl_->RemoveDisabledImages()) { + return BinderError("Failed to remove disabled images"); + } + return binder::Status::ok(); +} + bool ImageService::CheckUid() { return uid_ == IPCThreadState::self()->getCallingUid(); } |