diff options
author | Howard Chen <howardsoc@google.com> | 2019-02-26 18:14:47 +0800 |
---|---|---|
committer | Howard Chen <howardsoc@google.com> | 2019-03-15 09:39:32 +0000 |
commit | 670b3068f9c4b00d28e12c34b4b72f9290e3cb5f (patch) | |
tree | 2c20dbc47e41628fc0f43c07c51694e047b95161 /gsi_tool.cpp | |
parent | ecbc0198c6f38dd94b3ee817e1fb6ecfe40a71dd (diff) | |
download | gsid-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.cpp | 13 |
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; } |