lshal --init-vintf: can specify manifest partition
lshal --init-vintf [--init-vintf-partition=vendor] generates
device manifest.
lshal --init-vintf --init-vintf-partition=system generates
framework manifest.
lshal --init-vintf --init-vintf-partition=odm generates odm manifest.
Test: the above commands
health/backup is in system manifest
IBase is not in any manifest
graphics.composer/vr is in system manifest
Test: lshal_test
Fixes: 71802285
Change-Id: Ie16c8914218ece5c3cd698c93f2bada1be3ee29f
diff --git a/cmds/lshal/ListCommand.h b/cmds/lshal/ListCommand.h
index 7e252fc..1e85ea0 100644
--- a/cmds/lshal/ListCommand.h
+++ b/cmds/lshal/ListCommand.h
@@ -26,6 +26,7 @@
#include <android-base/macros.h>
#include <android/hidl/manager/1.0/IServiceManager.h>
+#include <hidl-util/FQName.h>
#include "Command.h"
#include "NullableOStream.h"
@@ -75,6 +76,8 @@
// key: value returned by getopt_long
using RegisteredOptions = std::vector<RegisteredOption>;
+ static std::string INIT_VINTF_NOTES;
+
protected:
Status parseArgs(const Arg &arg);
Status fetch();
@@ -104,10 +107,14 @@
// Read and return /proc/{pid}/cmdline.
virtual std::string parseCmdline(pid_t pid) const;
// Return /proc/{pid}/cmdline if it exists, else empty string.
- const std::string &getCmdline(pid_t pid);
+ const std::string& getCmdline(pid_t pid);
// Call getCmdline on all pid in pids. If it returns empty string, the process might
// have died, and the pid is removed from pids.
void removeDeadProcesses(Pids *pids);
+
+ virtual Partition getPartition(pid_t pid);
+ Partition resolvePartition(Partition processPartition, const FQName& fqName) const;
+
void forEachTable(const std::function<void(Table &)> &f);
void forEachTable(const std::function<void(const Table &)> &f) const;
@@ -125,8 +132,9 @@
bool mEmitDebugInfo = false;
- // If true, output in VINTF format.
+ // If true, output in VINTF format. Output only entries from the specified partition.
bool mVintf = false;
+ Partition mVintfPartition = Partition::UNKNOWN;
// If true, explanatory text are not emitted.
bool mNeat = false;
@@ -139,6 +147,9 @@
// Cache for getPidInfo.
std::map<pid_t, PidInfo> mCachedPidInfos;
+ // Cache for getPartition.
+ std::map<pid_t, Partition> mPartitions;
+
RegisteredOptions mOptions;
// All selected columns
std::vector<TableColumnType> mSelectedColumns;