Add disableImage() to IImageService
This plumbs ImageManager::DisableImage() through binder.
Bug: 241688845
Test: 1. adb disable-verity
2. adb reboot
3. adb enable-verity
4. adb reboot
5. Check that "remount" scratch partition under '/data/gsi/remount/'
is deleted
Change-Id: Ia77b5286bf048076b1ec371ae07b84ae2a1cc064
diff --git a/gsi_service.cpp b/gsi_service.cpp
index 3392a1d..10bbb51 100644
--- a/gsi_service.cpp
+++ b/gsi_service.cpp
@@ -577,6 +577,7 @@
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 @@
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();