From 7016a0dec67c472f82da6319be882aa23b35a94a Mon Sep 17 00:00:00 2001 From: David Anderson Date: Mon, 16 Dec 2019 22:06:47 -0800 Subject: Add removeDisabledImages to IImageService. This wraps ImageManager::RemoveDisabledImages. Bug: 134949511 Test: adb remount; fastboot flash system Change-Id: Ib288c356bd1a9bba2068b7c8f59990fa0d8a89f9 --- gsi_service.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'gsi_service.cpp') 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, 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 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(); } -- cgit v1.2.3