summaryrefslogtreecommitdiff
path: root/gsi_tool.cpp
diff options
context:
space:
mode:
authorHoward Chen <howardsoc@google.com>2019-02-26 18:14:47 +0800
committerHoward Chen <howardsoc@google.com>2019-03-15 09:39:32 +0000
commit670b3068f9c4b00d28e12c34b4b72f9290e3cb5f (patch)
tree2c20dbc47e41628fc0f43c07c51694e047b95161 /gsi_tool.cpp
parentecbc0198c6f38dd94b3ee817e1fb6ecfe40a71dd (diff)
downloadgsid-670b3068f9c4b00d28e12c34b4b72f9290e3cb5f.tar.gz
Add isGsiEnabled to GsiService
In order to re-enable the Gsi from framework, we need a method to query the current enable status. Bug: 125079548 Test: use the status command Change-Id: Ia6c0ae12e2e6613f112a241d2cf5733f8bf22984
Diffstat (limited to 'gsi_tool.cpp')
-rw-r--r--gsi_tool.cpp13
1 files changed, 10 insertions, 3 deletions
diff --git a/gsi_tool.cpp b/gsi_tool.cpp
index df2fcd5..a9a6920 100644
--- a/gsi_tool.cpp
+++ b/gsi_tool.cpp
@@ -342,7 +342,6 @@ static int Status(sp<IGsiService> gsid, int argc, char** /* argv */) {
return EX_SOFTWARE;
} else if (running) {
std::cout << "running" << std::endl;
- return 0;
}
bool installed;
status = gsid->isGsiInstalled(&installed);
@@ -351,9 +350,17 @@ static int Status(sp<IGsiService> gsid, int argc, char** /* argv */) {
return EX_SOFTWARE;
} else if (installed) {
std::cout << "installed" << std::endl;
- return 0;
}
- std::cout << "normal" << std::endl;
+ bool enabled;
+ status = gsid->isGsiEnabled(&enabled);
+ if (!status.isOk()) {
+ std::cerr << status.exceptionMessage().string() << std::endl;
+ return EX_SOFTWARE;
+ } else if (running || installed) {
+ std::cout << (enabled ? "enabled" : "disabled") << std::endl;
+ } else {
+ std::cout << "normal" << std::endl;
+ }
return 0;
}