hidl-gen: work as expected with various path args

Add root path to paths only if non-absolute

Test: all of these pass and provide expected results:
    hidl-gen -Lhash -p ~/android/aosp/ android.hardware.nfc@1.0
    hidl-gen -Lhash -p /usr/local/google/home/smoreland/android/aosp/ android.hardware.nfc@1.0
    hidl-gen -Lhash -p /usr/local/google/home/smoreland/android \
                    -randroid.hidl:master/system/libhidl/transport \
                    -randroid.hardware:aosp/hardware/interfaces android.hardware.nfc@1.0
    hidl-gen -Lhash android.hardware.nfc@1.0
    hidl-gen -Lhash -randroid.hidl:/usr/local/google/home/smoreland/android/master/system/libhidl/transport \
                    -randroid.hardware:/usr/local/google/home/smoreland/android/master/hardware/interfaces \
                    android.hardware.nfc@1.0
    hidl-gen -Lhash -randroid.hidl:system/libhidl/transport \
                    -randroid.hardware:/usr/local/google/home/smoreland/android/aosp/hardware/interfaces \
                    android.hardware.nfc@1.0
Fixes: 62106647

Change-Id: Ibfce35f68e6b2ac0eaecc08fed3c78701464f1d6
diff --git a/Coordinator.h b/Coordinator.h
index efa1cad..c401995 100644
--- a/Coordinator.h
+++ b/Coordinator.h
@@ -58,7 +58,6 @@
     // FQName of "android.hardware.nfc@1.0::INfc, then getPackagePath()
     // will return "hardware/interfaces/nfc/1.0" (if sanitized = false)
     // or "hardware/interfaces/nfc/V1_0" (if sanitized = true).
-
     std::string getPackagePath(
             const FQName &fqName, bool relative = false,
             bool sanitized = false) const;
@@ -67,7 +66,6 @@
     // "vendor.<something>.hardware"] and a FQName of
     // "android.hardware.nfc@1.0::INfc, then getPackageRoot() will
     // return "android.hardware".
-
     std::string getPackageRoot(const FQName &fqName) const;
 
     // Given package-root paths of ["hardware/interfaces",
@@ -75,7 +73,6 @@
     // ["android.hardware", "vendor.<something>.hardware"], and a
     // FQName of "android.hardware.nfc@1.0::INfc, then getPackageRootPath()
     // will return "hardware/interfaces".
-
     std::string getPackageRootPath(const FQName &fqName) const;
 
     // return getPackageRoot + ":" + getPackageRootPath
@@ -122,6 +119,14 @@
     std::vector<std::string>::const_iterator findPackageRoot(
             const FQName &fqName) const;
 
+    // Returns abs package path by prepending the root path if a package
+    // path is non-absolute.
+    // If root is '/android/master' and getPackagePath returns 'h/i/nfc/V1_0'
+    // this will return '/android/master/h/i/nfc/V1_0'.
+    // If root is '/android/master' and getPackagePath returns '/abs/path/to/nfc/V1_0'
+    // this will return '/abs/path/to/nfc/V1_0'
+    std::string getAbsolutePackagePath(const FQName& fqName) const;
+
     // Rules of enforceRestrictionsOnPackage are listed below.
     status_t enforceMinorVersionUprevs(const FQName &fqName) const;
     status_t enforceHashes(const FQName &fqName) const;