lshal: add --types=lazy|z

Add a new section to lshal that shows HALs in the manifest
  - as hwbinder HALs but not registered
  - as passthrough HALs but no impl found

Fixes: 71555570
Test: lshal_test
Test: lshal --types=z

Change-Id: I6947d9e7e08991fa2497f40c81005f885d408931
diff --git a/cmds/lshal/ListCommand.h b/cmds/lshal/ListCommand.h
index f4d3fdf..3f7321d 100644
--- a/cmds/lshal/ListCommand.h
+++ b/cmds/lshal/ListCommand.h
@@ -52,6 +52,7 @@
     PASSTHROUGH_CLIENTS,
     PASSTHROUGH_LIBRARIES,
     VINTF_MANIFEST,
+    LAZY_HALS,
 };
 
 class ListCommand : public Command {
@@ -99,6 +100,7 @@
     Status fetchBinderized(const sp<::android::hidl::manager::V1_0::IServiceManager> &manager);
     Status fetchAllLibraries(const sp<::android::hidl::manager::V1_0::IServiceManager> &manager);
     Status fetchManifestHals();
+    Status fetchLazyHals();
 
     Status fetchBinderizedEntry(const sp<::android::hidl::manager::V1_0::IServiceManager> &manager,
                                 TableEntry *entry);
@@ -153,10 +155,15 @@
 
     void initFetchTypes();
 
+    // Helper functions ti add HALs that are listed in VINTF manifest to LAZY_HALS table.
+    bool hasHwbinderEntry(const TableEntry& entry) const;
+    bool hasPassthroughEntry(const TableEntry& entry) const;
+
     Table mServicesTable{};
     Table mPassthroughRefTable{};
     Table mImplementationsTable{};
     Table mManifestHalsTable{};
+    Table mLazyHalsTable{};
 
     std::string mFileOutputPath;
     TableEntryCompare mSortColumn = nullptr;