Add FqInstance::inPackage

... that delegates to FQName::inPackage().
Test: lshal
Bug: 74247301

Change-Id: Ib4150032f70e10b3fa1fc3bb48ab93ec4d8c6fee
diff --git a/utils/FqInstance.cpp b/utils/FqInstance.cpp
index 4689aae..8b39fdd 100644
--- a/utils/FqInstance.cpp
+++ b/utils/FqInstance.cpp
@@ -129,4 +129,8 @@
     return !(*this == other);
 }
 
+bool FqInstance::inPackage(const std::string& package) const {
+    return mFqName.inPackage(package);
+}
+
 }  // namespace android
diff --git a/utils/include/hidl-util/FqInstance.h b/utils/include/hidl-util/FqInstance.h
index b831379..982bae0 100644
--- a/utils/include/hidl-util/FqInstance.h
+++ b/utils/include/hidl-util/FqInstance.h
@@ -48,6 +48,12 @@
     bool hasInterface() const;
     bool hasInstance() const;
 
+    // If this is android.hardware@1.0::IFoo
+    // package = "and" -> false
+    // package = "android" -> true
+    // package = "android.hardware@1.0" -> false
+    bool inPackage(const std::string& package) const;
+
     // Return true if valid:
     // android.hardware.foo@1.0::IFoo/instance
     // @1.0::IFoo/instance