diff options
author | David Anderson <dvander@google.com> | 2022-02-17 18:24:19 +0000 |
---|---|---|
committer | Gerrit Code Review <noreply-gerritcodereview@google.com> | 2022-02-17 18:24:19 +0000 |
commit | f949c45006c7930e5c87e1288c498e71c3818130 (patch) | |
tree | ef273064754773a69bfd226fc641730ba52f218c | |
parent | 48104202b4fe12c26611f823185424f07c773495 (diff) | |
parent | f116bece334720c600fed1ffb8d2fbd4b9bb10e7 (diff) | |
download | gsid-f949c45006c7930e5c87e1288c498e71c3818130.tar.gz |
Merge "Add isImageDisbled to ImageService."
-rw-r--r-- | aidl/android/gsi/IImageService.aidl | 5 | ||||
-rw-r--r-- | gsi_service.cpp | 9 |
2 files changed, 14 insertions, 0 deletions
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 @@ -135,6 +135,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. */ @utf8InCpp String getMappedImageDevice(@utf8InCpp String name); diff --git a/gsi_service.cpp b/gsi_service.cpp index c7b3a28..122bbf6 100644 --- a/gsi_service.cpp +++ b/gsi_service.cpp @@ -594,6 +594,7 @@ class ImageService : public BinderService<ImageService>, 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(); @@ -764,6 +765,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<std::mutex> 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(); |