summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Anderson <dvander@google.com>2022-02-18 05:02:17 +0000
committerAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>2022-02-18 05:02:17 +0000
commit090198bb079e118fb913eaa5618c45bd87cbf6fa (patch)
treeef273064754773a69bfd226fc641730ba52f218c
parent7117da69dfe1be9cec5a6d7b19fe0aa757b36c48 (diff)
parentfaa75d7955df87366d3936cc01ff2a87eb7e9b0d (diff)
downloadgsid-090198bb079e118fb913eaa5618c45bd87cbf6fa.tar.gz
Merge "Add isImageDisbled to ImageService." am: f949c45006 am: 47f3b0cb42 am: faa75d7955
Original change: https://android-review.googlesource.com/c/platform/system/gsid/+/1981766 Change-Id: I65d4d4c1d2d2b273f51e5db764d3dc29323559d6
-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 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();