summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Anderson <dvander@google.com>2022-02-10 23:35:03 -0800
committerDavid Anderson <dvander@google.com>2022-02-10 23:35:41 -0800
commitf116bece334720c600fed1ffb8d2fbd4b9bb10e7 (patch)
treeedfef7958a2e28f598ea6a76888f2667ad74a56d
parent468c9ab7d105829f0e6a3aea9cef6089a8f44324 (diff)
downloadgsid-f116bece334720c600fed1ffb8d2fbd4b9bb10e7.tar.gz
Add isImageDisbled to ImageService.
Bug: 205987817 Test: adb remount Change-Id: I0e5db586995ffcad1f51dd1fef75833b04cc5653
-rw-r--r--aidl/android/gsi/IImageService.aidl5
-rw-r--r--gsi_service.cpp9
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 2e1de14..6f7ff01 100644
--- a/gsi_service.cpp
+++ b/gsi_service.cpp
@@ -578,6 +578,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();
@@ -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<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();