Don't check hash while generating hash.

A common usecase of -Lhash is to add a new hash to
a current.txt file. However, doing so requires removing
old hashes which then must be re-added for correctness.

This is because hashes of released interfaces should never be
removed.

Here I've made it so that -Lhash will return a hash for
valid interfaces even if the hash fails. I've also added
this to hidl_hash_test.

Test: hidl_hash_test
Bug: 62858322
Change-Id: I840086ae59656c73c7109b20c142da27b47f80f8
diff --git a/Coordinator.h b/Coordinator.h
index c401995..2e761df 100644
--- a/Coordinator.h
+++ b/Coordinator.h
@@ -43,14 +43,20 @@
     // adds path only if it doesn't exist
     void addDefaultPackagePath(const std::string& root, const std::string& path);
 
+    enum class Enforce {
+        FULL,     // default
+        NO_HASH,  // only for use with -Lhash
+        NONE,     // only for use during enforcement
+    };
+
     // Attempts to parse the interface/types referred to by fqName.
     // Parsing an interface also parses the associated package's types.hal
     // file if it exists.
     // If "parsedASTs" is non-NULL, successfully parsed ASTs are inserted
     // into the set.
     // If !enforce, enforceRestrictionsOnPackage won't be run.
-    AST *parse(const FQName &fqName, std::set<AST *> *parsedASTs = nullptr,
-            bool enforce = true) const;
+    AST* parse(const FQName& fqName, std::set<AST*>* parsedASTs = nullptr,
+               Enforce enforcement = Enforce::FULL) const;
 
     // Given package-root paths of ["hardware/interfaces",
     // "vendor/<something>/interfaces"], package roots of
@@ -94,7 +100,8 @@
     //    - minor version upgrades
     // "packages" contains names like "android.hardware.nfc@1.1".
     //    - hashing restrictions
-    status_t enforceRestrictionsOnPackage(const FQName &fqName) const;
+    status_t enforceRestrictionsOnPackage(const FQName& fqName,
+                                          Enforce enforcement = Enforce::FULL) const;
 
     static bool MakeParentHierarchy(const std::string &path);