diff options
Diffstat (limited to 'cmds/lshal/TableEntry.cpp')
-rw-r--r-- | cmds/lshal/TableEntry.cpp | 21 |
1 files changed, 19 insertions, 2 deletions
diff --git a/cmds/lshal/TableEntry.cpp b/cmds/lshal/TableEntry.cpp index cbcf979f90..e8792a4307 100644 --- a/cmds/lshal/TableEntry.cpp +++ b/cmds/lshal/TableEntry.cpp @@ -16,6 +16,8 @@ #define LOG_TAG "lshal" #include <android-base/logging.h> +#include <hidl-hash/Hash.h> + #include "TableEntry.h" #include "TextTable.h" @@ -53,8 +55,10 @@ static std::string getTitle(TableColumnType type) { case TableColumnType::CLIENT_CMDS: return "Clients CMD"; case TableColumnType::ARCH: return "Arch"; case TableColumnType::THREADS: return "Thread Use"; + case TableColumnType::RELEASED: return "R"; + case TableColumnType::HASH: return "Hash"; default: - LOG(FATAL) << "Should not reach here."; + LOG(FATAL) << __func__ << "Should not reach here. " << static_cast<int>(type); return ""; } } @@ -79,12 +83,25 @@ std::string TableEntry::getField(TableColumnType type) const { return getArchString(arch); case TableColumnType::THREADS: return getThreadUsage(); + case TableColumnType::RELEASED: + return isReleased(); + case TableColumnType::HASH: + return hash; default: - LOG(FATAL) << "Should not reach here."; + LOG(FATAL) << __func__ << "Should not reach here. " << static_cast<int>(type); return ""; } } +std::string TableEntry::isReleased() const { + static const std::string unreleased = Hash::hexString(Hash::kEmptyHash); + + if (hash.empty() || hash == unreleased) { + return " "; // unknown or unreleased + } + return "Y"; // released +} + TextTable Table::createTextTable(bool neat, const std::function<std::string(const std::string&)>& emitDebugInfo) const { |