summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYi-Yo Chiang <yochiang@google.com>2022-08-08 19:03:09 +0800
committerYi-Yo Chiang <yochiang@google.com>2022-08-08 19:03:09 +0800
commit6c1043f18e2f825780c3af91a5567a5915ba04b8 (patch)
tree7c0a11da3fb60088b2e36e51a5c4e28613c1c575
parent6379aa78f708e4f698d9f5d2b998c78f5d273adf (diff)
downloadgsid-6c1043f18e2f825780c3af91a5567a5915ba04b8.tar.gz
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
-rw-r--r--aidl/android/gsi/IImageService.aidl7
-rw-r--r--gsi_service.cpp11
2 files changed, 17 insertions, 1 deletions
diff --git a/aidl/android/gsi/IImageService.aidl b/aidl/android/gsi/IImageService.aidl
index 363a919..9f84e50 100644
--- a/aidl/android/gsi/IImageService.aidl
+++ b/aidl/android/gsi/IImageService.aidl
@@ -130,7 +130,12 @@ interface IImageService {
void removeAllImages();
/**
- * Remove all images that were marked as disabled in recovery.
+ * Mark an image as disabled.
+ */
+ void disableImage(@utf8InCpp String name);
+
+ /**
+ * Remove all images that were marked as disabled.
*/
void removeDisabledImages();
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 @@ 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();