From f116bece334720c600fed1ffb8d2fbd4b9bb10e7 Mon Sep 17 00:00:00 2001 From: David Anderson Date: Thu, 10 Feb 2022 23:35:03 -0800 Subject: Add isImageDisbled to ImageService. Bug: 205987817 Test: adb remount Change-Id: I0e5db586995ffcad1f51dd1fef75833b04cc5653 --- aidl/android/gsi/IImageService.aidl | 5 +++++ gsi_service.cpp | 9 +++++++++ 2 files changed, 14 insertions(+) diff --git a/aidl/android/gsi/IImageService.aidl b/aidl/android/gsi/IImageService.aidl index c8c5a9d..363a919 100644 --- a/aidl/android/gsi/IImageService.aidl +++ b/aidl/android/gsi/IImageService.aidl @@ -134,6 +134,11 @@ interface IImageService { */ void removeDisabledImages(); + /** + * Return whether an image is disabled. + */ + boolean isImageDisabled(@utf8InCpp String name); + /** * Return the block device path of a mapped image, or an empty string if not mapped. */ diff --git a/gsi_service.cpp b/gsi_service.cpp index 2e1de14..6f7ff01 100644 --- a/gsi_service.cpp +++ b/gsi_service.cpp @@ -578,6 +578,7 @@ class ImageService : public BinderService, public BnImageService { binder::Status removeAllImages() 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; private: bool CheckUid(); @@ -748,6 +749,14 @@ binder::Status ImageService::removeDisabledImages() { return binder::Status::ok(); } +binder::Status ImageService::isImageDisabled(const std::string& name, bool* _aidl_return) { + if (!CheckUid()) return UidSecurityError(); + + std::lock_guard guard(service_->lock()); + *_aidl_return = impl_->IsImageDisabled(name); + return binder::Status::ok(); +} + binder::Status ImageService::getMappedImageDevice(const std::string& name, std::string* device) { if (!CheckUid()) return UidSecurityError(); -- cgit v1.2.3