Snap for 8426163 from 180592b84388ed395d2f4aea99214775697df06a to mainline-tzdata2-release

Change-Id: Ifb43c3d80faec717ed9eed9acfaf397a7f5c2e4c
diff --git a/AST.cpp b/AST.cpp
index dc62a19..cd4b4dd 100644
--- a/AST.cpp
+++ b/AST.cpp
@@ -376,12 +376,6 @@
 }
 
 bool AST::importFQName(const FQName& fqName) {
-    if (!fqName.valueName().empty()) {
-        std::cerr << "WARNING: must import type, but importing value: " << fqName.string()
-                  << ". Did you mean to use '::' instead of ':'?" << std::endl;
-        // TODO(b/146215188): consider as error
-    }
-
     if (fqName.name().empty()) {
         // import a package
 
@@ -847,23 +841,6 @@
 }
 
 bool AST::isJavaCompatible() const {
-    static const std::vector<std::string> keywords({
-            "abstract",  "continue",  "for",      "new",          "switch",  "assert",
-            "default",   "goto",      "package",  "synchronized", "boolean", "do",
-            "if",        "private",   "this",     "break",        "double",  "implements",
-            "protected", "throw",     "byte",     "else",         "import",  "public",
-            "throws",    "case",      "enum",     "instanceof",   "return",  "transient",
-            "catch",     "extends",   "int",      "short",        "try",     "char",
-            "final",     "interface", "static",   "void",         "class",   "finally",
-            "long",      "strictfp",  "volatile", "const",        "float",   "native",
-            "super",     "while",
-    });
-    // java package shouldn't contain java keywords
-    for (const auto& comp : mPackage.getPackageComponents()) {
-        if (std::find(keywords.begin(), keywords.end(), comp) != keywords.end()) {
-            return false;
-        }
-    }
     return mRootScope.isJavaCompatible();
 }
 
diff --git a/Android.bp b/Android.bp
index 09ecabe..0f46b9b 100644
--- a/Android.bp
+++ b/Android.bp
@@ -12,23 +12,6 @@
 // See the License for the specific language governing permissions and
 // limitations under the License.
 
-package {
-    default_applicable_licenses: ["system_tools_hidl_license"],
-}
-
-// Added automatically by a large-scale-change
-// See: http://go/android-license-faq
-license {
-    name: "system_tools_hidl_license",
-    visibility: [":__subpackages__"],
-    license_kinds: [
-        "SPDX-license-identifier-Apache-2.0",
-    ],
-    license_text: [
-        "NOTICE",
-    ],
-}
-
 cc_defaults {
     name: "hidl-gen-defaults",
     cflags: [
@@ -78,6 +61,9 @@
 cc_library_host_static {
     name: "libhidl-gen",
     defaults: ["hidl-gen-defaults"],
+    cflags: [
+        "-Wno-bool-operation", // found in ConstantExpression.cpp:105
+    ],
     srcs: [
         "Annotation.cpp",
         "ArrayType.cpp",
@@ -102,7 +88,6 @@
         "TypeDef.cpp",
         "VectorType.cpp",
     ],
-    header_libs: ["libhwbinder_headers"],  // for constants
     shared_libs: [
         "libbase",
         "liblog",
diff --git a/CompoundType.cpp b/CompoundType.cpp
index aa12c10..b35a35c 100644
--- a/CompoundType.cpp
+++ b/CompoundType.cpp
@@ -296,7 +296,7 @@
                       emitSafeUnionUnknownDiscriminatorError(out, "_hidl_d_primitive",
                                                              !isReader /*fatal*/);
                       if (isReader) {
-                          out << "_hidl_err = ::android::BAD_VALUE;\n";
+                          out << "_hidl_err = BAD_VALUE;\n";
                           handleError(out, mode);
                       }
                   }).endl();
@@ -1013,41 +1013,60 @@
     }).endl().endl();
 }
 
-void CompoundType::emitSafeUnionAssignDefinition(Formatter& out, const std::string& parameterName,
-                                                 bool usesMoveSemantics) const {
+void CompoundType::emitSafeUnionCopyAndAssignDefinition(Formatter& out,
+                                                        const std::string& parameterName,
+                                                        bool isCopyConstructor,
+                                                        bool usesMoveSemantics) const {
     out.block([&] {
-           out << "if (this == &" << parameterName << ") { return *this; }\n\n";
+        if (!isCopyConstructor) {
+            out << "if (this == &"
+            << parameterName
+            << ") { return *this; }\n\n";
+        }
 
-           out << "switch (" << parameterName << ".hidl_d) ";
+        out << "switch ("
+            << parameterName
+            << ".hidl_d) ";
 
-           out.block([&] {
-                  for (const auto& field : mFields) {
-                      const std::string parameterFieldName =
-                              (parameterName + ".hidl_u." + field->name());
+        out.block([&] {
+               for (const auto& field : mFields) {
+                   const std::string parameterFieldName =
+                           (parameterName + ".hidl_u." + field->name());
 
-                      const std::string argumentName =
-                              usesMoveSemantics ? ("std::move(" + parameterFieldName + ")")
-                                                : parameterFieldName;
+                   const std::string argumentName =
+                           usesMoveSemantics ? ("std::move(" + parameterFieldName + ")")
+                                             : parameterFieldName;
 
-                      out << "case hidl_discriminator::" << field->name() << ": ";
+                   out << "case hidl_discriminator::" << field->name() << ": ";
 
-                      out.block([&] {
-                             out << field->name() << "(" << argumentName << ");\n"
-                                 << "break;\n";
-                         }).endl();
-                  }
+                   if (isCopyConstructor) {
+                       out.block([&] {
+                              emitSafeUnionFieldConstructor(out, field, argumentName);
+                              out << "break;\n";
+                          }).endl();
+                   } else {
+                       out.block([&] {
+                              out << field->name() << "(" << argumentName << ");\n"
+                                  << "break;\n";
+                          }).endl();
+                   }
+               }
 
-                  out << "default: ";
-                  out.block([&] {
-                         emitSafeUnionUnknownDiscriminatorError(out, parameterName + ".hidl_d",
-                                                                true /*fatal*/);
-                     }).endl();
-              }).endl();
+               out << "default: ";
+               out.block([&] {
+                      emitSafeUnionUnknownDiscriminatorError(out, parameterName + ".hidl_d",
+                                                             true /*fatal*/);
+                  }).endl();
+           }).endl();
 
-           out << "return *this;\n";
-       })
-            .endl()
-            .endl();
+        if (isCopyConstructor) {
+            out << "\nhidl_d = "
+                << parameterName
+                << ".hidl_d;\n";
+        } else {
+            out << "return *this;\n";
+        }
+    }).endl().endl();
 }
 
 void CompoundType::emitSafeUnionTypeConstructors(Formatter& out) const {
@@ -1098,23 +1117,29 @@
     // Move constructor
     out << fullName() << "::" << definedName() << "(" << definedName()
         << "&& other) : " << fullName() << "() ";
-    out.block([&] { out << "*this = std::move(other);\n"; }).endl().endl();
+
+    emitSafeUnionCopyAndAssignDefinition(
+            out, "other", true /* isCopyConstructor */, true /* usesMoveSemantics */);
 
     // Copy constructor
     out << fullName() << "::" << definedName() << "(const " << definedName()
         << "& other) : " << fullName() << "() ";
-    out.block([&] { out << "*this = other;\n"; }).endl().endl();
+
+    emitSafeUnionCopyAndAssignDefinition(
+        out, "other", true /* isCopyConstructor */, false /* usesMoveSemantics */);
 
     // Move assignment operator
     out << fullName() << "& (" << fullName() << "::operator=)(" << definedName() << "&& other) ";
 
-    emitSafeUnionAssignDefinition(out, "other", true /* usesMoveSemantics */);
+    emitSafeUnionCopyAndAssignDefinition(
+            out, "other", false /* isCopyConstructor */, true /* usesMoveSemantics */);
 
     // Copy assignment operator
     out << fullName() << "& (" << fullName() << "::operator=)(const " << definedName()
         << "& other) ";
 
-    emitSafeUnionAssignDefinition(out, "other", false /* usesMoveSemantics */);
+    emitSafeUnionCopyAndAssignDefinition(
+            out, "other", false /* isCopyConstructor */, false /* usesMoveSemantics */);
 }
 
 void CompoundType::emitSafeUnionTypeDefinitions(Formatter& out) const {
diff --git a/CompoundType.h b/CompoundType.h
index 9a4c41c..566427c 100644
--- a/CompoundType.h
+++ b/CompoundType.h
@@ -168,8 +168,10 @@
     void emitSafeUnionUnknownDiscriminatorError(Formatter& out, const std::string& value,
                                                 bool fatal) const;
 
-    void emitSafeUnionAssignDefinition(Formatter& out, const std::string& parameterName,
-                                       bool usesMoveSemantics) const;
+    void emitSafeUnionCopyAndAssignDefinition(Formatter& out,
+                                              const std::string& parameterName,
+                                              bool isCopyConstructor,
+                                              bool usesMoveSemantics) const;
 
     CompoundLayout getCompoundAlignmentAndSize() const;
     void emitPaddingZero(Formatter& out, size_t offset, size_t size) const;
diff --git a/ConstantExpression.cpp b/ConstantExpression.cpp
index 02fbf76..9413c9a 100644
--- a/ConstantExpression.cpp
+++ b/ConstantExpression.cpp
@@ -102,13 +102,7 @@
     COMPUTE_UNARY(+)
     COMPUTE_UNARY(-)
     COMPUTE_UNARY(!)
-
-// bitwise negation of a boolean expression always evaluates to 'true'
-#pragma clang diagnostic push
-#pragma clang diagnostic ignored "-Wbool-operation"
     COMPUTE_UNARY(~)
-#pragma clang diagnostic pop
-
     // Should not reach here.
     SHOULD_NOT_REACH() << "Could not handleUnary for " << op << " " << val;
     return static_cast<T>(0xdeadbeef);
diff --git a/Coordinator.cpp b/Coordinator.cpp
index 9c7c13f..2e16cf1 100644
--- a/Coordinator.cpp
+++ b/Coordinator.cpp
@@ -63,10 +63,6 @@
     mVerbose = verbose;
 }
 
-void Coordinator::setRequireFrozen(bool requireFrozen) {
-    mRequireFrozen = requireFrozen;
-}
-
 bool Coordinator::isVerbose() const {
     return mVerbose;
 }
@@ -350,7 +346,7 @@
 }
 
 const Coordinator::PackageRoot* Coordinator::findPackageRoot(const FQName& fqName) const {
-    CHECK(!fqName.package().empty()) << fqName.string();
+    CHECK(!fqName.package().empty());
 
     // Find the right package prefix and path for this FQName.  For
     // example, if FQName is "android.hardware.nfc@1.0::INfc", and the
@@ -840,13 +836,6 @@
         // This ensures that it can be detected.
         Hash::clearHash(ast->getFilename());
 
-        if (mRequireFrozen) {
-            std::cerr << "ERROR: Unfrozen " << fqName.string()
-                      << " cannot be referenced from context specifying -F (require_frozen)."
-                      << std::endl;
-            return HashStatus::ERROR;
-        }
-
         return HashStatus::UNFROZEN;
     }
 
@@ -872,10 +861,6 @@
     std::set<FQName> imported;
     ast->getImportedPackages(&imported);
 
-    // consider current package as dependency for types.hal and also to make
-    // sure that if anything is frozen in a package, everything is.
-    imported.insert(fqName.getPackageAndVersion());
-
     // no circular dependency is already guaranteed by parsing
     // indirect dependencies will be checked when the imported interface frozen checks are done
     for (const FQName& importedPackage : imported) {
@@ -925,7 +910,7 @@
 
                 if (!unfrozenDependencies.empty()) {
                     std::cerr << "ERROR: Frozen interface " << currentFQName.string()
-                              << " cannot depend or be adjacent to unfrozen thing(s):" << std::endl;
+                              << " cannot depend on unfrozen thing(s):" << std::endl;
                     for (const FQName& name : unfrozenDependencies) {
                         std::cerr << " (unfrozen) " << name.string() << std::endl;
                     }
@@ -972,13 +957,12 @@
 }
 
 void Coordinator::emitOptionsUsageString(Formatter& out) {
-    out << "[-p <root path>] (-r <interface root>)+ [-R] [-F] [-v] [-d <depfile>]";
+    out << "[-p <root path>] (-r <interface root>)+ [-R] [-v] [-d <depfile>]";
 }
 
 void Coordinator::emitOptionsDetailString(Formatter& out) {
     out << "-p <root path>: Android build root, defaults to $ANDROID_BUILD_TOP or pwd.\n"
         << "-R: Do not add default package roots if not specified in -r.\n"
-        << "-F: Require all referenced ASTs to be frozen.\n"
         << "-r <package:path root>: E.g., android.hardware:hardware/interfaces.\n"
         << "-v: verbose output.\n"
         << "-d <depfile>: location of depfile to write to.\n";
@@ -992,7 +976,7 @@
     bool suppressDefaultPackagePaths = false;
 
     int res;
-    std::string optstr = options + "p:r:RFvd:";
+    std::string optstr = options + "p:r:Rvd:";
     while ((res = getopt(argc, argv, optstr.c_str())) >= 0) {
         switch (res) {
             case 'v': {
@@ -1035,10 +1019,6 @@
                 suppressDefaultPackagePaths = true;
                 break;
             }
-            case 'F': {
-                setRequireFrozen(true);
-                break;
-            }
             // something downstream should handle these cases
             default: { handleArg(res, optarg); }
         }
diff --git a/Coordinator.h b/Coordinator.h
index 766a806..7715e56 100644
--- a/Coordinator.h
+++ b/Coordinator.h
@@ -42,8 +42,6 @@
     void setVerbose(bool value);
     bool isVerbose() const;
 
-    void setRequireFrozen(bool requireFrozen);
-
     void setDepFile(const std::string& depFile);
 
     const std::string& getOwner() const;
@@ -191,7 +189,6 @@
 
     // hidl-gen options
     bool mVerbose = false;
-    bool mRequireFrozen = false;
     std::string mOwner;
 
     // cache to parse().
diff --git a/EnumType.cpp b/EnumType.cpp
index 31835b3..937f147 100644
--- a/EnumType.cpp
+++ b/EnumType.cpp
@@ -111,22 +111,6 @@
     return Scope::validate();
 }
 
-status_t EnumType::validateAnnotations() const {
-    for (const Annotation* annotation : annotations()) {
-        const std::string name = annotation->name();
-
-        if (name == "export") {
-            continue;
-        }
-
-        std::cerr << "WARNING: Unrecognized annotation '" << name << "' for " << typeName()
-                  << " at " << location() << ". Only @export is supported." << std::endl;
-        // This is a warning to avoid breaking downstream unnecessarily.
-        // return UNKNOWN_ERROR;
-    }
-    return OK;
-}
-
 status_t EnumType::validateUniqueNames() const {
     std::unordered_map<std::string, const EnumType*> registeredValueNames;
     for (const auto* type : superTypeChain()) {
diff --git a/EnumType.h b/EnumType.h
index 7a1733d..2093c37 100644
--- a/EnumType.h
+++ b/EnumType.h
@@ -74,7 +74,6 @@
 
     status_t resolveInheritance() override;
     status_t validate() const override;
-    status_t validateAnnotations() const override;
     status_t validateUniqueNames() const;
 
     void emitJavaFieldInitializer(Formatter&, const std::string&) const override;
@@ -122,9 +121,8 @@
 
     void emitExportedHeader(Formatter& out, bool forJava) const override;
 
+   private:
     std::vector<const EnumType*> typeChain() const;
-
-  private:
     std::vector<const EnumType*> superTypeChain() const;
 
     const Annotation *findExportAnnotation() const;
diff --git a/Interface.cpp b/Interface.cpp
index 1307a0b..af6315f 100644
--- a/Interface.cpp
+++ b/Interface.cpp
@@ -36,16 +36,41 @@
 #include <android-base/logging.h>
 #include <hidl-util/Formatter.h>
 #include <hidl-util/StringHelper.h>
-#include <hwbinder/IBinder.h>
 
 namespace android {
 
+#define B_PACK_CHARS(c1, c2, c3, c4) \
+         ((((c1)<<24)) | (((c2)<<16)) | (((c3)<<8)) | (c4))
+
+/* It is very important that these values NEVER change. These values
+ * must remain unchanged over the lifetime of android. This is
+ * because the framework on a device will be updated independently of
+ * the hals on a device. If the hals are compiled with one set of
+ * transaction values, and the framework with another, then the
+ * interface between them will be destroyed, and the device will not
+ * work.
+ */
+enum {
+    /////////////////// User defined transactions
+    FIRST_CALL_TRANSACTION  = 0x00000001,
+    LAST_CALL_TRANSACTION   = 0x0effffff,
+    /////////////////// HIDL reserved
+    FIRST_HIDL_TRANSACTION  = 0x0f000000,
+    HIDL_PING_TRANSACTION                     = B_PACK_CHARS(0x0f, 'P', 'N', 'G'),
+    HIDL_DESCRIPTOR_CHAIN_TRANSACTION         = B_PACK_CHARS(0x0f, 'C', 'H', 'N'),
+    HIDL_GET_DESCRIPTOR_TRANSACTION           = B_PACK_CHARS(0x0f, 'D', 'S', 'C'),
+    HIDL_SYSPROPS_CHANGED_TRANSACTION         = B_PACK_CHARS(0x0f, 'S', 'Y', 'S'),
+    HIDL_LINK_TO_DEATH_TRANSACTION            = B_PACK_CHARS(0x0f, 'L', 'T', 'D'),
+    HIDL_UNLINK_TO_DEATH_TRANSACTION          = B_PACK_CHARS(0x0f, 'U', 'T', 'D'),
+    HIDL_SET_HAL_INSTRUMENTATION_TRANSACTION  = B_PACK_CHARS(0x0f, 'I', 'N', 'T'),
+    HIDL_GET_REF_INFO_TRANSACTION             = B_PACK_CHARS(0x0f, 'R', 'E', 'F'),
+    HIDL_DEBUG_TRANSACTION                    = B_PACK_CHARS(0x0f, 'D', 'B', 'G'),
+    HIDL_HASH_CHAIN_TRANSACTION               = B_PACK_CHARS(0x0f, 'H', 'S', 'H'),
+    LAST_HIDL_TRANSACTION   = 0x0fffffff,
+};
+
 const std::unique_ptr<ConstantExpression> Interface::FLAG_ONE_WAY =
-        std::make_unique<LiteralConstantExpression>(ScalarType::KIND_UINT32,
-                                                    hardware::IBinder::FLAG_ONEWAY, "oneway");
-const std::unique_ptr<ConstantExpression> Interface::FLAG_CLEAR_BUF =
-        std::make_unique<LiteralConstantExpression>(ScalarType::KIND_UINT32,
-                                                    hardware::IBinder::FLAG_CLEAR_BUF, "clear buf");
+    std::make_unique<LiteralConstantExpression>(ScalarType::KIND_UINT32, 0x01, "oneway");
 
 Interface::Interface(const std::string& localName, const FQName& fullName, const Location& location,
                      Scope* parent, const Reference<Type>& superType, const Hash* fileHash)
@@ -65,7 +90,7 @@
     }
 
     method->fillImplementation(
-        hardware::IBinder::HIDL_PING_TRANSACTION,
+        HIDL_PING_TRANSACTION,
         {
             {IMPL_INTERFACE,
                 [](auto &out) {
@@ -96,7 +121,7 @@
     }
 
     method->fillImplementation(
-            hardware::IBinder::HIDL_LINK_TO_DEATH_TRANSACTION,
+            HIDL_LINK_TO_DEATH_TRANSACTION,
             {
                 {IMPL_INTERFACE,
                     [](auto &out) {
@@ -140,7 +165,7 @@
     }
 
     method->fillImplementation(
-            hardware::IBinder::HIDL_UNLINK_TO_DEATH_TRANSACTION,
+            HIDL_UNLINK_TO_DEATH_TRANSACTION,
             {
                 {IMPL_INTERFACE,
                     [](auto &out) {
@@ -188,7 +213,7 @@
     }
 
     method->fillImplementation(
-            hardware::IBinder::HIDL_SYSPROPS_CHANGED_TRANSACTION,
+            HIDL_SYSPROPS_CHANGED_TRANSACTION,
             { { IMPL_INTERFACE, [](auto &out) {
                 out << "::android::report_sysprop_change();\n";
                 out << "return ::android::hardware::Void();\n";
@@ -206,7 +231,7 @@
     }
 
     method->fillImplementation(
-            hardware::IBinder::HIDL_SET_HAL_INSTRUMENTATION_TRANSACTION,
+            HIDL_SET_HAL_INSTRUMENTATION_TRANSACTION,
             {
                 {IMPL_INTERFACE,
                     [](auto &out) {
@@ -239,7 +264,7 @@
     }
 
     method->fillImplementation(
-        hardware::IBinder::HIDL_DESCRIPTOR_CHAIN_TRANSACTION,
+        HIDL_DESCRIPTOR_CHAIN_TRANSACTION,
         { { IMPL_INTERFACE, [this](auto &out) {
             std::vector<const Interface *> chain = typeChain();
             out << "_hidl_cb(";
@@ -294,7 +319,7 @@
     const ArrayType *digestType = static_cast<const ArrayType *>(chainType->getElementType());
 
     method->fillImplementation(
-        hardware::IBinder::HIDL_HASH_CHAIN_TRANSACTION,
+        HIDL_HASH_CHAIN_TRANSACTION,
         { { IMPL_INTERFACE, [this, digestType](auto &out) {
             std::vector<const Interface *> chain = typeChain();
             out << "_hidl_cb(";
@@ -327,7 +352,7 @@
     }
 
     method->fillImplementation(
-        hardware::IBinder::HIDL_GET_DESCRIPTOR_TRANSACTION,
+        HIDL_GET_DESCRIPTOR_TRANSACTION,
         { { IMPL_INTERFACE, [this](auto &out) {
             out << "_hidl_cb("
                 << fullName()
@@ -356,7 +381,7 @@
             "#endif\n";
 
     method->fillImplementation(
-        hardware::IBinder::HIDL_GET_REF_INFO_TRANSACTION,
+        HIDL_GET_REF_INFO_TRANSACTION,
         {
             {IMPL_INTERFACE,
                 [](auto &out) {
@@ -400,7 +425,7 @@
         return false;
     }
 
-    method->fillImplementation(hardware::IBinder::HIDL_DEBUG_TRANSACTION,
+    method->fillImplementation(HIDL_DEBUG_TRANSACTION,
                                {
                                    {IMPL_INTERFACE,
                                     [](auto& out) {
@@ -456,14 +481,14 @@
 }
 
 status_t Interface::resolveInheritance() {
-    size_t serial = hardware::IBinder::FIRST_CALL_TRANSACTION;
+    size_t serial = FIRST_CALL_TRANSACTION;
     for (const auto* ancestor : superTypeChain()) {
         serial += ancestor->mUserMethods.size();
     }
 
     for (Method* method : mUserMethods) {
-        if (serial > hardware::IBinder::LAST_CALL_TRANSACTION) {
-            std::cerr << "ERROR: More than " << hardware::IBinder::LAST_CALL_TRANSACTION
+        if (serial > LAST_CALL_TRANSACTION) {
+            std::cerr << "ERROR: More than " << LAST_CALL_TRANSACTION
                       << " methods (including super and reserved) are not allowed at " << location()
                       << std::endl;
             return UNKNOWN_ERROR;
@@ -490,6 +515,9 @@
     err = validateUniqueNames();
     if (err != OK) return err;
 
+    err = validateAnnotations();
+    if (err != OK) return err;
+
     return Scope::validate();
 }
 
@@ -533,19 +561,6 @@
 }
 
 status_t Interface::validateAnnotations() const {
-    for (const Annotation* annotation : annotations()) {
-        const std::string name = annotation->name();
-
-        if (name == "SensitiveData") {
-            continue;
-        }
-
-        std::cerr << "WARNING: Unrecognized annotation '" << name << "' for " << typeName()
-                  << " at " << location() << ". Only @SensitiveData is supported." << std::endl;
-        // ideally would be error, but we don't want to break downstream
-        // return UNKNOWN_ERROR;
-    }
-
     for (const Method* method : methods()) {
         for (const Annotation* annotation : method->annotations()) {
             const std::string name = annotation->name();
@@ -555,13 +570,12 @@
             }
 
             std::cerr << "ERROR: Unrecognized annotation '" << name
-                      << "' for method: " << method->name() << " at " << method->location()
-                      << ". An annotation should be one of: "
-                      << "@entry, @exit, or @callflow." << std::endl;
+                      << "' for method: " << method->name() << ". An annotation should be one of: "
+                      << "entry, exit, callflow." << std::endl;
             return UNKNOWN_ERROR;
         }
     }
-    return OK;  // not calling superclass which is more restrictive
+    return OK;
 }
 
 bool Interface::addAllReservedMethods(const std::map<std::string, Method*>& allReservedMethods) {
@@ -598,16 +612,6 @@
     return true;
 }
 
-bool Interface::hasSensitiveDataAnnotation() const {
-    for (const auto& annotation : annotations()) {
-        if (annotation->name() == "SensitiveData") {
-            return true;
-        }
-    }
-
-    return false;
-}
-
 const Interface* Interface::superType() const {
     if (isIBase()) return nullptr;
     if (!mSuperType->isInterface()) {
@@ -961,10 +965,6 @@
 }
 
 bool Interface::deepIsJavaCompatible(std::unordered_set<const Type*>* visited) const {
-    if (hasSensitiveDataAnnotation()) {
-        return false;
-    }
-
     if (superType() != nullptr && !superType()->isJavaCompatible(visited)) {
         return false;
     }
diff --git a/Interface.h b/Interface.h
index ea28757..ff475c5 100644
--- a/Interface.h
+++ b/Interface.h
@@ -37,7 +37,6 @@
 
 struct Interface : public Scope {
     const static std::unique_ptr<ConstantExpression> FLAG_ONE_WAY;
-    const static std::unique_ptr<ConstantExpression> FLAG_CLEAR_BUF;
 
     Interface(const std::string& localName, const FQName& fullName, const Location& location,
               Scope* parent, const Reference<Type>& superType, const Hash* fileHash);
@@ -52,8 +51,6 @@
     bool isIBase() const { return fqName() == gIBaseFqName; }
     std::string typeName() const override;
 
-    bool hasSensitiveDataAnnotation() const;
-
     const Interface* superType() const;
 
     // Super type chain to root type.
@@ -106,7 +103,7 @@
     status_t resolveInheritance() override;
     status_t validate() const override;
     status_t validateUniqueNames() const;
-    status_t validateAnnotations() const override;
+    status_t validateAnnotations() const;
 
     void emitReaderWriter(
             Formatter &out,
diff --git a/MODULE_LICENSE_APACHE2 b/MODULE_LICENSE_APACHE2
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/MODULE_LICENSE_APACHE2
diff --git a/PREUPLOAD.cfg b/PREUPLOAD.cfg
index e2ce617..0a1b5b5 100644
--- a/PREUPLOAD.cfg
+++ b/PREUPLOAD.cfg
@@ -1,6 +1,9 @@
 [Options]
 ignore_merged_commits = true
 
+[Builtin Hooks Options]
+bpfmt = -s
+
 [Builtin Hooks]
 clang_format = true
 bpfmt = true
diff --git a/README.md b/README.md
index a727e4f..499cbd3 100644
--- a/README.md
+++ b/README.md
@@ -41,14 +41,6 @@
 See update-makefiles-helper.sh and update-all-google-makefiles.sh for examples
 of how to generate HIDL makefiles (using the -Landroidbp option).
 
-> **_NOTE:_**  When using the -Landroidbp option, you can force generated
-> modules to be installed in `/system_ext` rather than other partition by putting a
-> marker file `.hidl_for_system_ext` alongside `*.hal` files.
-
-> **_NOTE:_**  You can also install the vendor variant of the generated modules
-> to be installed in `/odm` rather than `/vendor` by putting a marker file
-> `.hidl_for_odm` alongside `*.hal` files.
-
 # c2hal
 
 This is a helper tool to convert C headers to valid .hal files.
diff --git a/Scope.cpp b/Scope.cpp
index 026a7ac..588ba95 100644
--- a/Scope.cpp
+++ b/Scope.cpp
@@ -41,13 +41,6 @@
     mTypeIndexByName[type->definedName()] = index;
 }
 
-status_t Scope::validate() const {
-    status_t status = validateAnnotations();
-    if (status != OK) return status;
-
-    return NamedType::validate();
-}
-
 status_t Scope::validateUniqueNames() const {
     for (const auto* type : mTypes) {
         if (mTypes[mTypeIndexByName.at(type->definedName())] != type) {
@@ -59,15 +52,6 @@
     return OK;
 }
 
-status_t Scope::validateAnnotations() const {
-    for (const Annotation* annotation : annotations()) {
-        std::cerr << "WARNING: Unrecognized annotation '" << annotation->name() << "' at "
-                  << location() << ". No annotations are supported here." << std::endl;
-        // This is a warning to avoid breaking downstream unnecessarily.
-    }
-    return OK;
-}
-
 NamedType *Scope::lookupType(const FQName &fqName) const {
     CHECK(fqName.package().empty() && fqName.version().empty());
     if (!fqName.valueName().empty()) {
diff --git a/Scope.h b/Scope.h
index d67a300..ea6ef2b 100644
--- a/Scope.h
+++ b/Scope.h
@@ -40,9 +40,6 @@
 
     void addType(NamedType* type);
 
-    status_t validate() const override;
-    virtual status_t validateAnnotations() const;
-
     status_t validateUniqueNames() const;
 
     // lookup a type given an FQName.
diff --git a/TEST_MAPPING b/TEST_MAPPING
index 13ed681..16467e1 100644
--- a/TEST_MAPPING
+++ b/TEST_MAPPING
@@ -1,10 +1,16 @@
 {
   "presubmit": [
     {
-      "name": "hidl_test"
+      "name": "hidl-gen-host_test",
+      "host": true
     },
     {
-      "name": "hidl_test_java"
+      "name": "libhidl-gen-host-utils_test",
+      "host": true
+    },
+    {
+      "name": "libhidl-gen-utils_test",
+      "host": true
     },
     {
       "name": "libhidl-gen-utils_test"
diff --git a/build/Android.bp b/build/Android.bp
index 963a690..ea22729 100644
--- a/build/Android.bp
+++ b/build/Android.bp
@@ -12,15 +12,6 @@
 // See the License for the specific language governing permissions and
 // limitations under the License.
 
-package {
-    // See: http://go/android-license-faq
-    // A large-scale-change added 'default_applicable_licenses' to import
-    // all of the 'license_kinds' from "system_tools_hidl_license"
-    // to get the below license kinds:
-    //   SPDX-license-identifier-Apache-2.0
-    default_applicable_licenses: ["system_tools_hidl_license"],
-}
-
 bootstrap_go_package {
     name: "hidl-soong-rules",
     pkgPath: "android/soong/hidl",
diff --git a/build/hidl_interface.go b/build/hidl_interface.go
index 8ce3e4b..c4f0256 100644
--- a/build/hidl_interface.go
+++ b/build/hidl_interface.go
@@ -44,20 +44,20 @@
 	hidlRule = pctx.StaticRule("hidlRule", blueprint.RuleParams{
 		Depfile:     "${depfile}",
 		Deps:        blueprint.DepsGCC,
-		Command:     "rm -rf ${genDir} && ${hidl} -R -p . -d ${depfile} -o ${genDir} -L ${language} ${options} ${fqName}",
+		Command:     "rm -rf ${genDir} && ${hidl} -R -p . -d ${depfile} -o ${genDir} -L ${language} ${roots} ${fqName}",
 		CommandDeps: []string{"${hidl}"},
 		Description: "HIDL ${language}: ${in} => ${out}",
-	}, "depfile", "fqName", "genDir", "language", "options")
+	}, "depfile", "fqName", "genDir", "language", "roots")
 
 	hidlSrcJarRule = pctx.StaticRule("hidlSrcJarRule", blueprint.RuleParams{
 		Depfile: "${depfile}",
 		Deps:    blueprint.DepsGCC,
 		Command: "rm -rf ${genDir} && " +
-			"${hidl} -R -p . -d ${depfile} -o ${genDir}/srcs -L ${language} ${options} ${fqName} && " +
+			"${hidl} -R -p . -d ${depfile} -o ${genDir}/srcs -L ${language} ${roots} ${fqName} && " +
 			"${soong_zip} -o ${genDir}/srcs.srcjar -C ${genDir}/srcs -D ${genDir}/srcs",
 		CommandDeps: []string{"${hidl}", "${soong_zip}"},
 		Description: "HIDL ${language}: ${in} => srcs.srcjar",
-	}, "depfile", "fqName", "genDir", "language", "options")
+	}, "depfile", "fqName", "genDir", "language", "roots")
 
 	vtsRule = pctx.StaticRule("vtsRule", blueprint.RuleParams{
 		Command:     "rm -rf ${genDir} && ${vtsc} -m${mode} -t${type} ${inputDir}/${packagePath} ${genDir}/${packagePath}",
@@ -66,10 +66,10 @@
 	}, "mode", "type", "inputDir", "genDir", "packagePath")
 
 	lintRule = pctx.StaticRule("lintRule", blueprint.RuleParams{
-		Command:     "rm -f ${output} && touch ${output} && ${lint} -j -e -R -p . ${options} ${fqName} > ${output}",
+		Command:     "rm -f ${output} && touch ${output} && ${lint} -j -e -R -p . ${roots} ${fqName} > ${output}",
 		CommandDeps: []string{"${lint}"},
 		Description: "hidl-lint ${fqName}: ${out}",
-	}, "output", "options", "fqName")
+	}, "output", "roots", "fqName")
 
 	zipLintRule = pctx.StaticRule("zipLintRule", blueprint.RuleParams{
 		Command:     "rm -f ${output} && ${soong_zip} -o ${output} -C ${intermediatesDir} ${files}",
@@ -78,10 +78,10 @@
 	}, "output", "files")
 
 	inheritanceHierarchyRule = pctx.StaticRule("inheritanceHierarchyRule", blueprint.RuleParams{
-		Command:     "rm -f ${out} && ${hidl} -L inheritance-hierarchy ${options} ${fqInterface} > ${out}",
+		Command:     "rm -f ${out} && ${hidl} -L inheritance-hierarchy ${roots} ${fqInterface} > ${out}",
 		CommandDeps: []string{"${hidl}"},
 		Description: "HIDL inheritance hierarchy: ${fqInterface} => ${out}",
-	}, "options", "fqInterface")
+	}, "roots", "fqInterface")
 
 	joinJsonObjectsToArrayRule = pctx.StaticRule("joinJsonObjectsToArrayRule", blueprint.RuleParams{
 		Rspfile:        "$out.rsp",
@@ -89,8 +89,6 @@
 		Command: "rm -rf ${out} && " +
 			// Start the output array with an opening bracket.
 			"echo '[' >> ${out} && " +
-			// Add prebuilt declarations
-			"echo \"${extras}\" >> ${out} && " +
 			// Append each input file and a comma to the output.
 			"for file in $$(cat ${out}.rsp); do " +
 			"cat $$file >> ${out}; echo ',' >> ${out}; " +
@@ -98,11 +96,10 @@
 			// Remove the last comma, replacing it with the closing bracket.
 			"sed -i '$$d' ${out} && echo ']' >> ${out}",
 		Description: "Joining JSON objects into array ${out}",
-	}, "extras", "files")
+	}, "files")
 )
 
 func init() {
-	android.RegisterModuleType("prebuilt_hidl_interfaces", prebuiltHidlInterfaceFactory)
 	android.RegisterModuleType("hidl_interface", hidlInterfaceFactory)
 	android.RegisterSingletonType("all_hidl_lints", allHidlLintsFactory)
 	android.RegisterMakeVarsProvider(pctx, makeVarsProvider)
@@ -131,7 +128,6 @@
 	}
 
 	var inheritanceHierarchyOutputs android.Paths
-	additionalInterfaces := []string{}
 	ctx.VisitDirectDeps(func(m android.Module) {
 		if !m.ExportedToMake() {
 			return
@@ -140,8 +136,6 @@
 			if t.properties.Language == "inheritance-hierarchy" {
 				inheritanceHierarchyOutputs = append(inheritanceHierarchyOutputs, t.genOutputs.Paths()...)
 			}
-		} else if t, ok := m.(*prebuiltHidlInterface); ok {
-			additionalInterfaces = append(additionalInterfaces, t.properties.Interfaces...)
 		}
 	})
 
@@ -152,8 +146,7 @@
 		Inputs: inheritanceHierarchyOutputs,
 		Output: m.inheritanceHierarchyPath,
 		Args: map[string]string{
-			"extras": strings.Join(wrap("{\\\"interface\\\":\\\"", additionalInterfaces, "\\\"},"), " "),
-			"files":  strings.Join(inheritanceHierarchyOutputs.Strings(), " "),
+			"files": strings.Join(inheritanceHierarchyOutputs.Strings(), " "),
 		},
 	})
 }
@@ -263,26 +256,24 @@
 		vtsListMutex.Unlock()
 	}
 
-	var extraOptions []string // including roots
+	var fullRootOptions []string
 	var currentPath android.OptionalPath
 	ctx.VisitDirectDeps(func(dep android.Module) {
 		switch t := dep.(type) {
 		case *hidlInterface:
-			extraOptions = append(extraOptions, t.properties.Full_root_option)
+			fullRootOptions = append(fullRootOptions, t.properties.Full_root_option)
 		case *hidlPackageRoot:
 			if currentPath.Valid() {
 				panic(fmt.Sprintf("Expecting only one path, but found %v %v", currentPath, t.getCurrentPath()))
 			}
 
 			currentPath = t.getCurrentPath()
-
-			if t.requireFrozen() {
-				extraOptions = append(extraOptions, "-F")
-			}
+		default:
+			panic(fmt.Sprintf("Unrecognized hidlGenProperties dependency: %T", t))
 		}
 	})
 
-	extraOptions = android.FirstUniqueStrings(extraOptions)
+	fullRootOptions = android.FirstUniqueStrings(fullRootOptions)
 
 	inputs := g.genInputs
 	if currentPath.Valid() {
@@ -300,9 +291,9 @@
 			Inputs: inputs,
 			Output: g.genOutputs[0],
 			Args: map[string]string{
-				"output":  g.genOutputs[0].String(),
-				"fqName":  g.properties.FqName,
-				"options": strings.Join(extraOptions, " "),
+				"output": g.genOutputs[0].String(),
+				"fqName": g.properties.FqName,
+				"roots":  strings.Join(fullRootOptions, " "),
 			},
 		})
 
@@ -317,7 +308,7 @@
 				Output: g.genOutputs[i],
 				Args: map[string]string{
 					"fqInterface": g.properties.FqName + "::" + intf,
-					"options":     strings.Join(extraOptions, " "),
+					"roots":       strings.Join(fullRootOptions, " "),
 				},
 			})
 		}
@@ -335,7 +326,7 @@
 			"genDir":   g.genOutputDir.String(),
 			"fqName":   g.properties.FqName,
 			"language": g.properties.Language,
-			"options":  strings.Join(extraOptions, " "),
+			"roots":    strings.Join(fullRootOptions, " "),
 		},
 	})
 }
@@ -448,33 +439,6 @@
 	return g
 }
 
-type prebuiltHidlInterfaceProperties struct {
-	// List of interfaces to consider valid, e.g. "vendor.foo.bar@1.0::IFoo" for typo checking
-	// between init.rc, VINTF, and elsewhere. Note that inheritance properties will not be
-	// checked for these (but would be checked in a branch where the actual hidl_interface
-	// exists).
-	Interfaces []string
-}
-
-type prebuiltHidlInterface struct {
-	android.ModuleBase
-
-	properties prebuiltHidlInterfaceProperties
-}
-
-func (p *prebuiltHidlInterface) GenerateAndroidBuildActions(ctx android.ModuleContext) {}
-
-func (p *prebuiltHidlInterface) DepsMutator(ctx android.BottomUpMutatorContext) {
-	ctx.AddReverseDependency(ctx.Module(), nil, hidlMetadataSingletonName)
-}
-
-func prebuiltHidlInterfaceFactory() android.Module {
-	i := &prebuiltHidlInterface{}
-	i.AddProperties(&i.properties)
-	android.InitAndroidModule(i)
-	return i
-}
-
 type hidlInterfaceProperties struct {
 	// Vndk properties for interface library only.
 	cc.VndkProperties
@@ -505,6 +469,10 @@
 	// example: -randroid.hardware:hardware/interfaces
 	Full_root_option string `blueprint:"mutated"`
 
+	// Whether this interface library should be installed on product partition.
+	// TODO(b/150902910): remove, since this should be an inherited property.
+	Product_specific *bool
+
 	// List of APEX modules this interface can be used in.
 	//
 	// WARNING: HIDL is not fully supported in APEX since VINTF currently doesn't
@@ -517,10 +485,6 @@
 	// does  not apply to VTS targets/adapter targets/fuzzers since these components
 	// should not be shipped on device.
 	Apex_available []string
-
-	// Installs the vendor variant of the module to the /odm partition instead of
-	// the /vendor partition.
-	Odm_available *bool
 }
 
 type hidlInterface struct {
@@ -588,11 +552,6 @@
 }
 
 func hidlInterfaceMutator(mctx android.LoadHookContext, i *hidlInterface) {
-	if !canInterfaceExist(i.ModuleBase.Name()) {
-		mctx.PropertyErrorf("name", "No more HIDL interfaces can be added to Android. Please use AIDL.")
-		return
-	}
-
 	name, err := parseFqName(i.ModuleBase.Name())
 	if err != nil {
 		mctx.PropertyErrorf("name", err.Error())
@@ -636,19 +595,8 @@
 	shouldGenerateJavaConstants := i.properties.Gen_java_constants
 	shouldGenerateVts := shouldGenerateLibrary && proptools.BoolDefault(i.properties.Gen_vts, true)
 
-	// To generate VTS, hidl_interface must have a core variant.
-	// A module with 'product_specific: true' does not create a core variant.
-	shouldGenerateVts = shouldGenerateVts && !mctx.ProductSpecific()
-
-	var productAvailable *bool
-	if !mctx.ProductSpecific() {
-		productAvailable = proptools.BoolPtr(true)
-	}
-
-	var vendorAvailable *bool
-	if !proptools.Bool(i.properties.Odm_available) {
-		vendorAvailable = proptools.BoolPtr(true)
-	}
+	// TODO(b/150902910): re-enable VTS builds for product things
+	shouldGenerateVts = shouldGenerateVts && !proptools.Bool(i.properties.Product_specific)
 
 	var libraryIfExists []string
 	if shouldGenerateLibrary {
@@ -693,9 +641,7 @@
 			Name:               proptools.StringPtr(name.string()),
 			Host_supported:     proptools.BoolPtr(true),
 			Recovery_available: proptools.BoolPtr(true),
-			Vendor_available:   vendorAvailable,
-			Odm_available:      i.properties.Odm_available,
-			Product_available:  productAvailable,
+			Vendor_available:   proptools.BoolPtr(true),
 			Double_loadable:    proptools.BoolPtr(isDoubleLoadable(name.string())),
 			Defaults:           []string{"hidl-module-defaults"},
 			Generated_sources:  []string{name.sourcesName()},
@@ -797,9 +743,7 @@
 
 	mctx.CreateModule(cc.LibraryFactory, &ccProperties{
 		Name:              proptools.StringPtr(name.adapterHelperName()),
-		Vendor_available:  vendorAvailable,
-		Odm_available:     i.properties.Odm_available,
-		Product_available: productAvailable,
+		Vendor_available:  proptools.BoolPtr(true),
 		Defaults:          []string{"hidl-module-defaults"},
 		Generated_sources: []string{name.adapterHelperSourcesName()},
 		Generated_headers: []string{name.adapterHelperHeadersName()},
@@ -971,13 +915,11 @@
 func (h *hidlInterface) GenerateAndroidBuildActions(ctx android.ModuleContext) {
 	visited := false
 	ctx.VisitDirectDeps(func(dep android.Module) {
-		if r, ok := dep.(*hidlPackageRoot); ok {
-			if visited {
-				panic("internal error, multiple dependencies found but only one added")
-			}
-			visited = true
-			h.properties.Full_root_option = r.getFullPackageRoot()
+		if visited {
+			panic("internal error, multiple dependencies found but only one added")
 		}
+		visited = true
+		h.properties.Full_root_option = dep.(*hidlPackageRoot).getFullPackageRoot()
 	})
 	if !visited {
 		panic("internal error, no dependencies found but dependency added")
@@ -998,7 +940,6 @@
 }
 
 var minSdkVersion = map[string]string{
-	"android.frameworks.bufferhub@1.0":          "29",
 	"android.hardware.audio.common@5.0":         "30",
 	"android.hardware.bluetooth.a2dp@1.0":       "30",
 	"android.hardware.bluetooth.audio@2.0":      "30",
@@ -1021,7 +962,6 @@
 	"android.hardware.media.bufferpool@2.0":     "29",
 	"android.hardware.media.c2@1.0":             "29",
 	"android.hardware.media.c2@1.1":             "29",
-	"android.hardware.media.c2@1.2":             "29",
 	"android.hardware.media.omx@1.0":            "29",
 	"android.hardware.media@1.0":                "29",
 	"android.hardware.neuralnetworks@1.0":       "30",
@@ -1033,16 +973,13 @@
 	"android.hardware.wifi@1.2":                 "30",
 	"android.hardware.wifi@1.3":                 "30",
 	"android.hardware.wifi@1.4":                 "30",
-	"android.hardware.wifi@1.5":                 "30",
 	"android.hardware.wifi.hostapd@1.0":         "30",
 	"android.hardware.wifi.hostapd@1.1":         "30",
 	"android.hardware.wifi.hostapd@1.2":         "30",
-	"android.hardware.wifi.hostapd@1.3":         "30",
 	"android.hardware.wifi.supplicant@1.0":      "30",
 	"android.hardware.wifi.supplicant@1.1":      "30",
 	"android.hardware.wifi.supplicant@1.2":      "30",
 	"android.hardware.wifi.supplicant@1.3":      "30",
-	"android.hardware.wifi.supplicant@1.4":      "30",
 	"android.hidl.allocator@1.0":                "29",
 	"android.hidl.manager@1.0":                  "30",
 	"android.hidl.manager@1.1":                  "30",
@@ -1105,18 +1042,15 @@
 
 var fuzzerPackageNameBlacklist = []string{
 	"android.hardware.keymaster@", // to avoid deleteAllKeys()
-	// Same-process HALs are always opened in the same process as their client.
-	// So stability guarantees don't apply to them, e.g. it's OK to crash on
-	// NULL input from client. Disable corresponding fuzzers as they create too
-	// much noise.
-	"android.hardware.graphics.mapper@",
-	"android.hardware.renderscript@",
-	"android.hidl.memory@",
 }
 
 func isFuzzerEnabled(name string) bool {
-	// TODO(151338797): re-enable fuzzers
-	return false
+	for _, pkgname := range fuzzerPackageNameBlacklist {
+		if strings.HasPrefix(name, pkgname) {
+			return false
+		}
+	}
+	return true
 }
 
 // TODO(b/126383715): centralize this logic/support filtering in core VTS build
@@ -1152,254 +1086,3 @@
 
 	ctx.Strict("VTS_SPEC_FILE_LIST", strings.Join(vtsList, " "))
 }
-
-func canInterfaceExist(name string) bool {
-	if strings.HasPrefix(name, "android.") {
-		return allAospHidlInterfaces[name]
-	}
-
-	return true
-}
-
-var allAospHidlInterfaces = map[string]bool{
-	"android.frameworks.automotive.display@1.0":         true,
-	"android.frameworks.bufferhub@1.0":                  true,
-	"android.frameworks.cameraservice.common@2.0":       true,
-	"android.frameworks.cameraservice.device@2.0":       true,
-	"android.frameworks.cameraservice.device@2.1":       true,
-	"android.frameworks.cameraservice.service@2.0":      true,
-	"android.frameworks.cameraservice.service@2.1":      true,
-	"android.frameworks.cameraservice.service@2.2":      true,
-	"android.frameworks.displayservice@1.0":             true,
-	"android.frameworks.schedulerservice@1.0":           true,
-	"android.frameworks.sensorservice@1.0":              true,
-	"android.frameworks.stats@1.0":                      true,
-	"android.frameworks.vr.composer@1.0":                true,
-	"android.frameworks.vr.composer@2.0":                true,
-	"android.hardware.atrace@1.0":                       true,
-	"android.hardware.audio@2.0":                        true,
-	"android.hardware.audio@4.0":                        true,
-	"android.hardware.audio@5.0":                        true,
-	"android.hardware.audio@6.0":                        true,
-	"android.hardware.audio@7.0":                        true,
-	"android.hardware.audio.common@2.0":                 true,
-	"android.hardware.audio.common@4.0":                 true,
-	"android.hardware.audio.common@5.0":                 true,
-	"android.hardware.audio.common@6.0":                 true,
-	"android.hardware.audio.common@7.0":                 true,
-	"android.hardware.audio.effect@2.0":                 true,
-	"android.hardware.audio.effect@4.0":                 true,
-	"android.hardware.audio.effect@5.0":                 true,
-	"android.hardware.audio.effect@6.0":                 true,
-	"android.hardware.audio.effect@7.0":                 true,
-	"android.hardware.authsecret@1.0":                   true,
-	"android.hardware.automotive.audiocontrol@1.0":      true,
-	"android.hardware.automotive.audiocontrol@2.0":      true,
-	"android.hardware.automotive.can@1.0":               true,
-	"android.hardware.automotive.evs@1.0":               true,
-	"android.hardware.automotive.evs@1.1":               true,
-	"android.hardware.automotive.sv@1.0":                true,
-	"android.hardware.automotive.vehicle@2.0":           true,
-	"android.hardware.biometrics.face@1.0":              true,
-	"android.hardware.biometrics.fingerprint@2.1":       true,
-	"android.hardware.biometrics.fingerprint@2.2":       true,
-	"android.hardware.biometrics.fingerprint@2.3":       true,
-	"android.hardware.bluetooth@1.0":                    true,
-	"android.hardware.bluetooth@1.1":                    true,
-	"android.hardware.bluetooth.a2dp@1.0":               true,
-	"android.hardware.bluetooth.audio@2.0":              true,
-	"android.hardware.bluetooth.audio@2.1":              true,
-	"android.hardware.boot@1.0":                         true,
-	"android.hardware.boot@1.1":                         true,
-	"android.hardware.boot@1.2":                         true,
-	"android.hardware.broadcastradio@1.0":               true,
-	"android.hardware.broadcastradio@1.1":               true,
-	"android.hardware.broadcastradio@2.0":               true,
-	"android.hardware.camera.common@1.0":                true,
-	"android.hardware.camera.device@1.0":                true,
-	"android.hardware.camera.device@3.2":                true,
-	"android.hardware.camera.device@3.3":                true,
-	"android.hardware.camera.device@3.4":                true,
-	"android.hardware.camera.device@3.5":                true,
-	"android.hardware.camera.device@3.6":                true,
-	"android.hardware.camera.device@3.7":                true,
-	"android.hardware.camera.metadata@3.2":              true,
-	"android.hardware.camera.metadata@3.3":              true,
-	"android.hardware.camera.metadata@3.4":              true,
-	"android.hardware.camera.metadata@3.5":              true,
-	"android.hardware.camera.metadata@3.6":              true,
-	"android.hardware.camera.provider@2.4":              true,
-	"android.hardware.camera.provider@2.5":              true,
-	"android.hardware.camera.provider@2.6":              true,
-	"android.hardware.camera.provider@2.7":              true,
-	"android.hardware.cas@1.0":                          true,
-	"android.hardware.cas@1.1":                          true,
-	"android.hardware.cas@1.2":                          true,
-	"android.hardware.cas.native@1.0":                   true,
-	"android.hardware.configstore@1.0":                  true,
-	"android.hardware.configstore@1.1":                  true,
-	"android.hardware.confirmationui@1.0":               true,
-	"android.hardware.contexthub@1.0":                   true,
-	"android.hardware.contexthub@1.1":                   true,
-	"android.hardware.contexthub@1.2":                   true,
-	"android.hardware.drm@1.0":                          true,
-	"android.hardware.drm@1.1":                          true,
-	"android.hardware.drm@1.2":                          true,
-	"android.hardware.drm@1.3":                          true,
-	"android.hardware.drm@1.4":                          true,
-	"android.hardware.dumpstate@1.0":                    true,
-	"android.hardware.dumpstate@1.1":                    true,
-	"android.hardware.fastboot@1.0":                     true,
-	"android.hardware.fastboot@1.1":                     true,
-	"android.hardware.gatekeeper@1.0":                   true,
-	"android.hardware.gnss@1.0":                         true,
-	"android.hardware.gnss@1.1":                         true,
-	"android.hardware.gnss@2.0":                         true,
-	"android.hardware.gnss@2.1":                         true,
-	"android.hardware.gnss.measurement_corrections@1.0": true,
-	"android.hardware.gnss.measurement_corrections@1.1": true,
-	"android.hardware.gnss.visibility_control@1.0":      true,
-	"android.hardware.graphics.allocator@2.0":           true,
-	"android.hardware.graphics.allocator@3.0":           true,
-	"android.hardware.graphics.allocator@4.0":           true,
-	"android.hardware.graphics.bufferqueue@1.0":         true,
-	"android.hardware.graphics.bufferqueue@2.0":         true,
-	"android.hardware.graphics.common@1.0":              true,
-	"android.hardware.graphics.common@1.1":              true,
-	"android.hardware.graphics.common@1.2":              true,
-	"android.hardware.graphics.composer@2.1":            true,
-	"android.hardware.graphics.composer@2.2":            true,
-	"android.hardware.graphics.composer@2.3":            true,
-	"android.hardware.graphics.composer@2.4":            true,
-	"android.hardware.graphics.mapper@2.0":              true,
-	"android.hardware.graphics.mapper@2.1":              true,
-	"android.hardware.graphics.mapper@3.0":              true,
-	"android.hardware.graphics.mapper@4.0":              true,
-	"android.hardware.health@1.0":                       true,
-	"android.hardware.health@2.0":                       true,
-	"android.hardware.health@2.1":                       true,
-	"android.hardware.health.storage@1.0":               true,
-	"android.hardware.input.classifier@1.0":             true,
-	"android.hardware.input.common@1.0":                 true,
-	"android.hardware.ir@1.0":                           true,
-	"android.hardware.keymaster@3.0":                    true,
-	"android.hardware.keymaster@4.0":                    true,
-	"android.hardware.keymaster@4.1":                    true,
-	"android.hardware.light@2.0":                        true,
-	"android.hardware.media@1.0":                        true,
-	"android.hardware.media.bufferpool@1.0":             true,
-	"android.hardware.media.bufferpool@2.0":             true,
-	"android.hardware.media.c2@1.0":                     true,
-	"android.hardware.media.c2@1.1":                     true,
-	"android.hardware.media.c2@1.2":                     true,
-	"android.hardware.media.omx@1.0":                    true,
-	"android.hardware.memtrack@1.0":                     true,
-	"android.hardware.neuralnetworks@1.0":               true,
-	"android.hardware.neuralnetworks@1.1":               true,
-	"android.hardware.neuralnetworks@1.2":               true,
-	"android.hardware.neuralnetworks@1.3":               true,
-	"android.hardware.nfc@1.0":                          true,
-	"android.hardware.nfc@1.1":                          true,
-	"android.hardware.nfc@1.2":                          true,
-	"android.hardware.oemlock@1.0":                      true,
-	"android.hardware.power@1.0":                        true,
-	"android.hardware.power@1.1":                        true,
-	"android.hardware.power@1.2":                        true,
-	"android.hardware.power@1.3":                        true,
-	"android.hardware.power.stats@1.0":                  true,
-	"android.hardware.radio@1.0":                        true,
-	"android.hardware.radio@1.1":                        true,
-	"android.hardware.radio@1.2":                        true,
-	"android.hardware.radio@1.3":                        true,
-	"android.hardware.radio@1.4":                        true,
-	"android.hardware.radio@1.5":                        true,
-	"android.hardware.radio@1.6":                        true,
-	"android.hardware.radio.config@1.0":                 true,
-	"android.hardware.radio.config@1.1":                 true,
-	"android.hardware.radio.config@1.2":                 true,
-	"android.hardware.radio.config@1.3":                 true,
-	"android.hardware.radio.deprecated@1.0":             true,
-	"android.hardware.renderscript@1.0":                 true,
-	"android.hardware.secure_element@1.0":               true,
-	"android.hardware.secure_element@1.1":               true,
-	"android.hardware.secure_element@1.2":               true,
-	"android.hardware.sensors@1.0":                      true,
-	"android.hardware.sensors@2.0":                      true,
-	"android.hardware.sensors@2.1":                      true,
-	"android.hardware.soundtrigger@2.0":                 true,
-	"android.hardware.soundtrigger@2.1":                 true,
-	"android.hardware.soundtrigger@2.2":                 true,
-	"android.hardware.soundtrigger@2.3":                 true,
-	"android.hardware.soundtrigger@2.4":                 true,
-	"android.hardware.tests.bar@1.0":                    true,
-	"android.hardware.tests.baz@1.0":                    true,
-	"android.hardware.tests.expression@1.0":             true,
-	"android.hardware.tests.extension.light@2.0":        true,
-	"android.hardware.tests.foo@1.0":                    true,
-	"android.hardware.tests.hash@1.0":                   true,
-	"android.hardware.tests.inheritance@1.0":            true,
-	"android.hardware.tests.lazy@1.0":                   true,
-	"android.hardware.tests.lazy@1.1":                   true,
-	"android.hardware.tests.libhwbinder@1.0":            true,
-	"android.hardware.tests.memory@1.0":                 true,
-	"android.hardware.tests.memory@2.0":                 true,
-	"android.hardware.tests.msgq@1.0":                   true,
-	"android.hardware.tests.multithread@1.0":            true,
-	"android.hardware.tests.safeunion@1.0":              true,
-	"android.hardware.tests.safeunion.cpp@1.0":          true,
-	"android.hardware.tests.trie@1.0":                   true,
-	"android.hardware.tetheroffload.config@1.0":         true,
-	"android.hardware.tetheroffload.control@1.0":        true,
-	"android.hardware.tetheroffload.control@1.1":        true,
-	"android.hardware.thermal@1.0":                      true,
-	"android.hardware.thermal@1.1":                      true,
-	"android.hardware.thermal@2.0":                      true,
-	"android.hardware.tv.cec@1.0":                       true,
-	"android.hardware.tv.cec@1.1":                       true,
-	"android.hardware.tv.input@1.0":                     true,
-	"android.hardware.tv.tuner@1.0":                     true,
-	"android.hardware.tv.tuner@1.1":                     true,
-	"android.hardware.usb@1.0":                          true,
-	"android.hardware.usb@1.1":                          true,
-	"android.hardware.usb@1.2":                          true,
-	"android.hardware.usb@1.3":                          true,
-	"android.hardware.usb.gadget@1.0":                   true,
-	"android.hardware.usb.gadget@1.1":                   true,
-	"android.hardware.usb.gadget@1.2":                   true,
-	"android.hardware.vibrator@1.0":                     true,
-	"android.hardware.vibrator@1.1":                     true,
-	"android.hardware.vibrator@1.2":                     true,
-	"android.hardware.vibrator@1.3":                     true,
-	"android.hardware.vr@1.0":                           true,
-	"android.hardware.weaver@1.0":                       true,
-	"android.hardware.wifi@1.0":                         true,
-	"android.hardware.wifi@1.1":                         true,
-	"android.hardware.wifi@1.2":                         true,
-	"android.hardware.wifi@1.3":                         true,
-	"android.hardware.wifi@1.4":                         true,
-	"android.hardware.wifi@1.5":                         true,
-	"android.hardware.wifi.hostapd@1.0":                 true,
-	"android.hardware.wifi.hostapd@1.1":                 true,
-	"android.hardware.wifi.hostapd@1.2":                 true,
-	"android.hardware.wifi.hostapd@1.3":                 true,
-	"android.hardware.wifi.offload@1.0":                 true,
-	"android.hardware.wifi.supplicant@1.0":              true,
-	"android.hardware.wifi.supplicant@1.1":              true,
-	"android.hardware.wifi.supplicant@1.2":              true,
-	"android.hardware.wifi.supplicant@1.3":              true,
-	"android.hardware.wifi.supplicant@1.4":              true,
-	"android.hidl.allocator@1.0":                        true,
-	"android.hidl.base@1.0":                             true,
-	"android.hidl.manager@1.0":                          true,
-	"android.hidl.manager@1.1":                          true,
-	"android.hidl.manager@1.2":                          true,
-	"android.hidl.memory@1.0":                           true,
-	"android.hidl.memory.block@1.0":                     true,
-	"android.hidl.memory.token@1.0":                     true,
-	"android.hidl.safe_union@1.0":                       true,
-	"android.hidl.token@1.0":                            true,
-	"android.system.net.netd@1.0":                       true,
-	"android.system.net.netd@1.1":                       true,
-	"android.system.suspend@1.0":                        true,
-	"android.system.wifi.keystore@1.0":                  true,
-}
diff --git a/build/hidl_package_root.go b/build/hidl_package_root.go
index fc58597..e15b4ac 100644
--- a/build/hidl_package_root.go
+++ b/build/hidl_package_root.go
@@ -30,20 +30,6 @@
 	}, "output")
 )
 
-type hidlPackageRootProperties struct {
-	// Path to the package root from android build root. It is recommended not to set this and
-	// use the current path. This will be deprecated in the future.
-	Path *string
-
-	// True to require a current.txt API file here.
-	//
-	// When false, it uses the file only when it exists.
-	Use_current *bool
-
-	// True to require all things referenced by this package root to be frozen.
-	Require_frozen *bool
-}
-
 func init() {
 	android.RegisterModuleType("hidl_package_root", hidlPackageRootFactory)
 }
@@ -51,7 +37,16 @@
 type hidlPackageRoot struct {
 	android.ModuleBase
 
-	properties hidlPackageRootProperties
+	properties struct {
+		// Path to the package root from android build root. It is recommended not to set this and
+		// use the current path. This will be deprecated in the future.
+		Path *string
+
+		// True to require a current.txt API file here.
+		//
+		// When false, it uses the file only when it exists.
+		Use_current *bool
+	}
 
 	currentPath android.OptionalPath
 	genOutputs  android.Paths
@@ -67,10 +62,6 @@
 	return r.currentPath
 }
 
-func (r *hidlPackageRoot) requireFrozen() bool {
-	return proptools.BoolDefault(r.properties.Require_frozen, false)
-}
-
 func (r *hidlPackageRoot) generateCurrentFile(ctx android.ModuleContext) {
 	if !r.currentPath.Valid() {
 		return
diff --git a/build/properties.go b/build/properties.go
index c88bbef..d746bec 100644
--- a/build/properties.go
+++ b/build/properties.go
@@ -30,8 +30,6 @@
 	Defaults                  []string
 	Host_supported            *bool
 	Vendor_available          *bool
-	Odm_available             *bool
-	Product_available         *bool
 	Recovery_available        *bool
 	Generated_sources         []string
 	Generated_headers         []string
diff --git a/c2hal/Android.bp b/c2hal/Android.bp
index 099e3a5..69f2212 100644
--- a/c2hal/Android.bp
+++ b/c2hal/Android.bp
@@ -12,15 +12,6 @@
 // See the License for the specific language governing permissions and
 // limitations under the License.
 
-package {
-    // See: http://go/android-license-faq
-    // A large-scale-change added 'default_applicable_licenses' to import
-    // all of the 'license_kinds' from "system_tools_hidl_license"
-    // to get the below license kinds:
-    //   SPDX-license-identifier-Apache-2.0
-    default_applicable_licenses: ["system_tools_hidl_license"],
-}
-
 cc_binary_host {
     name: "c2hal",
     defaults: ["hidl-gen-defaults"],
diff --git a/c2hal/c2hal_y.yy b/c2hal/c2hal_y.yy
index 1296ded..596b211 100644
--- a/c2hal/c2hal_y.yy
+++ b/c2hal/c2hal_y.yy
@@ -72,7 +72,7 @@
 %parse-param { android::AST *ast }
 %lex-param   { void *scanner }
 %locations
-%define api.pure
+%pure-parser
 %glr-parser
 
 /* These have to do with the fact that
diff --git a/c2hal/test/Android.bp b/c2hal/test/Android.bp
index 4e69de6..722d1a8 100644
--- a/c2hal/test/Android.bp
+++ b/c2hal/test/Android.bp
@@ -13,15 +13,6 @@
 // limitations under the License.
 //
 
-package {
-    // See: http://go/android-license-faq
-    // A large-scale-change added 'default_applicable_licenses' to import
-    // all of the 'license_kinds' from "system_tools_hidl_license"
-    // to get the below license kinds:
-    //   SPDX-license-identifier-Apache-2.0
-    default_applicable_licenses: ["system_tools_hidl_license"],
-}
-
 genrule {
     name: "c2hal_test_genc++_headers",
     tools: [
diff --git a/generateCpp.cpp b/generateCpp.cpp
index ec95774..d7ee043 100644
--- a/generateCpp.cpp
+++ b/generateCpp.cpp
@@ -1071,9 +1071,6 @@
         declareCppReaderLocals(
                 out, method->results(), true /* forResults */);
     }
-    if (superInterface->hasSensitiveDataAnnotation()) {
-        out << "_hidl_data.markSensitive();\n";
-    }
 
     out << "_hidl_err = _hidl_data.writeInterfaceToken(";
     out << klassName;
@@ -1101,14 +1098,15 @@
         out << "::android::hardware::ProcessState::self()->startThreadPool();\n";
     }
     out << "_hidl_transact_err = ::android::hardware::IInterface::asBinder(_hidl_this)->transact("
-        << method->getSerialId() << " /* " << method->name()
-        << " */, _hidl_data, &_hidl_reply, 0 /* flags */";
+        << method->getSerialId()
+        << " /* "
+        << method->name()
+        << " */, _hidl_data, &_hidl_reply";
 
     if (method->isOneway()) {
-        out << " | " << Interface::FLAG_ONE_WAY->cppValue();
-    }
-    if (superInterface->hasSensitiveDataAnnotation()) {
-        out << " | " << Interface::FLAG_CLEAR_BUF->cppValue();
+        out << ", " << Interface::FLAG_ONE_WAY->cppValue();
+    } else {
+        out << ", 0";
     }
 
     if (hasCallback) {
diff --git a/generateInheritanceHierarchy.cpp b/generateInheritanceHierarchy.cpp
index b558543..38d1a5d 100644
--- a/generateInheritanceHierarchy.cpp
+++ b/generateInheritanceHierarchy.cpp
@@ -19,7 +19,6 @@
 #include <android-base/logging.h>
 #include <hidl-util/Formatter.h>
 #include <json/json.h>
-#include <sstream>
 #include <string>
 #include <vector>
 
@@ -41,12 +40,8 @@
         }
         root["inheritedInterfaces"] = inheritedInterfaces;
     }
-    Json::StreamWriterBuilder factory;
-    std::unique_ptr<Json::StreamWriter> const writer(factory.newStreamWriter());
-    std::ostringstream ss;
-    writer->write(root, &ss);
-    ss << std::endl;
-    out << ss.str();
+    Json::StyledWriter writer;
+    out << writer.write(root);
 }
 
 }  // namespace android
diff --git a/generateJava.cpp b/generateJava.cpp
index 4b6fea6..9eb1232 100644
--- a/generateJava.cpp
+++ b/generateJava.cpp
@@ -73,17 +73,15 @@
                 "This will invoke the equivalent of the C++ getService(std::string) if retry is\n"
                 "true or tryGetService(std::string) if retry is false. If the service is\n"
                 "available on the device and retry is true, this will wait for the service to\n"
-                "start.\n\n@throws NoSuchElementException if this service is not available",
+                "start. Otherwise, it will return immediately even if the service is null.",
                 HIDL_LOCATION_HERE)
                 .emit(out);
     } else {
         DocComment(
-                "@throws NoSuchElementException if this service is not available\n"
-                "@deprecated this will not wait for the interface to come up if it hasn't yet\n"
-                "    started. See getService(String,boolean) instead.\n",
+                "Warning: this will not wait for the interface to come up if it hasn't yet\n"
+                "started. See getService(String,boolean) instead.",
                 HIDL_LOCATION_HERE)
                 .emit(out);
-        out << "@Deprecated\n";
     }
     out << "public static "
         << ifaceName
@@ -108,12 +106,10 @@
         DocComment("Calls getService(\"default\",retry).", HIDL_LOCATION_HERE).emit(out);
     } else {
         DocComment(
-                "@throws NoSuchElementException if this service is not available\n"
-                "@deprecated this will not wait for the interface to come up if it hasn't yet\n"
-                "    started. See getService(boolean) instead.\n",
+                "Warning: this will not wait for the interface to come up if it hasn't yet "
+                "started. See getService(String,boolean) instead.",
                 HIDL_LOCATION_HERE)
                 .emit(out);
-        out << "@Deprecated\n";
     }
     out << "public static "
         << ifaceName
diff --git a/hashing/Android.bp b/hashing/Android.bp
index c6bacd3..9f63a27 100644
--- a/hashing/Android.bp
+++ b/hashing/Android.bp
@@ -12,15 +12,6 @@
 // See the License for the specific language governing permissions and
 // limitations under the License.
 
-package {
-    // See: http://go/android-license-faq
-    // A large-scale-change added 'default_applicable_licenses' to import
-    // all of the 'license_kinds' from "system_tools_hidl_license"
-    // to get the below license kinds:
-    //   SPDX-license-identifier-Apache-2.0
-    default_applicable_licenses: ["system_tools_hidl_license"],
-}
-
 cc_library {
     name: "libhidl-gen-hash",
     host_supported: true,
diff --git a/hidl2aidl/AidlHelper.cpp b/hidl2aidl/AidlHelper.cpp
index 94ab1e0..509b2aa 100644
--- a/hidl2aidl/AidlHelper.cpp
+++ b/hidl2aidl/AidlHelper.cpp
@@ -14,20 +14,17 @@
  * limitations under the License.
  */
 
-#include <android-base/file.h>
 #include <android-base/logging.h>
 #include <android-base/strings.h>
 #include <hidl-util/FQName.h>
 #include <hidl-util/Formatter.h>
 #include <hidl-util/StringHelper.h>
-#include <iostream>
 #include <set>
 #include <string>
 #include <vector>
 
 #include "AidlHelper.h"
 #include "ArrayType.h"
-#include "CompoundType.h"
 #include "Coordinator.h"
 #include "Interface.h"
 #include "Method.h"
@@ -38,8 +35,6 @@
 namespace android {
 
 Formatter* AidlHelper::notesFormatter = nullptr;
-std::string AidlHelper::fileHeader = "";
-bool AidlHelper::expandExtended = false;
 
 Formatter& AidlHelper::notes() {
     CHECK(notesFormatter != nullptr);
@@ -68,19 +63,11 @@
     return aidlPackage;
 }
 
-std::string AidlHelper::getAidlPackagePath(const FQName& fqName) {
-    return base::Join(base::Split(AidlHelper::getAidlPackage(fqName), "."), "/");
-}
-
-std::optional<std::string> AidlHelper::getAidlFQName(const FQName& fqName) {
-    std::optional<const ReplacedTypeInfo> type = getAidlReplacedType(fqName);
-    if (type) {
-        return type.value().aidlReplacedFQName;
-    }
+std::string AidlHelper::getAidlFQName(const FQName& fqName) {
     return getAidlPackage(fqName) + "." + getAidlName(fqName);
 }
 
-void AidlHelper::importLocallyReferencedType(const Type& type, std::set<std::string>* imports) {
+static void importLocallyReferencedType(const Type& type, std::set<std::string>* imports) {
     if (type.isArray()) {
         return importLocallyReferencedType(*static_cast<const ArrayType*>(&type)->getElementType(),
                                            imports);
@@ -93,20 +80,16 @@
     if (!type.isNamedType()) return;
     const NamedType& namedType = *static_cast<const NamedType*>(&type);
 
-    std::optional<std::string> import = AidlHelper::getAidlFQName(namedType.fqName());
-    if (import) {
-        imports->insert(import.value());
-    }
+    std::string import = AidlHelper::getAidlFQName(namedType.fqName());
+    imports->insert(import);
 }
 
 // This tries iterating over the HIDL AST which is a bit messy because
 // it has to encode the logic in the rest of hidl2aidl. It would be better
 // if we could iterate over the AIDL structure which has already been
 // processed.
-void AidlHelper::emitFileHeader(
-        Formatter& out, const NamedType& type,
-        const std::map<const NamedType*, const ProcessedCompoundType>& processedTypes) {
-    AidlHelper::emitFileHeader(out);
+void AidlHelper::emitFileHeader(Formatter& out, const NamedType& type) {
+    out << "// FIXME: license file if you have one\n\n";
     out << "package " << getAidlPackage(type.fqName()) << ";\n\n";
 
     std::set<std::string> imports;
@@ -121,34 +104,17 @@
 
     // Import all the referenced types
     if (type.isInterface()) {
-        // This is a separate case because getReferences doesn't traverse all the superTypes and
+        // This is a separate case becase getReferences doesn't traverse all the superTypes and
         // sometimes includes references to types that would not exist on AIDL
         const std::vector<const Method*>& methods =
-                getUserDefinedMethods(out, static_cast<const Interface&>(type));
+                getUserDefinedMethods(static_cast<const Interface&>(type));
         for (const Method* method : methods) {
             for (const Reference<Type>* ref : method->getReferences()) {
                 importLocallyReferencedType(*ref->get(), &imports);
             }
         }
-    } else if (type.isCompoundType()) {
-        // Get all of the imports for the flattened compound type that may
-        // include additional fields and subtypes from older versions
-        const auto& it = processedTypes.find(&type);
-        CHECK(it != processedTypes.end()) << "Failed to find " << type.fullName();
-        const ProcessedCompoundType& processedType = it->second;
-
-        for (const auto& field : processedType.fields) {
-            importLocallyReferencedType(*field.field->get(), &imports);
-        }
-        for (const auto& subType : processedType.subTypes) {
-            importLocallyReferencedType(*subType, &imports);
-        }
     } else {
         for (const Reference<Type>* ref : type.getReferences()) {
-            if (ref->get()->definedName() == type.fqName().name()) {
-                // Don't import the referenced type if this is referencing itself
-                continue;
-            }
             importLocallyReferencedType(*ref->get(), &imports);
         }
     }
@@ -162,94 +128,14 @@
     }
 }
 
-Formatter AidlHelper::getFileWithHeader(
-        const NamedType& namedType, const Coordinator& coordinator,
-        const std::map<const NamedType*, const ProcessedCompoundType>& processedTypes) {
-    Formatter out =
-            coordinator.getFormatter(namedType.fqName(), Coordinator::Location::DIRECT,
-                                     AidlHelper::getAidlPackagePath(namedType.fqName()) + "/" +
-                                             getAidlName(namedType.fqName()) + ".aidl");
-    emitFileHeader(out, namedType, processedTypes);
+Formatter AidlHelper::getFileWithHeader(const NamedType& namedType,
+                                        const Coordinator& coordinator) {
+    std::string aidlPackage = getAidlPackage(namedType.fqName());
+    Formatter out = coordinator.getFormatter(namedType.fqName(), Coordinator::Location::DIRECT,
+                                             base::Join(base::Split(aidlPackage, "."), "/") + "/" +
+                                                     getAidlName(namedType.fqName()) + ".aidl");
+    emitFileHeader(out, namedType);
     return out;
 }
 
-void AidlHelper::processCompoundType(const CompoundType& compoundType,
-                                     ProcessedCompoundType* processedType,
-                                     const std::string& fieldNamePrefix) {
-    // Gather all of the subtypes defined in this type
-    for (const NamedType* subType : compoundType.getSubTypes()) {
-        processedType->subTypes.insert(subType);
-    }
-    std::pair<size_t, size_t> version = compoundType.fqName().hasVersion()
-                                                ? compoundType.fqName().getVersion()
-                                                : std::pair<size_t, size_t>{0, 0};
-    for (const NamedReference<Type>* field : compoundType.getFields()) {
-        // Check for references to another version of itself
-        if (field->get()->typeName() == compoundType.typeName()) {
-            if (AidlHelper::shouldBeExpanded(
-                        static_cast<const CompoundType&>(*field->get()).fqName(),
-                        compoundType.fqName())) {
-                processCompoundType(static_cast<const CompoundType&>(*field->get()), processedType,
-                                    fieldNamePrefix + field->name() + ".");
-            } else {
-                // Keep this field as is
-                processedType->fields.push_back({field, fieldNamePrefix + field->name(), version});
-            }
-        } else {
-            // Handle duplicate field names. Keep only the most recent definitions.
-            auto it = std::find_if(processedType->fields.begin(), processedType->fields.end(),
-                                   [field](auto& processedField) {
-                                       return processedField.field->name() == field->name();
-                                   });
-            if (it != processedType->fields.end()) {
-                AidlHelper::notes()
-                        << "Found conflicting field name \"" << field->name()
-                        << "\" in different versions of " << compoundType.fqName().name() << ". ";
-
-                if (version.first > it->version.first ||
-                    (version.first == it->version.first && version.second > it->version.second)) {
-                    AidlHelper::notes()
-                            << "Keeping " << field->get()->typeName() << " from " << version.first
-                            << "." << version.second << " and discarding "
-                            << (it->field)->get()->typeName() << " from " << it->version.first
-                            << "." << it->version.second << ".\n";
-                    it->fullName = fieldNamePrefix + field->name();
-                    it->field = field;
-                    it->version = version;
-                } else {
-                    AidlHelper::notes()
-                            << "Keeping " << (it->field)->get()->typeName() << " from "
-                            << it->version.first << "." << it->version.second << " and discarding "
-                            << field->get()->typeName() << " from " << version.first << "."
-                            << version.second << ".\n";
-                }
-            } else {
-                processedType->fields.push_back({field, fieldNamePrefix + field->name(), version});
-            }
-        }
-    }
-}
-
-void AidlHelper::setFileHeader(const std::string& file) {
-    if (!file.empty()) {
-        if (!android::base::ReadFileToString(file, &fileHeader)) {
-            std::cerr << "ERROR: Failed to find license file: " << file << "\n";
-            exit(1);
-        }
-    }
-}
-
-void AidlHelper::emitFileHeader(Formatter& out) {
-    if (fileHeader.empty()) {
-        out << "// FIXME: license file, or use the -l option to generate the files with the "
-               "header.\n\n";
-    } else {
-        out << fileHeader << "\n";
-    }
-}
-
-bool AidlHelper::shouldBeExpanded(const FQName& a, const FQName& b) {
-    return a.package() == b.package() || expandExtended;
-}
-
 }  // namespace android
diff --git a/hidl2aidl/AidlHelper.h b/hidl2aidl/AidlHelper.h
index 246744c..54f3bf4 100644
--- a/hidl2aidl/AidlHelper.h
+++ b/hidl2aidl/AidlHelper.h
@@ -16,15 +16,11 @@
 
 #pragma once
 
-#include <map>
-#include <set>
 #include <string>
 #include <vector>
-#include "Reference.h"
 
 namespace android {
 
-struct CompoundType;
 struct Coordinator;
 struct Formatter;
 struct FQName;
@@ -34,32 +30,6 @@
 struct Scope;
 struct Type;
 
-struct FieldWithVersion {
-    const NamedReference<Type>* field;
-    // name of the field appended by the
-    std::string fullName;
-    std::pair<size_t, size_t> version;
-};
-
-struct ProcessedCompoundType {
-    // map modified name to field. This modified name is old.new
-    std::vector<FieldWithVersion> fields;
-    std::set<const NamedType*> subTypes;
-};
-
-struct ReplacedTypeInfo {
-    // if a HIDL type is replaced, this returns the new AIDL type
-    // android.hardware.safe_enum@1.0::Monostate -> boolean
-    std::string aidlReplacedType;
-    // if a HIDL type is replaced, this is the FQName of the new AIDL type
-    // android.hardware.safe_enum@1.0::Monostate -> std::nullopt
-    std::optional<std::string> aidlReplacedFQName;
-    // if a HIDL type is replaced, this returns the function needed to generate translation
-    std::optional<std::function<void(Formatter&)>> translateField;
-};
-
-enum class AidlBackend { UNKNOWN, NDK, CPP, JAVA };
-
 struct AidlHelper {
     /* FQName helpers */
     // getAidlName returns the type names
@@ -70,65 +40,33 @@
     // android.hardware.foo@1.x -> android.hardware.foo
     // android.hardware.foo@2.x -> android.hardware.foo2
     static std::string getAidlPackage(const FQName& fqName);
-    // returns getAidlPackage(fqName) with '.' replaced by '/'
-    // android.hardware.foo@1.x -> android/hardware/foo
-    static std::string getAidlPackagePath(const FQName& fqName);
 
     // getAidlFQName = getAidlPackage + "." + getAidlName
-    static std::optional<std::string> getAidlFQName(const FQName& fqName);
+    static std::string getAidlFQName(const FQName& fqName);
 
-    // if a HIDL type is replaced, this returns the ReplacedTypeInfo for the new AIDL type
-    static std::optional<const ReplacedTypeInfo> getAidlReplacedType(const FQName& fqName);
-
-    static void emitFileHeader(
-            Formatter& out, const NamedType& type,
-            const std::map<const NamedType*, const ProcessedCompoundType>& processedTypes);
-    static void importLocallyReferencedType(const Type& type, std::set<std::string>* imports);
-    static Formatter getFileWithHeader(
-            const NamedType& namedType, const Coordinator& coordinator,
-            const std::map<const NamedType*, const ProcessedCompoundType>& processedTypes);
+    static void emitFileHeader(Formatter& out, const NamedType& type);
+    static Formatter getFileWithHeader(const NamedType& namedType, const Coordinator& coordinator);
 
     /* Methods for Type */
     static std::string getAidlType(const Type& type, const FQName& relativeTo);
 
     /* Methods for NamedType */
-    static void emitAidl(
-            const NamedType& namedType, const Coordinator& coordinator,
-            const std::map<const NamedType*, const ProcessedCompoundType>& processedTypes);
+    static void emitAidl(const NamedType& namedType, const Coordinator& coordinator);
+
+    /* Methods for Scope */
+    static void emitAidl(const Scope& scope, const Coordinator& coordinator);
 
     /* Methods for Interface */
-    static void emitAidl(const Interface& interface, const Coordinator& coordinator,
-                         const std::map<const NamedType*, const ProcessedCompoundType>&);
+    static void emitAidl(const Interface& interface, const Coordinator& coordinator);
     // Returns all methods that would exist in an AIDL equivalent interface
-    static std::vector<const Method*> getUserDefinedMethods(Formatter& out,
-                                                            const Interface& interface);
-
-    static void processCompoundType(const CompoundType& compoundType,
-                                    ProcessedCompoundType* processedType,
-                                    const std::string& fieldNamePrefix);
+    static std::vector<const Method*> getUserDefinedMethods(const Interface& interface);
 
     static Formatter& notes();
     static void setNotes(Formatter* formatter);
 
-    // return the full file names for the header/source files based on the backend
-    static std::string translateHeaderFile(const FQName& fqName, AidlBackend backend);
-    static std::string translateSourceFile(const FQName& fqName, AidlBackend backend);
-
-    static void emitTranslation(
-            const Coordinator& coordinator, const FQName& fqName,
-            const std::set<const NamedType*>& namedTypesInPackage,
-            const std::map<const NamedType*, const ProcessedCompoundType>& processedTypes);
-    static void setFileHeader(const std::string& file);
-    static void emitFileHeader(Formatter& out);
-    static void setExpandExtended(bool expand) { expandExtended = expand; };
-    static bool isExpandExtended() { return expandExtended; };
-    static bool shouldBeExpanded(const FQName& source, const FQName& extended);
-
   private:
     // This is the formatter to use for additional conversion output
     static Formatter* notesFormatter;
-    static std::string fileHeader;
-    static bool expandExtended;
 };
 
 }  // namespace android
diff --git a/hidl2aidl/AidlInterface.cpp b/hidl2aidl/AidlInterface.cpp
index 6c4b4af..cece6cb 100644
--- a/hidl2aidl/AidlInterface.cpp
+++ b/hidl2aidl/AidlInterface.cpp
@@ -61,18 +61,9 @@
     }
 }
 
-std::vector<const Method*> AidlHelper::getUserDefinedMethods(Formatter& out,
-                                                             const Interface& interface) {
+std::vector<const Method*> AidlHelper::getUserDefinedMethods(const Interface& interface) {
     std::vector<const Method*> methods;
     for (const Interface* iface : interface.typeChain()) {
-        if (!AidlHelper::shouldBeExpanded(interface.fqName(), iface->fqName()) &&
-            iface->fqName() != gIBaseFqName) {
-            out << "// Types from " << iface->fqName().string()
-                << " are not included because it is in a separate package, and it is expected to "
-                   "be a separate AIDL interface. To include these methods, use the '-e' argument. "
-                   "\n";
-            break;
-        }
         const std::vector<Method*> userDefined = iface->userDefinedMethods();
         methods.insert(methods.end(), userDefined.begin(), userDefined.end());
     }
@@ -80,54 +71,50 @@
     return methods;
 }
 
-// Represents a node which is potentially overriding another node.
-// e.g. if this is 'foo_1_4'
-template <class NODE>
-struct NodeWithVersion {
-    size_t major;          // 1
-    size_t minor;          // 4
-    const NODE* node;      // HIDL object representing foo_1_4.
-    std::string baseName;  // foo
+struct MethodWithVersion {
+    size_t major;
+    size_t minor;
+    const Method* method;
+    std::string name;
 };
 
-std::string getBaseName(const std::string& rawName) {
-    size_t underscore = rawName.find('_');
+static void pushVersionedMethodOntoMap(MethodWithVersion versionedMethod,
+                                       std::map<std::string, MethodWithVersion>* map,
+                                       std::vector<const MethodWithVersion*>* ignored) {
+    const Method* method = versionedMethod.method;
+    std::string name = method->name();
+    size_t underscore = name.find('_');
     if (underscore != std::string::npos) {
-        std::string version = rawName.substr(underscore + 1);  // don't include _
-        std::string baseName = rawName.substr(0, underscore);
+        std::string version = name.substr(underscore + 1);  // don't include _
+        std::string nameWithoutVersion = name.substr(0, underscore);
         underscore = version.find('_');
 
         size_t major, minor;
         if (underscore != std::string::npos &&
             base::ParseUint(version.substr(0, underscore), &major) &&
             base::ParseUint(version.substr(underscore + 1), &minor)) {
-            // contains major and minor version. consider it's baseName now.
-            return baseName;
+            // contains major and minor version. consider it's nameWithoutVersion now.
+            name = nameWithoutVersion;
+            versionedMethod.name = nameWithoutVersion;
         }
     }
-    return rawName;
-}
 
-template <class NODE>
-static void pushVersionedNodeOntoMap(const NODE& versionedNode,
-                                     std::map<std::string, NODE>* latestNodeForBaseName,
-                                     std::vector<const NODE>* supersededNode) {
-    // attempt to push name onto latestNodeForBaseName
-    auto [it, inserted] =
-            latestNodeForBaseName->emplace(std::move(versionedNode.baseName), versionedNode);
+    // push name onto map
+    auto [it, inserted] = map->emplace(std::move(name), versionedMethod);
     if (!inserted) {
         auto* current = &it->second;
 
-        // Node in the latestNodeForBaseName is more recent
-        if ((current->major > versionedNode.major) ||
-            (current->major == versionedNode.major && current->minor > versionedNode.minor)) {
-            supersededNode->push_back(versionedNode);
+        // Method in the map is more recent
+        if ((current->major > versionedMethod.major) ||
+            (current->major == versionedMethod.major && current->minor > versionedMethod.minor)) {
+            // ignoring versionedMethod
+            ignored->push_back(&versionedMethod);
             return;
         }
 
         // Either current.major < versioned.major OR versioned.minor >= current.minor
-        supersededNode->push_back(*current);
-        *current = std::move(versionedNode);
+        ignored->push_back(current);
+        *current = std::move(versionedMethod);
     }
 }
 
@@ -151,29 +138,12 @@
     return false;
 }
 
-static bool shouldWarnOutParam(const std::string& typeName) {
-    static const std::vector<std::string> kNoOutParamTypes = {"ParcelFileDescriptor",
-                                                              "FileDescriptor",
-                                                              "ParcelableHolder",
-                                                              "IBinder",
-                                                              "String",
-                                                              "CharacterSequence",
-                                                              "void",
-                                                              "boolean",
-                                                              "byte",
-                                                              "char",
-                                                              "int",
-                                                              "long",
-                                                              "float",
-                                                              "double"};
-    return std::find(kNoOutParamTypes.begin(), kNoOutParamTypes.end(), typeName) !=
-           kNoOutParamTypes.end();
-}
+void AidlHelper::emitAidl(const Interface& interface, const Coordinator& coordinator) {
+    for (const NamedType* type : interface.getSubTypes()) {
+        emitAidl(*type, coordinator);
+    }
 
-void AidlHelper::emitAidl(
-        const Interface& interface, const Coordinator& coordinator,
-        const std::map<const NamedType*, const ProcessedCompoundType>& processedTypes) {
-    Formatter out = getFileWithHeader(interface, coordinator, processedTypes);
+    Formatter out = getFileWithHeader(interface, coordinator);
 
     interface.emitDocComment(out);
     if (interface.superType() && interface.superType()->fqName() != gIBaseFqName) {
@@ -181,164 +151,132 @@
             << " but AIDL does not support interface inheritance.\n";
     }
 
-    out << "@VintfStability\n";
     out << "interface " << getAidlName(interface.fqName()) << " ";
     out.block([&] {
-        std::map<std::string, NodeWithVersion<NamedType>> latestTypeForBaseName;
-        std::vector<const NodeWithVersion<NamedType>> supersededNamedTypes;
-        std::map<std::string, NodeWithVersion<Method>> latestMethodForBaseName;
-        std::vector<const NodeWithVersion<Method>> supersededMethods;
-        for (const Interface* iface : interface.typeChain()) {
-            if (!AidlHelper::shouldBeExpanded(interface.fqName(), iface->fqName())) {
-                // Stop traversing extended interfaces once they leave this package
-                break;
-            }
-            for (const Method* method : iface->userDefinedMethods()) {
-                pushVersionedNodeOntoMap({iface->fqName().getPackageMajorVersion(),
-                                          iface->fqName().getPackageMinorVersion(), method,
-                                          getBaseName(method->name())},
-                                         &latestMethodForBaseName, &supersededMethods);
-            }
-            // Types from other interfaces will be handled while those interfaces
-            // are being emitted.
-            if (iface->getBaseName() != interface.getBaseName()) {
-                continue;
-            }
-            for (const NamedType* type : iface->getSubTypes()) {
-                // The baseName for types is not being stripped of the version
-                // numbers like that of the methods. If a type was named
-                // BigStruct_1_1 and the previous version was named BigStruct,
-                // they will be treated as two different types.
-                pushVersionedNodeOntoMap({iface->fqName().getPackageMajorVersion(),
-                                          iface->fqName().getPackageMinorVersion(), type,
-                                          getAidlName(type->fqName())},
-                                         &latestTypeForBaseName, &supersededNamedTypes);
+        for (const NamedType* type : interface.getSubTypes()) {
+            emitAidl(*type, coordinator);
+        }
+
+        std::map<std::string, MethodWithVersion> methodMap;
+        std::vector<const MethodWithVersion*> ignoredMethods;
+        std::vector<std::string> methodNames;
+        std::vector<const Interface*> typeChain = interface.typeChain();
+        for (auto iface = typeChain.rbegin(); iface != typeChain.rend(); ++iface) {
+            for (const Method* method : (*iface)->userDefinedMethods()) {
+                pushVersionedMethodOntoMap(
+                        {(*iface)->fqName().getPackageMajorVersion(),
+                         (*iface)->fqName().getPackageMinorVersion(), method, method->name()},
+                        &methodMap, &ignoredMethods);
+                methodNames.push_back(method->name());
             }
         }
 
-        // Add comment for superseded types
-        out.join(supersededNamedTypes.begin(), supersededNamedTypes.end(), "\n",
-                 [&](const NodeWithVersion<NamedType>& versionedType) {
-                     out << "// Ignoring type " << getAidlName(versionedType.node->fqName())
-                         << " from " << versionedType.major << "." << versionedType.minor
+        std::set<std::string> ignoredMethodNames;
+        out.join(ignoredMethods.begin(), ignoredMethods.end(), "\n",
+                 [&](const MethodWithVersion* versionedMethod) {
+                     out << "// Ignoring method " << versionedMethod->method->name() << " from "
+                         << versionedMethod->major << "." << versionedMethod->minor
                          << "::" << getAidlName(interface.fqName())
                          << " since a newer alternative is available.";
+                     ignoredMethodNames.insert(versionedMethod->method->name());
                  });
-        if (!supersededNamedTypes.empty()) out << "\n\n";
+        if (!ignoredMethods.empty()) out << "\n\n";
 
-        // Add comment for superseded methods
-        out.join(supersededMethods.begin(), supersededMethods.end(), "\n",
-                 [&](const NodeWithVersion<Method>& versionedMethod) {
-                     out << "// Ignoring method " << versionedMethod.node->name() << " from "
-                         << versionedMethod.major << "." << versionedMethod.minor
-                         << "::" << getAidlName(interface.fqName())
-                         << " since a newer alternative is available.";
-                 });
-        if (!supersededMethods.empty()) out << "\n\n";
+        out.join(methodNames.begin(), methodNames.end(), "\n", [&](const std::string& name) {
+            const Method* method = methodMap[name].method;
+            if (method == nullptr) {
+                CHECK(ignoredMethodNames.count(name) == 1);
+                return;
+            }
 
-        // Emit latest methods defined for this interface
-        out.join(latestMethodForBaseName.begin(), latestMethodForBaseName.end(), "\n",
-                 [&](const std::pair<std::string, NodeWithVersion<Method>>& methodPair) {
-                     const Method* method = methodPair.second.node;
-                     const std::string& baseName = methodPair.first;
-                     std::vector<NamedReference<Type>*> results;
-                     std::vector<ResultTransformation> transformations;
-                     for (NamedReference<Type>* res : method->results()) {
-                         const std::string aidlType = getAidlType(*res->get(), interface.fqName());
+            std::vector<NamedReference<Type>*> results;
+            std::vector<ResultTransformation> transformations;
+            for (NamedReference<Type>* res : method->results()) {
+                const std::string aidlType = getAidlType(*res->get(), interface.fqName());
 
-                         if (shouldWarnStatusType(aidlType)) {
-                             out << "// FIXME: AIDL has built-in status types. Do we need the "
-                                    "status type here?\n";
-                         }
-                         if (method->results().size() > 1 && shouldWarnOutParam(aidlType)) {
-                             out << "// FIXME: AIDL does not allow " << aidlType
-                                 << " to be an out parameter.\n";
-                             out << "// Move it to return, or add it to a Parcelable.\n";
-                         }
-                         results.push_back(res);
-                     }
+                if (shouldWarnStatusType(aidlType)) {
+                    out << "// FIXME: AIDL has built-in status types. Do we need the status type "
+                           "here?\n";
+                }
+                results.push_back(res);
+            }
 
-                     if (method->name() != baseName) {
-                         out << "// Changing method name from " << method->name() << " to "
-                             << baseName << "\n";
-                     }
+            if (method->name() != name) {
+                out << "// Changing method name from " << method->name() << " to " << name << "\n";
+            }
 
-                     std::string returnType = "void";
-                     if (results.size() == 1) {
-                         returnType = getAidlType(*results[0]->get(), interface.fqName());
+            std::string returnType = "void";
+            if (results.size() == 1) {
+                returnType = getAidlType(*results[0]->get(), interface.fqName());
 
-                         out << "// Adding return type to method instead of out param "
-                             << returnType << " " << results[0]->name()
-                             << " since there is only one return value.\n";
-                         transformations.emplace_back(ResultTransformation{
-                                 results[0]->name(), ResultTransformation::TransformType::MOVED});
-                         results.clear();
-                     }
+                out << "// Adding return type to method instead of out param " << returnType << " "
+                    << results[0]->name() << " since there is only one return value.\n";
+                transformations.emplace_back(ResultTransformation{
+                        results[0]->name(), ResultTransformation::TransformType::MOVED});
+                results.clear();
+            }
 
-                     if (method->getDocComment() != nullptr) {
-                         std::vector<std::string> modifiedDocComment;
-                         for (const std::string& line : method->getDocComment()->lines()) {
-                             std::vector<std::string> tokens = base::Split(line, " ");
-                             if (tokens.size() <= 1 || tokens[0] != "@return") {
-                                 // unimportant line
-                                 modifiedDocComment.emplace_back(line);
-                                 continue;
-                             }
+            if (method->getDocComment() != nullptr) {
+                std::vector<std::string> modifiedDocComment;
+                for (const std::string& line : method->getDocComment()->lines()) {
+                    std::vector<std::string> tokens = base::Split(line, " ");
+                    if (tokens.size() <= 1 || tokens[0] != "@return") {
+                        // unimportant line
+                        modifiedDocComment.emplace_back(line);
+                        continue;
+                    }
 
-                             const std::string& res = tokens[1];
-                             bool transformed = false;
-                             for (const ResultTransformation& transform : transformations) {
-                                 if (transform.resultName != res) continue;
+                    const std::string& res = tokens[1];
+                    bool transformed = false;
+                    for (const ResultTransformation& transform : transformations) {
+                        if (transform.resultName != res) continue;
 
-                                 // Some transform was done to it
-                                 if (transform.type == ResultTransformation::TransformType::MOVED) {
-                                     // remove the name
-                                     tokens.erase(++tokens.begin());
-                                     transformed = true;
-                                 } else {
-                                     CHECK(transform.type ==
-                                           ResultTransformation::TransformType::REMOVED);
-                                     tokens.insert(tokens.begin(),
-                                                   "FIXME: The following return was removed\n");
-                                     transformed = true;
-                                 }
-                             }
+                        // Some transform was done to it
+                        if (transform.type == ResultTransformation::TransformType::MOVED) {
+                            // remove the name
+                            tokens.erase(++tokens.begin());
+                            transformed = true;
+                        } else {
+                            CHECK(transform.type == ResultTransformation::TransformType::REMOVED);
+                            tokens.insert(tokens.begin(),
+                                          "FIXME: The following return was removed\n");
+                            transformed = true;
+                        }
+                    }
 
-                             if (!transformed) {
-                                 tokens.erase(tokens.begin());
-                                 tokens.insert(tokens.begin(), "@param out");
-                             }
+                    if (!transformed) {
+                        tokens.erase(tokens.begin());
+                        tokens.insert(tokens.begin(), "@param out");
+                    }
 
-                             modifiedDocComment.emplace_back(base::Join(tokens, " "));
-                         }
+                    modifiedDocComment.emplace_back(base::Join(tokens, " "));
+                }
 
-                         DocComment(modifiedDocComment, HIDL_LOCATION_HERE).emit(out);
-                     }
+                DocComment(modifiedDocComment, HIDL_LOCATION_HERE).emit(out);
+            }
 
-                     WrappedOutput wrappedOutput(MAX_LINE_LENGTH);
+            WrappedOutput wrappedOutput(MAX_LINE_LENGTH);
 
-                     if (method->isOneway()) wrappedOutput << "oneway ";
-                     wrappedOutput << returnType << " " << baseName << "(";
+            if (method->isOneway()) wrappedOutput << "oneway ";
+            wrappedOutput << returnType << " " << name << "(";
 
-                     if (results.empty()) {
-                         emitAidlMethodParams(&wrappedOutput, method->args(), /* prefix */ "in ",
-                                              /* attachToLast */ ");\n", interface);
-                     } else {
-                         const bool emitArgs = !method->args().empty();
-                         if (emitArgs) {
-                             emitAidlMethodParams(&wrappedOutput, method->args(),
-                                                  /* prefix */ "in ",
-                                                  /* attachToLast */ ",", interface);
-                         }
-                         wrappedOutput.group([&] {
-                             if (emitArgs) wrappedOutput.printUnlessWrapped(" ");
-                             emitAidlMethodParams(&wrappedOutput, results, /* prefix */ "out ",
-                                                  /* attachToLast */ ");\n", interface);
-                         });
-                     }
+            if (results.empty()) {
+                emitAidlMethodParams(&wrappedOutput, method->args(), /* prefix */ "in ",
+                                     /* attachToLast */ ");\n", interface);
+            } else {
+                if (!method->args().empty()) {
+                    emitAidlMethodParams(&wrappedOutput, method->args(), /* prefix */ "in ",
+                                         /* attachToLast */ ",", interface);
+                    wrappedOutput.printUnlessWrapped(" ");
+                }
 
-                     out << wrappedOutput;
-                 });
+                // TODO: Emit warning if a primitive is given as a out param.
+                emitAidlMethodParams(&wrappedOutput, results, /* prefix */ "out ",
+                                     /* attachToLast */ ");\n", interface);
+            }
+
+            out << wrappedOutput;
+        });
     });
 }
 
diff --git a/hidl2aidl/AidlNamedType.cpp b/hidl2aidl/AidlNamedType.cpp
index a1382d9..8c98287 100644
--- a/hidl2aidl/AidlNamedType.cpp
+++ b/hidl2aidl/AidlNamedType.cpp
@@ -18,7 +18,6 @@
 #include "CompoundType.h"
 #include "Coordinator.h"
 #include "EnumType.h"
-#include "Interface.h"
 #include "NamedType.h"
 #include "TypeDef.h"
 
@@ -43,84 +42,56 @@
     CHECK(scalar != nullptr) << enumType.typeName();
 
     enumType.emitDocComment(out);
-    out << "@VintfStability\n";
     out << "@Backing(type=\"" << AidlHelper::getAidlType(*scalar, enumType.fqName()) << "\")\n";
-    out << "enum " << AidlHelper::getAidlType(enumType, enumType.fqName()) << " ";
-
-    std::vector<const EnumValue*> values;
-    const EnumType* skippedType = nullptr;
-    for (const EnumType* type : enumType.typeChain()) {
-        if (!AidlHelper::shouldBeExpanded(enumType.fqName(), type->fqName())) {
-            skippedType = type;
-            break;
-        }
-        values.insert(values.end(), type->values().rbegin(), type->values().rend());
-    }
+    out << "enum " << enumType.fqName().name() << " ";
     out.block([&] {
-        if (skippedType != nullptr) {
-            out << "// Not expanding values from " << skippedType->fqName().string()
-                << ". See \'-e\' argument.\n";
-        }
-        for (auto it = values.rbegin(); it != values.rend(); ++it) {
-            (*it)->emitDocComment(out);
-            out << (*it)->name();
-            if (!(*it)->isAutoFill()) {
-                out << " = " << (*it)->constExpr()->expression();
+        enumType.forEachValueFromRoot([&](const EnumValue* value) {
+            value->emitDocComment(out);
+            out << value->name();
+            if (!value->isAutoFill()) {
+                out << " = " << value->constExpr()->expression();
             }
             out << ",\n";
-        };
+        });
     });
 }
 
-static void emitCompoundTypeAidlDefinition(
-        Formatter& out, const CompoundType& compoundType,
-        const std::map<const NamedType*, const ProcessedCompoundType>& processedTypes) {
-    // Get all of the subtypes and fields from this type and any older versions
-    // that it references.
-    const auto& it = processedTypes.find(&compoundType);
-    CHECK(it != processedTypes.end()) << "Failed to find " << compoundType.fullName();
-    const ProcessedCompoundType& processedType = it->second;
+static void emitCompoundTypeAidlDefinition(Formatter& out, const CompoundType& compoundType,
+                                           const Coordinator& coordinator) {
+    for (const NamedType* namedType : compoundType.getSubTypes()) {
+        AidlHelper::emitAidl(*namedType, coordinator);
+    }
 
     compoundType.emitDocComment(out);
-    out << "@VintfStability\n";
+    out << "parcelable " << AidlHelper::getAidlName(compoundType.fqName()) << " ";
     if (compoundType.style() == CompoundType::STYLE_STRUCT) {
-        out << "parcelable " << AidlHelper::getAidlName(compoundType.fqName()) << " ";
+        out.block([&] {
+            for (const NamedReference<Type>* field : compoundType.getFields()) {
+                field->emitDocComment(out);
+                out << AidlHelper::getAidlType(*field->get(), compoundType.fqName()) << " "
+                    << field->name() << ";\n";
+            }
+        });
     } else {
-        if (compoundType.style() == CompoundType::STYLE_UNION) {
-            out << "// FIXME Any discriminators should be removed since they are automatically "
-                   "added.\n";
-        }
-        out << "union " << AidlHelper::getAidlName(compoundType.fqName()) << " ";
+        out << "{}\n";
+        out << "// Cannot convert unions/safe_unions since AIDL does not support them.\n";
+        emitConversionNotes(out, compoundType);
     }
-    out.block([&] {
-        // Emit all of the fields from the processed type
-        for (auto const& fieldWithVersion : processedType.fields) {
-            fieldWithVersion.field->emitDocComment(out);
-            std::string aidlType =
-                    AidlHelper::getAidlType(*fieldWithVersion.field->get(), compoundType.fqName());
-            out << aidlType << " " << fieldWithVersion.field->name() << ";\n";
-        }
-    });
     out << "\n\n";
 }
 
 // TODO: Enum/Typedef should just emit to hidl-error.log or similar
-void AidlHelper::emitAidl(
-        const NamedType& namedType, const Coordinator& coordinator,
-        const std::map<const NamedType*, const ProcessedCompoundType>& processedTypes) {
-    Formatter out = getFileWithHeader(namedType, coordinator, processedTypes);
+void AidlHelper::emitAidl(const NamedType& namedType, const Coordinator& coordinator) {
+    Formatter out = getFileWithHeader(namedType, coordinator);
     if (namedType.isTypeDef()) {
         const TypeDef& typeDef = static_cast<const TypeDef&>(namedType);
         emitTypeDefAidlDefinition(out, typeDef);
     } else if (namedType.isCompoundType()) {
         const CompoundType& compoundType = static_cast<const CompoundType&>(namedType);
-        emitCompoundTypeAidlDefinition(out, compoundType, processedTypes);
+        emitCompoundTypeAidlDefinition(out, compoundType, coordinator);
     } else if (namedType.isEnum()) {
         const EnumType& enumType = static_cast<const EnumType&>(namedType);
         emitEnumAidlDefinition(out, enumType);
-    } else if (namedType.isInterface()) {
-        const Interface& iface = static_cast<const Interface&>(namedType);
-        emitAidl(iface, coordinator, processedTypes);
     } else {
         out << "// TODO: Fix this " << namedType.definedName() << "\n";
     }
diff --git a/hidl2aidl/test/1.2/IFoo.hal b/hidl2aidl/AidlScope.cpp
similarity index 64%
rename from hidl2aidl/test/1.2/IFoo.hal
rename to hidl2aidl/AidlScope.cpp
index 344f2e7..bd74c30 100644
--- a/hidl2aidl/test/1.2/IFoo.hal
+++ b/hidl2aidl/AidlScope.cpp
@@ -14,13 +14,17 @@
  * limitations under the License.
  */
 
-package hidl2aidl.test@1.2;
+#include "AidlHelper.h"
+#include "Coordinator.h"
+#include "NamedType.h"
+#include "Scope.h"
 
-import @1.1::IFoo;
+namespace android {
 
-interface IFoo extends @1.1::IFoo {
-    /*
-     * Should take precedence over @1.1::someBar
-     */
-    someBar_1_2(string a, string b);
-};
+void AidlHelper::emitAidl(const Scope& scope, const Coordinator& coordinator) {
+    for (const NamedType* type : scope.getSubTypes()) {
+        AidlHelper::emitAidl(*type, coordinator);
+    }
+}
+
+}  // namespace android
diff --git a/hidl2aidl/AidlTranslate.cpp b/hidl2aidl/AidlTranslate.cpp
deleted file mode 100644
index aa47664..0000000
--- a/hidl2aidl/AidlTranslate.cpp
+++ /dev/null
@@ -1,545 +0,0 @@
-/*
- * Copyright (C) 2020 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include <android-base/logging.h>
-#include <android-base/strings.h>
-#include <hidl-util/FQName.h>
-#include <hidl-util/Formatter.h>
-#include <hidl-util/StringHelper.h>
-#include <limits>
-#include <set>
-#include <string>
-#include <vector>
-
-#include "AidlHelper.h"
-#include "ArrayType.h"
-#include "CompoundType.h"
-#include "ConstantExpression.h"
-#include "Coordinator.h"
-#include "EnumType.h"
-#include "Interface.h"
-#include "NamedType.h"
-#include "ScalarType.h"
-#include "Scope.h"
-#include "VectorType.h"
-
-namespace android {
-
-std::string AidlHelper::translateHeaderFile(const FQName& fqName, AidlBackend backend) {
-    switch (backend) {
-        case AidlBackend::NDK:
-            return AidlHelper::getAidlPackagePath(fqName) + "/translate-ndk.h";
-        case AidlBackend::CPP:
-            return AidlHelper::getAidlPackagePath(fqName) + "/translate-cpp.h";
-        default:
-            LOG(FATAL) << "Unexpected AidlBackend value";
-            return "";
-    }
-}
-
-std::string AidlHelper::translateSourceFile(const FQName& fqName, AidlBackend backend) {
-    switch (backend) {
-        case AidlBackend::NDK:
-            return AidlHelper::getAidlPackagePath(fqName) + "/translate-ndk.cpp";
-        case AidlBackend::CPP:
-            return AidlHelper::getAidlPackagePath(fqName) + "/translate-cpp.cpp";
-        case AidlBackend::JAVA:
-            return AidlHelper::getAidlPackagePath(fqName) + "/Translate.java";
-        default:
-            LOG(FATAL) << "Unexpected AidlBackend value";
-            return "";
-    }
-}
-
-static const std::string aidlTypePackage(const NamedType& type, AidlBackend backend) {
-    const std::string prefix = (backend == AidlBackend::NDK) ? "aidl::" : std::string();
-    const std::string separator = (backend == AidlBackend::JAVA) ? "." : "::";
-    return prefix +
-           base::Join(base::Split(AidlHelper::getAidlPackage(type.fqName()), "."), separator) +
-           separator + AidlHelper::getAidlType(type, type.fqName());
-}
-
-static void emitEnumStaticAssert(Formatter& out, const NamedType& namedType, AidlBackend backend) {
-    CHECK(namedType.isEnum());
-    const auto& enumType = static_cast<const EnumType&>(namedType);
-
-    std::vector<const EnumValue*> values;
-    for (const EnumType* type : enumType.typeChain()) {
-        if (!AidlHelper::shouldBeExpanded(enumType.fqName(), type->fqName())) {
-            break;
-        }
-        values.insert(values.end(), type->values().rbegin(), type->values().rend());
-    }
-
-    for (auto it = values.rbegin(); it != values.rend(); ++it) {
-        out << "static_assert(" << aidlTypePackage(namedType, backend) << "::" << (*it)->name()
-            << " == static_cast<" << aidlTypePackage(namedType, backend) << ">("
-            << namedType.fullName() << "::" << (*it)->name() << "));\n";
-    };
-
-    out << "\n";
-}
-
-static void emitStaticAsserts(Formatter& out, const std::set<const NamedType*>& namedTypes,
-                              AidlBackend backend) {
-    CHECK(backend != AidlBackend::JAVA);
-    for (const auto& namedType : namedTypes) {
-        if (namedType->isEnum()) {
-            emitEnumStaticAssert(out, *namedType, backend);
-        }
-    }
-}
-
-static void namedTypeTranslation(Formatter& out, const std::set<const NamedType*>& namedTypes,
-                                 const FieldWithVersion& field, const CompoundType* parent,
-                                 AidlBackend backend) {
-    const NamedType* type = static_cast<const NamedType*>(field.field->get());
-    if (namedTypes.find(type) == namedTypes.end()) {
-        std::optional<const ReplacedTypeInfo> replacedType =
-                AidlHelper::getAidlReplacedType(type->fqName());
-        if (replacedType) {
-            std::optional<std::function<void(Formatter&)>> translateField =
-                    replacedType.value().translateField;
-            if (translateField) {
-                translateField.value()(out);
-            }
-        } else {
-            AidlHelper::notes() << "An unknown named type was found in translation: "
-                                << type->fqName().string() + "\n";
-            out << "// FIXME Unknown type: " << type->fqName().string() << "\n";
-            out << "// That type's package needs to be converted separately and the corresponding "
-                   "translate function should be added here.\n";
-        }
-    } else {
-        if (parent->style() == CompoundType::STYLE_STRUCT) {
-            if (backend == AidlBackend::JAVA) {
-                out << "out." << field.field->name() << " = h2aTranslate(in." << field.fullName
-                    << ");\n";
-            } else {
-                out << "if (!translate(in." << field.fullName << ", &out->" << field.field->name()
-                    << ")) return false;\n";
-            }
-        } else {
-            if (backend == AidlBackend::JAVA) {
-                out << "out.set" << StringHelper::Capitalize(field.field->name())
-                    << "(h2aTranslate(in." << field.fullName << "()));\n";
-            } else {
-                out << "{\n";
-                out << aidlTypePackage(*type, backend) << " " << field.field->name() << ";\n";
-                out << "if (!translate(in." << field.fullName + "(), &" << field.field->name()
-                    << ")) return false;\n";
-                out << "out->set<" << aidlTypePackage(*parent, backend) << "::" << field.fullName
-                    << ">(" << field.field->name() << ");\n";
-                out << "}\n";
-            }
-        }
-    }
-}
-
-static void h2aScalarChecks(Formatter& out, const Type& type, const std::string& inputAccess,
-                            AidlBackend backend) {
-    static const std::map<ScalarType::Kind, std::pair<std::string, size_t>> kSignedMaxSize{
-            {ScalarType::KIND_UINT8,
-             {"std::numeric_limits<int8_t>::max()", std::numeric_limits<int8_t>::max()}},
-            {ScalarType::KIND_UINT16, {"", 0}},
-            {ScalarType::KIND_INT16, {"", 0}},
-            {ScalarType::KIND_UINT32,
-             {"std::numeric_limits<int32_t>::max()", std::numeric_limits<int32_t>::max()}},
-            {ScalarType::KIND_UINT64,
-             {"std::numeric_limits<int64_t>::max()", std::numeric_limits<int64_t>::max()}}};
-    const ScalarType* scalarType = type.resolveToScalarType();
-    if (scalarType != nullptr && !type.isEnum()) {
-        const auto& it = kSignedMaxSize.find(scalarType->getKind());
-        // *int16_t is a special case for both HIDL and AIDL. For uint16_t, checks are only
-        // needed in the Java backend.
-        if (backend != AidlBackend::JAVA && scalarType->getKind() == ScalarType::KIND_UINT16) {
-            return;
-        }
-        if (it != kSignedMaxSize.end()) {
-            out << "// FIXME This requires conversion between signed and unsigned. Change this if "
-                   "it doesn't suit your needs.\n";
-            if (scalarType->getKind() == ScalarType::KIND_UINT16 ||
-                scalarType->getKind() == ScalarType::KIND_INT16) {
-                // HIDL uses a signed 16-bit char in Java for uint16_t and int16_t
-                // AIDL uses an unsigned 16-bit char/char16_t, so this is signed to unsigned.
-                out << "if (" << inputAccess << " < 0) {\n";
-            } else {
-                std::string affix = (scalarType->getKind() == ScalarType::KIND_UINT64) ? "L" : "";
-                std::string limit = (backend == AidlBackend::JAVA)
-                                            ? std::to_string(it->second.second) + affix
-                                            : it->second.first;
-                out << "if (" << inputAccess << " > " << limit << " || " << inputAccess
-                    << " < 0) {\n";
-            }
-            if (backend == AidlBackend::JAVA) {
-                out.indent([&] {
-                    out << "throw new RuntimeException(\"Unsafe conversion between signed and "
-                           "unsigned scalars for field: "
-                        << inputAccess << "\");\n";
-                });
-            } else {
-                out.indent([&] { out << "return false;\n"; });
-            }
-            out << "}\n";
-        }
-    }
-}
-
-static std::string wrapToString16(const std::string& payload, AidlBackend backend) {
-    if (backend == AidlBackend::CPP) {
-        return "String16(" + payload + ".c_str())";
-    } else {
-        return payload;
-    }
-}
-
-static std::string wrapStaticCast(const std::string& payload, const Type& type,
-                                  const FQName& fqName, AidlBackend backend) {
-    static const std::map<std::string, std::string> kAidlBackendScalarTypes{
-            {"boolean", "bool"}, {"byte", "int8_t"}, {"char", "char16_t"}, {"int", "int32_t"},
-            {"long", "int64_t"}, {"float", "float"}, {"double", "double"}};
-    if (type.isEnum()) {
-        return "static_cast<" +
-               aidlTypePackage(static_cast<const android::NamedType&>(type), backend) + ">(" +
-               payload + ")";
-    }
-    const auto& it = kAidlBackendScalarTypes.find(AidlHelper::getAidlType(type, fqName));
-    if (it != kAidlBackendScalarTypes.end()) {
-        return "static_cast<" + it->second + ">(" + payload + ")";
-    } else {
-        return payload;
-    }
-}
-
-static std::string wrapCppSource(const std::string& payload, const Type& type, const FQName& fqName,
-                                 AidlBackend backend) {
-    if (type.isString()) {
-        return wrapToString16(payload, backend);
-    } else if (type.isBitField()) {
-        return wrapStaticCast(payload, *static_cast<const BitFieldType&>(type).getElementEnumType(),
-                              fqName, backend);
-    } else {
-        return wrapStaticCast(payload, type, fqName, backend);
-    }
-}
-
-static void containerTranslation(Formatter& out, const FieldWithVersion& field,
-                                 const CompoundType* parent, AidlBackend backend) {
-    const Type* elementType;
-    std::string javaSizeAccess;
-    std::string javaElementAccess;
-    std::string cppSize;
-    if (field.field->type().isArray()) {
-        elementType = static_cast<const ArrayType*>(field.field->get())->getElementType();
-        javaSizeAccess = ".length";
-        javaElementAccess = "[i]";
-        cppSize = "sizeof(in." + field.fullName + ")/sizeof(in." + field.fullName + "[0])";
-    } else if (field.field->type().isVector()) {
-        elementType = static_cast<const VectorType*>(field.field->get())->getElementType();
-        javaSizeAccess = ".size()";
-        javaElementAccess = ".get(i)";
-        cppSize = "in." + field.fullName + ".size()";
-    } else {
-        LOG(FATAL) << "Unexpected container type for field: " << field.field->name();
-        return;
-    }
-    if (elementType->isArray() || elementType->isVector()) {
-        out << "#error Nested arrays and vectors are currently not supported. Needs implementation "
-               "for field: "
-            << field.field->name() << "\n";
-        return;
-    }
-    if (elementType->isNamedType() && !elementType->isEnum()) {
-        out << "#error Arrays of NamedTypes are not currently not supported. Needs implementation "
-               "for field: "
-            << field.field->name() << "\n";
-        return;
-    }
-    if (backend == AidlBackend::JAVA) {
-        const std::string inputAccess = "in." + field.fullName;
-        out << "if (" << inputAccess << " != null) {\n";
-        out.indent([&] {
-            out << "out." << field.field->name() << " = new " << elementType->getJavaType(true)
-                << "[" << inputAccess << javaSizeAccess << "];\n";
-            out << "for (int i = 0; i < " << inputAccess << javaSizeAccess << "; i++) {\n";
-            out.indent([&] {
-                h2aScalarChecks(out, *elementType, inputAccess + javaElementAccess, backend);
-                out << "out." << field.field->name() << "[i] = " << inputAccess << javaElementAccess
-                    << ";\n";
-            });
-            out << "}\n";
-        });
-        out << "}\n";
-    } else {
-        const std::string inputAccessElement = "in." + field.fullName + "[i]";
-        out << "{\n";
-        out.indent([&] {
-            out << "size_t size = " << cppSize << ";\n";
-            out << "for (size_t i = 0; i < size; i++) {\n";
-            out.indent([&] {
-                h2aScalarChecks(out, *elementType, inputAccessElement, backend);
-                out << "out->" << field.field->name() << ".push_back("
-                    << wrapCppSource(inputAccessElement, *elementType, parent->fqName(), backend)
-                    << ");\n";
-            });
-            out << "}\n";
-        });
-        out << "}\n";
-    }
-}
-
-static void simpleTranslation(Formatter& out, const FieldWithVersion& field,
-                              const CompoundType* parent, AidlBackend backend) {
-    std::string inputAccess = "in." + field.fullName;
-    if (backend == AidlBackend::JAVA) {
-        // HIDL uses short(signed) in the Java backend for uint16_t and int16_t
-        // AIDL uses char which is unsigned. This assignment needs a cast.
-        std::string cast;
-        if (AidlHelper::getAidlType(field.field->type(), parent->fqName()) == "char") {
-            cast = "(char) ";
-        }
-        if (parent->style() == CompoundType::STYLE_STRUCT) {
-            h2aScalarChecks(out, field.field->type(), inputAccess, backend);
-            out << "out." << field.field->name() << " = " << cast << inputAccess << ";\n";
-        } else {
-            inputAccess += "()";
-            h2aScalarChecks(out, field.field->type(), inputAccess, backend);
-            out << "out.set" << StringHelper::Capitalize(field.fullName) << "(" << cast
-                << inputAccess << ");\n";
-        }
-    } else {
-        if (parent->style() == CompoundType::STYLE_STRUCT) {
-            h2aScalarChecks(out, field.field->type(), inputAccess, backend);
-            out << "out->" << field.field->name() << " = "
-                << wrapCppSource("in." + field.fullName, field.field->type(), parent->fqName(),
-                                 backend)
-                << ";\n";
-        } else {
-            inputAccess += "()";
-            h2aScalarChecks(out, field.field->type(), inputAccess, backend);
-            out << "*out = "
-                << wrapCppSource(inputAccess, field.field->type(), parent->fqName(), backend)
-                << ";\n";
-        }
-    }
-}
-
-static void h2aFieldTranslation(Formatter& out, const std::set<const NamedType*>& namedTypes,
-                                const CompoundType* parent, const FieldWithVersion& field,
-                                AidlBackend backend) {
-    if (field.field->type().isNamedType() && !field.field->type().isEnum()) {
-        namedTypeTranslation(out, namedTypes, field, parent, backend);
-    } else if (field.field->type().isArray() || field.field->type().isVector()) {
-        containerTranslation(out, field, parent, backend);
-    } else if (field.field->type().isEnum() || field.field->type().isScalar() ||
-               field.field->type().isString() || field.field->type().isBitField()) {
-        simpleTranslation(out, field, parent, backend);
-    } else {
-        AidlHelper::notes() << "An unhandled type was found in translation: "
-                            << field.field->type().typeName() << "\n";
-        out << "#error FIXME Unhandled type: " << field.field->type().typeName() << "\n";
-    }
-}
-
-static const std::string declareAidlFunctionSignature(const NamedType* type, AidlBackend backend) {
-    if (backend == AidlBackend::JAVA) {
-        return "static public " + aidlTypePackage(*type, backend) + " h2aTranslate(" +
-               type->fullJavaName() + " in)";
-    } else {
-        return "__attribute__((warn_unused_result)) bool translate(const " + type->fullName() +
-               "& in, " + aidlTypePackage(*type, backend) + "* out)";
-    }
-}
-
-static const std::string getHidlPackagePath(const NamedType* type) {
-    return base::Join(base::Split(type->fqName().package(), "."), "/");
-}
-
-static std::optional<const Interface*> getParentInterface(const NamedType* type) {
-    const Scope* parent = type->parent();
-    while (parent != nullptr) {
-        if (parent->definesInterfaces()) {
-            return parent->getInterface();
-        }
-        parent = parent->parent();
-    }
-    return std::nullopt;
-}
-
-static const std::string hidlIncludeFile(const NamedType* type) {
-    std::optional<const Interface*> parent = getParentInterface(type);
-    if (parent) {
-        return "#include \"" + getHidlPackagePath(type) + "/" + type->fqName().version() + "/" +
-               parent.value()->fqName().getInterfaceName() + ".h\"\n";
-    } else {
-        return "#include \"" + getHidlPackagePath(type) + "/" + type->fqName().version() +
-               "/types.h\"\n";
-    }
-}
-
-static const std::string aidlIncludeFile(const NamedType* type, AidlBackend backend) {
-    const std::string prefix = (backend == AidlBackend::NDK) ? "aidl/" : std::string();
-    return "#include \"" + prefix + AidlHelper::getAidlPackagePath(type->fqName()) + "/" +
-           AidlHelper::getAidlType(*type, type->fqName()) + ".h\"\n";
-}
-
-static void emitCppTranslateHeader(
-        const Coordinator& coordinator, const FQName& fqName,
-        const std::set<const NamedType*>& namedTypes,
-        const std::map<const NamedType*, const ProcessedCompoundType>& processedTypes,
-        AidlBackend backend) {
-    CHECK(backend == AidlBackend::CPP || backend == AidlBackend::NDK);
-    Formatter out =
-            coordinator.getFormatter(fqName, Coordinator::Location::DIRECT,
-                                     "include/" + AidlHelper::translateHeaderFile(fqName, backend));
-
-    AidlHelper::emitFileHeader(out);
-    out << "// FIXME Remove this file if you don't need to translate types in this backend.\n\n";
-    out << "#pragma once\n\n";
-
-    std::set<std::string> includes = {"#include <limits>"};
-    for (const auto& type : namedTypes) {
-        const auto& it = processedTypes.find(type);
-        if (it == processedTypes.end() && !type->isEnum()) {
-            continue;
-        }
-        includes.insert(aidlIncludeFile(type, backend));
-        includes.insert(hidlIncludeFile(type));
-    }
-    out << base::Join(includes, "") << "\n\n";
-
-    out << "namespace android::h2a {\n\n";
-    for (const auto& type : namedTypes) {
-        const auto& it = processedTypes.find(type);
-        if (it == processedTypes.end()) {
-            continue;
-        }
-        out << declareAidlFunctionSignature(type, backend) << ";\n";
-    }
-    out << "\n}  // namespace android::h2a\n";
-}
-
-static void emitTranslateSource(
-        const Coordinator& coordinator, const FQName& fqName,
-        const std::set<const NamedType*>& namedTypes,
-        const std::map<const NamedType*, const ProcessedCompoundType>& processedTypes,
-        AidlBackend backend) {
-    Formatter out = coordinator.getFormatter(fqName, Coordinator::Location::DIRECT,
-                                             AidlHelper::translateSourceFile(fqName, backend));
-    AidlHelper::emitFileHeader(out);
-    out << "// FIXME Remove this file if you don't need to translate types in this backend.\n\n";
-    if (backend == AidlBackend::JAVA) {
-        out << "package " << AidlHelper::getAidlPackage(fqName) + ";\n\n";
-        out << "public class Translate {\n";
-    } else {
-        out << "#include \""
-            << AidlHelper::translateHeaderFile((*namedTypes.begin())->fqName(), backend) + "\"\n\n";
-        out << "namespace android::h2a {\n\n";
-        emitStaticAsserts(out, namedTypes, backend);
-    }
-    for (const auto& type : namedTypes) {
-        const auto& it = processedTypes.find(type);
-        if (it == processedTypes.end()) {
-            continue;
-        }
-        CHECK(type->isCompoundType()) << "Unexpected type: " << type->fqName().string();
-        const CompoundType* compound = static_cast<const CompoundType*>(type);
-
-        if (compound->style() == CompoundType::STYLE_UNION) {
-            // HIDL Java backend doesn't support union so don't add a comment.
-            if (backend != AidlBackend::JAVA) {
-                out << "// FIXME not enough information to safely convert. Remove this function or "
-                       "fill it out using the custom discriminators.\n";
-                out << "// " << declareAidlFunctionSignature(type, backend) << "\n\n";
-            }
-            continue;
-        }
-
-        out << declareAidlFunctionSignature(type, backend) << " {\n";
-        if (compound->style() == CompoundType::STYLE_SAFE_UNION) {
-            out.indent([&] {
-                if (backend == AidlBackend::JAVA) {
-                    out << aidlTypePackage(*type, backend) << " out = new "
-                        << aidlTypePackage(*type, backend) << "();\n";
-                }
-                out << "switch (in.getDiscriminator()) {\n";
-                out.indent([&] {
-                    const ProcessedCompoundType& processedType = it->second;
-                    for (const auto& field : processedType.fields) {
-                        if (backend == AidlBackend::JAVA) {
-                            out << "case " << compound->fullJavaName() << ".hidl_discriminator."
-                                << field.field->name() << ":\n";
-                        } else {
-                            out << "case " << compound->fullName()
-                                << "::hidl_discriminator::" << field.field->name() << ":\n";
-                        }
-                        out.indent([&] {
-                            h2aFieldTranslation(out, namedTypes, compound, field, backend);
-                            out << "break;\n";
-                        });
-                    }
-                    out << "default:\n";
-                    if (backend == AidlBackend::JAVA) {
-                        out.indent([&] {
-                            out << "throw new RuntimeException(\"Unknown discriminator value: \" + "
-                                   "Integer.toString(in.getDiscriminator()));\n";
-                        });
-                    } else {
-                        out.indent([&] { out << "return false;\n"; });
-                    }
-                });
-                out << "}\n";
-            });
-        } else {
-            out.indent([&] {
-                if (backend == AidlBackend::JAVA) {
-                    out << aidlTypePackage(*type, backend) << " out = new "
-                        << aidlTypePackage(*type, backend) << "();\n";
-                }
-                const ProcessedCompoundType& processedType = it->second;
-                for (const auto& field : processedType.fields) {
-                    h2aFieldTranslation(out, namedTypes, compound, field, backend);
-                }
-            });
-        }
-        if (backend == AidlBackend::JAVA) {
-            out.indent([&] { out << "return out;\n"; });
-        } else {
-            out.indent([&] { out << "return true;\n"; });
-        }
-        out << "}\n\n";
-    }
-    if (backend == AidlBackend::JAVA) {
-        out << "}";
-    } else {
-        out << "}  // namespace android::h2a";
-    }
-}
-
-void AidlHelper::emitTranslation(
-        const Coordinator& coordinator, const FQName& fqName,
-        const std::set<const NamedType*>& namedTypes,
-        const std::map<const NamedType*, const ProcessedCompoundType>& processedTypes) {
-    if (processedTypes.empty()) return;
-    for (auto backend : {AidlBackend::NDK, AidlBackend::CPP, AidlBackend::JAVA}) {
-        if (backend != AidlBackend::JAVA) {
-            emitCppTranslateHeader(coordinator, fqName, namedTypes, processedTypes, backend);
-        }
-        emitTranslateSource(coordinator, fqName, namedTypes, processedTypes, backend);
-    }
-}
-
-}  // namespace android
diff --git a/hidl2aidl/AidlType.cpp b/hidl2aidl/AidlType.cpp
index 471044e..d293de1 100644
--- a/hidl2aidl/AidlType.cpp
+++ b/hidl2aidl/AidlType.cpp
@@ -18,8 +18,6 @@
 #include <string>
 
 #include "AidlHelper.h"
-#include "ArrayType.h"
-#include "EnumType.h"
 #include "FmqType.h"
 #include "NamedType.h"
 #include "Type.h"
@@ -31,46 +29,19 @@
     return "IBinder /* FIXME: " + type + " */";
 }
 
-static const std::map<std::string, ReplacedTypeInfo> kReplacedTypes{
-        {"android.hidl.safe_union@1.0::Monostate",
-         ReplacedTypeInfo{
-                 "boolean", std::nullopt,
-                 [](Formatter& out) { out << "// Nothing to translate for Monostate.\n"; }}},
-};
-
-std::optional<const ReplacedTypeInfo> AidlHelper::getAidlReplacedType(const FQName& fqName) {
-    const auto& it = kReplacedTypes.find(fqName.string());
-    if (it != kReplacedTypes.end()) {
-        return it->second;
-    }
-    return std::nullopt;
-}
-
 std::string AidlHelper::getAidlType(const Type& type, const FQName& relativeTo) {
     if (type.isVector()) {
         const VectorType& vec = static_cast<const VectorType&>(type);
-        return getAidlType(*vec.getElementType(), relativeTo) + "[]";
-    } else if (type.isArray()) {
-        const ArrayType& arr = static_cast<const ArrayType&>(type);
-        return getAidlType(*arr.getElementType(), relativeTo) + "[]";
+        const Type* elementType = vec.getElementType();
+
+        // Aidl doesn't support List<*> for C++ and NDK backends
+        return getAidlType(*elementType, relativeTo) + "[]";
     } else if (type.isNamedType()) {
         const NamedType& namedType = static_cast<const NamedType&>(type);
         if (getAidlPackage(relativeTo) == getAidlPackage(namedType.fqName())) {
             return getAidlName(namedType.fqName());
         } else {
-            std::optional<const ReplacedTypeInfo> type = getAidlReplacedType(namedType.fqName());
-            if (type) {
-                notes() << "Replacing type " << namedType.fqName().string() << " with "
-                        << type.value().aidlReplacedType << ".\n";
-                return type.value().aidlReplacedType;
-            }
-            std::optional<std::string> name = getAidlFQName(namedType.fqName()).value();
-            if (name) {
-                return name.value();
-            } else {
-                LOG(FATAL) << "Failed to resolve Aidl FQName: " << namedType.fqName().string();
-                return "";
-            }
+            return getAidlFQName(namedType.fqName());
         }
     } else if (type.isMemory()) {
         return getPlaceholderType("memory");
@@ -84,13 +55,6 @@
         // enum type goes to the primitive java type in HIDL, but AIDL should use
         // the enum type name itself
         return type.definedName();
-    } else if (type.isBitField()) {
-        const BitFieldType& bitfield = static_cast<const BitFieldType&>(type);
-        return getAidlType(*bitfield.getElementType(), relativeTo);
-    } else if (type.getJavaType() == "short") {
-        notes() << relativeTo.name()
-                << ": Consider replacing char with int if signed integer is desired\n";
-        return "char";
     } else {
         return type.getJavaType();
     }
diff --git a/hidl2aidl/Android.bp b/hidl2aidl/Android.bp
index 69cef49..816d31e 100644
--- a/hidl2aidl/Android.bp
+++ b/hidl2aidl/Android.bp
@@ -14,15 +14,6 @@
  * limitations under the License.
  */
 
-package {
-    // See: http://go/android-license-faq
-    // A large-scale-change added 'default_applicable_licenses' to import
-    // all of the 'license_kinds' from "system_tools_hidl_license"
-    // to get the below license kinds:
-    //   SPDX-license-identifier-Apache-2.0
-    default_applicable_licenses: ["system_tools_hidl_license"],
-}
-
 cc_binary_host {
     name: "hidl2aidl",
     defaults: ["hidl-gen-defaults"],
@@ -30,8 +21,8 @@
         "AidlHelper.cpp",
         "AidlInterface.cpp",
         "AidlNamedType.cpp",
+        "AidlScope.cpp",
         "AidlType.cpp",
-        "AidlTranslate.cpp",
         "main.cpp",
     ],
     static_libs: [
diff --git a/hidl2aidl/main.cpp b/hidl2aidl/main.cpp
index 9a3b50e..e440af6 100644
--- a/hidl2aidl/main.cpp
+++ b/hidl2aidl/main.cpp
@@ -25,19 +25,17 @@
 
 #include "AST.h"
 #include "AidlHelper.h"
-#include "CompoundType.h"
 #include "Coordinator.h"
 #include "DocComment.h"
-#include "Interface.h"
 
 using namespace android;
 
 static void usage(const char* me) {
     Formatter out(stderr);
 
-    out << "Usage: " << me << " [-fh] [-o <output path>] [-l <header file>] ";
+    out << "Usage: " << me << " [-o <output path>] ";
     Coordinator::emitOptionsUsageString(out);
-    out << " FQNAME\n\n";
+    out << " FQNAME...\n\n";
 
     out << "Converts FQNAME, PACKAGE(.SUBPACKAGE)*@[0-9]+.[0-9]+(::TYPE)? to an aidl "
            "equivalent.\n\n";
@@ -45,11 +43,8 @@
     out.indent();
     out.indent();
 
-    out << "-f: Force hidl2aidl to convert older packages\n";
-    out << "-e: Used for expanding extensions and types from other packages\n";
-    out << "-h: Prints this menu.\n";
     out << "-o <output path>: Location to output files.\n";
-    out << "-l <header file>: File containing a header to prepend to generated files.\n";
+    out << "-h: Prints this menu.\n";
     Coordinator::emitOptionsDetailString(out);
 
     out.unindent();
@@ -86,7 +81,7 @@
 }
 
 static FQName getLatestMinorVersionNamedTypeFromList(const FQName& fqName,
-                                                     const std::set<const NamedType*>& list) {
+                                                     const std::vector<const NamedType*>& list) {
     FQName currentCandidate = fqName;
     bool found = false;
     for (const NamedType* currentNamedType : list) {
@@ -114,30 +109,6 @@
     return result;
 }
 
-// assuming fqName exists, find oldest version which does exist
-// e.g. android.hardware.foo@1.7 -> android.hardware.foo@1.1 (if foo@1.0 doesn't
-// exist)
-static FQName getLowestExistingFqName(const Coordinator& coordinator, const FQName& fqName) {
-    FQName lowest(fqName);
-    while (lowest.getPackageMinorVersion() != 0) {
-        if (!packageExists(coordinator, lowest.downRev())) break;
-
-        lowest = lowest.downRev();
-    }
-    return lowest;
-}
-
-// assuming fqName exists, find newest version which does exist
-// e.g. android.hardware.foo@1.1 -> android.hardware.foo@1.7 if that's the
-// newest
-static FQName getHighestExistingFqName(const Coordinator& coordinator, const FQName& fqName) {
-    FQName highest(fqName);
-    while (packageExists(coordinator, highest.upRev())) {
-        highest = highest.upRev();
-    }
-    return highest;
-}
-
 static AST* parse(const Coordinator& coordinator, const FQName& target) {
     AST* ast = coordinator.parse(target);
     if (ast == nullptr) {
@@ -159,114 +130,6 @@
     return ast;
 }
 
-static void getSubTypes(const NamedType& namedType, std::set<const NamedType*>* types) {
-    if (namedType.isScope()) {
-        const Scope& compoundType = static_cast<const Scope&>(namedType);
-        for (const NamedType* subType : compoundType.getSubTypes()) {
-            types->insert(subType);
-            getSubTypes(*subType, types);
-        }
-    }
-}
-
-static void emitAidlSharedLibs(Formatter& out, FQName fqName, AidlBackend backend) {
-    if (backend == AidlBackend::NDK) {
-        out << "        \"libbinder_ndk\",\n";
-        out << "        \"libhidlbase\",\n";
-        out << "        \"" << AidlHelper::getAidlPackage(fqName) << "-V1-ndk_platform\",\n";
-    } else if (backend == AidlBackend::CPP) {
-        out << "        \"libbinder\",\n";
-        out << "        \"libhidlbase\",\n";
-        out << "        \"" << AidlHelper::getAidlPackage(fqName) << "-V1-cpp\",\n";
-        out << "        \"libutils\",\n";
-    } else {
-        out << "        \"" << AidlHelper::getAidlPackage(fqName) << "-V1-java\",\n";
-    }
-}
-
-static void emitHidlSharedLibs(Formatter& out, std::vector<FQName>& targets, AidlBackend backend) {
-    std::set<std::string> uniquePackages;
-    for (const auto& target : targets) {
-        if (backend == AidlBackend::JAVA) {
-            uniquePackages.insert(
-                    android::base::StringReplace(target.getPackageAndVersion().string(), "@", "-V",
-                                                 false /* all */) +
-                    "-java");
-        } else {
-            uniquePackages.insert(target.getPackageAndVersion().string());
-        }
-    }
-    for (const auto& package : uniquePackages) {
-        out << "        \"" << package << "\",\n";
-    }
-}
-
-static std::string aidlTranslateLibraryName(FQName fqName, AidlBackend backend) {
-    std::string postfix;
-    if (backend == AidlBackend::NDK) {
-        postfix = "-ndk";
-    } else if (backend == AidlBackend::CPP) {
-        postfix = "-cpp";
-    } else {
-        postfix = "-java";
-    }
-    return AidlHelper::getAidlPackage(fqName) + "-translate" + postfix;
-}
-
-static void emitBuildFile(Formatter& out, const FQName& fqName, std::vector<FQName>& targets,
-                          bool needsTranslation) {
-    out << "// This is the expected build file, but it may not be right in all cases\n";
-    out << "\n";
-    out << "aidl_interface {\n";
-    out << "    name: \"" << AidlHelper::getAidlPackage(fqName) << "\",\n";
-    out << "    vendor_available: true,\n";
-    out << "    srcs: [\"" << AidlHelper::getAidlPackagePath(fqName) << "/*.aidl\"],\n";
-    out << "    stability: \"vintf\",\n";
-    out << "    backend: {\n";
-    out << "        cpp: {\n";
-    out << "            // FIXME should this be disabled?\n";
-    out << "            // prefer NDK backend which can be used anywhere\n";
-    out << "            enabled: true,\n";
-    out << "        },\n";
-    out << "        java: {\n";
-    out << "            sdk_version: \"module_current\",\n";
-    out << "        },\n";
-    out << "        ndk: {\n";
-    out << "            vndk: {\n";
-    out << "                enabled: true,\n";
-    out << "            },\n";
-    out << "        },\n";
-    out << "    },\n";
-    out << "}\n\n";
-
-    if (!needsTranslation) return;
-
-    for (auto backend : {AidlBackend::CPP, AidlBackend::NDK}) {
-        out << "cc_library {\n";
-        out << "    name: \"" << aidlTranslateLibraryName(fqName, backend) << +"\",\n";
-        if (backend == AidlBackend::NDK) {
-            out << "    vendor_available: true,\n";
-        }
-        out << "    srcs: [\"" << AidlHelper::translateSourceFile(fqName, backend) + "\"],\n";
-        out << "    shared_libs: [\n";
-        emitAidlSharedLibs(out, fqName, backend);
-        emitHidlSharedLibs(out, targets, backend);
-        out << "    ],\n";
-        out << "    export_include_dirs: [\"include\"],\n";
-        out << "}\n\n";
-    }
-
-    out << "java_library {\n";
-    out << "    name: \"" << aidlTranslateLibraryName(fqName, AidlBackend::JAVA) << +"\",\n";
-    out << "    srcs: [\"" << AidlHelper::translateSourceFile(fqName, AidlBackend::JAVA) + "\"],\n";
-    out << "    libs: [\n";
-    emitAidlSharedLibs(out, fqName, AidlBackend::JAVA);
-    emitHidlSharedLibs(out, targets, AidlBackend::JAVA);
-    out << "    ],\n";
-    out << "    sdk_version: \"module_current\",\n";
-    out << "}\n\n";
-}
-
 // hidl is intentionally leaky. Turn off LeakSanitizer by default.
 extern "C" const char* __asan_default_options() {
     return "detect_leaks=0";
@@ -282,9 +145,7 @@
 
     Coordinator coordinator;
     std::string outputPath;
-    std::string fileHeader;
-    bool forceConvertOldInterfaces = false;
-    coordinator.parseOptions(argc, argv, "fho:l:e", [&](int res, char* arg) {
+    coordinator.parseOptions(argc, argv, "ho:", [&](int res, char* arg) {
         switch (res) {
             case 'o': {
                 if (!outputPath.empty()) {
@@ -294,19 +155,6 @@
                 outputPath = arg;
                 break;
             }
-            case 'l':
-                if (!fileHeader.empty()) {
-                    fprintf(stderr, "ERROR: -l <header file> can only be specified once.\n");
-                    exit(1);
-                }
-                fileHeader = arg;
-                break;
-            case 'f':
-                forceConvertOldInterfaces = true;
-                break;
-            case 'e':
-                AidlHelper::setExpandExtended(true);
-                break;
             case 'h':
             case '?':
             default: {
@@ -321,7 +169,6 @@
         outputPath += "/";
     }
     coordinator.setOutputPath(outputPath);
-    AidlHelper::setFileHeader(fileHeader);
 
     argc -= optind;
     argv += optind;
@@ -332,135 +179,107 @@
         exit(1);
     }
 
-    if (argc > 1) {
-        usage(me);
-        std::cerr << "ERROR: only one fqname can be specified." << std::endl;
-        exit(1);
-    }
+    for (int i = 0; i < argc; ++i) {
+        const char* arg = argv[i];
 
-    const char* arg = argv[0];
-
-    FQName fqName;
-    if (!FQName::parse(arg, &fqName)) {
-        std::cerr << "ERROR: Invalid fully-qualified name as argument: " << arg << "." << std::endl;
-        exit(1);
-    }
-
-    if (fqName.isFullyQualified()) {
-        std::cerr << "ERROR: hidl2aidl only supports converting an entire package, try "
-                     "converting "
-                  << fqName.getPackageAndVersion().string() << " instead." << std::endl;
-        exit(1);
-    }
-
-    if (!packageExists(coordinator, fqName)) {
-        std::cerr << "ERROR: Could not get sources for: " << arg << "." << std::endl;
-        exit(1);
-    }
-
-    if (!forceConvertOldInterfaces) {
-        const FQName highestFqName = getHighestExistingFqName(coordinator, fqName);
-        if (fqName != highestFqName) {
-            std::cerr << "ERROR: A newer minor version of " << fqName.string() << " exists ("
-                      << highestFqName.string()
-                      << "). In general, prefer to convert that instead. If you really mean to "
-                         "use an old minor version use '-f'."
+        FQName fqName;
+        if (!FQName::parse(arg, &fqName)) {
+            std::cerr << "ERROR: Invalid fully-qualified name as argument: " << arg << "."
                       << std::endl;
             exit(1);
         }
-    }
 
-    // This is the list of all types which should be converted
-    std::vector<FQName> targets;
-    for (FQName version = getLowestExistingFqName(coordinator, fqName);
-         version.getPackageMinorVersion() <= fqName.getPackageMinorVersion();
-         version = version.upRev()) {
-        std::vector<FQName> newTargets;
-        status_t err = coordinator.appendPackageInterfacesToVector(version, &newTargets);
-        if (err != OK) exit(1);
+        if (!packageExists(coordinator, fqName)) {
+            std::cerr << "ERROR: Could not get sources for: " << arg << "." << std::endl;
+            exit(1);
+        }
 
-        targets.insert(targets.end(), newTargets.begin(), newTargets.end());
-    }
+        FQName currentFqName(fqName);
+        while (currentFqName.getPackageMinorVersion() != 0) {
+            if (!packageExists(coordinator, currentFqName.downRev())) break;
 
-    // targets should not contain duplicates since appendPackageInterfaces is only called once
-    // per version. now remove all the elements that are not the "newest"
-    const auto& newEnd =
-            std::remove_if(targets.begin(), targets.end(), [&](const FQName& fqName) -> bool {
-                if (fqName.name() == "types") return false;
+            currentFqName = currentFqName.downRev();
+        }
 
-                return getLatestMinorVersionFQNameFromList(fqName, targets) != fqName;
-            });
-    targets.erase(newEnd, targets.end());
+        std::vector<FQName> targets;
+        while (packageExists(coordinator, currentFqName)) {
+            std::vector<FQName> newTargets;
+            status_t err = coordinator.appendPackageInterfacesToVector(currentFqName, &newTargets);
+            if (err != OK) break;
 
-    // Set up AIDL conversion log
-    Formatter err =
-            coordinator.getFormatter(fqName, Coordinator::Location::DIRECT, "conversion.log");
-    err << "Notes relating to hidl2aidl conversion of " << fqName.string() << " to "
-        << AidlHelper::getAidlPackage(fqName) << " (if any) follow:\n";
-    AidlHelper::setNotes(&err);
+            targets.insert(targets.end(), newTargets.begin(), newTargets.end());
 
-    // Gather all the types and interfaces
-    std::set<const NamedType*> namedTypesInPackage;
-    for (const FQName& target : targets) {
+            currentFqName = currentFqName.upRev();
+        }
 
-        AST* ast = parse(coordinator, target);
-        CHECK(ast);
+        // targets should not contain duplicates since appendPackageInterfaces is only called once
+        // per version. now remove all the elements that are not the "newest"
+        const auto& newEnd =
+                std::remove_if(targets.begin(), targets.end(), [&](const FQName& fqName) -> bool {
+                    if (fqName.name() == "types") return false;
 
-        const Interface* iface = ast->getInterface();
-        if (iface) {
-            namedTypesInPackage.insert(iface);
+                    return getLatestMinorVersionFQNameFromList(fqName, targets) != fqName;
+                });
+        targets.erase(newEnd, targets.end());
 
-            // Get all of the types defined in the interface chain(includes self)
-            for (const Interface* interface : iface->typeChain()) {
-                if (!AidlHelper::shouldBeExpanded(iface->fqName(), interface->fqName())) {
-                    break;
-                }
-                getSubTypes(*interface, &namedTypesInPackage);
+        if (fqName.isFullyQualified()) {
+            // Ensure that this fqName exists in the list.
+            // If not then there is a more recent version
+            if (std::find(targets.begin(), targets.end(), fqName) == targets.end()) {
+                // Not found. Error.
+                std::cerr << "ERROR: A newer minor version of " << fqName.string()
+                          << " exists. Compile that instead." << std::endl;
+                exit(1);
+            } else {
+                targets.clear();
+                targets.push_back(fqName);
             }
-        } else {
-            getSubTypes(ast->getRootScope(), &namedTypesInPackage);
+        }
+
+        // Set up AIDL conversion log
+        std::string aidlPackage = AidlHelper::getAidlPackage(fqName);
+        std::string aidlName = AidlHelper::getAidlName(fqName);
+        Formatter err = coordinator.getFormatter(
+                fqName, Coordinator::Location::DIRECT,
+                base::Join(base::Split(aidlPackage, "."), "/") + "/" +
+                        (aidlName.empty() ? "" : (aidlName + "-")) + "conversion.log");
+        AidlHelper::setNotes(&err);
+
+        std::vector<const NamedType*> namedTypesInPackage;
+        for (const FQName& target : targets) {
+            if (target.name() != "types") continue;
+
+            AST* ast = parse(coordinator, target);
+
+            CHECK(!ast->isInterface());
+
+            std::vector<const NamedType*> types = ast->getRootScope().getSortedDefinedTypes();
+            namedTypesInPackage.insert(namedTypesInPackage.end(), types.begin(), types.end());
+        }
+
+        const auto& endNamedTypes = std::remove_if(
+                namedTypesInPackage.begin(), namedTypesInPackage.end(),
+                [&](const NamedType* namedType) -> bool {
+                    return getLatestMinorVersionNamedTypeFromList(
+                                   namedType->fqName(), namedTypesInPackage) != namedType->fqName();
+                });
+        namedTypesInPackage.erase(endNamedTypes, namedTypesInPackage.end());
+
+        for (const NamedType* namedType : namedTypesInPackage) {
+            AidlHelper::emitAidl(*namedType, coordinator);
+        }
+
+        for (const FQName& target : targets) {
+            if (target.name() == "types") continue;
+
+            AST* ast = parse(coordinator, target);
+
+            const Interface* iface = ast->getInterface();
+            CHECK(iface);
+
+            AidlHelper::emitAidl(*iface, coordinator);
         }
     }
 
-    // Remove all of the older versions of types and keep the latest
-    for (auto it = namedTypesInPackage.begin(); it != namedTypesInPackage.end();) {
-        if (getLatestMinorVersionNamedTypeFromList((*it)->fqName(), namedTypesInPackage) !=
-            (*it)->fqName()) {
-            it = namedTypesInPackage.erase(it);
-        } else {
-            it++;
-        }
-    }
-
-    // Process and flatten all of the types. Many types include fields of older
-    // versions of that type.
-    // This step recursively finds all of those fields and adds their fields to
-    // the most recent top level type.
-    std::map<const NamedType*, const ProcessedCompoundType> processedTypesInPackage;
-    for (const auto& namedType : namedTypesInPackage) {
-        if (namedType->isCompoundType()) {
-            ProcessedCompoundType processed;
-            AidlHelper::processCompoundType(static_cast<const CompoundType&>(*namedType),
-                                            &processed, std::string());
-            processedTypesInPackage.insert(
-                    std::pair<const NamedType*, const ProcessedCompoundType>(namedType, processed));
-        }
-    }
-
-    Formatter buildFile =
-            coordinator.getFormatter(fqName, Coordinator::Location::DIRECT, "Android.bp");
-    emitBuildFile(buildFile, fqName, targets, !processedTypesInPackage.empty());
-    AidlHelper::emitTranslation(coordinator, fqName, namedTypesInPackage, processedTypesInPackage);
-
-    // Emit all types and interfaces
-    // The interfaces and types are still be further manipulated inside
-    // emitAidl. The interfaces are consolidating methods from their typechains
-    // and the composite types are being flattened.
-    for (const auto& namedType : namedTypesInPackage) {
-        AidlHelper::emitAidl(*namedType, coordinator, processedTypesInPackage);
-    }
-
-    err << "END OF LOG\n";
-
     return 0;
 }
diff --git a/hidl2aidl/test/1.0/Android.bp b/hidl2aidl/test/1.0/Android.bp
deleted file mode 100644
index a20796c..0000000
--- a/hidl2aidl/test/1.0/Android.bp
+++ /dev/null
@@ -1,22 +0,0 @@
-package {
-    // See: http://go/android-license-faq
-    // A large-scale-change added 'default_applicable_licenses' to import
-    // all of the 'license_kinds' from "system_tools_hidl_license"
-    // to get the below license kinds:
-    //   SPDX-license-identifier-Apache-2.0
-    default_applicable_licenses: ["system_tools_hidl_license"],
-}
-
-hidl_interface {
-    name: "hidl2aidl.test@1.0",
-    root: "hidl2aidl.test",
-    srcs: [
-        "types.hal",
-        "IFoo.hal",
-        "IBar.hal",
-    ],
-    interfaces: [
-        "android.hidl.base@1.0",
-    ],
-    gen_java: true,
-}
diff --git a/hidl2aidl/test/1.0/IBar.hal b/hidl2aidl/test/1.0/IBar.hal
index d87742a..b58f4d1 100644
--- a/hidl2aidl/test/1.0/IBar.hal
+++ b/hidl2aidl/test/1.0/IBar.hal
@@ -14,7 +14,7 @@
  * limitations under the License.
  */
 
-package hidl2aidl.test@1.0;
+package hidl2aidl@1.0;
 
 import IFoo;
 
@@ -24,4 +24,6 @@
     };
 
     extraMethod(Inner inner);
+
+    fmqMethod(fmq_sync<bool> sync, fmq_unsync<int32_t> unsync) generates (pointer t);
 };
diff --git a/hidl2aidl/test/1.0/IFoo.hal b/hidl2aidl/test/1.0/IFoo.hal
index 8f2d4ce..e484f25 100644
--- a/hidl2aidl/test/1.0/IFoo.hal
+++ b/hidl2aidl/test/1.0/IFoo.hal
@@ -14,13 +14,11 @@
  * limitations under the License.
  */
 
-package hidl2aidl.test@1.0;
+package hidl2aidl@1.0;
 
 interface IFoo {
-    struct BigStruct {
-        uint8_t type;
-    };
     oneway someFoo(int8_t a);
+    retVec(int8_t a) generates (vec<string> b);
     someBar(string a, int8_t b) generates (string foo);
 
     // This case fails since string cannot be an out param in aidl.
diff --git a/hidl2aidl/test/1.0/types.hal b/hidl2aidl/test/1.0/types.hal
index d4d75d1..0332b3f 100644
--- a/hidl2aidl/test/1.0/types.hal
+++ b/hidl2aidl/test/1.0/types.hal
@@ -14,7 +14,7 @@
  * limitations under the License.
  */
 
-package hidl2aidl.test@1.0;
+package hidl2aidl@1.0;
 
 struct Outer {
     struct Inner {
@@ -24,13 +24,6 @@
 
 struct OverrideMe {
     uint8_t a;
-    uint8_t b;
-};
-
-struct NameCollision {
-    uint8_t a;
-    uint8_t b;
-    uint8_t c;
 };
 
 struct OnlyIn10 {
diff --git a/hidl2aidl/test/1.1/Android.bp b/hidl2aidl/test/1.1/Android.bp
deleted file mode 100644
index 82869ab..0000000
--- a/hidl2aidl/test/1.1/Android.bp
+++ /dev/null
@@ -1,22 +0,0 @@
-package {
-    // See: http://go/android-license-faq
-    // A large-scale-change added 'default_applicable_licenses' to import
-    // all of the 'license_kinds' from "system_tools_hidl_license"
-    // to get the below license kinds:
-    //   SPDX-license-identifier-Apache-2.0
-    default_applicable_licenses: ["system_tools_hidl_license"],
-}
-
-hidl_interface {
-    name: "hidl2aidl.test@1.1",
-    root: "hidl2aidl.test",
-    srcs: [
-        "types.hal",
-        "IFoo.hal",
-    ],
-    interfaces: [
-        "hidl2aidl.test@1.0",
-        "android.hidl.base@1.0",
-    ],
-    gen_java: true,
-}
diff --git a/hidl2aidl/test/1.1/IFoo.hal b/hidl2aidl/test/1.1/IFoo.hal
index c561a8b..59d9a7c 100644
--- a/hidl2aidl/test/1.1/IFoo.hal
+++ b/hidl2aidl/test/1.1/IFoo.hal
@@ -14,7 +14,7 @@
  * limitations under the License.
  */
 
-package hidl2aidl.test@1.1;
+package hidl2aidl@1.1;
 
 import @1.0::IFoo;
 import @1.0::Outer;
@@ -22,7 +22,6 @@
 interface IFoo extends @1.0::IFoo {
     struct BigStruct {
         uint8_t type;
-        uint8_t value;
     };
 
     // Should take precedence over @1.0::someBar
@@ -35,6 +34,12 @@
     useImportedStruct(Outer outer);
 
     /**
+     * @param mem memory
+     */
+    useMemory(memory mem);
+    shouldImportCorrectTypes() generates (vec<OnlyIn11> lst);
+
+    /**
      * @return output output
      */
     oneOutput() generates (string output);
diff --git a/hidl2aidl/test/1.1/types.hal b/hidl2aidl/test/1.1/types.hal
index 47c2b32..ed9d2db 100644
--- a/hidl2aidl/test/1.1/types.hal
+++ b/hidl2aidl/test/1.1/types.hal
@@ -14,30 +14,18 @@
  * limitations under the License.
  */
 
-package hidl2aidl.test@1.1;
+package hidl2aidl@1.1;
 
 import @1.0::Value;
-import @1.0::Outer;
-import @1.0::NameCollision;
 
 struct OverrideMe {
     string a;
 };
 
-struct NameCollision {
-    string b;
-    @1.0::NameCollision reference;
-};
-
 struct OnlyIn11 {
     int32_t str;
 };
 
-struct Outer {
-    @1.0::Outer v1_0;
-    int32_t a;
-};
-
 enum Value : @1.0::Value {
     D,
     E = 27,
diff --git a/hidl2aidl/test/1.2/Android.bp b/hidl2aidl/test/1.2/Android.bp
deleted file mode 100644
index f94c7e3..0000000
--- a/hidl2aidl/test/1.2/Android.bp
+++ /dev/null
@@ -1,24 +0,0 @@
-package {
-    // See: http://go/android-license-faq
-    // A large-scale-change added 'default_applicable_licenses' to import
-    // all of the 'license_kinds' from "system_tools_hidl_license"
-    // to get the below license kinds:
-    //   SPDX-license-identifier-Apache-2.0
-    default_applicable_licenses: ["system_tools_hidl_license"],
-}
-
-hidl_interface {
-    name: "hidl2aidl.test@1.2",
-    root: "hidl2aidl.test",
-    srcs: [
-        "types.hal",
-        "IFoo.hal",
-    ],
-    interfaces: [
-        "hidl2aidl.test@1.0",
-        "hidl2aidl.test@1.1",
-        "android.hidl.base@1.0",
-        "android.hidl.safe_union@1.0",
-    ],
-    gen_java: true,
-}
diff --git a/hidl2aidl/test/1.2/types.hal b/hidl2aidl/test/1.2/types.hal
deleted file mode 100644
index 4dcf2fc..0000000
--- a/hidl2aidl/test/1.2/types.hal
+++ /dev/null
@@ -1,74 +0,0 @@
-/*
- * Copyright (C) 2020 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package hidl2aidl.test@1.2;
-
-import @1.1::OnlyIn11;
-import @1.1::NameCollision;
-import @1.1::Value;
-import android.hidl.safe_union@1.0::Monostate;
-
-struct NameCollision {
-    @1.1::NameCollision reference;
-
-    string c;
-    int16_t d;
-};
-
-union UnionFoo {
-    int64_t a;
-    int8_t b;
-    @1.1::OnlyIn11 c;
-};
-
-enum FooFlag : uint32_t {
-    NONE = 0x0,
-    FIRST = 0x1 << 0,
-    SECOND = 0x1 << 1,
-    THIRD = 0x1 << 2,
-};
-
-safe_union SafeUnionBar {
-    Monostate noInit;
-    int8_t a;
-    uint64_t b;
-    struct InnerStructBar {
-      int8_t x;
-      int8_t z;
-    } innerStructBar;
-    @1.1::OnlyIn11 c;
-    string d;
-    float e;
-    double f;
-    bitfield<FooFlag> g;
-    @1.1::Value h;
-    uint16_t i;
-};
-
-struct ArrayFoo {
-    int8_t[12] a;
-    uint32_t[12] b;
-    @1.1::Value[12] c;
-    string[2] d;
-};
-
-struct VectorFoo {
-    vec<int8_t> a;
-    vec<uint32_t> b;
-    vec<@1.1::Value> c;
-    vec<string> d;
-};
-
diff --git a/hidl2aidl/test/1.3/IFoo.hal b/hidl2aidl/test/1.3/IFoo.hal
deleted file mode 100644
index 5ce6dab..0000000
--- a/hidl2aidl/test/1.3/IFoo.hal
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * Copyright (C) 2020 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package hidl2aidl.test@1.1;
-
-import @1.2::IFoo;
-
-/**
- * The types in this package are not supported in the Java backend of HIDL
- */
-interface IFoo extends @1.2::IFoo {
-    ImportedStruct(Outer outer);
-
-    /**
-     * @param mem memory
-     */
-    useMemory(memory mem);
-    shouldImportCorrectTypes() generates (vec<OnlyIn11> lst);
-
-    removedOutput() generates (string status);
-
-    fmqMethod(fmq_sync<bool> sync, fmq_unsync<int32_t> unsync) generates (pointer t);
-
-    retVec(int8_t a) generates (vec<string> b);
-};
diff --git a/hidl2aidl/test/2.0/IFoo.hal b/hidl2aidl/test/2.0/IFoo.hal
index d1a4ab6..8c2bbad 100644
--- a/hidl2aidl/test/2.0/IFoo.hal
+++ b/hidl2aidl/test/2.0/IFoo.hal
@@ -14,16 +14,13 @@
  * limitations under the License.
  */
 
-package hidl2aidl.test@2.0;
+package hidl2aidl@2.0;
 
 import @1.0::IFoo;
-import @1.0::Value;
 
-/* This should go into a package called hidl2aidl.test2 */
+/* This should go into a package called hidl2aidl2 */
 interface IFoo {
     oneway someFoo(int8_t a);
 
     shouldImportExternalTypes(@1.0::IFoo foo);
-
-    useImportedEnum(Value value);
 };
diff --git a/hidl2aidl/test/3.0/Android.bp b/hidl2aidl/test/3.0/Android.bp
deleted file mode 100644
index 9c6fdbd..0000000
--- a/hidl2aidl/test/3.0/Android.bp
+++ /dev/null
@@ -1,20 +0,0 @@
-package {
-    // See: http://go/android-license-faq
-    // A large-scale-change added 'default_applicable_licenses' to import
-    // all of the 'license_kinds' from "system_tools_hidl_license"
-    // to get the below license kinds:
-    //   SPDX-license-identifier-Apache-2.0
-    default_applicable_licenses: ["system_tools_hidl_license"],
-}
-
-hidl_interface {
-    name: "hidl2aidl.test@3.0",
-    root: "hidl2aidl.test",
-    srcs: [
-        "IFoo.hal",
-    ],
-    interfaces: [
-        "android.hidl.base@1.0",
-    ],
-    gen_java: true,
-}
diff --git a/hidl2aidl/test/3.0/IFoo.hal b/hidl2aidl/test/3.0/IFoo.hal
deleted file mode 100644
index 76128c0..0000000
--- a/hidl2aidl/test/3.0/IFoo.hal
+++ /dev/null
@@ -1,25 +0,0 @@
-/*
- * Copyright (C) 2020 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package hidl2aidl.test@3.0;
-
-// minimal file for run_build_file_test.sh
-interface IFoo {
-    // minimal type to get translate libraries to generate and build
-    struct BuildThis {
-        int32_t a;
-    };
-};
diff --git a/hidl2aidl/test/Android.bp b/hidl2aidl/test/Android.bp
index e364b4b..fa923d2 100644
--- a/hidl2aidl/test/Android.bp
+++ b/hidl2aidl/test/Android.bp
@@ -14,131 +14,40 @@
  * limitations under the License.
  */
 
-package {
-    // See: http://go/android-license-faq
-    // A large-scale-change added 'default_applicable_licenses' to import
-    // all of the 'license_kinds' from "system_tools_hidl_license"
-    // to get the below license kinds:
-    //   SPDX-license-identifier-Apache-2.0
-    default_applicable_licenses: ["system_tools_hidl_license"],
-}
-
-genrule_defaults {
-    name: "hidl2aidl_test_gen_defaults",
+genrule {
+    name: "hidl2aidl_test_gen_aidl",
     tools: ["hidl2aidl"],
-    cmd: "$(location hidl2aidl) -f -o $(genDir)/ " +
-        "-rhidl2aidl.test:system/tools/hidl/hidl2aidl/test " +
-        "hidl2aidl.test@1.2 && " +
-        "$(location hidl2aidl) -f -o $(genDir)/ " +
-        "-rhidl2aidl.test:system/tools/hidl/hidl2aidl/test " +
-        "hidl2aidl.test.extension@1.2 && " +
-        "$(location hidl2aidl) -o $(genDir)/ " +
-        "-rhidl2aidl.test:system/tools/hidl/hidl2aidl/test " +
-        "hidl2aidl.test@2.0 && " +
-        "mv $(genDir)/include/hidl2aidl/test/translate-ndk.h $(genDir)/hidl2aidl/test/ && " +
-        "mv $(genDir)/include/hidl2aidl/test/translate-cpp.h $(genDir)/hidl2aidl/test/ &&" +
-        "mv $(genDir)/include/hidl2aidl/test/extension/translate-ndk.h $(genDir)/hidl2aidl/test/extension/ && " +
-        "mv $(genDir)/include/hidl2aidl/test/extension/translate-cpp.h $(genDir)/hidl2aidl/test/extension/ ",
+    cmd: "$(location hidl2aidl) -o $(genDir)/ " +
+        "-rhidl2aidl:system/tools/hidl/hidl2aidl/test " +
+        "hidl2aidl@1.0 hidl2aidl@2.0",
+    required: ["android.hidl.base@1.0"],
     srcs: [
         "1.0/IBar.hal",
         "1.0/IFoo.hal",
         "1.0/types.hal",
         "1.1/IFoo.hal",
         "1.1/types.hal",
-        "1.2/IFoo.hal",
         "2.0/IFoo.hal",
-        "extension/1.2/IFoo.hal",
-        "extension/1.2/types.hal",
     ],
-}
-
-genrule {
-    name: "hidl2aidl_test_gen_aidl",
-    defaults: ["hidl2aidl_test_gen_defaults"],
     out: [
-        "hidl2aidl/test/ArrayFoo.aidl",
-        "hidl2aidl/test/VectorFoo.aidl",
-        "hidl2aidl/test/FooFlag.aidl",
-        "hidl2aidl/test/IBar.aidl",
-        "hidl2aidl/test/IBarInner.aidl",
-        "hidl2aidl/test/IFoo.aidl",
-        "hidl2aidl/test/IFooBigStruct.aidl",
-        "hidl2aidl/test/NameCollision.aidl",
-        "hidl2aidl/test/OnlyIn10.aidl",
-        "hidl2aidl/test/OnlyIn11.aidl",
-        "hidl2aidl/test/Outer.aidl",
-        "hidl2aidl/test/OuterInner.aidl",
-        "hidl2aidl/test/OverrideMe.aidl",
-        "hidl2aidl/test/SafeUnionBar.aidl",
-        "hidl2aidl/test/SafeUnionBarInnerStructBar.aidl",
-        "hidl2aidl/test/UnionFoo.aidl",
-        "hidl2aidl/test/Value.aidl",
-        "hidl2aidl/test2/IFoo.aidl",
-        "hidl2aidl/test/extension/IFoo.aidl",
-        "hidl2aidl/test/extension/FooFlag.aidl",
-        "hidl2aidl/test/extension/ArrayFoo.aidl",
-    ],
-}
-
-genrule {
-    name: "hidl2aidl_translate_ndk_test_gen_src",
-    defaults: ["hidl2aidl_test_gen_defaults"],
-    out: [
-        "hidl2aidl/test/translate-ndk.cpp",
-        "hidl2aidl/test/extension/translate-ndk.cpp",
-    ],
-}
-
-genrule {
-    name: "hidl2aidl_translate_ndk_test_gen_headers",
-    defaults: ["hidl2aidl_test_gen_defaults"],
-    out: [
-        "hidl2aidl/test/translate-ndk.h",
-        "hidl2aidl/test/extension/translate-ndk.h",
-    ],
-}
-
-genrule {
-    name: "hidl2aidl_translate_cpp_test_gen_src",
-    defaults: ["hidl2aidl_test_gen_defaults"],
-    out: [
-        "hidl2aidl/test/translate-cpp.cpp",
-        "hidl2aidl/test/extension/translate-cpp.cpp",
-    ],
-}
-
-genrule {
-    name: "hidl2aidl_translate_cpp_test_gen_headers",
-    defaults: ["hidl2aidl_test_gen_defaults"],
-    out: [
-        "hidl2aidl/test/translate-cpp.h",
-        "hidl2aidl/test/extension/translate-cpp.h",
-    ],
-}
-
-genrule {
-    name: "hidl2aidl_translate_java_test_gen_src",
-    defaults: ["hidl2aidl_test_gen_defaults"],
-    out: [
-        "hidl2aidl/test/Translate.java",
-        "hidl2aidl/test/extension/Translate.java",
+        "hidl2aidl/IBar.aidl",
+        "hidl2aidl/IBarInner.aidl",
+        "hidl2aidl/IFoo.aidl",
+        "hidl2aidl/IFooBigStruct.aidl",
+        "hidl2aidl/OnlyIn10.aidl",
+        "hidl2aidl/OnlyIn11.aidl",
+        "hidl2aidl/Outer.aidl",
+        "hidl2aidl/OuterInner.aidl",
+        "hidl2aidl/OverrideMe.aidl",
+        "hidl2aidl/Value.aidl",
+        "hidl2aidl2/IFoo.aidl",
     ],
 }
 
 aidl_interface {
     name: "hidl2aidl_test_gen",
-    owner: "test",
-    stability: "vintf",
+    unstable: true,
     srcs: [":hidl2aidl_test_gen_aidl"],
-    backend: {
-        java: {
-            sdk_version: "module_current",
-        },
-    },
-    flags: [
-        "-Werror",
-        "-Wno-mixed-oneway",
-    ],
 }
 
 cc_test_library {
@@ -148,8 +57,8 @@
         "ndk_test_compile.cpp",
     ],
     shared_libs: [
-        "hidl2aidl_test_gen-V1-cpp",
-        "hidl2aidl_test_gen-V1-ndk_platform",
+        "hidl2aidl_test_gen-cpp",
+        "hidl2aidl_test_gen-ndk_platform",
         "libbinder",
         "libbinder_ndk",
         "libutils",
@@ -157,115 +66,10 @@
     gtest: false,
 }
 
-cc_test {
-    name: "hidl2aidl_translate_ndk_test",
-    test_suites: ["general-tests"],
-
-    cflags: [
-        "-Wall",
-        "-Wextra",
-        "-Werror",
-        "-g",
-    ],
-    srcs: [
-        ":hidl2aidl_translate_ndk_test_gen_src",
-        "translate_ndk_test.cpp",
-    ],
-    generated_headers: [
-        "hidl2aidl_translate_ndk_test_gen_headers",
-    ],
-    shared_libs: [
-        "libbinder_ndk",
-        "libhidlbase",
-        "liblog",
-    ],
-    static_libs: [
-        "hidl2aidl_test_gen-V1-ndk_platform",
-        "hidl2aidl.test@1.0",
-        "hidl2aidl.test@1.1",
-        "hidl2aidl.test@1.2",
-        "hidl2aidl.test.extension@1.2",
-    ],
-    host_required: [
-        "hidl2aidl",
-    ],
-}
-
-cc_test {
-    name: "hidl2aidl_translate_cpp_test",
-    test_suites: ["general-tests"],
-
-    cflags: [
-        "-Wall",
-        "-Wextra",
-        "-Werror",
-        "-g",
-        "-DHIDL2AIDLTESTING",
-    ],
-    srcs: [
-        ":hidl2aidl_translate_cpp_test_gen_src",
-        "translate_cpp_test.cpp",
-    ],
-    generated_headers: [
-        "hidl2aidl_translate_cpp_test_gen_headers",
-    ],
-    shared_libs: [
-        "libbinder",
-        "libhidlbase",
-        "libutils",
-        "liblog",
-    ],
-    static_libs: [
-        "hidl2aidl_test_gen-V1-cpp",
-        "hidl2aidl.test@1.0",
-        "hidl2aidl.test@1.1",
-        "hidl2aidl.test@1.2",
-        "hidl2aidl.test.extension@1.2",
-    ],
-    host_required: [
-        "hidl2aidl",
-    ],
-}
-
-android_test {
-    name: "hidl2aidl_translate_java_test",
-    platform_apis: true,
-    // Turn off Java optimization tools to speed up our test iterations.
-    optimize: {
-        enabled: false,
-    },
-    dex_preopt: {
-        enabled: false,
-    },
-    srcs: [
-        ":hidl2aidl_translate_java_test_gen_src",
-        "TranslateJavaTest.java",
-    ],
-    static_libs: [
-        "androidx.test.core",
-        "androidx.test.runner",
-        "hidl2aidl_test_gen-V1-java",
-        "hidl2aidl.test-V1.0-java",
-        "hidl2aidl.test-V1.1-java",
-        "hidl2aidl.test-V1.2-java",
-        "hidl2aidl.test.extension-V1.2-java",
-    ],
-    host_required: [
-        "hidl2aidl",
-    ],
-    test_suites: ["general-tests"],
-}
-
 phony {
     name: "hidl2aidl_test",
     required: [
         "hidl2aidl_test_comp_cc",
-        "hidl2aidl_test_gen-V1-java",
-        "hidl2aidl_translate_ndk_test",
-        "hidl2aidl_translate_cpp_test",
+        "hidl2aidl_test_gen",
     ],
 }
-
-hidl_package_root {
-    name: "hidl2aidl.test",
-}
diff --git a/hidl2aidl/test/AndroidManifest.xml b/hidl2aidl/test/AndroidManifest.xml
deleted file mode 100644
index eb0122f..0000000
--- a/hidl2aidl/test/AndroidManifest.xml
+++ /dev/null
@@ -1,28 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2020 The Android Open Source Project
-
-     Licensed under the Apache License, Version 2.0 (the "License");
-     you may not use this file except in compliance with the License.
-     You may obtain a copy of the License at
-
-          http://www.apache.org/licenses/LICENSE-2.0
-
-     Unless required by applicable law or agreed to in writing, software
-     distributed under the License is distributed on an "AS IS" BASIS,
-     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-     See the License for the specific language governing permissions and
-     limitations under the License.
--->
-
-<manifest xmlns:android="http://schemas.android.com/apk/res/android"
-        package="hidl2aidl.tests">
-
-    <application>
-        <uses-library android:name="android.test.runner" />
-    </application>
-
-    <instrumentation
-        android:name="androidx.test.runner.AndroidJUnitRunner"
-        android:targetPackage="hidl2aidl.tests"
-        android:label="Hidl2aidl Tests" />
-</manifest>
diff --git a/hidl2aidl/test/TranslateJavaTest.java b/hidl2aidl/test/TranslateJavaTest.java
deleted file mode 100644
index 32fcc85..0000000
--- a/hidl2aidl/test/TranslateJavaTest.java
+++ /dev/null
@@ -1,346 +0,0 @@
-/*
- * Copyright (C) 2020, The Android Open Source Project
- *
- * Licensed under the Apache License, is(Version 2.0 (the "License"));
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package hidl2aidl.tests;
-
-import static org.hamcrest.core.Is.is;
-import static org.junit.Assert.assertThat;
-import static org.junit.Assert.fail;
-
-import hidl2aidl.test.Translate;
-import org.junit.Test;
-import org.junit.runners.JUnit4;
-
-public class TranslateJavaTest {
-    @Test
-    public void OnlyIn10() {
-        hidl2aidl.test.OnlyIn10 dest;
-        hidl2aidl.test.V1_0.OnlyIn10 source = new hidl2aidl.test.V1_0.OnlyIn10();
-        source.str = "Hello";
-        dest = Translate.h2aTranslate(source);
-        assertThat(source.str, is(dest.str));
-    }
-
-    @Test
-    public void OnlyIn11() {
-        hidl2aidl.test.OnlyIn11 dest;
-        hidl2aidl.test.V1_1.OnlyIn11 source = new hidl2aidl.test.V1_1.OnlyIn11();
-        source.str = 12;
-        dest = Translate.h2aTranslate(source);
-        assertThat(source.str, is(dest.str));
-    }
-
-    @Test
-    public void OverrideMe() {
-        hidl2aidl.test.OverrideMe dest;
-        hidl2aidl.test.V1_1.OverrideMe source = new hidl2aidl.test.V1_1.OverrideMe();
-        source.a = "World";
-        dest = Translate.h2aTranslate(source);
-        assertThat(source.a, is(dest.a));
-    }
-
-    @Test
-    public void Outer() {
-        hidl2aidl.test.Outer dest;
-        hidl2aidl.test.V1_1.Outer source = new hidl2aidl.test.V1_1.Outer();
-        source.a = 12;
-        source.v1_0.inner.a = 16;
-        dest = Translate.h2aTranslate(source);
-        assertThat(source.v1_0.inner.a, is(dest.inner.a));
-    }
-
-    @Test
-    public void OuterInner() {
-        hidl2aidl.test.OuterInner dest;
-        hidl2aidl.test.V1_0.Outer.Inner source = new hidl2aidl.test.V1_0.Outer.Inner();
-        source.a = 12;
-        dest = Translate.h2aTranslate(source);
-        assertThat(source.a, is(dest.a));
-    }
-
-    @Test
-    public void NameCollision() {
-        hidl2aidl.test.NameCollision dest;
-        hidl2aidl.test.V1_2.NameCollision source = new hidl2aidl.test.V1_2.NameCollision();
-        source.reference.reference.a = 12;
-        source.reference.b = "Fancy";
-        source.c = "Car";
-        dest = Translate.h2aTranslate(source);
-        assertThat(source.reference.reference.a, is(dest.a));
-        assertThat(source.reference.b, is(dest.b));
-        assertThat(source.c, is(dest.c));
-    }
-
-    @Test
-    public void IFooBigStruct() {
-        hidl2aidl.test.IFooBigStruct dest;
-        hidl2aidl.test.V1_1.IFoo.BigStruct source = new hidl2aidl.test.V1_1.IFoo.BigStruct();
-        source.type = 12;
-        source.value = 16;
-        dest = Translate.h2aTranslate(source);
-        assertThat(source.type, is(dest.type));
-        assertThat(source.value, is(dest.value));
-    }
-
-    @Test
-    public void IBarInner() {
-        hidl2aidl.test.IBarInner dest;
-        hidl2aidl.test.V1_0.IBar.Inner source = new hidl2aidl.test.V1_0.IBar.Inner();
-        source.a = 0x70000000;
-        dest = Translate.h2aTranslate(source);
-        assertThat(source.a, is(dest.a));
-    }
-
-    @Test
-    public void UnsignedToSignedTooLarge() {
-        hidl2aidl.test.IBarInner dest;
-        hidl2aidl.test.V1_0.IBar.Inner source = new hidl2aidl.test.V1_0.IBar.Inner();
-        // source.a is uint32_t, dest.a is int32_t
-        source.a = -1;
-        try {
-            dest = Translate.h2aTranslate(source);
-            fail("Expected an exception to be thrown for out of bounds unsigned to signed translation");
-        } catch (RuntimeException e) {
-            String message = e.getMessage();
-            assertThat("Unsafe conversion between signed and unsigned scalars for field: in.a",
-                    is(message));
-        }
-    }
-
-    @Test
-    public void SafeUnionBarByte() {
-        hidl2aidl.test.SafeUnionBar dest;
-        hidl2aidl.test.V1_2.SafeUnionBar source = new hidl2aidl.test.V1_2.SafeUnionBar();
-        source.a((byte) 8);
-        assertThat(hidl2aidl.test.V1_2.SafeUnionBar.hidl_discriminator.a,
-                is(source.getDiscriminator()));
-        dest = Translate.h2aTranslate(source);
-        assertThat(source.a(), is(dest.getA()));
-    }
-
-    @Test
-    public void SafeUnionBarInt64() {
-        hidl2aidl.test.SafeUnionBar dest;
-        hidl2aidl.test.V1_2.SafeUnionBar source = new hidl2aidl.test.V1_2.SafeUnionBar();
-        source.b(25000);
-        dest = Translate.h2aTranslate(source);
-        assertThat(source.b(), is(dest.getB()));
-    }
-
-    @Test
-    public void SafeUnionBarInnerStructBar() {
-        hidl2aidl.test.SafeUnionBar dest;
-        hidl2aidl.test.V1_2.SafeUnionBar source = new hidl2aidl.test.V1_2.SafeUnionBar();
-        hidl2aidl.test.V1_2.SafeUnionBar.InnerStructBar inner =
-                new hidl2aidl.test.V1_2.SafeUnionBar.InnerStructBar();
-        inner.x = 8;
-        inner.z = 12;
-        source.innerStructBar(inner);
-        dest = Translate.h2aTranslate(source);
-        assertThat(source.innerStructBar().x, is(dest.getInnerStructBar().x));
-        assertThat(source.innerStructBar().z, is(dest.getInnerStructBar().z));
-    }
-
-    @Test
-    public void SafeUnionBarOnlyIn11() {
-        hidl2aidl.test.SafeUnionBar dest;
-        hidl2aidl.test.V1_2.SafeUnionBar source = new hidl2aidl.test.V1_2.SafeUnionBar();
-        hidl2aidl.test.V1_1.OnlyIn11 onlyIn11 = new hidl2aidl.test.V1_1.OnlyIn11();
-        onlyIn11.str = 12;
-        source.c(onlyIn11);
-        dest = Translate.h2aTranslate(source);
-        assertThat(source.c().str, is(dest.getC().str));
-    }
-
-    @Test
-    public void SafeUnionBarString() {
-        hidl2aidl.test.SafeUnionBar dest;
-        hidl2aidl.test.V1_2.SafeUnionBar source = new hidl2aidl.test.V1_2.SafeUnionBar();
-        source.d("Hello world!");
-        dest = Translate.h2aTranslate(source);
-        assertThat(source.d(), is(dest.getD()));
-    }
-
-    @Test
-    public void SafeUnionBarFloat() {
-        hidl2aidl.test.SafeUnionBar dest;
-        hidl2aidl.test.V1_2.SafeUnionBar source = new hidl2aidl.test.V1_2.SafeUnionBar();
-        source.e(3.5f);
-        dest = Translate.h2aTranslate(source);
-        assertThat(source.e(), is(dest.getE()));
-    }
-
-    @Test
-    public void SafeUnionBarDouble() {
-        hidl2aidl.test.SafeUnionBar dest;
-        hidl2aidl.test.V1_2.SafeUnionBar source = new hidl2aidl.test.V1_2.SafeUnionBar();
-        source.f(3e10);
-        dest = Translate.h2aTranslate(source);
-        assertThat(source.f(), is(dest.getF()));
-    }
-
-    @Test
-    public void SafeUnionBarBitfield() {
-        hidl2aidl.test.SafeUnionBar dest;
-        hidl2aidl.test.V1_2.SafeUnionBar source = new hidl2aidl.test.V1_2.SafeUnionBar();
-        source.g(hidl2aidl.test.V1_2.FooFlag.THIRD);
-        dest = Translate.h2aTranslate(source);
-        assertThat(source.g(), is(dest.getG()));
-    }
-
-    @Test
-    public void SafeUnionBarEnum() {
-        hidl2aidl.test.SafeUnionBar dest;
-        hidl2aidl.test.V1_2.SafeUnionBar source = new hidl2aidl.test.V1_2.SafeUnionBar();
-        source.h(hidl2aidl.test.V1_1.Value.B);
-        dest = Translate.h2aTranslate(source);
-        assertThat(source.h(), is(dest.getH()));
-    }
-
-    @Test
-    public void SafeUnionBarChar() {
-        hidl2aidl.test.SafeUnionBar dest;
-        hidl2aidl.test.V1_2.SafeUnionBar source = new hidl2aidl.test.V1_2.SafeUnionBar();
-        source.i((short) 12);
-        dest = Translate.h2aTranslate(source);
-        assertThat(source.i(), is((short) dest.getI()));
-    }
-
-    @Test
-    public void SafeUnionBarNegativeChar() {
-        hidl2aidl.test.SafeUnionBar dest;
-        hidl2aidl.test.V1_2.SafeUnionBar source = new hidl2aidl.test.V1_2.SafeUnionBar();
-        source.i((short) -1);
-        try {
-            dest = Translate.h2aTranslate(source);
-            fail("Expected an exception to be thrown for out of bounds signed to unsigned translation");
-        } catch (RuntimeException e) {
-            String message = e.getMessage();
-            assertThat("Unsafe conversion between signed and unsigned scalars for field: in.i()",
-                    is(message));
-        }
-    }
-
-    @Test
-    public void ArrayFoo() {
-        hidl2aidl.test.ArrayFoo dest;
-        hidl2aidl.test.V1_2.ArrayFoo source = new hidl2aidl.test.V1_2.ArrayFoo();
-        source.a[0] = 42;
-        source.a[0] = 42;
-        dest = Translate.h2aTranslate(source);
-        assertThat(source.a[0], is(dest.a[0]));
-    }
-
-    @Test
-    public void ArrayFooEmpty() {
-        hidl2aidl.test.ArrayFoo dest;
-        hidl2aidl.test.V1_2.ArrayFoo source = new hidl2aidl.test.V1_2.ArrayFoo();
-        dest = Translate.h2aTranslate(source);
-        assertThat(source.a.length, is(dest.a.length));
-    }
-
-    @Test
-    public void ArrayFooEnum() {
-        hidl2aidl.test.ArrayFoo dest;
-        hidl2aidl.test.V1_2.ArrayFoo source = new hidl2aidl.test.V1_2.ArrayFoo();
-        source.c[0] = hidl2aidl.test.Value.A;
-        source.c[1] = hidl2aidl.test.Value.B;
-        dest = Translate.h2aTranslate(source);
-        assertThat(source.c[0], is(dest.c[0]));
-        assertThat(source.c[1], is(dest.c[1]));
-    }
-
-    @Test
-    public void ArrayFooString() {
-        hidl2aidl.test.ArrayFoo dest;
-        hidl2aidl.test.V1_2.ArrayFoo source = new hidl2aidl.test.V1_2.ArrayFoo();
-        source.d[0] = "hello";
-        source.d[1] = "world";
-        dest = Translate.h2aTranslate(source);
-        assertThat(source.d[0], is(dest.d[0]));
-        assertThat(source.d[1], is(dest.d[1]));
-    }
-
-    @Test
-    public void VectorFoo() {
-        hidl2aidl.test.VectorFoo dest;
-        hidl2aidl.test.V1_2.VectorFoo source = new hidl2aidl.test.V1_2.VectorFoo();
-        source.a.add((byte) 42);
-        source.a.add((byte) 8);
-        dest = Translate.h2aTranslate(source);
-        assertThat(source.a.get(0), is(dest.a[0]));
-        assertThat(source.a.get(1), is(dest.a[1]));
-    }
-
-    @Test
-    public void VectorFooEmpty() {
-        hidl2aidl.test.VectorFoo dest;
-        hidl2aidl.test.V1_2.VectorFoo source = new hidl2aidl.test.V1_2.VectorFoo();
-        dest = Translate.h2aTranslate(source);
-        assertThat(source.a.size(), is(dest.a.length));
-    }
-
-    @Test
-    public void VectorFooUnsigned() {
-        hidl2aidl.test.VectorFoo dest;
-        hidl2aidl.test.V1_2.VectorFoo source = new hidl2aidl.test.V1_2.VectorFoo();
-        source.b.add(12);
-        source.b.add(0xf0000000);
-        try {
-            dest = Translate.h2aTranslate(source);
-            fail("Expected an exception to be thrown for out of bounds unsigned to signed translation");
-        } catch (RuntimeException e) {
-            String message = e.getMessage();
-            assertThat(
-                    "Unsafe conversion between signed and unsigned scalars for field: in.b.get(i)",
-                    is(message));
-        }
-    }
-
-    @Test
-    public void VectorFooEnum() {
-        hidl2aidl.test.VectorFoo dest;
-        hidl2aidl.test.V1_2.VectorFoo source = new hidl2aidl.test.V1_2.VectorFoo();
-        source.c.add(hidl2aidl.test.Value.A);
-        source.c.add(hidl2aidl.test.Value.B);
-        dest = Translate.h2aTranslate(source);
-        assertThat(source.c.get(0), is(dest.c[0]));
-        assertThat(source.c.get(1), is(dest.c[1]));
-    }
-
-    @Test
-    public void VectorFooString() {
-        hidl2aidl.test.VectorFoo dest;
-        hidl2aidl.test.V1_2.VectorFoo source = new hidl2aidl.test.V1_2.VectorFoo();
-        source.d.add("hello");
-        source.d.add("world");
-        dest = Translate.h2aTranslate(source);
-        assertThat(source.d.get(0), is(dest.d[0]));
-        assertThat(source.d.get(1), is(dest.d[1]));
-    }
-
-    @Test
-    public void ExtensionArrayFoo() {
-        hidl2aidl.test.extension.ArrayFoo dest;
-        hidl2aidl.test.extension.V1_2.ArrayFoo source =
-                new hidl2aidl.test.extension.V1_2.ArrayFoo();
-        source.e[0] = 12;
-        source.e[1] = 2;
-        dest = hidl2aidl.test.extension.Translate.h2aTranslate(source);
-        assertThat(source.e[0], is(dest.e[0]));
-        assertThat(source.e[1], is(dest.e[1]));
-    }
-}
diff --git a/hidl2aidl/test/aidl_api/hidl2aidl_test_gen/current/hidl2aidl/test/ArrayFoo.aidl b/hidl2aidl/test/aidl_api/hidl2aidl_test_gen/current/hidl2aidl/test/ArrayFoo.aidl
deleted file mode 100644
index 1dce1a2..0000000
--- a/hidl2aidl/test/aidl_api/hidl2aidl_test_gen/current/hidl2aidl/test/ArrayFoo.aidl
+++ /dev/null
@@ -1,27 +0,0 @@
-// FIXME: license file, or use the -l option to generate the files with the header.
-///////////////////////////////////////////////////////////////////////////////
-// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE.                          //
-///////////////////////////////////////////////////////////////////////////////
-
-// This file is a snapshot of an AIDL file. Do not edit it manually. There are
-// two cases:
-// 1). this is a frozen version file - do not edit this in any case.
-// 2). this is a 'current' file. If you make a backwards compatible change to
-//     the interface (from the latest frozen version), the build system will
-//     prompt you to update this file with `m <name>-update-api`.
-//
-// You must not make a backward incompatible change to any AIDL file built
-// with the aidl_interface module type with versions property set. The module
-// type is used to build AIDL files in a way that they can be used across
-// independently updatable components of the system. If a device is shipped
-// with such a backward incompatible change, it has a high risk of breaking
-// later when a module using the interface is updated, e.g., Mainline modules.
-
-package hidl2aidl.test;
-@VintfStability
-parcelable ArrayFoo {
-  byte[] a;
-  int[] b;
-  hidl2aidl.test.Value[] c;
-  String[] d;
-}
diff --git a/hidl2aidl/test/aidl_api/hidl2aidl_test_gen/current/hidl2aidl/test/FooFlag.aidl b/hidl2aidl/test/aidl_api/hidl2aidl_test_gen/current/hidl2aidl/test/FooFlag.aidl
deleted file mode 100644
index 46b32b9..0000000
--- a/hidl2aidl/test/aidl_api/hidl2aidl_test_gen/current/hidl2aidl/test/FooFlag.aidl
+++ /dev/null
@@ -1,27 +0,0 @@
-// FIXME: license file, or use the -l option to generate the files with the header.
-///////////////////////////////////////////////////////////////////////////////
-// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE.                          //
-///////////////////////////////////////////////////////////////////////////////
-
-// This file is a snapshot of an AIDL file. Do not edit it manually. There are
-// two cases:
-// 1). this is a frozen version file - do not edit this in any case.
-// 2). this is a 'current' file. If you make a backwards compatible change to
-//     the interface (from the latest frozen version), the build system will
-//     prompt you to update this file with `m <name>-update-api`.
-//
-// You must not make a backward incompatible change to any AIDL file built
-// with the aidl_interface module type with versions property set. The module
-// type is used to build AIDL files in a way that they can be used across
-// independently updatable components of the system. If a device is shipped
-// with such a backward incompatible change, it has a high risk of breaking
-// later when a module using the interface is updated, e.g., Mainline modules.
-
-package hidl2aidl.test;
-@Backing(type="int") @VintfStability
-enum FooFlag {
-  NONE = 0,
-  FIRST = 1,
-  SECOND = 2,
-  THIRD = 4,
-}
diff --git a/hidl2aidl/test/aidl_api/hidl2aidl_test_gen/current/hidl2aidl/test/IBar.aidl b/hidl2aidl/test/aidl_api/hidl2aidl_test_gen/current/hidl2aidl/test/IBar.aidl
deleted file mode 100644
index cbd8a37..0000000
--- a/hidl2aidl/test/aidl_api/hidl2aidl_test_gen/current/hidl2aidl/test/IBar.aidl
+++ /dev/null
@@ -1,26 +0,0 @@
-// FIXME: license file, or use the -l option to generate the files with the header.
-///////////////////////////////////////////////////////////////////////////////
-// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE.                          //
-///////////////////////////////////////////////////////////////////////////////
-
-// This file is a snapshot of an AIDL file. Do not edit it manually. There are
-// two cases:
-// 1). this is a frozen version file - do not edit this in any case.
-// 2). this is a 'current' file. If you make a backwards compatible change to
-//     the interface (from the latest frozen version), the build system will
-//     prompt you to update this file with `m <name>-update-api`.
-//
-// You must not make a backward incompatible change to any AIDL file built
-// with the aidl_interface module type with versions property set. The module
-// type is used to build AIDL files in a way that they can be used across
-// independently updatable components of the system. If a device is shipped
-// with such a backward incompatible change, it has a high risk of breaking
-// later when a module using the interface is updated, e.g., Mainline modules.
-
-package hidl2aidl.test;
-@VintfStability
-interface IBar {
-  void extraMethod(in hidl2aidl.test.IBarInner inner);
-  String someBar(in String a, in byte b);
-  oneway void someFoo(in byte a);
-}
diff --git a/hidl2aidl/test/aidl_api/hidl2aidl_test_gen/current/hidl2aidl/test/IBarInner.aidl b/hidl2aidl/test/aidl_api/hidl2aidl_test_gen/current/hidl2aidl/test/IBarInner.aidl
deleted file mode 100644
index 78c9d3b..0000000
--- a/hidl2aidl/test/aidl_api/hidl2aidl_test_gen/current/hidl2aidl/test/IBarInner.aidl
+++ /dev/null
@@ -1,24 +0,0 @@
-// FIXME: license file, or use the -l option to generate the files with the header.
-///////////////////////////////////////////////////////////////////////////////
-// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE.                          //
-///////////////////////////////////////////////////////////////////////////////
-
-// This file is a snapshot of an AIDL file. Do not edit it manually. There are
-// two cases:
-// 1). this is a frozen version file - do not edit this in any case.
-// 2). this is a 'current' file. If you make a backwards compatible change to
-//     the interface (from the latest frozen version), the build system will
-//     prompt you to update this file with `m <name>-update-api`.
-//
-// You must not make a backward incompatible change to any AIDL file built
-// with the aidl_interface module type with versions property set. The module
-// type is used to build AIDL files in a way that they can be used across
-// independently updatable components of the system. If a device is shipped
-// with such a backward incompatible change, it has a high risk of breaking
-// later when a module using the interface is updated, e.g., Mainline modules.
-
-package hidl2aidl.test;
-@VintfStability
-parcelable IBarInner {
-  int a;
-}
diff --git a/hidl2aidl/test/aidl_api/hidl2aidl_test_gen/current/hidl2aidl/test/IFoo.aidl b/hidl2aidl/test/aidl_api/hidl2aidl_test_gen/current/hidl2aidl/test/IFoo.aidl
deleted file mode 100644
index b990a90..0000000
--- a/hidl2aidl/test/aidl_api/hidl2aidl_test_gen/current/hidl2aidl/test/IFoo.aidl
+++ /dev/null
@@ -1,34 +0,0 @@
-// FIXME: license file, or use the -l option to generate the files with the header.
-///////////////////////////////////////////////////////////////////////////////
-// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE.                          //
-///////////////////////////////////////////////////////////////////////////////
-
-// This file is a snapshot of an AIDL file. Do not edit it manually. There are
-// two cases:
-// 1). this is a frozen version file - do not edit this in any case.
-// 2). this is a 'current' file. If you make a backwards compatible change to
-//     the interface (from the latest frozen version), the build system will
-//     prompt you to update this file with `m <name>-update-api`.
-//
-// You must not make a backward incompatible change to any AIDL file built
-// with the aidl_interface module type with versions property set. The module
-// type is used to build AIDL files in a way that they can be used across
-// independently updatable components of the system. If a device is shipped
-// with such a backward incompatible change, it has a high risk of breaking
-// later when a module using the interface is updated, e.g., Mainline modules.
-
-package hidl2aidl.test;
-@VintfStability
-interface IFoo {
-  void multipleInputs(in String in1, in String in2);
-  void multipleInputsAndOutputs(in String in1, in String in2, out hidl2aidl.test.IFooBigStruct out1, out hidl2aidl.test.IFooBigStruct out2);
-  void multipleOutputs(out hidl2aidl.test.IFooBigStruct out1, out hidl2aidl.test.IFooBigStruct out2);
-  String oneOutput();
-  String removedOutput();
-  void someBar(in String a, in String b);
-  oneway void someFoo(in byte a);
-  void useImportedStruct(in hidl2aidl.test.Outer outer);
-  hidl2aidl.test.IFooBigStruct useStruct();
-  void versionTest_(in String a);
-  boolean versionTest_two_(in String a);
-}
diff --git a/hidl2aidl/test/aidl_api/hidl2aidl_test_gen/current/hidl2aidl/test/IFooBigStruct.aidl b/hidl2aidl/test/aidl_api/hidl2aidl_test_gen/current/hidl2aidl/test/IFooBigStruct.aidl
deleted file mode 100644
index 81a292a..0000000
--- a/hidl2aidl/test/aidl_api/hidl2aidl_test_gen/current/hidl2aidl/test/IFooBigStruct.aidl
+++ /dev/null
@@ -1,25 +0,0 @@
-// FIXME: license file, or use the -l option to generate the files with the header.
-///////////////////////////////////////////////////////////////////////////////
-// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE.                          //
-///////////////////////////////////////////////////////////////////////////////
-
-// This file is a snapshot of an AIDL file. Do not edit it manually. There are
-// two cases:
-// 1). this is a frozen version file - do not edit this in any case.
-// 2). this is a 'current' file. If you make a backwards compatible change to
-//     the interface (from the latest frozen version), the build system will
-//     prompt you to update this file with `m <name>-update-api`.
-//
-// You must not make a backward incompatible change to any AIDL file built
-// with the aidl_interface module type with versions property set. The module
-// type is used to build AIDL files in a way that they can be used across
-// independently updatable components of the system. If a device is shipped
-// with such a backward incompatible change, it has a high risk of breaking
-// later when a module using the interface is updated, e.g., Mainline modules.
-
-package hidl2aidl.test;
-@VintfStability
-parcelable IFooBigStruct {
-  byte type;
-  byte value;
-}
diff --git a/hidl2aidl/test/aidl_api/hidl2aidl_test_gen/current/hidl2aidl/test/NameCollision.aidl b/hidl2aidl/test/aidl_api/hidl2aidl_test_gen/current/hidl2aidl/test/NameCollision.aidl
deleted file mode 100644
index 3225990..0000000
--- a/hidl2aidl/test/aidl_api/hidl2aidl_test_gen/current/hidl2aidl/test/NameCollision.aidl
+++ /dev/null
@@ -1,27 +0,0 @@
-// FIXME: license file, or use the -l option to generate the files with the header.
-///////////////////////////////////////////////////////////////////////////////
-// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE.                          //
-///////////////////////////////////////////////////////////////////////////////
-
-// This file is a snapshot of an AIDL file. Do not edit it manually. There are
-// two cases:
-// 1). this is a frozen version file - do not edit this in any case.
-// 2). this is a 'current' file. If you make a backwards compatible change to
-//     the interface (from the latest frozen version), the build system will
-//     prompt you to update this file with `m <name>-update-api`.
-//
-// You must not make a backward incompatible change to any AIDL file built
-// with the aidl_interface module type with versions property set. The module
-// type is used to build AIDL files in a way that they can be used across
-// independently updatable components of the system. If a device is shipped
-// with such a backward incompatible change, it has a high risk of breaking
-// later when a module using the interface is updated, e.g., Mainline modules.
-
-package hidl2aidl.test;
-@VintfStability
-parcelable NameCollision {
-  String b;
-  byte a;
-  String c;
-  char d;
-}
diff --git a/hidl2aidl/test/aidl_api/hidl2aidl_test_gen/current/hidl2aidl/test/OnlyIn10.aidl b/hidl2aidl/test/aidl_api/hidl2aidl_test_gen/current/hidl2aidl/test/OnlyIn10.aidl
deleted file mode 100644
index 0b4b35e..0000000
--- a/hidl2aidl/test/aidl_api/hidl2aidl_test_gen/current/hidl2aidl/test/OnlyIn10.aidl
+++ /dev/null
@@ -1,24 +0,0 @@
-// FIXME: license file, or use the -l option to generate the files with the header.
-///////////////////////////////////////////////////////////////////////////////
-// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE.                          //
-///////////////////////////////////////////////////////////////////////////////
-
-// This file is a snapshot of an AIDL file. Do not edit it manually. There are
-// two cases:
-// 1). this is a frozen version file - do not edit this in any case.
-// 2). this is a 'current' file. If you make a backwards compatible change to
-//     the interface (from the latest frozen version), the build system will
-//     prompt you to update this file with `m <name>-update-api`.
-//
-// You must not make a backward incompatible change to any AIDL file built
-// with the aidl_interface module type with versions property set. The module
-// type is used to build AIDL files in a way that they can be used across
-// independently updatable components of the system. If a device is shipped
-// with such a backward incompatible change, it has a high risk of breaking
-// later when a module using the interface is updated, e.g., Mainline modules.
-
-package hidl2aidl.test;
-@VintfStability
-parcelable OnlyIn10 {
-  String str;
-}
diff --git a/hidl2aidl/test/aidl_api/hidl2aidl_test_gen/current/hidl2aidl/test/OnlyIn11.aidl b/hidl2aidl/test/aidl_api/hidl2aidl_test_gen/current/hidl2aidl/test/OnlyIn11.aidl
deleted file mode 100644
index 2efa378..0000000
--- a/hidl2aidl/test/aidl_api/hidl2aidl_test_gen/current/hidl2aidl/test/OnlyIn11.aidl
+++ /dev/null
@@ -1,24 +0,0 @@
-// FIXME: license file, or use the -l option to generate the files with the header.
-///////////////////////////////////////////////////////////////////////////////
-// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE.                          //
-///////////////////////////////////////////////////////////////////////////////
-
-// This file is a snapshot of an AIDL file. Do not edit it manually. There are
-// two cases:
-// 1). this is a frozen version file - do not edit this in any case.
-// 2). this is a 'current' file. If you make a backwards compatible change to
-//     the interface (from the latest frozen version), the build system will
-//     prompt you to update this file with `m <name>-update-api`.
-//
-// You must not make a backward incompatible change to any AIDL file built
-// with the aidl_interface module type with versions property set. The module
-// type is used to build AIDL files in a way that they can be used across
-// independently updatable components of the system. If a device is shipped
-// with such a backward incompatible change, it has a high risk of breaking
-// later when a module using the interface is updated, e.g., Mainline modules.
-
-package hidl2aidl.test;
-@VintfStability
-parcelable OnlyIn11 {
-  int str;
-}
diff --git a/hidl2aidl/test/aidl_api/hidl2aidl_test_gen/current/hidl2aidl/test/Outer.aidl b/hidl2aidl/test/aidl_api/hidl2aidl_test_gen/current/hidl2aidl/test/Outer.aidl
deleted file mode 100644
index a3e3eb7..0000000
--- a/hidl2aidl/test/aidl_api/hidl2aidl_test_gen/current/hidl2aidl/test/Outer.aidl
+++ /dev/null
@@ -1,25 +0,0 @@
-// FIXME: license file, or use the -l option to generate the files with the header.
-///////////////////////////////////////////////////////////////////////////////
-// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE.                          //
-///////////////////////////////////////////////////////////////////////////////
-
-// This file is a snapshot of an AIDL file. Do not edit it manually. There are
-// two cases:
-// 1). this is a frozen version file - do not edit this in any case.
-// 2). this is a 'current' file. If you make a backwards compatible change to
-//     the interface (from the latest frozen version), the build system will
-//     prompt you to update this file with `m <name>-update-api`.
-//
-// You must not make a backward incompatible change to any AIDL file built
-// with the aidl_interface module type with versions property set. The module
-// type is used to build AIDL files in a way that they can be used across
-// independently updatable components of the system. If a device is shipped
-// with such a backward incompatible change, it has a high risk of breaking
-// later when a module using the interface is updated, e.g., Mainline modules.
-
-package hidl2aidl.test;
-@VintfStability
-parcelable Outer {
-  hidl2aidl.test.OuterInner inner;
-  int a;
-}
diff --git a/hidl2aidl/test/aidl_api/hidl2aidl_test_gen/current/hidl2aidl/test/OuterInner.aidl b/hidl2aidl/test/aidl_api/hidl2aidl_test_gen/current/hidl2aidl/test/OuterInner.aidl
deleted file mode 100644
index e23b9df..0000000
--- a/hidl2aidl/test/aidl_api/hidl2aidl_test_gen/current/hidl2aidl/test/OuterInner.aidl
+++ /dev/null
@@ -1,24 +0,0 @@
-// FIXME: license file, or use the -l option to generate the files with the header.
-///////////////////////////////////////////////////////////////////////////////
-// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE.                          //
-///////////////////////////////////////////////////////////////////////////////
-
-// This file is a snapshot of an AIDL file. Do not edit it manually. There are
-// two cases:
-// 1). this is a frozen version file - do not edit this in any case.
-// 2). this is a 'current' file. If you make a backwards compatible change to
-//     the interface (from the latest frozen version), the build system will
-//     prompt you to update this file with `m <name>-update-api`.
-//
-// You must not make a backward incompatible change to any AIDL file built
-// with the aidl_interface module type with versions property set. The module
-// type is used to build AIDL files in a way that they can be used across
-// independently updatable components of the system. If a device is shipped
-// with such a backward incompatible change, it has a high risk of breaking
-// later when a module using the interface is updated, e.g., Mainline modules.
-
-package hidl2aidl.test;
-@VintfStability
-parcelable OuterInner {
-  byte a;
-}
diff --git a/hidl2aidl/test/aidl_api/hidl2aidl_test_gen/current/hidl2aidl/test/OverrideMe.aidl b/hidl2aidl/test/aidl_api/hidl2aidl_test_gen/current/hidl2aidl/test/OverrideMe.aidl
deleted file mode 100644
index 090a284..0000000
--- a/hidl2aidl/test/aidl_api/hidl2aidl_test_gen/current/hidl2aidl/test/OverrideMe.aidl
+++ /dev/null
@@ -1,24 +0,0 @@
-// FIXME: license file, or use the -l option to generate the files with the header.
-///////////////////////////////////////////////////////////////////////////////
-// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE.                          //
-///////////////////////////////////////////////////////////////////////////////
-
-// This file is a snapshot of an AIDL file. Do not edit it manually. There are
-// two cases:
-// 1). this is a frozen version file - do not edit this in any case.
-// 2). this is a 'current' file. If you make a backwards compatible change to
-//     the interface (from the latest frozen version), the build system will
-//     prompt you to update this file with `m <name>-update-api`.
-//
-// You must not make a backward incompatible change to any AIDL file built
-// with the aidl_interface module type with versions property set. The module
-// type is used to build AIDL files in a way that they can be used across
-// independently updatable components of the system. If a device is shipped
-// with such a backward incompatible change, it has a high risk of breaking
-// later when a module using the interface is updated, e.g., Mainline modules.
-
-package hidl2aidl.test;
-@VintfStability
-parcelable OverrideMe {
-  String a;
-}
diff --git a/hidl2aidl/test/aidl_api/hidl2aidl_test_gen/current/hidl2aidl/test/SafeUnionBar.aidl b/hidl2aidl/test/aidl_api/hidl2aidl_test_gen/current/hidl2aidl/test/SafeUnionBar.aidl
deleted file mode 100644
index 34b9638..0000000
--- a/hidl2aidl/test/aidl_api/hidl2aidl_test_gen/current/hidl2aidl/test/SafeUnionBar.aidl
+++ /dev/null
@@ -1,34 +0,0 @@
-// FIXME: license file, or use the -l option to generate the files with the header.
-///////////////////////////////////////////////////////////////////////////////
-// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE.                          //
-///////////////////////////////////////////////////////////////////////////////
-
-// This file is a snapshot of an AIDL file. Do not edit it manually. There are
-// two cases:
-// 1). this is a frozen version file - do not edit this in any case.
-// 2). this is a 'current' file. If you make a backwards compatible change to
-//     the interface (from the latest frozen version), the build system will
-//     prompt you to update this file with `m <name>-update-api`.
-//
-// You must not make a backward incompatible change to any AIDL file built
-// with the aidl_interface module type with versions property set. The module
-// type is used to build AIDL files in a way that they can be used across
-// independently updatable components of the system. If a device is shipped
-// with such a backward incompatible change, it has a high risk of breaking
-// later when a module using the interface is updated, e.g., Mainline modules.
-
-package hidl2aidl.test;
-@VintfStability
-union SafeUnionBar {
-  boolean noInit;
-  byte a;
-  long b;
-  hidl2aidl.test.SafeUnionBarInnerStructBar innerStructBar;
-  hidl2aidl.test.OnlyIn11 c;
-  String d;
-  float e;
-  double f;
-  hidl2aidl.test.FooFlag g;
-  hidl2aidl.test.Value h;
-  char i;
-}
diff --git a/hidl2aidl/test/aidl_api/hidl2aidl_test_gen/current/hidl2aidl/test/SafeUnionBarInnerStructBar.aidl b/hidl2aidl/test/aidl_api/hidl2aidl_test_gen/current/hidl2aidl/test/SafeUnionBarInnerStructBar.aidl
deleted file mode 100644
index 3fd291f..0000000
--- a/hidl2aidl/test/aidl_api/hidl2aidl_test_gen/current/hidl2aidl/test/SafeUnionBarInnerStructBar.aidl
+++ /dev/null
@@ -1,25 +0,0 @@
-// FIXME: license file, or use the -l option to generate the files with the header.
-///////////////////////////////////////////////////////////////////////////////
-// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE.                          //
-///////////////////////////////////////////////////////////////////////////////
-
-// This file is a snapshot of an AIDL file. Do not edit it manually. There are
-// two cases:
-// 1). this is a frozen version file - do not edit this in any case.
-// 2). this is a 'current' file. If you make a backwards compatible change to
-//     the interface (from the latest frozen version), the build system will
-//     prompt you to update this file with `m <name>-update-api`.
-//
-// You must not make a backward incompatible change to any AIDL file built
-// with the aidl_interface module type with versions property set. The module
-// type is used to build AIDL files in a way that they can be used across
-// independently updatable components of the system. If a device is shipped
-// with such a backward incompatible change, it has a high risk of breaking
-// later when a module using the interface is updated, e.g., Mainline modules.
-
-package hidl2aidl.test;
-@VintfStability
-parcelable SafeUnionBarInnerStructBar {
-  byte x;
-  byte z;
-}
diff --git a/hidl2aidl/test/aidl_api/hidl2aidl_test_gen/current/hidl2aidl/test/UnionFoo.aidl b/hidl2aidl/test/aidl_api/hidl2aidl_test_gen/current/hidl2aidl/test/UnionFoo.aidl
deleted file mode 100644
index fdda556..0000000
--- a/hidl2aidl/test/aidl_api/hidl2aidl_test_gen/current/hidl2aidl/test/UnionFoo.aidl
+++ /dev/null
@@ -1,26 +0,0 @@
-// FIXME: license file, or use the -l option to generate the files with the header.
-///////////////////////////////////////////////////////////////////////////////
-// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE.                          //
-///////////////////////////////////////////////////////////////////////////////
-
-// This file is a snapshot of an AIDL file. Do not edit it manually. There are
-// two cases:
-// 1). this is a frozen version file - do not edit this in any case.
-// 2). this is a 'current' file. If you make a backwards compatible change to
-//     the interface (from the latest frozen version), the build system will
-//     prompt you to update this file with `m <name>-update-api`.
-//
-// You must not make a backward incompatible change to any AIDL file built
-// with the aidl_interface module type with versions property set. The module
-// type is used to build AIDL files in a way that they can be used across
-// independently updatable components of the system. If a device is shipped
-// with such a backward incompatible change, it has a high risk of breaking
-// later when a module using the interface is updated, e.g., Mainline modules.
-
-package hidl2aidl.test;
-@VintfStability
-union UnionFoo {
-  long a;
-  byte b;
-  hidl2aidl.test.OnlyIn11 c;
-}
diff --git a/hidl2aidl/test/aidl_api/hidl2aidl_test_gen/current/hidl2aidl/test/Value.aidl b/hidl2aidl/test/aidl_api/hidl2aidl_test_gen/current/hidl2aidl/test/Value.aidl
deleted file mode 100644
index b0f1d4f..0000000
--- a/hidl2aidl/test/aidl_api/hidl2aidl_test_gen/current/hidl2aidl/test/Value.aidl
+++ /dev/null
@@ -1,29 +0,0 @@
-// FIXME: license file, or use the -l option to generate the files with the header.
-///////////////////////////////////////////////////////////////////////////////
-// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE.                          //
-///////////////////////////////////////////////////////////////////////////////
-
-// This file is a snapshot of an AIDL file. Do not edit it manually. There are
-// two cases:
-// 1). this is a frozen version file - do not edit this in any case.
-// 2). this is a 'current' file. If you make a backwards compatible change to
-//     the interface (from the latest frozen version), the build system will
-//     prompt you to update this file with `m <name>-update-api`.
-//
-// You must not make a backward incompatible change to any AIDL file built
-// with the aidl_interface module type with versions property set. The module
-// type is used to build AIDL files in a way that they can be used across
-// independently updatable components of the system. If a device is shipped
-// with such a backward incompatible change, it has a high risk of breaking
-// later when a module using the interface is updated, e.g., Mainline modules.
-
-package hidl2aidl.test;
-@Backing(type="int") @VintfStability
-enum Value {
-  A = 3,
-  B = 7,
-  C = 8,
-  D = 9,
-  E = 27,
-  F = 28,
-}
diff --git a/hidl2aidl/test/aidl_api/hidl2aidl_test_gen/current/hidl2aidl/test/VectorFoo.aidl b/hidl2aidl/test/aidl_api/hidl2aidl_test_gen/current/hidl2aidl/test/VectorFoo.aidl
deleted file mode 100644
index bafe592..0000000
--- a/hidl2aidl/test/aidl_api/hidl2aidl_test_gen/current/hidl2aidl/test/VectorFoo.aidl
+++ /dev/null
@@ -1,27 +0,0 @@
-// FIXME: license file, or use the -l option to generate the files with the header.
-///////////////////////////////////////////////////////////////////////////////
-// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE.                          //
-///////////////////////////////////////////////////////////////////////////////
-
-// This file is a snapshot of an AIDL file. Do not edit it manually. There are
-// two cases:
-// 1). this is a frozen version file - do not edit this in any case.
-// 2). this is a 'current' file. If you make a backwards compatible change to
-//     the interface (from the latest frozen version), the build system will
-//     prompt you to update this file with `m <name>-update-api`.
-//
-// You must not make a backward incompatible change to any AIDL file built
-// with the aidl_interface module type with versions property set. The module
-// type is used to build AIDL files in a way that they can be used across
-// independently updatable components of the system. If a device is shipped
-// with such a backward incompatible change, it has a high risk of breaking
-// later when a module using the interface is updated, e.g., Mainline modules.
-
-package hidl2aidl.test;
-@VintfStability
-parcelable VectorFoo {
-  byte[] a;
-  int[] b;
-  hidl2aidl.test.Value[] c;
-  String[] d;
-}
diff --git a/hidl2aidl/test/aidl_api/hidl2aidl_test_gen/current/hidl2aidl/test/extension/ArrayFoo.aidl b/hidl2aidl/test/aidl_api/hidl2aidl_test_gen/current/hidl2aidl/test/extension/ArrayFoo.aidl
deleted file mode 100644
index 4fd7104..0000000
--- a/hidl2aidl/test/aidl_api/hidl2aidl_test_gen/current/hidl2aidl/test/extension/ArrayFoo.aidl
+++ /dev/null
@@ -1,25 +0,0 @@
-// FIXME: license file, or use the -l option to generate the files with the header.
-///////////////////////////////////////////////////////////////////////////////
-// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE.                          //
-///////////////////////////////////////////////////////////////////////////////
-
-// This file is a snapshot of an AIDL file. Do not edit it manually. There are
-// two cases:
-// 1). this is a frozen version file - do not edit this in any case.
-// 2). this is a 'current' file. If you make a backwards compatible change to
-//     the interface (from the latest frozen version), the build system will
-//     prompt you to update this file with `m <name>-update-api`.
-//
-// You must not make a backward incompatible change to any AIDL file built
-// with the aidl_interface module type with versions property set. The module
-// type is used to build AIDL files in a way that they can be used across
-// independently updatable components of the system. If a device is shipped
-// with such a backward incompatible change, it has a high risk of breaking
-// later when a module using the interface is updated, e.g., Mainline modules.
-
-package hidl2aidl.test.extension;
-@VintfStability
-parcelable ArrayFoo {
-  hidl2aidl.test.ArrayFoo base;
-  byte[] e;
-}
diff --git a/hidl2aidl/test/aidl_api/hidl2aidl_test_gen/current/hidl2aidl/test/extension/FooFlag.aidl b/hidl2aidl/test/aidl_api/hidl2aidl_test_gen/current/hidl2aidl/test/extension/FooFlag.aidl
deleted file mode 100644
index 5ba6dde..0000000
--- a/hidl2aidl/test/aidl_api/hidl2aidl_test_gen/current/hidl2aidl/test/extension/FooFlag.aidl
+++ /dev/null
@@ -1,24 +0,0 @@
-// FIXME: license file, or use the -l option to generate the files with the header.
-///////////////////////////////////////////////////////////////////////////////
-// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE.                          //
-///////////////////////////////////////////////////////////////////////////////
-
-// This file is a snapshot of an AIDL file. Do not edit it manually. There are
-// two cases:
-// 1). this is a frozen version file - do not edit this in any case.
-// 2). this is a 'current' file. If you make a backwards compatible change to
-//     the interface (from the latest frozen version), the build system will
-//     prompt you to update this file with `m <name>-update-api`.
-//
-// You must not make a backward incompatible change to any AIDL file built
-// with the aidl_interface module type with versions property set. The module
-// type is used to build AIDL files in a way that they can be used across
-// independently updatable components of the system. If a device is shipped
-// with such a backward incompatible change, it has a high risk of breaking
-// later when a module using the interface is updated, e.g., Mainline modules.
-
-package hidl2aidl.test.extension;
-@Backing(type="int") @VintfStability
-enum FooFlag {
-  FOURTH = 8,
-}
diff --git a/hidl2aidl/test/aidl_api/hidl2aidl_test_gen/current/hidl2aidl/test/extension/IFoo.aidl b/hidl2aidl/test/aidl_api/hidl2aidl_test_gen/current/hidl2aidl/test/extension/IFoo.aidl
deleted file mode 100644
index 2b525ba..0000000
--- a/hidl2aidl/test/aidl_api/hidl2aidl_test_gen/current/hidl2aidl/test/extension/IFoo.aidl
+++ /dev/null
@@ -1,24 +0,0 @@
-// FIXME: license file, or use the -l option to generate the files with the header.
-///////////////////////////////////////////////////////////////////////////////
-// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE.                          //
-///////////////////////////////////////////////////////////////////////////////
-
-// This file is a snapshot of an AIDL file. Do not edit it manually. There are
-// two cases:
-// 1). this is a frozen version file - do not edit this in any case.
-// 2). this is a 'current' file. If you make a backwards compatible change to
-//     the interface (from the latest frozen version), the build system will
-//     prompt you to update this file with `m <name>-update-api`.
-//
-// You must not make a backward incompatible change to any AIDL file built
-// with the aidl_interface module type with versions property set. The module
-// type is used to build AIDL files in a way that they can be used across
-// independently updatable components of the system. If a device is shipped
-// with such a backward incompatible change, it has a high risk of breaking
-// later when a module using the interface is updated, e.g., Mainline modules.
-
-package hidl2aidl.test.extension;
-@VintfStability
-interface IFoo {
-  int doCoolThings();
-}
diff --git a/hidl2aidl/test/aidl_api/hidl2aidl_test_gen/current/hidl2aidl/test2/IFoo.aidl b/hidl2aidl/test/aidl_api/hidl2aidl_test_gen/current/hidl2aidl/test2/IFoo.aidl
deleted file mode 100644
index 7c3fffe..0000000
--- a/hidl2aidl/test/aidl_api/hidl2aidl_test_gen/current/hidl2aidl/test2/IFoo.aidl
+++ /dev/null
@@ -1,26 +0,0 @@
-// FIXME: license file, or use the -l option to generate the files with the header.
-///////////////////////////////////////////////////////////////////////////////
-// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE.                          //
-///////////////////////////////////////////////////////////////////////////////
-
-// This file is a snapshot of an AIDL file. Do not edit it manually. There are
-// two cases:
-// 1). this is a frozen version file - do not edit this in any case.
-// 2). this is a 'current' file. If you make a backwards compatible change to
-//     the interface (from the latest frozen version), the build system will
-//     prompt you to update this file with `m <name>-update-api`.
-//
-// You must not make a backward incompatible change to any AIDL file built
-// with the aidl_interface module type with versions property set. The module
-// type is used to build AIDL files in a way that they can be used across
-// independently updatable components of the system. If a device is shipped
-// with such a backward incompatible change, it has a high risk of breaking
-// later when a module using the interface is updated, e.g., Mainline modules.
-
-package hidl2aidl.test2;
-@VintfStability
-interface IFoo {
-  void shouldImportExternalTypes(in hidl2aidl.test.IFoo foo);
-  oneway void someFoo(in byte a);
-  void useImportedEnum(in hidl2aidl.test.Value value);
-}
diff --git a/hidl2aidl/test/cpp_test_compile.cpp b/hidl2aidl/test/cpp_test_compile.cpp
index 56ad7ce..98048bb 100644
--- a/hidl2aidl/test/cpp_test_compile.cpp
+++ b/hidl2aidl/test/cpp_test_compile.cpp
@@ -17,68 +17,54 @@
 // This is a compilation test only, to see that types are generated as
 // expected.
 
-#include <hidl2aidl/test/BnBar.h>
-#include <hidl2aidl/test/BnFoo.h>
-#include <hidl2aidl/test/BpBar.h>
-#include <hidl2aidl/test/BpFoo.h>
-#include <hidl2aidl/test/IBar.h>
-#include <hidl2aidl/test/IBarInner.h>
-#include <hidl2aidl/test/IFoo.h>
-#include <hidl2aidl/test/IFooBigStruct.h>
-#include <hidl2aidl/test/NameCollision.h>
-#include <hidl2aidl/test/OnlyIn10.h>
-#include <hidl2aidl/test/OnlyIn11.h>
-#include <hidl2aidl/test/Outer.h>
-#include <hidl2aidl/test/OuterInner.h>
-#include <hidl2aidl/test/OverrideMe.h>
-#include <hidl2aidl/test/Value.h>
-#include <hidl2aidl/test2/BnFoo.h>
-#include <hidl2aidl/test2/BpFoo.h>
-#include <hidl2aidl/test2/IFoo.h>
+#include <hidl2aidl/BnBar.h>
+#include <hidl2aidl/BnFoo.h>
+#include <hidl2aidl/BpBar.h>
+#include <hidl2aidl/BpFoo.h>
+#include <hidl2aidl/IBar.h>
+#include <hidl2aidl/IBarInner.h>
+#include <hidl2aidl/IFoo.h>
+#include <hidl2aidl/IFooBigStruct.h>
+#include <hidl2aidl/OnlyIn10.h>
+#include <hidl2aidl/OnlyIn11.h>
+#include <hidl2aidl/Outer.h>
+#include <hidl2aidl/OuterInner.h>
+#include <hidl2aidl/OverrideMe.h>
+#include <hidl2aidl/Value.h>
+#include <hidl2aidl2/BnFoo.h>
+#include <hidl2aidl2/BpFoo.h>
+#include <hidl2aidl2/IFoo.h>
 
 using android::sp;
 using android::String16;
 using android::binder::Status;
 
-void testIFoo(const sp<hidl2aidl::test::IFoo>& foo) {
-    Status status1 = foo->someBar(String16(), String16());
+void testIFoo(const sp<hidl2aidl::IFoo>& foo) {
+    Status status1 = foo->someBar(String16());
     (void)status1;
     String16 f;
     Status status2 = foo->oneOutput(&f);
     (void)status2;
-    hidl2aidl::test::IFooBigStruct big_struct;
-    big_struct.type = 2;
-    big_struct.value = 3;
-    // Test some of the types here as well
-    hidl2aidl::test::Outer outer;
-    outer.inner.a = 1;
-    outer.a = 2;
-    hidl2aidl::test::OverrideMe override;
-    override.a = String16();
-    hidl2aidl::test::NameCollision collision;
-    collision.a = 1;
-    collision.b = String16();
-    collision.c = String16();
 }
 
-void testIBar(const sp<hidl2aidl::test::IBar>& bar) {
+void testIBar(const sp<hidl2aidl::IBar>& bar) {
     String16 out;
     Status status1 = bar->someBar(String16(), 3, &out);
     (void)status1;
-    hidl2aidl::test::IBarInner inner;
+    hidl2aidl::IBarInner inner;
     inner.a = 3;
     Status status2 = bar->extraMethod(inner);
     (void)status2;
 }
 
-static_assert(static_cast<int>(hidl2aidl::test::Value::A) == 3);
-static_assert(static_cast<int>(hidl2aidl::test::Value::B) == 7);
-static_assert(static_cast<int>(hidl2aidl::test::Value::C) == 8);
-static_assert(static_cast<int>(hidl2aidl::test::Value::D) == 9);
-static_assert(static_cast<int>(hidl2aidl::test::Value::E) == 27);
-static_assert(static_cast<int>(hidl2aidl::test::Value::F) == 28);
+static_assert(static_cast<int>(hidl2aidl::Value::A) == 3);
+static_assert(static_cast<int>(hidl2aidl::Value::B) == 7);
+static_assert(static_cast<int>(hidl2aidl::Value::C) == 8);
+static_assert(static_cast<int>(hidl2aidl::Value::D) == 9);
+static_assert(static_cast<int>(hidl2aidl::Value::E) == 27);
+static_assert(static_cast<int>(hidl2aidl::Value::F) == 28);
 
-void testIFoo2(const sp<hidl2aidl::test2::IFoo>& foo) {
+void testIFoo2(const sp<hidl2aidl2::IFoo>& foo) {
     Status status = foo->someFoo(3);
     (void)status;
 }
diff --git a/hidl2aidl/test/extension/1.2/Android.bp b/hidl2aidl/test/extension/1.2/Android.bp
deleted file mode 100644
index 3124132..0000000
--- a/hidl2aidl/test/extension/1.2/Android.bp
+++ /dev/null
@@ -1,28 +0,0 @@
-// This file is autogenerated by hidl-gen -Landroidbp.
-
-package {
-    // See: http://go/android-license-faq
-    // A large-scale-change added 'default_applicable_licenses' to import
-    // all of the 'license_kinds' from "system_tools_hidl_license"
-    // to get the below license kinds:
-    //   SPDX-license-identifier-Apache-2.0
-    default_applicable_licenses: ["system_tools_hidl_license"],
-}
-
-hidl_interface {
-    name: "hidl2aidl.test.extension@1.2",
-    root: "hidl2aidl.test",
-    system_ext_specific: true,
-    srcs: [
-        "types.hal",
-        "IFoo.hal",
-    ],
-    interfaces: [
-        "android.hidl.base@1.0",
-        "android.hidl.safe_union@1.0",
-        "hidl2aidl.test@1.0",
-        "hidl2aidl.test@1.1",
-        "hidl2aidl.test@1.2",
-    ],
-    gen_java: true,
-}
diff --git a/hidl2aidl/test/extension/1.2/IFoo.hal b/hidl2aidl/test/extension/1.2/IFoo.hal
deleted file mode 100644
index ee5bc73..0000000
--- a/hidl2aidl/test/extension/1.2/IFoo.hal
+++ /dev/null
@@ -1,7 +0,0 @@
-package hidl2aidl.test.extension@1.2;
-
-import hidl2aidl.test@1.2::IFoo;
-
-interface IFoo extends hidl2aidl.test@1.2::IFoo {
-    doCoolThings() generates (int32_t status);
-};
diff --git a/hidl2aidl/test/extension/1.2/types.hal b/hidl2aidl/test/extension/1.2/types.hal
deleted file mode 100644
index 22cf760..0000000
--- a/hidl2aidl/test/extension/1.2/types.hal
+++ /dev/null
@@ -1,13 +0,0 @@
-package hidl2aidl.test.extension@1.2;
-
-import hidl2aidl.test@1.2::FooFlag;
-import hidl2aidl.test@1.2::ArrayFoo;
-
-enum FooFlag : hidl2aidl.test@1.2::FooFlag {
-    FOURTH = 0x1 << 3,
-};
-
-struct ArrayFoo {
-    hidl2aidl.test@1.2::ArrayFoo base;
-    int8_t[12] e;
-};
diff --git a/hidl2aidl/test/ndk_test_compile.cpp b/hidl2aidl/test/ndk_test_compile.cpp
index 5b427c5..5ddbcbb 100644
--- a/hidl2aidl/test/ndk_test_compile.cpp
+++ b/hidl2aidl/test/ndk_test_compile.cpp
@@ -17,50 +17,50 @@
 // This is a compilation test only, to see that types are generated as
 // expected.
 
-#include <aidl/hidl2aidl/test/BnBar.h>
-#include <aidl/hidl2aidl/test/BnFoo.h>
-#include <aidl/hidl2aidl/test/BpBar.h>
-#include <aidl/hidl2aidl/test/BpFoo.h>
-#include <aidl/hidl2aidl/test/IBar.h>
-#include <aidl/hidl2aidl/test/IBarInner.h>
-#include <aidl/hidl2aidl/test/IFoo.h>
-#include <aidl/hidl2aidl/test/IFooBigStruct.h>
-#include <aidl/hidl2aidl/test/OnlyIn10.h>
-#include <aidl/hidl2aidl/test/OnlyIn11.h>
-#include <aidl/hidl2aidl/test/Outer.h>
-#include <aidl/hidl2aidl/test/OuterInner.h>
-#include <aidl/hidl2aidl/test/OverrideMe.h>
-#include <aidl/hidl2aidl/test/Value.h>
-#include <aidl/hidl2aidl/test2/BnFoo.h>
-#include <aidl/hidl2aidl/test2/BpFoo.h>
-#include <aidl/hidl2aidl/test2/IFoo.h>
+#include <aidl/hidl2aidl/BnBar.h>
+#include <aidl/hidl2aidl/BnFoo.h>
+#include <aidl/hidl2aidl/BpBar.h>
+#include <aidl/hidl2aidl/BpFoo.h>
+#include <aidl/hidl2aidl/IBar.h>
+#include <aidl/hidl2aidl/IBarInner.h>
+#include <aidl/hidl2aidl/IFoo.h>
+#include <aidl/hidl2aidl/IFooBigStruct.h>
+#include <aidl/hidl2aidl/OnlyIn10.h>
+#include <aidl/hidl2aidl/OnlyIn11.h>
+#include <aidl/hidl2aidl/Outer.h>
+#include <aidl/hidl2aidl/OuterInner.h>
+#include <aidl/hidl2aidl/OverrideMe.h>
+#include <aidl/hidl2aidl/Value.h>
+#include <aidl/hidl2aidl2/BnFoo.h>
+#include <aidl/hidl2aidl2/BpFoo.h>
+#include <aidl/hidl2aidl2/IFoo.h>
 
-void testIFoo(const std::shared_ptr<aidl::hidl2aidl::test::IFoo>& foo) {
-    ndk::ScopedAStatus status1 = foo->someBar(std::string(), std::string());
+void testIFoo(const std::shared_ptr<aidl::hidl2aidl::IFoo>& foo) {
+    ndk::ScopedAStatus status1 = foo->someBar(std::string());
     (void)status1;
     std::string f;
     ndk::ScopedAStatus status2 = foo->oneOutput(&f);
     (void)status2;
 }
 
-void testIBar(const std::shared_ptr<aidl::hidl2aidl::test::IBar>& bar) {
+void testIBar(const std::shared_ptr<aidl::hidl2aidl::IBar>& bar) {
     std::string out;
     ndk::ScopedAStatus status1 = bar->someBar(std::string(), 3, &out);
     (void)status1;
-    aidl::hidl2aidl::test::IBarInner inner;
+    aidl::hidl2aidl::IBarInner inner;
     inner.a = 3;
     ndk::ScopedAStatus status2 = bar->extraMethod(inner);
     (void)status2;
 }
 
-static_assert(static_cast<int>(aidl::hidl2aidl::test::Value::A) == 3);
-static_assert(static_cast<int>(aidl::hidl2aidl::test::Value::B) == 7);
-static_assert(static_cast<int>(aidl::hidl2aidl::test::Value::C) == 8);
-static_assert(static_cast<int>(aidl::hidl2aidl::test::Value::D) == 9);
-static_assert(static_cast<int>(aidl::hidl2aidl::test::Value::E) == 27);
-static_assert(static_cast<int>(aidl::hidl2aidl::test::Value::F) == 28);
+static_assert(static_cast<int>(aidl::hidl2aidl::Value::A) == 3);
+static_assert(static_cast<int>(aidl::hidl2aidl::Value::B) == 7);
+static_assert(static_cast<int>(aidl::hidl2aidl::Value::C) == 8);
+static_assert(static_cast<int>(aidl::hidl2aidl::Value::D) == 9);
+static_assert(static_cast<int>(aidl::hidl2aidl::Value::E) == 27);
+static_assert(static_cast<int>(aidl::hidl2aidl::Value::F) == 28);
 
-void testIFoo2(const std::shared_ptr<aidl::hidl2aidl::test2::IFoo>& foo) {
+void testIFoo2(const std::shared_ptr<aidl::hidl2aidl2::IFoo>& foo) {
     ndk::ScopedAStatus status = foo->someFoo(3);
     (void)status;
 }
diff --git a/hidl2aidl/test/run_build_file_test.sh b/hidl2aidl/test/run_build_file_test.sh
deleted file mode 100755
index 306da53..0000000
--- a/hidl2aidl/test/run_build_file_test.sh
+++ /dev/null
@@ -1,18 +0,0 @@
-#!/bin/bash
-
-if [[ -z $ANDROID_BUILD_TOP ]]; then
-    echo "ANDROID_BUILD_TOP not defined, lunch?"
-    exit 1
-fi
-
-set -ex
-
-$ANDROID_BUILD_TOP/build/soong/soong_ui.bash --make-mode hidl2aidl
-
-hidl2aidl -o $ANDROID_BUILD_TOP/system/tools/hidl/hidl2aidl/test/build_test_delete_me \
-  -rhidl2aidl.test:system/tools/hidl/hidl2aidl/test hidl2aidl.test@3.0
-
-$ANDROID_BUILD_TOP/build/soong/soong_ui.bash --make-mode hidl2aidl.test3-update-api
-
-$ANDROID_BUILD_TOP/build/soong/soong_ui.bash --make-mode \
-      MODULES-IN-system-tools-hidl-hidl2aidl
diff --git a/hidl2aidl/test/translate_cpp_test.cpp b/hidl2aidl/test/translate_cpp_test.cpp
deleted file mode 100644
index 40f1cda..0000000
--- a/hidl2aidl/test/translate_cpp_test.cpp
+++ /dev/null
@@ -1,292 +0,0 @@
-/*
- * Copyright (C) 2020 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include <hidl2aidl/test/extension/translate-cpp.h>
-#include <hidl2aidl/test/translate-cpp.h>
-
-#include <gtest/gtest.h>
-
-class Hidl2aidlTranslateTest : public ::testing::Test {};
-
-namespace android {
-
-TEST_F(Hidl2aidlTranslateTest, OnlyIn10) {
-    hidl2aidl::test::OnlyIn10 dest;
-    hidl2aidl::test::V1_0::OnlyIn10 source;
-    source.str = "Hello";
-    ASSERT_TRUE(h2a::translate(source, &dest));
-    EXPECT_EQ(source.str, String8(dest.str).c_str());
-}
-
-TEST_F(Hidl2aidlTranslateTest, OnlyIn11) {
-    hidl2aidl::test::OnlyIn11 dest;
-    hidl2aidl::test::V1_1::OnlyIn11 source;
-    source.str = 12;
-    ASSERT_TRUE(h2a::translate(source, &dest));
-    EXPECT_EQ(source.str, dest.str);
-}
-
-TEST_F(Hidl2aidlTranslateTest, OverrideMe) {
-    hidl2aidl::test::OverrideMe dest;
-    hidl2aidl::test::V1_1::OverrideMe source;
-    source.a = "World";
-    ASSERT_TRUE(h2a::translate(source, &dest));
-    EXPECT_EQ(source.a, String8(dest.a).c_str());
-}
-
-TEST_F(Hidl2aidlTranslateTest, Outer) {
-    hidl2aidl::test::Outer dest;
-    hidl2aidl::test::V1_1::Outer source;
-    source.a = 12;
-    source.v1_0.inner.a = 16;
-    ASSERT_TRUE(h2a::translate(source, &dest));
-    EXPECT_EQ(source.a, dest.a);
-    EXPECT_EQ(source.v1_0.inner.a, dest.inner.a);
-}
-
-TEST_F(Hidl2aidlTranslateTest, OuterInner) {
-    hidl2aidl::test::OuterInner dest;
-    hidl2aidl::test::V1_0::Outer::Inner source;
-    source.a = 12;
-    ASSERT_TRUE(h2a::translate(source, &dest));
-    EXPECT_EQ(source.a, dest.a);
-}
-
-TEST_F(Hidl2aidlTranslateTest, NameCollision) {
-    hidl2aidl::test::NameCollision dest;
-    hidl2aidl::test::V1_2::NameCollision source;
-    source.reference.reference.a = 12;
-    source.reference.b = "Fancy";
-    source.c = "Car";
-    ASSERT_TRUE(h2a::translate(source, &dest));
-    EXPECT_EQ(source.reference.reference.a, dest.a);
-    EXPECT_EQ(source.reference.b, String8(dest.b).c_str());
-    EXPECT_EQ(source.c, String8(dest.c).c_str());
-}
-
-TEST_F(Hidl2aidlTranslateTest, IFooBigStruct) {
-    hidl2aidl::test::IFooBigStruct dest;
-    hidl2aidl::test::V1_1::IFoo::BigStruct source;
-    source.type = 12;
-    source.value = 16;
-    ASSERT_TRUE(h2a::translate(source, &dest));
-    EXPECT_EQ(source.type, dest.type);
-    EXPECT_EQ(source.value, dest.value);
-}
-
-TEST_F(Hidl2aidlTranslateTest, IBarInner) {
-    hidl2aidl::test::IBarInner dest;
-    hidl2aidl::test::V1_0::IBar::Inner source;
-    source.a = 0x70000000;
-    ASSERT_TRUE(h2a::translate(source, &dest));
-    EXPECT_EQ(static_cast<int32_t>(source.a), dest.a);
-}
-
-TEST_F(Hidl2aidlTranslateTest, UnsignedToSignedTooLarge) {
-    hidl2aidl::test::IBarInner dest;
-    hidl2aidl::test::V1_0::IBar::Inner source;
-    // source.a is uint32_t, dest.a is int32_t
-    source.a = 0xf0000000;
-    ASSERT_FALSE(h2a::translate(source, &dest));
-    EXPECT_NE(static_cast<int32_t>(source.a), dest.a);
-}
-
-TEST_F(Hidl2aidlTranslateTest, SafeUnionBarByte) {
-    hidl2aidl::test::SafeUnionBar dest;
-    hidl2aidl::test::V1_2::SafeUnionBar source;
-    source.a(8);
-    ASSERT_TRUE(h2a::translate(source, &dest));
-    EXPECT_EQ(source.a(), dest.get<hidl2aidl::test::SafeUnionBar::a>());
-}
-
-TEST_F(Hidl2aidlTranslateTest, SafeUnionBarInt64) {
-    hidl2aidl::test::SafeUnionBar dest;
-    hidl2aidl::test::V1_2::SafeUnionBar source;
-    source.b(25000);
-    ASSERT_TRUE(h2a::translate(source, &dest));
-    EXPECT_EQ(static_cast<int64_t>(source.b()), dest.get<hidl2aidl::test::SafeUnionBar::b>());
-}
-
-TEST_F(Hidl2aidlTranslateTest, SafeUnionBarInnerStructBar) {
-    hidl2aidl::test::SafeUnionBar dest;
-    hidl2aidl::test::V1_2::SafeUnionBar source;
-    hidl2aidl::test::V1_2::SafeUnionBar::InnerStructBar inner;
-    inner.x = 8;
-    inner.z = 12;
-    source.innerStructBar(inner);
-    ASSERT_TRUE(h2a::translate(source, &dest));
-    EXPECT_EQ(source.innerStructBar().x,
-              dest.get<hidl2aidl::test::SafeUnionBar::innerStructBar>().x);
-    EXPECT_EQ(source.innerStructBar().z,
-              dest.get<hidl2aidl::test::SafeUnionBar::innerStructBar>().z);
-}
-
-TEST_F(Hidl2aidlTranslateTest, SafeUnionBarOnlyIn11) {
-    hidl2aidl::test::SafeUnionBar dest;
-    hidl2aidl::test::V1_2::SafeUnionBar source;
-    hidl2aidl::test::V1_1::OnlyIn11 onlyIn11;
-    onlyIn11.str = 12;
-    source.c(onlyIn11);
-    ASSERT_TRUE(h2a::translate(source, &dest));
-    EXPECT_EQ(source.c().str, dest.get<hidl2aidl::test::SafeUnionBar::c>().str);
-}
-
-TEST_F(Hidl2aidlTranslateTest, SafeUnionBarString) {
-    hidl2aidl::test::SafeUnionBar dest;
-    hidl2aidl::test::V1_2::SafeUnionBar source;
-    source.d("Hello world!");
-    ASSERT_TRUE(h2a::translate(source, &dest));
-    EXPECT_EQ(source.d(), String8(dest.get<hidl2aidl::test::SafeUnionBar::d>()).c_str());
-}
-
-TEST_F(Hidl2aidlTranslateTest, SafeUnionBarFloat) {
-    hidl2aidl::test::SafeUnionBar dest;
-    hidl2aidl::test::V1_2::SafeUnionBar source;
-    source.e(3.5f);
-    ASSERT_TRUE(h2a::translate(source, &dest));
-    EXPECT_EQ(source.e(), dest.get<hidl2aidl::test::SafeUnionBar::e>());
-}
-
-TEST_F(Hidl2aidlTranslateTest, SafeUnionBarDouble) {
-    hidl2aidl::test::SafeUnionBar dest;
-    hidl2aidl::test::V1_2::SafeUnionBar source;
-    source.f(3e10);
-    ASSERT_TRUE(h2a::translate(source, &dest));
-    EXPECT_EQ(source.f(), dest.get<hidl2aidl::test::SafeUnionBar::f>());
-}
-
-TEST_F(Hidl2aidlTranslateTest, SafeUnionBarBitfield) {
-    hidl2aidl::test::SafeUnionBar dest;
-    hidl2aidl::test::V1_2::SafeUnionBar source;
-    ::android::hardware::hidl_bitfield<::hidl2aidl::test::V1_2::FooFlag> bits(0);
-    bits |= hidl2aidl::test::V1_2::FooFlag::THIRD;
-    source.g(bits);
-    ASSERT_TRUE(h2a::translate(source, &dest));
-    EXPECT_EQ(static_cast<hidl2aidl::test::FooFlag>(source.g()),
-              dest.get<hidl2aidl::test::SafeUnionBar::g>());
-}
-
-TEST_F(Hidl2aidlTranslateTest, SafeUnionBarEnum) {
-    hidl2aidl::test::SafeUnionBar dest;
-    hidl2aidl::test::V1_2::SafeUnionBar source;
-    source.h(hidl2aidl::test::V1_1::Value::B);
-    ASSERT_TRUE(h2a::translate(source, &dest));
-    EXPECT_EQ(static_cast<hidl2aidl::test::Value>(source.h()),
-              dest.get<hidl2aidl::test::SafeUnionBar::h>());
-}
-
-TEST_F(Hidl2aidlTranslateTest, SafeUnionBarChar16) {
-    hidl2aidl::test::SafeUnionBar dest;
-    hidl2aidl::test::V1_2::SafeUnionBar source;
-    source.i(12);
-    ASSERT_TRUE(h2a::translate(source, &dest));
-    EXPECT_EQ(source.i(), dest.get<hidl2aidl::test::SafeUnionBar::i>());
-}
-
-TEST_F(Hidl2aidlTranslateTest, ArrayFoo) {
-    hidl2aidl::test::ArrayFoo dest;
-    hidl2aidl::test::V1_2::ArrayFoo source;
-    source.a[0] = 42;
-    source.a[1] = 8;
-    ASSERT_TRUE(h2a::translate(source, &dest));
-    ASSERT_EQ(12u, dest.a.size());
-    EXPECT_EQ(source.a[0], dest.a[0]);
-    EXPECT_EQ(source.a[1], dest.a[1]);
-    EXPECT_EQ(source.a[2], dest.a[2]);
-    EXPECT_EQ(source.a[11], dest.a[11]);
-}
-
-TEST_F(Hidl2aidlTranslateTest, ArrayFooEmpty) {
-    hidl2aidl::test::ArrayFoo dest;
-    hidl2aidl::test::V1_2::ArrayFoo source;
-    ASSERT_TRUE(h2a::translate(source, &dest));
-    EXPECT_EQ(12u, dest.a.size());
-    EXPECT_EQ(0, dest.a[0]);
-}
-
-TEST_F(Hidl2aidlTranslateTest, ArrayFooEnum) {
-    hidl2aidl::test::ArrayFoo dest;
-    hidl2aidl::test::V1_2::ArrayFoo source;
-    source.c[0] = hidl2aidl::test::V1_1::Value::A;
-    source.c[1] = hidl2aidl::test::V1_1::Value::B;
-    ASSERT_TRUE(h2a::translate(source, &dest));
-    EXPECT_EQ(static_cast<hidl2aidl::test::Value>(source.c[0]), dest.c[0]);
-    EXPECT_EQ(static_cast<hidl2aidl::test::Value>(source.c[1]), dest.c[1]);
-}
-
-TEST_F(Hidl2aidlTranslateTest, ArrayFooString) {
-    hidl2aidl::test::ArrayFoo dest;
-    hidl2aidl::test::V1_2::ArrayFoo source;
-    source.d[0] = "hello";
-    source.d[1] = "world";
-    ASSERT_TRUE(h2a::translate(source, &dest));
-    EXPECT_EQ(source.d[0], String8(dest.d[0]).c_str());
-    EXPECT_EQ(source.d[1], String8(dest.d[1]).c_str());
-}
-
-TEST_F(Hidl2aidlTranslateTest, VectorFoo) {
-    hidl2aidl::test::VectorFoo dest;
-    hidl2aidl::test::V1_2::VectorFoo source;
-    source.a = {42, 8};
-    ASSERT_TRUE(h2a::translate(source, &dest));
-    EXPECT_EQ(source.a[0], dest.a[0]);
-    EXPECT_EQ(source.a[1], dest.a[1]);
-}
-
-TEST_F(Hidl2aidlTranslateTest, VectorFooEmpty) {
-    hidl2aidl::test::VectorFoo dest;
-    hidl2aidl::test::V1_2::VectorFoo source;
-    ASSERT_TRUE(h2a::translate(source, &dest));
-    EXPECT_EQ(0u, dest.a.size());
-}
-
-TEST_F(Hidl2aidlTranslateTest, VectorFooUnsigned) {
-    hidl2aidl::test::VectorFoo dest;
-    hidl2aidl::test::V1_2::VectorFoo source;
-    // source.a is uint32_t, dest.a is int32_t
-    source.b = {12, 0xf0000000};
-    ASSERT_FALSE(h2a::translate(source, &dest));
-}
-
-TEST_F(Hidl2aidlTranslateTest, VectorFooEnum) {
-    hidl2aidl::test::VectorFoo dest;
-    hidl2aidl::test::V1_2::VectorFoo source;
-    source.c = {hidl2aidl::test::V1_1::Value::A, hidl2aidl::test::V1_1::Value::B};
-    ASSERT_TRUE(h2a::translate(source, &dest));
-    EXPECT_EQ(static_cast<hidl2aidl::test::Value>(source.c[0]), dest.c[0]);
-    EXPECT_EQ(static_cast<hidl2aidl::test::Value>(source.c[1]), dest.c[1]);
-}
-
-TEST_F(Hidl2aidlTranslateTest, VectorFooString) {
-    hidl2aidl::test::VectorFoo dest;
-    hidl2aidl::test::V1_2::VectorFoo source;
-    source.d = {"hello", "world"};
-    ASSERT_TRUE(h2a::translate(source, &dest));
-    EXPECT_EQ(source.d[0], String8(dest.d[0]).c_str());
-    EXPECT_EQ(source.d[1], String8(dest.d[1]).c_str());
-}
-
-TEST_F(Hidl2aidlTranslateTest, ExtensionArrayFoo) {
-    hidl2aidl::test::extension::ArrayFoo dest;
-    hidl2aidl::test::extension::V1_2::ArrayFoo source;
-    source.e[0] = 12;
-    source.e[1] = 2;
-    ASSERT_TRUE(h2a::translate(source, &dest));
-    EXPECT_EQ(source.e[0], dest.e[0]);
-    EXPECT_EQ(source.e[1], dest.e[1]);
-}
-
-}  // namespace android
diff --git a/hidl2aidl/test/translate_ndk_test.cpp b/hidl2aidl/test/translate_ndk_test.cpp
deleted file mode 100644
index ec49dea..0000000
--- a/hidl2aidl/test/translate_ndk_test.cpp
+++ /dev/null
@@ -1,292 +0,0 @@
-/*
- * Copyright (C) 2020 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include <hidl2aidl/test/extension/translate-ndk.h>
-#include <hidl2aidl/test/translate-ndk.h>
-
-#include <gtest/gtest.h>
-
-class Hidl2aidlTranslateTest : public ::testing::Test {};
-
-namespace android {
-
-TEST_F(Hidl2aidlTranslateTest, Onlyin10) {
-    aidl::hidl2aidl::test::OnlyIn10 dest;
-    hidl2aidl::test::V1_0::OnlyIn10 source;
-    source.str = "Hello";
-    ASSERT_TRUE(h2a::translate(source, &dest));
-    EXPECT_EQ(source.str, dest.str);
-}
-
-TEST_F(Hidl2aidlTranslateTest, OnlyIn11) {
-    aidl::hidl2aidl::test::OnlyIn11 dest;
-    hidl2aidl::test::V1_1::OnlyIn11 source;
-    source.str = 12;
-    ASSERT_TRUE(h2a::translate(source, &dest));
-    EXPECT_EQ(source.str, dest.str);
-}
-
-TEST_F(Hidl2aidlTranslateTest, OverrideMe) {
-    aidl::hidl2aidl::test::OverrideMe dest;
-    hidl2aidl::test::V1_1::OverrideMe source;
-    source.a = "World";
-    ASSERT_TRUE(h2a::translate(source, &dest));
-    EXPECT_EQ(source.a, dest.a);
-}
-
-TEST_F(Hidl2aidlTranslateTest, Outer) {
-    aidl::hidl2aidl::test::Outer dest;
-    hidl2aidl::test::V1_1::Outer source;
-    source.a = 12;
-    source.v1_0.inner.a = 16;
-    ASSERT_TRUE(h2a::translate(source, &dest));
-    EXPECT_EQ(source.a, dest.a);
-    EXPECT_EQ(source.v1_0.inner.a, dest.inner.a);
-}
-
-TEST_F(Hidl2aidlTranslateTest, OuterInner) {
-    aidl::hidl2aidl::test::OuterInner dest;
-    hidl2aidl::test::V1_0::Outer::Inner source;
-    source.a = 12;
-    ASSERT_TRUE(h2a::translate(source, &dest));
-    EXPECT_EQ(source.a, dest.a);
-}
-
-TEST_F(Hidl2aidlTranslateTest, NameCollision) {
-    aidl::hidl2aidl::test::NameCollision dest;
-    hidl2aidl::test::V1_2::NameCollision source;
-    source.reference.reference.a = 12;
-    source.reference.b = "Fancy";
-    source.c = "Car";
-    ASSERT_TRUE(h2a::translate(source, &dest));
-    EXPECT_EQ(source.reference.reference.a, dest.a);
-    EXPECT_EQ(source.reference.b, dest.b);
-    EXPECT_EQ(source.c, dest.c);
-}
-
-TEST_F(Hidl2aidlTranslateTest, IFooBigStruct) {
-    aidl::hidl2aidl::test::IFooBigStruct dest;
-    hidl2aidl::test::V1_1::IFoo::BigStruct source;
-    source.type = 12;
-    source.value = 16;
-    ASSERT_TRUE(h2a::translate(source, &dest));
-    EXPECT_EQ(source.type, dest.type);
-    EXPECT_EQ(source.value, dest.value);
-}
-
-TEST_F(Hidl2aidlTranslateTest, IBarInner) {
-    aidl::hidl2aidl::test::IBarInner dest;
-    hidl2aidl::test::V1_0::IBar::Inner source;
-    source.a = 0x70000000;
-    ASSERT_TRUE(h2a::translate(source, &dest));
-    EXPECT_EQ(static_cast<int32_t>(source.a), dest.a);
-}
-
-TEST_F(Hidl2aidlTranslateTest, UnsignedToSignedTooLarge) {
-    aidl::hidl2aidl::test::IBarInner dest;
-    hidl2aidl::test::V1_0::IBar::Inner source;
-    // source.a is uint32_t, dest.a is int32_t
-    source.a = 0xf0000000;
-    ASSERT_FALSE(h2a::translate(source, &dest));
-    EXPECT_NE(static_cast<int32_t>(source.a), dest.a);
-}
-
-TEST_F(Hidl2aidlTranslateTest, SafeUnionBarByte) {
-    aidl::hidl2aidl::test::SafeUnionBar dest;
-    hidl2aidl::test::V1_2::SafeUnionBar source;
-    source.a(8);
-    ASSERT_TRUE(h2a::translate(source, &dest));
-    EXPECT_EQ(source.a(), dest.get<aidl::hidl2aidl::test::SafeUnionBar::a>());
-}
-
-TEST_F(Hidl2aidlTranslateTest, SafeUnionBarInt64) {
-    aidl::hidl2aidl::test::SafeUnionBar dest;
-    hidl2aidl::test::V1_2::SafeUnionBar source;
-    source.b(25000);
-    ASSERT_TRUE(h2a::translate(source, &dest));
-    EXPECT_EQ(static_cast<int64_t>(source.b()), dest.get<aidl::hidl2aidl::test::SafeUnionBar::b>());
-}
-
-TEST_F(Hidl2aidlTranslateTest, SafeUnionBarInnerStructBar) {
-    aidl::hidl2aidl::test::SafeUnionBar dest;
-    hidl2aidl::test::V1_2::SafeUnionBar source;
-    hidl2aidl::test::V1_2::SafeUnionBar::InnerStructBar inner;
-    inner.x = 8;
-    inner.z = 12;
-    source.innerStructBar(inner);
-    ASSERT_TRUE(h2a::translate(source, &dest));
-    EXPECT_EQ(source.innerStructBar().x,
-              dest.get<aidl::hidl2aidl::test::SafeUnionBar::innerStructBar>().x);
-    EXPECT_EQ(source.innerStructBar().z,
-              dest.get<aidl::hidl2aidl::test::SafeUnionBar::innerStructBar>().z);
-}
-
-TEST_F(Hidl2aidlTranslateTest, SafeUnionBarOnlyIn11) {
-    aidl::hidl2aidl::test::SafeUnionBar dest;
-    hidl2aidl::test::V1_2::SafeUnionBar source;
-    hidl2aidl::test::V1_1::OnlyIn11 onlyIn11;
-    onlyIn11.str = 12;
-    source.c(onlyIn11);
-    ASSERT_TRUE(h2a::translate(source, &dest));
-    EXPECT_EQ(source.c().str, dest.get<aidl::hidl2aidl::test::SafeUnionBar::c>().str);
-}
-
-TEST_F(Hidl2aidlTranslateTest, SafeUnionBarString) {
-    aidl::hidl2aidl::test::SafeUnionBar dest;
-    hidl2aidl::test::V1_2::SafeUnionBar source;
-    source.d("Hello world!");
-    ASSERT_TRUE(h2a::translate(source, &dest));
-    EXPECT_EQ(source.d(), dest.get<aidl::hidl2aidl::test::SafeUnionBar::d>());
-}
-
-TEST_F(Hidl2aidlTranslateTest, SafeUnionBarFloat) {
-    aidl::hidl2aidl::test::SafeUnionBar dest;
-    hidl2aidl::test::V1_2::SafeUnionBar source;
-    source.e(3.5f);
-    ASSERT_TRUE(h2a::translate(source, &dest));
-    EXPECT_EQ(source.e(), dest.get<aidl::hidl2aidl::test::SafeUnionBar::e>());
-}
-
-TEST_F(Hidl2aidlTranslateTest, SafeUnionBarDouble) {
-    aidl::hidl2aidl::test::SafeUnionBar dest;
-    hidl2aidl::test::V1_2::SafeUnionBar source;
-    source.f(3e10);
-    ASSERT_TRUE(h2a::translate(source, &dest));
-    EXPECT_EQ(source.f(), dest.get<aidl::hidl2aidl::test::SafeUnionBar::f>());
-}
-
-TEST_F(Hidl2aidlTranslateTest, SafeUnionBarBitfield) {
-    aidl::hidl2aidl::test::SafeUnionBar dest;
-    hidl2aidl::test::V1_2::SafeUnionBar source;
-    ::android::hardware::hidl_bitfield<::hidl2aidl::test::V1_2::FooFlag> bits(0);
-    bits |= hidl2aidl::test::V1_2::FooFlag::THIRD;
-    source.g(bits);
-    ASSERT_TRUE(h2a::translate(source, &dest));
-    EXPECT_EQ(static_cast<aidl::hidl2aidl::test::FooFlag>(source.g()),
-              dest.get<aidl::hidl2aidl::test::SafeUnionBar::g>());
-}
-
-TEST_F(Hidl2aidlTranslateTest, SafeUnionBarEnum) {
-    aidl::hidl2aidl::test::SafeUnionBar dest;
-    hidl2aidl::test::V1_2::SafeUnionBar source;
-    source.h(hidl2aidl::test::V1_1::Value::B);
-    ASSERT_TRUE(h2a::translate(source, &dest));
-    EXPECT_EQ(static_cast<aidl::hidl2aidl::test::Value>(source.h()),
-              dest.get<aidl::hidl2aidl::test::SafeUnionBar::h>());
-}
-
-TEST_F(Hidl2aidlTranslateTest, SafeUnionBarChar16) {
-    aidl::hidl2aidl::test::SafeUnionBar dest;
-    hidl2aidl::test::V1_2::SafeUnionBar source;
-    source.i(12);
-    ASSERT_TRUE(h2a::translate(source, &dest));
-    EXPECT_EQ(source.i(), dest.get<aidl::hidl2aidl::test::SafeUnionBar::i>());
-}
-
-TEST_F(Hidl2aidlTranslateTest, ArrayFoo) {
-    aidl::hidl2aidl::test::ArrayFoo dest;
-    hidl2aidl::test::V1_2::ArrayFoo source;
-    source.a[0] = 42;
-    source.a[1] = 8;
-    ASSERT_TRUE(h2a::translate(source, &dest));
-    ASSERT_EQ(12u, dest.a.size());
-    EXPECT_EQ(source.a[0], dest.a[0]);
-    EXPECT_EQ(source.a[1], dest.a[1]);
-    EXPECT_EQ(source.a[2], dest.a[2]);
-    EXPECT_EQ(source.a[11], dest.a[11]);
-}
-
-TEST_F(Hidl2aidlTranslateTest, ArrayFooEmpty) {
-    aidl::hidl2aidl::test::ArrayFoo dest;
-    hidl2aidl::test::V1_2::ArrayFoo source;
-    ASSERT_TRUE(h2a::translate(source, &dest));
-    EXPECT_EQ(12u, dest.a.size());
-    EXPECT_EQ(0, dest.a[0]);
-}
-
-TEST_F(Hidl2aidlTranslateTest, ArrayFooEnum) {
-    aidl::hidl2aidl::test::ArrayFoo dest;
-    hidl2aidl::test::V1_2::ArrayFoo source;
-    source.c[0] = hidl2aidl::test::V1_1::Value::A;
-    source.c[1] = hidl2aidl::test::V1_1::Value::B;
-    ASSERT_TRUE(h2a::translate(source, &dest));
-    EXPECT_EQ(static_cast<aidl::hidl2aidl::test::Value>(source.c[0]), dest.c[0]);
-    EXPECT_EQ(static_cast<aidl::hidl2aidl::test::Value>(source.c[1]), dest.c[1]);
-}
-
-TEST_F(Hidl2aidlTranslateTest, ArrayFooString) {
-    aidl::hidl2aidl::test::ArrayFoo dest;
-    hidl2aidl::test::V1_2::ArrayFoo source;
-    source.d[0] = "hello";
-    source.d[1] = "world";
-    ASSERT_TRUE(h2a::translate(source, &dest));
-    EXPECT_EQ(source.d[0], dest.d[0]);
-    EXPECT_EQ(source.d[1], dest.d[1]);
-}
-
-TEST_F(Hidl2aidlTranslateTest, VectorFoo) {
-    aidl::hidl2aidl::test::VectorFoo dest;
-    hidl2aidl::test::V1_2::VectorFoo source;
-    source.a = {42, 8};
-    ASSERT_TRUE(h2a::translate(source, &dest));
-    EXPECT_EQ(source.a[0], dest.a[0]);
-    EXPECT_EQ(source.a[1], dest.a[1]);
-}
-
-TEST_F(Hidl2aidlTranslateTest, VectorFooEmpty) {
-    aidl::hidl2aidl::test::VectorFoo dest;
-    hidl2aidl::test::V1_2::VectorFoo source;
-    ASSERT_TRUE(h2a::translate(source, &dest));
-    EXPECT_EQ(0u, dest.a.size());
-}
-
-TEST_F(Hidl2aidlTranslateTest, VectorFooUnsigned) {
-    aidl::hidl2aidl::test::VectorFoo dest;
-    hidl2aidl::test::V1_2::VectorFoo source;
-    // source.a is uint32_t, dest.a is int32_t
-    source.b = {12, 0xf0000000};
-    ASSERT_FALSE(h2a::translate(source, &dest));
-}
-
-TEST_F(Hidl2aidlTranslateTest, VectorFooEnum) {
-    aidl::hidl2aidl::test::VectorFoo dest;
-    hidl2aidl::test::V1_2::VectorFoo source;
-    source.c = {hidl2aidl::test::V1_1::Value::A, hidl2aidl::test::V1_1::Value::B};
-    ASSERT_TRUE(h2a::translate(source, &dest));
-    EXPECT_EQ(static_cast<aidl::hidl2aidl::test::Value>(source.c[0]), dest.c[0]);
-    EXPECT_EQ(static_cast<aidl::hidl2aidl::test::Value>(source.c[1]), dest.c[1]);
-}
-
-TEST_F(Hidl2aidlTranslateTest, VectorFooString) {
-    aidl::hidl2aidl::test::VectorFoo dest;
-    hidl2aidl::test::V1_2::VectorFoo source;
-    source.d = {"hello", "world"};
-    ASSERT_TRUE(h2a::translate(source, &dest));
-    EXPECT_EQ(source.d[0], dest.d[0]);
-    EXPECT_EQ(source.d[1], dest.d[1]);
-}
-
-TEST_F(Hidl2aidlTranslateTest, ExtensionArrayFoo) {
-    aidl::hidl2aidl::test::extension::ArrayFoo dest;
-    hidl2aidl::test::extension::V1_2::ArrayFoo source;
-    source.e[0] = 12;
-    source.e[1] = 2;
-    ASSERT_TRUE(h2a::translate(source, &dest));
-    EXPECT_EQ(source.e[0], dest.e[0]);
-    EXPECT_EQ(source.e[1], dest.e[1]);
-}
-
-}  // namespace android
diff --git a/host_utils/Android.bp b/host_utils/Android.bp
index ded575f..f1c4818 100644
--- a/host_utils/Android.bp
+++ b/host_utils/Android.bp
@@ -12,15 +12,6 @@
 // See the License for the specific language governing permissions and
 // limitations under the License.
 
-package {
-    // See: http://go/android-license-faq
-    // A large-scale-change added 'default_applicable_licenses' to import
-    // all of the 'license_kinds' from "system_tools_hidl_license"
-    // to get the below license kinds:
-    //   SPDX-license-identifier-Apache-2.0
-    default_applicable_licenses: ["system_tools_hidl_license"],
-}
-
 cc_library {
     name: "libhidl-gen-host-utils",
     defaults: ["hidl-gen-defaults"],
diff --git a/host_utils/Formatter.cpp b/host_utils/Formatter.cpp
index 5c73c01..c801cf7 100644
--- a/host_utils/Formatter.cpp
+++ b/host_utils/Formatter.cpp
@@ -34,7 +34,7 @@
       mCurrentPosition(0) {}
 
 Formatter::~Formatter() {
-    if (mFile != stdout && mFile != stdin && mFile != stderr) {
+    if (mFile != stdout) {
         fclose(mFile);
     }
     mFile = nullptr;
diff --git a/lint/Android.bp b/lint/Android.bp
index f91f5c7..f520220 100644
--- a/lint/Android.bp
+++ b/lint/Android.bp
@@ -14,15 +14,6 @@
  * limitations under the License.
  */
 
-package {
-    // See: http://go/android-license-faq
-    // A large-scale-change added 'default_applicable_licenses' to import
-    // all of the 'license_kinds' from "system_tools_hidl_license"
-    // to get the below license kinds:
-    //   SPDX-license-identifier-Apache-2.0
-    default_applicable_licenses: ["system_tools_hidl_license"],
-}
-
 cc_library_host_static {
     name: "libhidl-lint",
     defaults: ["hidl-gen-defaults"],
diff --git a/lint/main.cpp b/lint/main.cpp
index 004d7d6..84d9f9a 100644
--- a/lint/main.cpp
+++ b/lint/main.cpp
@@ -156,9 +156,8 @@
     }
 
     if (machineReadable) {
-        Json::StreamWriterBuilder factory;
-        std::unique_ptr<Json::StreamWriter> const writer(factory.newStreamWriter());
-        writer->write(lintJsonArray, &std::cout);
+        Json::StyledStreamWriter writer;
+        writer.write(std::cout, lintJsonArray);
     }
 
     return errorOnLints && haveLints;
diff --git a/lint/test/Android.bp b/lint/test/Android.bp
index e482c71..35fa922 100644
--- a/lint/test/Android.bp
+++ b/lint/test/Android.bp
@@ -14,15 +14,6 @@
  * limitations under the License.
  */
 
-package {
-    // See: http://go/android-license-faq
-    // A large-scale-change added 'default_applicable_licenses' to import
-    // all of the 'license_kinds' from "system_tools_hidl_license"
-    // to get the below license kinds:
-    //   SPDX-license-identifier-Apache-2.0
-    default_applicable_licenses: ["system_tools_hidl_license"],
-}
-
 cc_test_host {
     name: "hidl-lint_test",
     defaults: ["hidl-gen-defaults"],
@@ -40,8 +31,4 @@
         "liblog",
     ],
     whole_static_libs: ["libhidl-lint"],
-    test_options: {
-        // These tests currently require the source tree to run properly.
-        unit_test: false,
-    },
 }
diff --git a/main.cpp b/main.cpp
index 420351d..b25ef70 100644
--- a/main.cpp
+++ b/main.cpp
@@ -498,40 +498,16 @@
            package.inPackage("android.hardware");
 }
 
-// Keep the list of libs which are used by VNDK core libs and should be part of
-// VNDK libs
-static const std::vector<std::string> vndkLibs = {
-        "android.hardware.audio.common@2.0",
-        "android.hardware.configstore@1.0",
-        "android.hardware.configstore@1.1",
-        "android.hardware.graphics.allocator@2.0",
-        "android.hardware.graphics.allocator@3.0",
-        "android.hardware.graphics.allocator@4.0",
-        "android.hardware.graphics.bufferqueue@1.0",
-        "android.hardware.graphics.bufferqueue@2.0",
-        "android.hardware.media.bufferpool@2.0",
-        "android.hardware.media.omx@1.0",
-        "android.hardware.media@1.0",
-        "android.hardware.memtrack@1.0",
-        "android.hardware.soundtrigger@2.0",
-        "android.hidl.token@1.0",
-        "android.system.suspend@1.0",
-};
-
-bool isVndkCoreLib(const FQName& fqName) {
-    return std::find(vndkLibs.begin(), vndkLibs.end(), fqName.string()) != vndkLibs.end();
-}
-
-status_t hasVariantFile(const FQName& fqName, const Coordinator* coordinator,
-                        const std::string& fileName, bool* isVariant) {
+// TODO(b/69862859): remove special case
+status_t isTestPackage(const FQName& fqName, const Coordinator* coordinator, bool* isTestPackage) {
     const auto fileExists = [](const std::string& file) {
         struct stat buf;
         return stat(file.c_str(), &buf) == 0;
     };
 
     std::string path;
-    status_t err =
-            coordinator->getFilepath(fqName, Coordinator::Location::PACKAGE_ROOT, fileName, &path);
+    status_t err = coordinator->getFilepath(fqName, Coordinator::Location::PACKAGE_ROOT,
+                                            ".hidl_for_test", &path);
     if (err != OK) return err;
 
     const bool exists = fileExists(path);
@@ -540,19 +516,10 @@
         coordinator->onFileAccess(path, "r");
     }
 
-    *isVariant = exists;
+    *isTestPackage = exists;
     return OK;
 }
 
-status_t isSystemExtPackage(const FQName& fqName, const Coordinator* coordinator,
-                            bool* isSystemExt) {
-    return hasVariantFile(fqName, coordinator, ".hidl_for_system_ext", isSystemExt);
-}
-
-status_t isOdmPackage(const FQName& fqName, const Coordinator* coordinator, bool* isOdm) {
-    return hasVariantFile(fqName, coordinator, ".hidl_for_odm", isOdm);
-}
-
 static status_t generateAdapterMainSource(const FQName& packageFQName,
                                           const Coordinator* coordinator,
                                           const FileGenerator::GetFormatter& getFormatter) {
@@ -652,19 +619,18 @@
     if (err != OK) return err;
     bool genJavaLibrary = needsJavaCode && isJavaCompatible;
 
+    bool generateForTest;
+    err = isTestPackage(packageFQName, coordinator, &generateForTest);
+    if (err != OK) return err;
+
     bool isCoreAndroid = isCoreAndroidPackage(packageFQName);
 
-    bool isVndkCore = isVndkCoreLib(packageFQName);
-    bool isVndkSp = isSystemProcessSupportedPackage(packageFQName);
+    bool isVndk = !generateForTest && isCoreAndroid;
+    bool isVndkSp = isVndk && isSystemProcessSupportedPackage(packageFQName);
 
-    bool isSystemExtHidl;
-    err = isSystemExtPackage(packageFQName, coordinator, &isSystemExtHidl);
-    if (err != OK) return err;
-    bool isSystemExt = isSystemExtHidl || !isCoreAndroid;
-
-    bool isForOdm;
-    err = isOdmPackage(packageFQName, coordinator, &isForOdm);
-    if (err != OK) return err;
+    // Currently, all platform-provided interfaces are in the VNDK, so if it isn't in the VNDK, it
+    // is device specific and so should be put in the system_ext partition.
+    bool isSystemExt = !isCoreAndroid;
 
     std::string packageRoot;
     err = coordinator->getPackageRoot(packageFQName, &packageRoot);
@@ -684,7 +650,7 @@
             out << "owner: \"" << coordinator->getOwner() << "\",\n";
         }
         out << "root: \"" << packageRoot << "\",\n";
-        if (isVndkCore || isVndkSp) {
+        if (isVndk) {
             out << "vndk: ";
             out.block([&]() {
                 out << "enabled: true,\n";
@@ -696,9 +662,6 @@
         if (isSystemExt) {
             out << "system_ext_specific: true,\n";
         }
-        if (isForOdm) {
-            out << "odm_available: true,\n";
-        }
         (out << "srcs: [\n").indent([&] {
            for (const auto& fqName : packageInterfaces) {
                out << "\"" << fqName.name() << ".hal\",\n";
@@ -859,52 +822,6 @@
     return true;
 }
 
-bool validateForFormat(const FQName& fqName, const Coordinator* coordinator,
-                       const std::string& format) {
-    CHECK_EQ(format, "format");
-
-    if (!validateForSource(fqName, coordinator, format)) return false;
-
-    std::vector<FQName> packageInterfaces;
-
-    if (fqName.isFullyQualified()) {
-        packageInterfaces.push_back(fqName);
-    } else {
-        status_t err = coordinator->appendPackageInterfacesToVector(fqName, &packageInterfaces);
-        if (err != OK) return err;
-    }
-
-    bool destroysInformation = false;
-
-    for (const auto& fqName : packageInterfaces) {
-        AST* ast = coordinator->parse(fqName);
-
-        if (ast->getUnhandledComments().size() > 0) {
-            destroysInformation = true;
-            for (const auto& i : ast->getUnhandledComments()) {
-                std::cerr << "Unrecognized comment at " << i->location() << std::endl;
-                Formatter err(stderr);
-                err.indent();
-                i->emit(err);
-                err.unindent();
-                err.endl();
-            }
-        }
-    }
-
-    if (destroysInformation) {
-        std::cerr << "\nhidl-gen does not support comments at these locations, and formatting "
-                     "the file would destroy them. HIDL doc comments need to be multiline comments "
-                     "(/*...*/) before specific elements. This will also cause them to be emitted "
-                     "in output files in the correct locations so that IDE users or people "
-                     "inspecting generated source can see them in the correct location. Formatting "
-                     "the file would destroy these comments.\n";
-        return false;
-    }
-
-    return true;
-}
-
 FileGenerator::GenerationFunction generateExportHeaderForPackage(bool forJava) {
     return [forJava](const FQName& packageFQName, const Coordinator* coordinator,
                      const FileGenerator::GetFormatter& getFormatter) -> status_t {
@@ -937,11 +854,7 @@
         }
 
         if (exportedTypes.empty()) {
-            fprintf(stderr,
-                    "ERROR: -Ljava-constants (Android.bp: gen_java_constants) requested for %s, "
-                    "but no types declare @export.",
-                    packageFQName.string().c_str());
-            return UNKNOWN_ERROR;
+            return OK;
         }
 
         Formatter out = getFormatter();
@@ -1401,7 +1314,7 @@
         OutputMode::NEEDS_SRC,
         Coordinator::Location::PACKAGE_ROOT,
         GenerationGranularity::PER_FILE,
-        validateForFormat,
+        validateForSource,
         {
             {
                 FileGenerator::alwaysGenerate,
@@ -1583,7 +1496,8 @@
         }
 
         if (!outputFormat->validate(fqName, &coordinator, outputFormat->name())) {
-            fprintf(stderr, "ERROR: Validation failed.\n");
+            fprintf(stderr,
+                    "ERROR: output handler failed.\n");
             exit(1);
         }
 
diff --git a/metadata/Android.bp b/metadata/Android.bp
index 0f4399b..32b829a 100644
--- a/metadata/Android.bp
+++ b/metadata/Android.bp
@@ -1,13 +1,4 @@
 // build time C++ available list of all HIDL interfaces in the tree
-package {
-    // See: http://go/android-license-faq
-    // A large-scale-change added 'default_applicable_licenses' to import
-    // all of the 'license_kinds' from "system_tools_hidl_license"
-    // to get the below license kinds:
-    //   SPDX-license-identifier-Apache-2.0
-    default_applicable_licenses: ["system_tools_hidl_license"],
-}
-
 cc_library {
     name: "libhidlmetadata",
     host_supported: true,
@@ -19,36 +10,11 @@
 
 cc_library_headers {
     name: "libhidlmetadata_headers",
-    product_available: true,
     recovery_available: true,
     host_supported: true,
     export_include_dirs: ["include"],
 }
 
-cc_test_host {
-    name: "hidl_metadata_test",
-    srcs: ["test.cpp"],
-    static_libs: [
-        "libhidlmetadata",
-        "libgmock",
-    ],
-}
-
-prebuilt_hidl_interfaces {
-    name: "hidl_metadata_test_interfaces1",
-    interfaces: [
-        "hidl.metadata.test@1.0::IBar",
-    ],
-}
-
-prebuilt_hidl_interfaces {
-    name: "hidl_metadata_test_interfaces2",
-    interfaces: [
-        "hidl.metadata.test@1.0::IBaz",
-        "hidl.metadata.test@1.0::IFoo",
-    ],
-}
-
 // private impl below
 
 cc_binary {
diff --git a/metadata/parser.cpp b/metadata/parser.cpp
index 0d52f89..71613b8 100644
--- a/metadata/parser.cpp
+++ b/metadata/parser.cpp
@@ -27,13 +27,12 @@
     const std::string path = argv[1];
 
     Json::Value root;
-    Json::CharReaderBuilder builder;
+    Json::Reader reader;
 
     std::ifstream stream(path);
-    std::string errorMessage;
-    if (!Json::parseFromStream(builder, stream, &root, &errorMessage)) {
+    if (!reader.parse(stream, root)) {
         std::cerr << "Failed to read interface inheritance hierarchy file: " << path << std::endl
-                  << errorMessage << std::endl;
+                  << reader.getFormattedErrorMessages() << std::endl;
         return EXIT_FAILURE;
     }
 
diff --git a/metadata/test.cpp b/metadata/test.cpp
deleted file mode 100644
index fbd4bb5..0000000
--- a/metadata/test.cpp
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * Copyright (C) 2020 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include <gmock/gmock.h>
-#include <gtest/gtest.h>
-#include <hidl/metadata.h>
-
-#include <optional>
-
-using ::android::HidlInterfaceMetadata;
-using ::testing::ElementsAre;
-
-static std::optional<HidlInterfaceMetadata> metadataForModule(const std::string& name) {
-    for (const HidlInterfaceMetadata& info : HidlInterfaceMetadata::all()) {
-        if (name == info.name) return info;
-    }
-    return std::nullopt;
-}
-
-TEST(AidlMetadata, HasTestInstances) {
-    const auto& info = metadataForModule("android.hardware.tests.bar@1.0::IBar");
-    ASSERT_NE(info, std::nullopt);
-    EXPECT_THAT(info->inherited, ElementsAre("android.hardware.tests.foo@1.0::IFoo"));
-}
-
-TEST(AidlMetadata, HasPrebuiltInstances) {
-    for (const std::string& iface : {"hidl.metadata.test@1.0::IBar", "hidl.metadata.test@1.0::IBaz",
-                                     "hidl.metadata.test@1.0::IFoo"}) {
-        const auto& info = metadataForModule(iface);
-        ASSERT_NE(info, std::nullopt) << iface;
-    }
-}
diff --git a/scripts/hal-queries.sh b/scripts/hal-queries.sh
index e1009df..5192765 100755
--- a/scripts/hal-queries.sh
+++ b/scripts/hal-queries.sh
@@ -138,23 +138,3 @@
     echo "Done: generated sources are in $outputDir"
 }
 
-# WARNING, must have all branches in question downloaded
-# Example:
-# $ cd $ANDROID_BUILD_TOP/hardware/interfaces
-# $ repo sync -j128 . # must not use -c
-# $ hidl_current_check aosp/oreo-release aosp/oreo-mr1-release aosp/pie-release # etc..
-#
-# This can be used to make sure interfaces are not removed.
-function hidl_current_check() {
-    local args=("$@")
-    for ((i=0;i<${#args[@]} - 1;++i)); do
-        local parent="${args[i]}"
-        local child="${args[i+1]}"
-        git show-ref -q $parent || { echo "$parent doesn't exist" && continue; }
-        echo "$parent .. $child"
-        diff <(git show "$parent":current.txt | grep -oP "^[^ ]+ [^ ]+" | sort) \
-             <(git show "$child":current.txt | grep -oP "^[^ ]+ [^ ]+" | sort) |
-             grep "<"
-    done
-}
-
diff --git a/scripts/hidl2aidl-all-interfaces.sh b/scripts/hidl2aidl-all-interfaces.sh
deleted file mode 100755
index c63a45d..0000000
--- a/scripts/hidl2aidl-all-interfaces.sh
+++ /dev/null
@@ -1,26 +0,0 @@
-#!/usr/bin/env bash
-
-# Runs all released packages through the hidl2aidl tool and reports any failures
-# Requires that hidl2aidl is built.
-# 'm hidl2aidl'
-
-
-function hidl2aidl-all-interfaces-main() {
-    local ANY_FAIL=0
-    local TEST_DIR='/tmp/hidl2aidl_test'
-    set -e
-    mkdir "$TEST_DIR"
-    source "${ANDROID_BUILD_TOP}/system/tools/hidl/scripts/hal-queries.sh"
-
-    for i in $(aosp-released-packages);
-    do
-        hidl2aidl -o "$TEST_DIR" -f "$i" || \
-            { echo "FAIL: $i"; ANY_FAIL=1; }
-    done
-
-    rm -rf "$TEST_DIR"
-
-    [ $ANY_FAIL -eq 0 ] && echo 'All passed!'
-}
-
-hidl2aidl-all-interfaces-main
diff --git a/scripts/run-tests.sh b/scripts/run-tests.sh
new file mode 100755
index 0000000..bb6f7d7
--- /dev/null
+++ b/scripts/run-tests.sh
@@ -0,0 +1,114 @@
+#!/bin/bash
+
+# See hal_hidl_gtest.py
+
+THREADS=
+CHECKER=vts_testability_checker
+CHECKER_DEVICE_PATH="/data/local/tmp/${CHECKER}"
+PRINT_COMMANDS=
+
+function run() {
+    if [ "${PRINT_COMMANDS}" = true ] ; then
+        >&2 echo "*** $@"
+    fi
+    $@
+}
+
+function make_modules() {
+    if [ "${THREADS}" != "0" ] ; then
+        run make -j${THREADS} -C ${ANDROID_BUILD_TOP} -f build/core/main.mk $@
+    fi
+}
+
+function push_checker() {
+    run adb push ${OUT}/system/bin/${CHECKER} ${CHECKER_DEVICE_PATH}
+}
+
+function push_test() {
+    local module=$1
+    for test_dir in nativetest nativetest64 ; do
+        local test_file=/data/${test_dir}/${module}/${module}
+        run adb push ${OUT}${test_file} ${test_file}
+    done
+}
+
+function read_checker_output() {
+    python -c 'import json,sys;obj=json.load(sys.stdin);sys.stdout.write("%s\n"%obj["Testable"]);map(lambda i:sys.stdout.write("%s\n"%i),obj["instances"])'
+}
+
+function run_test() {
+    local module=$1
+    local status=0
+
+    for test_dir in nativetest nativetest64 ; do
+        local test_file=/data/${test_dir}/${module}/${module}
+        local interfaces=$(run adb shell ${test_file} --list_registered_services \
+            | sed -n 's/^hal_service: \(.*\)$/\1/p')
+        if [ -z "$interfaces" ]; then
+            run adb shell ${test_file} || status=$?
+        else
+            for interface in ${interfaces} ; do
+                local output=$(run adb shell ${CHECKER_DEVICE_PATH} -c ${interface} | read_checker_output)
+                local testable=$(echo "${output}" | head -n1)
+                local instances=$(echo "${output}" | tail -n+2)
+
+                if [ "${testable}" == "True" ] ; then
+                    for instance in ${instances} ; do
+                        run adb shell ${test_file} --hal_service_instance="${interface}/${instance}" || status=$?
+                    done
+                fi
+            done
+        fi
+    done
+    return ${status}
+}
+
+function usage() {
+    echo "usage: $0 -m <module_name> [-m <module_name>[...]] [-j <jobs>] [-p]"
+    echo "          -m <module_name>: name of test (e.g. VtsHalHealthV2_0TargetTest)"
+    echo "          -p: print commands"
+    echo "          -j <jobs>: # jobs in make. "
+    echo "                     -j0 skips making any modules."
+    echo "                     If not present, use infinite number of jobs."
+
+    exit 1
+}
+
+function main() {
+    local modules=
+
+    while getopts "m:j:p" option ; do
+        case "${option}" in
+            m)
+                [ ! -z ${OPTARG} ] || usage
+                modules="${modules} ${OPTARG}"
+                ;;
+            j)
+                THREADS=${OPTARG}
+                ;;
+            p)
+                PRINT_COMMANDS=true
+                ;;
+            *)
+                usage
+                ;;
+        esac
+    done
+
+    set -e
+    make_modules ${CHECKER} ${modules}
+    run adb root
+    push_checker
+    for module in ${modules} ; do
+        push_test ${module}
+    done
+
+    set +e
+    local status=0
+    for module in ${modules} ; do
+        run_test ${module} || status=$?
+    done
+    return ${status}
+}
+
+main $@
diff --git a/test/Android.bp b/test/Android.bp
index 7503037..1459fa6 100644
--- a/test/Android.bp
+++ b/test/Android.bp
@@ -1,12 +1,3 @@
-package {
-    // See: http://go/android-license-faq
-    // A large-scale-change added 'default_applicable_licenses' to import
-    // all of the 'license_kinds' from "system_tools_hidl_license"
-    // to get the below license kinds:
-    //   SPDX-license-identifier-Apache-2.0
-    default_applicable_licenses: ["system_tools_hidl_license"],
-}
-
 hidl_package_root {
     name: "hidl.tests",
 }
diff --git a/test/build_variants/1.0/Android.bp b/test/build_variants/1.0/Android.bp
index b448401..81f7880 100644
--- a/test/build_variants/1.0/Android.bp
+++ b/test/build_variants/1.0/Android.bp
@@ -1,12 +1,3 @@
-package {
-    // See: http://go/android-license-faq
-    // A large-scale-change added 'default_applicable_licenses' to import
-    // all of the 'license_kinds' from "system_tools_hidl_license"
-    // to get the below license kinds:
-    //   SPDX-license-identifier-Apache-2.0
-    default_applicable_licenses: ["system_tools_hidl_license"],
-}
-
 hidl_interface {
     name: "hidl_test_system_ext@1.0",
     root: "hidl_test_system_ext",
diff --git a/test/build_variants/2.0/Android.bp b/test/build_variants/2.0/Android.bp
index c9347e9..ab2cdfc 100644
--- a/test/build_variants/2.0/Android.bp
+++ b/test/build_variants/2.0/Android.bp
@@ -1,12 +1,3 @@
-package {
-    // See: http://go/android-license-faq
-    // A large-scale-change added 'default_applicable_licenses' to import
-    // all of the 'license_kinds' from "system_tools_hidl_license"
-    // to get the below license kinds:
-    //   SPDX-license-identifier-Apache-2.0
-    default_applicable_licenses: ["system_tools_hidl_license"],
-}
-
 hidl_interface {
     name: "hidl_test_product@2.0",
     product_specific: true,
diff --git a/test/build_variants/Android.bp b/test/build_variants/Android.bp
index c312d97..691218e 100644
--- a/test/build_variants/Android.bp
+++ b/test/build_variants/Android.bp
@@ -1,12 +1,3 @@
-package {
-    // See: http://go/android-license-faq
-    // A large-scale-change added 'default_applicable_licenses' to import
-    // all of the 'license_kinds' from "system_tools_hidl_license"
-    // to get the below license kinds:
-    //   SPDX-license-identifier-Apache-2.0
-    default_applicable_licenses: ["system_tools_hidl_license"],
-}
-
 hidl_package_root {
     name: "hidl_test_system_ext",
 }
diff --git a/test/cpp_impl_test/Android.bp b/test/cpp_impl_test/Android.bp
index 7901dc5..9b1a2e6 100644
--- a/test/cpp_impl_test/Android.bp
+++ b/test/cpp_impl_test/Android.bp
@@ -1,20 +1,11 @@
-package {
-    // See: http://go/android-license-faq
-    // A large-scale-change added 'default_applicable_licenses' to import
-    // all of the 'license_kinds' from "system_tools_hidl_license"
-    // to get the below license kinds:
-    //   SPDX-license-identifier-Apache-2.0
-    default_applicable_licenses: ["system_tools_hidl_license"],
-}
-
 genrule {
     name: "hidl_cpp_impl_test_gen-headers",
     tools: [
         "hidl-gen",
     ],
-    srcs: [
-        ":android.hardware.tests.foo@1.0_hal",
-        ":hidl.tests.vendor.android@1.0_hal",
+    required: [
+        "android.hardware.tests.foo@1.0",
+        "hidl.tests.vendor.android@1.0",
     ],
     cmd: "$(location hidl-gen) -o $(genDir) -Lc++-impl-headers android.hardware.tests.foo@1.0 && " +
         "$(location hidl-gen) -o $(genDir) -r hidl.tests:system/tools/hidl/test/ " +
@@ -34,9 +25,9 @@
     tools: [
         "hidl-gen",
     ],
-    srcs: [
-        ":android.hardware.tests.foo@1.0_hal",
-        ":hidl.tests.vendor.android@1.0_hal",
+    required: [
+        "android.hardware.tests.foo@1.0",
+        "hidl.tests.vendor.android@1.0",
     ],
     cmd: "$(location hidl-gen) -o $(genDir) -Lc++-impl-sources android.hardware.tests.foo@1.0 && " +
         "$(location hidl-gen) -o $(genDir) -r hidl.tests:system/tools/hidl/test/ " +
diff --git a/test/error_test/Android.bp b/test/error_test/Android.bp
index 03bc45f..4c8c899 100644
--- a/test/error_test/Android.bp
+++ b/test/error_test/Android.bp
@@ -1,12 +1,3 @@
-package {
-    // See: http://go/android-license-faq
-    // A large-scale-change added 'default_applicable_licenses' to import
-    // all of the 'license_kinds' from "system_tools_hidl_license"
-    // to get the below license kinds:
-    //   SPDX-license-identifier-Apache-2.0
-    default_applicable_licenses: ["system_tools_hidl_license"],
-}
-
 genrule {
     name: "hidl_error_test_gen",
     tools: ["hidl-gen"],
@@ -24,5 +15,4 @@
     name: "hidl_error_test",
     cflags: ["-Wall", "-Werror"],
     generated_sources: ["hidl_error_test_gen"],
-    gtest: false,
 }
diff --git a/test/error_test/import_identifier/1.0/IFoo.hal b/test/error_test/import_identifier/1.0/IFoo.hal
deleted file mode 100644
index 8274358..0000000
--- a/test/error_test/import_identifier/1.0/IFoo.hal
+++ /dev/null
@@ -1,25 +0,0 @@
-/*
- * Copyright (C) 2020 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package test.import_identifier@1.0;
-
-// Used to secretly import all types
-import test.import_identifier@1.0::types:Foo;
-
-// since this is only a warning for now
-Syntax error!
-
-interface IFoo {
-};
diff --git a/test/error_test/import_identifier/1.0/required_error b/test/error_test/import_identifier/1.0/required_error
deleted file mode 100644
index 7b1ad8f..0000000
--- a/test/error_test/import_identifier/1.0/required_error
+++ /dev/null
@@ -1 +0,0 @@
-must import type, but importing value
diff --git a/test/error_test/import_identifier/1.0/types.hal b/test/error_test/import_identifier/1.0/types.hal
deleted file mode 100644
index 0b4cc43..0000000
--- a/test/error_test/import_identifier/1.0/types.hal
+++ /dev/null
@@ -1,19 +0,0 @@
-/*
- * Copyright (C) 2020 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package test.import_identifier@1.0;
-
-struct Foo { uint8_t a; uint8_t b; };
-
diff --git a/test/export_test/Android.bp b/test/export_test/Android.bp
index 7317e1a..5d7bead 100644
--- a/test/export_test/Android.bp
+++ b/test/export_test/Android.bp
@@ -1,12 +1,3 @@
-package {
-    // See: http://go/android-license-faq
-    // A large-scale-change added 'default_applicable_licenses' to import
-    // all of the 'license_kinds' from "system_tools_hidl_license"
-    // to get the below license kinds:
-    //   SPDX-license-identifier-Apache-2.0
-    default_applicable_licenses: ["system_tools_hidl_license"],
-}
-
 genrule {
     name: "hidl_export_test_gen-headers",
     tools: [
diff --git a/test/format_test/1.0/Android.bp b/test/format_test/1.0/Android.bp
index ca3e9f3..a0e0e6a 100644
--- a/test/format_test/1.0/Android.bp
+++ b/test/format_test/1.0/Android.bp
@@ -1,14 +1,5 @@
 // This file is autogenerated by hidl-gen -Landroidbp.
 
-package {
-    // See: http://go/android-license-faq
-    // A large-scale-change added 'default_applicable_licenses' to import
-    // all of the 'license_kinds' from "system_tools_hidl_license"
-    // to get the below license kinds:
-    //   SPDX-license-identifier-Apache-2.0
-    default_applicable_licenses: ["system_tools_hidl_license"],
-}
-
 hidl_interface {
     name: "hidl_format_test_pkg@1.0",
     root: "hidl_format_test_pkg",
diff --git a/test/format_test/Android.bp b/test/format_test/Android.bp
index 62b1466..f2e17b2 100644
--- a/test/format_test/Android.bp
+++ b/test/format_test/Android.bp
@@ -14,15 +14,6 @@
  * limitations under the License.
  */
 
-package {
-    // See: http://go/android-license-faq
-    // A large-scale-change added 'default_applicable_licenses' to import
-    // all of the 'license_kinds' from "system_tools_hidl_license"
-    // to get the below license kinds:
-    //   SPDX-license-identifier-Apache-2.0
-    default_applicable_licenses: ["system_tools_hidl_license"],
-}
-
 genrule {
     name: "hidl_format_test_diff",
     tools: ["hidl-gen"],
@@ -37,6 +28,7 @@
         "1.0/IFoo.hal",
         "1.0/types.hal",
     ],
+    required: ["android.hidl.base@1.0"],
     out: [
         "system/tools/hidl/test/format_test/1.0/Android.bp",
         "system/tools/hidl/test/format_test/1.0/IBar.hal",
diff --git a/test/hash_test/Android.bp b/test/hash_test/Android.bp
index b58a058..5f9f248 100644
--- a/test/hash_test/Android.bp
+++ b/test/hash_test/Android.bp
@@ -1,55 +1,36 @@
-package {
-    // See: http://go/android-license-faq
-    // A large-scale-change added 'default_applicable_licenses' to import
-    // all of the 'license_kinds' from "system_tools_hidl_license"
-    // to get the below license kinds:
-    //   SPDX-license-identifier-Apache-2.0
-    default_applicable_licenses: ["system_tools_hidl_license"],
-}
-
 genrule {
     name: "hidl_hash_test_gen",
     tools: [
         "hidl-gen",
     ],
     cmd: "$(location hidl-gen) -L check " +
-        "    -r android.hidl:system/libhidl/transport" +
-        "    -r test.hash:system/tools/hidl/test/hash_test/correct_hash" +
-        "    test.hash.hash@1.0" +
-        "&&" +
-        "!($(location hidl-gen) -F -L check " +
-        "    -r android.hidl:system/libhidl/transport" +
-        "    -r test.hash:system/tools/hidl/test/hash_test/missing_hash" +
-        "    test.hash.hash@1.0 2> /dev/null)" +
-        "&&" +
-        "!($(location hidl-gen) -L check " +
-        "    -r android.hidl:system/libhidl/transport" +
-        "    -r test.hash:system/tools/hidl/test/hash_test/incorrect_hash" +
-        "    test.hash.hash@1.0 2> /dev/null)" +
-        "&&" +
-        "$(location hidl-gen) -L hash " +
-        "    -r android.hidl:system/libhidl/transport" +
-        "    -r test.hash:system/tools/hidl/test/hash_test/incorrect_hash" +
-        "    test.hash.hash@1.0 > /dev/null" +
-        "&&" +
-        "echo 'int main(){return 0;}' > $(genDir)/TODO_b_37575883.cpp",
+         "    -r android.hidl:system/libhidl/transport" +
+         "    -r test.hash:system/tools/hidl/test/hash_test/good" +
+         "    test.hash.hash@1.0" +
+         "&&" +
+         "!($(location hidl-gen) -L check " +
+         "    -r android.hidl:system/libhidl/transport" +
+         "    -r test.hash:system/tools/hidl/test/hash_test/bad" +
+         "    test.hash.hash@1.0 2> /dev/null)" +
+         "&&" +
+         "$(location hidl-gen) -L hash " +
+         "    -r android.hidl:system/libhidl/transport" +
+         "    -r test.hash:system/tools/hidl/test/hash_test/bad" +
+         "    test.hash.hash@1.0 > /dev/null" +
+         "&&" +
+         "echo 'int main(){return 0;}' > $(genDir)/TODO_b_37575883.cpp",
     out: ["TODO_b_37575883.cpp"],
 
     srcs: [
-        "correct_hash/current.txt",
-        "correct_hash/hash/1.0/IHash.hal",
-        "incorrect_hash/current.txt",
-        "incorrect_hash/hash/1.0/IHash.hal",
-        "missing_hash/hash/1.0/IUnhashed.hal",
+        "bad/hash/1.0/IHash.hal",
+        "bad/current.txt",
+        "good/hash/1.0/IHash.hal",
+        "good/current.txt",
     ],
 }
 
 cc_test_host {
     name: "hidl_hash_test",
-    cflags: [
-        "-Wall",
-        "-Werror",
-    ],
+    cflags: ["-Wall", "-Werror"],
     generated_sources: ["hidl_hash_test_gen"],
-    gtest: false,
 }
diff --git a/test/hash_test/incorrect_hash/current.txt b/test/hash_test/bad/current.txt
similarity index 100%
rename from test/hash_test/incorrect_hash/current.txt
rename to test/hash_test/bad/current.txt
diff --git a/test/hash_test/incorrect_hash/hash/1.0/IHash.hal b/test/hash_test/bad/hash/1.0/IHash.hal
similarity index 100%
rename from test/hash_test/incorrect_hash/hash/1.0/IHash.hal
rename to test/hash_test/bad/hash/1.0/IHash.hal
diff --git a/test/hash_test/correct_hash/current.txt b/test/hash_test/good/current.txt
similarity index 75%
rename from test/hash_test/correct_hash/current.txt
rename to test/hash_test/good/current.txt
index c99ada4..ff4b669 100644
--- a/test/hash_test/correct_hash/current.txt
+++ b/test/hash_test/good/current.txt
@@ -1,3 +1 @@
 b19939ecb4f877820df49b684f3164f0a3f9aa18743a3521f3bd04e4a06fed64 test.hash.hash@1.0::IHash # comments are fine too
-
-# explicitly not including IUnhashed
diff --git a/test/hash_test/correct_hash/hash/1.0/IHash.hal b/test/hash_test/good/hash/1.0/IHash.hal
similarity index 100%
rename from test/hash_test/correct_hash/hash/1.0/IHash.hal
rename to test/hash_test/good/hash/1.0/IHash.hal
diff --git a/test/hash_test/missing_hash/hash/1.0/IUnhashed.hal b/test/hash_test/missing_hash/hash/1.0/IUnhashed.hal
deleted file mode 100644
index d760aea..0000000
--- a/test/hash_test/missing_hash/hash/1.0/IUnhashed.hal
+++ /dev/null
@@ -1,20 +0,0 @@
-/*
- * Copyright (C) 2020 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package test.hash.hash@1.0;
-
-// okay unless -F is specified
-interface IUnhashed {
-};
diff --git a/test/hidl_test/Android.bp b/test/hidl_test/Android.bp
index fe0fe34..fcecd6d 100644
--- a/test/hidl_test/Android.bp
+++ b/test/hidl_test/Android.bp
@@ -1,29 +1,5 @@
-package {
-    // See: http://go/android-license-faq
-    // A large-scale-change added 'default_applicable_licenses' to import
-    // all of the 'license_kinds' from "system_tools_hidl_license"
-    // to get the below license kinds:
-    //   SPDX-license-identifier-Apache-2.0
-    default_applicable_licenses: ["system_tools_hidl_license"],
-}
-
-python_test_host {
-    name: "hidl_test",
-    main: "hidl_test.py",
-    srcs: ["hidl_test.py"],
-    test_config: "hidl_test.xml",
-    target_required: [
-        "hidl_test_client",
-        "hidl_test_servers",
-    ],
-    test_suites: ["general-tests"],
-    test_options: {
-        unit_test: false,
-    },
-}
-
 cc_defaults {
-    name: "hidl_test-defaults",
+    name: "hidl_test_client-defaults",
     defaults: ["hidl-gen-defaults"],
 
     shared_libs: [
@@ -76,27 +52,16 @@
     ],
 
     group_static_libs: true,
-
-    compile_multilib: "both",
-    multilib: {
-        lib32: {
-            suffix: "32",
-        },
-        lib64: {
-            suffix: "64",
-        },
-    },
-    test_suites: ["general-tests"],
 }
 
 cc_test {
     name: "hidl_test_client",
-    defaults: ["hidl_test-defaults"],
+    defaults: ["hidl_test_client-defaults"],
 
     srcs: [
         "hidl_test_client.cpp",
         "FooCallback.cpp",
-        "static_test.cpp",
+        "static_test.cpp"
     ],
 
     shared_libs: [
@@ -106,7 +71,7 @@
 
 cc_test {
     name: "hidl_test_servers",
-    defaults: ["hidl_test-defaults"],
+    defaults: ["hidl_test_client-defaults"],
     srcs: ["hidl_test_servers.cpp"],
     gtest: false,
 }
diff --git a/test/hidl_test/Android.mk b/test/hidl_test/Android.mk
new file mode 100644
index 0000000..e949ecd
--- /dev/null
+++ b/test/hidl_test/Android.mk
@@ -0,0 +1,48 @@
+#
+# Copyright (C) 2017 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#      http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+LOCAL_PATH:= $(call my-dir)
+include $(CLEAR_VARS)
+LOCAL_MODULE := hidl_test_helper
+LOCAL_MODULE_CLASS := NATIVE_TESTS
+LOCAL_SRC_FILES := hidl_test_helper
+
+LOCAL_MODULE_PATH := $(TARGET_OUT_DATA)/nativetest64
+
+include $(BUILD_PREBUILT)
+
+include $(CLEAR_VARS)
+LOCAL_MODULE := hidl_test
+LOCAL_MODULE_CLASS := NATIVE_TESTS
+LOCAL_SRC_FILES := hidl_test
+
+LOCAL_MODULE_PATH := $(TARGET_OUT_DATA)/nativetest64
+
+LOCAL_REQUIRED_MODULES := \
+    hidl_test_client \
+    hidl_test_helper \
+    hidl_test_servers
+
+ifneq ($(TARGET_2ND_ARCH),)
+LOCAL_REQUIRED_MODULES += hidl_test_servers$(TARGET_2ND_ARCH_MODULE_SUFFIX)
+LOCAL_REQUIRED_MODULES += hidl_test_client$(TARGET_2ND_ARCH_MODULE_SUFFIX)
+endif
+
+include $(BUILD_PREBUILT)
+
+include $(CLEAR_VARS)
+
+LOCAL_MODULE := VtsHidlUnitTests
+-include test/vts/tools/build/Android.host_config.mk
diff --git a/test/hidl_test/AndroidTest.xml b/test/hidl_test/AndroidTest.xml
new file mode 100644
index 0000000..6633942
--- /dev/null
+++ b/test/hidl_test/AndroidTest.xml
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2016 The Android Open Source Project
+
+     Licensed under the Apache License, Version 2.0 (the "License");
+     you may not use this file except in compliance with the License.
+     You may obtain a copy of the License at
+
+          http://www.apache.org/licenses/LICENSE-2.0
+
+     Unless required by applicable law or agreed to in writing, software
+     distributed under the License is distributed on an "AS IS" BASIS,
+     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+     See the License for the specific language governing permissions and
+     limitations under the License.
+-->
+<configuration description="Config for VTS HIDL unit tests">
+    <option name="config-descriptor:metadata" key="plan" value="vts-library" />
+    <target_preparer class="com.android.compatibility.common.tradefed.targetprep.VtsFilePusher">
+        <option name="push-group" value="HostDrivenTest.push" />
+        <option name="cleanup" value="true" />
+        <option name="push" value="DATA/nativetest/hidl_test_servers/hidl_test_servers->/data/nativetest/hidl_test_servers/hidl_test_servers" />
+        <option name="push" value="DATA/nativetest64/hidl_test_servers/hidl_test_servers->/data/nativetest64/hidl_test_servers/hidl_test_servers" />
+        <option name="push" value="DATA/nativetest/hidl_test_client/hidl_test_client->/data/nativetest/hidl_test_client/hidl_test_client" />
+        <option name="push" value="DATA/nativetest64/hidl_test_client/hidl_test_client->/data/nativetest64/hidl_test_client/hidl_test_client" />
+        <option name="push" value="DATA/nativetest64/hidl_test_helper->/data/nativetest64/hidl_test_helper" />
+    </target_preparer>
+    <multi_target_preparer class="com.android.tradefed.targetprep.VtsPythonVirtualenvPreparer" />
+    <test class="com.android.tradefed.testtype.VtsMultiDeviceTest">
+      <option name="test-module-name" value="VtsHidlUnitTests" />
+      <option name="binary-test-type" value="binary_test" />
+      <option name="binary-test-source" value="DATA/nativetest64/hidl_test->/data/nativetest64/hidl_test" />
+      <option name="test-timeout" value="1m" />
+    </test>
+</configuration>
diff --git a/test/hidl_test/hidl_test b/test/hidl_test/hidl_test
new file mode 100644
index 0000000..883484d
--- /dev/null
+++ b/test/hidl_test/hidl_test
@@ -0,0 +1,14 @@
+source /data/nativetest64/hidl_test_helper &&
+
+chmod a+x /data/nativetest/hidl_test_servers/hidl_test_servers &&
+chmod a+x /data/nativetest64/hidl_test_servers/hidl_test_servers &&
+chmod a+x /data/nativetest/hidl_test_client/hidl_test_client &&
+chmod a+x /data/nativetest64/hidl_test_client/hidl_test_client &&
+
+run_all_tests \
+    "/data/nativetest/hidl_test_servers/hidl_test_servers" \
+    "/data/nativetest64/hidl_test_servers/hidl_test_servers" \
+    "/data/nativetest/hidl_test_client/hidl_test_client" \
+    "/data/nativetest64/hidl_test_client/hidl_test_client" \
+    "hidl_test" \
+    "$@"
diff --git a/test/hidl_test/hidl_test.py b/test/hidl_test/hidl_test.py
deleted file mode 100644
index 1a58e5d..0000000
--- a/test/hidl_test/hidl_test.py
+++ /dev/null
@@ -1,74 +0,0 @@
-#!/usr/bin/env python3
-#
-# Copyright (C) 2020 The Android Open Source Project
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-#      http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-
-import subprocess
-import unittest
-
-def run_cmd(cmd, ignore_error=False):
-    print("Running command:", cmd)
-    p = subprocess.Popen(cmd, shell=True)
-    p.communicate()
-    if not ignore_error and p.returncode:
-        raise subprocess.CalledProcessError(p.returncode, cmd)
-    return p.returncode
-
-class TestHidl(unittest.TestCase):
-    pass
-
-def make_test(client, server):
-    def test(self):
-        try:
-            run_cmd("adb shell killall %s >/dev/null 2>&1" % client, ignore_error=True)
-            run_cmd("adb shell killall %s >/dev/null 2>&1" % server, ignore_error=True)
-            run_cmd("adb shell \"( %s ) </dev/null >/dev/null 2>&1 &\"" % server)
-            run_cmd("adb shell %s" % client)
-        finally:
-            run_cmd("adb shell killall %s >/dev/null 2>&1" % client, ignore_error=True)
-            run_cmd("adb shell killall %s >/dev/null 2>&1" % server, ignore_error=True)
-    return test
-
-def has_bitness(bitness):
-    return 0 == run_cmd("echo '[[ \"$(getprop ro.product.cpu.abilist%s)\" != \"\" ]]' | adb shell sh" % bitness, ignore_error=True)
-
-if __name__ == '__main__':
-    clients = []
-    servers = []
-
-    if has_bitness(32):
-        clients += ["/data/nativetest/hidl_test_client/hidl_test_client"]
-        servers += ["/data/nativetest/hidl_test_servers/hidl_test_servers"]
-
-    if has_bitness(64):
-        clients += ["/data/nativetest64/hidl_test_client/hidl_test_client"]
-        servers += ["/data/nativetest64/hidl_test_servers/hidl_test_servers"]
-
-    assert len(clients) > 0
-    assert len(servers) > 0
-
-    def short_name(binary):
-        if "64" in binary:
-            return "64"
-        return "32"
-
-    for client in clients:
-        for server in servers:
-            test_name = 'test_%s_to_%s' % (short_name(client), short_name(server))
-            test = make_test(client, server)
-            setattr(TestHidl, test_name, test)
-
-    suite = unittest.TestLoader().loadTestsFromTestCase(TestHidl)
-    unittest.TextTestRunner(verbosity=2).run(suite)
diff --git a/test/hidl_test/hidl_test.xml b/test/hidl_test/hidl_test.xml
deleted file mode 100644
index 586adc4..0000000
--- a/test/hidl_test/hidl_test.xml
+++ /dev/null
@@ -1,40 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2020 The Android Open Source Project
-
-     Licensed under the Apache License, Version 2.0 (the "License");
-     you may not use this file except in compliance with the License.
-     You may obtain a copy of the License at
-
-          http://www.apache.org/licenses/LICENSE-2.0
-
-     Unless required by applicable law or agreed to in writing, software
-     distributed under the License is distributed on an "AS IS" BASIS,
-     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-     See the License for the specific language governing permissions and
-     limitations under the License.
--->
-<configuration description="Runs HIDL on-device integration tests.">
-    <option name="test-suite-tag" value="apct" />
-    <option name="test-suite-tag" value="apct-native" />
-
-    <target_preparer class="com.android.tradefed.targetprep.RootTargetPreparer"/>
-
-    <target_preparer class="com.android.tradefed.targetprep.PushFilePreparer">
-      <!-- We would like to abort, but currently there is not a simple way to specify installation of both bitnesses of targets. -->
-      <option name="abort-on-push-failure" value="false"/>
-
-      <option name="push" value="hidl_test_client32->/data/nativetest/hidl_test_client/hidl_test_client" />
-      <option name="push" value="hidl_test_client64->/data/nativetest64/hidl_test_client/hidl_test_client" />
-
-      <option name="push" value="hidl_test_servers32->/data/nativetest/hidl_test_servers/hidl_test_servers" />
-      <option name="push" value="hidl_test_servers64->/data/nativetest64/hidl_test_servers/hidl_test_servers" />
-
-      <option name="cleanup" value="true" />
-    </target_preparer>
-
-    <test class="com.android.tradefed.testtype.python.PythonBinaryHostTest" >
-        <option name="par-file-name" value="hidl_test" />
-        <option name="test-timeout" value="2m" />
-    </test>
-</configuration>
-
diff --git a/test/hidl_test/hidl_test_client.cpp b/test/hidl_test/hidl_test_client.cpp
index eff40a5..1993198 100644
--- a/test/hidl_test/hidl_test_client.cpp
+++ b/test/hidl_test/hidl_test_client.cpp
@@ -33,6 +33,7 @@
 #include <android/hardware/tests/inheritance/1.0/IParent.h>
 #include <android/hardware/tests/memory/1.0/IMemoryTest.h>
 #include <android/hardware/tests/multithread/1.0/IMultithread.h>
+#include <android/hardware/tests/safeunion/1.0/IOtherInterface.h>
 #include <android/hardware/tests/safeunion/1.0/ISafeUnion.h>
 #include <android/hardware/tests/safeunion/cpp/1.0/ICppSafeUnion.h>
 #include <android/hardware/tests/trie/1.0/ITrie.h>
@@ -132,6 +133,7 @@
 using ::android::hardware::tests::memory::V1_0::IMemoryTest;
 using ::android::hardware::tests::multithread::V1_0::IMultithread;
 using ::android::hardware::tests::safeunion::cpp::V1_0::ICppSafeUnion;
+using ::android::hardware::tests::safeunion::V1_0::IOtherInterface;
 using ::android::hardware::tests::safeunion::V1_0::ISafeUnion;
 using ::android::hardware::tests::trie::V1_0::ITrie;
 using ::android::hardware::tests::trie::V1_0::TrieNode;
@@ -309,6 +311,16 @@
     int32_t mCookie;
 };
 
+struct OtherInterface : public IOtherInterface {
+    Return<void> concatTwoStrings(const hidl_string& a, const hidl_string& b,
+                                  concatTwoStrings_cb _hidl_cb) override {
+        hidl_string result = std::string(a) + std::string(b);
+        _hidl_cb(result);
+
+        return Void();
+    }
+};
+
 struct ServiceNotification : public IServiceNotification {
     std::mutex mutex;
     std::condition_variable condition;
@@ -710,7 +722,13 @@
                                                    ASSERT_EQ(1, registered.size());
                                                    EXPECT_EQ("default", registered[0]);
                                                }));
-
+    // vendor service (this is required on all devices)
+    EXPECT_OK(
+        manager->listManifestByInterface("android.hardware.configstore@1.0::ISurfaceFlingerConfigs",
+                                         [](const hidl_vec<hidl_string>& registered) {
+                                             ASSERT_EQ(1, registered.size());
+                                             EXPECT_EQ("default", registered[0]);
+                                         }));
     // test service that will never be in a manifest
     EXPECT_OK(manager->listManifestByInterface(
         IParent::descriptor,
@@ -1636,7 +1654,7 @@
     swi.array = testArray;
     swi.oneString = testString;
     swi.vectorOfStrings = testStrings;
-    swi.iface = baz;
+    swi.dummy = baz;
 
     EXPECT_OK(baz->haveSomeStructWithInterface(swi, [&](const IBaz::StructWithInterface& swiBack) {
         EXPECT_EQ(42, swiBack.number);
@@ -1647,7 +1665,9 @@
         EXPECT_EQ(testString, std::string(swiBack.oneString));
         EXPECT_EQ(testStrings, swiBack.vectorOfStrings);
 
-        EXPECT_TRUE(interfacesEqual(swi.iface, swiBack.iface));
+        EXPECT_TRUE(interfacesEqual(swi.dummy, swiBack.dummy));
+        EXPECT_OK(swiBack.dummy->someBoolVectorMethod(
+            testVector, [&](const hidl_vec<bool>& result) { EXPECT_EQ(goldenResult, result); }));
     }));
 }
 
@@ -1875,7 +1895,7 @@
     sp<IBinder> binder = ::android::hardware::toBinder(bar);
 
     Parcel request, reply;
-    EXPECT_EQ(::android::BAD_TYPE, binder->transact(3 /*someBoolMethod*/, request, &reply));
+    EXPECT_EQ(::android::BAD_TYPE, binder->transact(2 /*someBoolMethod*/, request, &reply));
 
     EXPECT_OK(bar->ping());  // still works
 }
@@ -1890,7 +1910,7 @@
     Parcel request, reply;
     // wrong descriptor
     EXPECT_EQ(::android::OK, request.writeInterfaceToken("not a real descriptor"));
-    EXPECT_EQ(::android::BAD_TYPE, binder->transact(3 /*someBoolMethod*/, request, &reply));
+    EXPECT_EQ(::android::BAD_TYPE, binder->transact(2 /*someBoolMethod*/, request, &reply));
 
     EXPECT_OK(bar->ping());  // still works
 }
@@ -1906,7 +1926,7 @@
     EXPECT_EQ(::android::OK, request.writeInterfaceToken(IBaz::descriptor));
     EXPECT_EQ(::android::OK, request.writeInt64(1234));
     // IBaz::doThatAndReturnSomething is two-way but we call it using FLAG_ONEWAY.
-    EXPECT_EQ(::android::OK, binder->transact(19 /*doThatAndReturnSomething*/, request, &reply,
+    EXPECT_EQ(::android::OK, binder->transact(18 /*doThatAndReturnSomething*/, request, &reply,
                                               IBinder::FLAG_ONEWAY));
 
     ::android::hardware::Status status;
@@ -1938,7 +1958,7 @@
             // sends an empty reply for two-way transactions if the transaction itself
             // did not send a reply.
             ::android::OK,
-            binder->transact(18 /*doThis*/, request, &reply, 0 /* Not FLAG_ONEWAY */));
+            binder->transact(17 /*doThis*/, request, &reply, 0 /* Not FLAG_ONEWAY */));
     if (gHidlEnvironment->enableDelayMeasurementTests) {
         // IBaz::doThis is oneway, should return instantly.
         EXPECT_LT(systemTime() - now, ONEWAY_TOLERANCE_NS);
@@ -2129,7 +2149,7 @@
 }
 
 TEST_F(HidlTest, SafeUnionMoveConstructorTest) {
-    sp<SimpleChild> otherInterface = new SimpleChild();
+    sp<IOtherInterface> otherInterface = new OtherInterface();
     ASSERT_EQ(1, otherInterface->getStrongCount());
 
     InterfaceTypeSafeUnion safeUnion;
@@ -2158,7 +2178,7 @@
 }
 
 TEST_F(HidlTest, SafeUnionMoveAssignmentTest) {
-    sp<SimpleChild> otherInterface = new SimpleChild();
+    sp<IOtherInterface> otherInterface = new OtherInterface();
     ASSERT_EQ(1, otherInterface->getStrongCount());
 
     InterfaceTypeSafeUnion safeUnion;
@@ -2229,6 +2249,10 @@
     const std::string testStringA = "Hello";
     const std::string testStringB = "World";
 
+    const std::string serviceName = "otherinterface";
+    sp<IOtherInterface> otherInterface = new OtherInterface();
+    EXPECT_EQ(::android::OK, otherInterface->registerAsService(serviceName));
+
     EXPECT_OK(
         safeunionInterface->newInterfaceTypeSafeUnion([&](const InterfaceTypeSafeUnion& safeUnion) {
             EXPECT_EQ(InterfaceTypeSafeUnion::hidl_discriminator::noinit,
@@ -2244,13 +2268,15 @@
                     }
 
                     EXPECT_OK(safeunionInterface->setInterfaceC(
-                            safeUnion, manager, [&](const InterfaceTypeSafeUnion& safeUnion) {
-                                EXPECT_EQ(InterfaceTypeSafeUnion::hidl_discriminator::c,
-                                          safeUnion.getDiscriminator());
+                        safeUnion, otherInterface, [&](const InterfaceTypeSafeUnion& safeUnion) {
+                            EXPECT_EQ(InterfaceTypeSafeUnion::hidl_discriminator::c,
+                                      safeUnion.getDiscriminator());
 
-                                using ::android::hardware::interfacesEqual;
-                                EXPECT_TRUE(interfacesEqual(safeUnion.c(), manager));
-                            }));
+                            EXPECT_OK(safeUnion.c()->concatTwoStrings(
+                                testStringA, testStringB, [&](const hidl_string& result) {
+                                    EXPECT_EQ(testStringA + testStringB, std::string(result));
+                                }));
+                        }));
                 }));
 
             EXPECT_OK(safeunionInterface->setInterfaceD(
@@ -2479,7 +2505,7 @@
 }
 
 TEST_F(HidlTest, SafeUnionSimpleDestructorTest) {
-    sp<SimpleChild> otherInterface = new SimpleChild();
+    sp<IOtherInterface> otherInterface = new OtherInterface();
     ASSERT_EQ(1, otherInterface->getStrongCount());
 
     {
@@ -2492,7 +2518,7 @@
 }
 
 TEST_F(HidlTest, SafeUnionSwitchActiveComponentsDestructorTest) {
-    sp<SimpleChild> otherInterface = new SimpleChild();
+    sp<IOtherInterface> otherInterface = new OtherInterface();
     ASSERT_EQ(1, otherInterface->getStrongCount());
 
     InterfaceTypeSafeUnion safeUnion;
@@ -2636,7 +2662,7 @@
 }
 
 int main(int argc, char **argv) {
-    android::hardware::details::setTrebleTestingOverride(true);
+    setenv("TREBLE_TESTING_OVERRIDE", "true", true);
 
     const char *me = argv[0];
     bool b = false;
diff --git a/test/hidl_test/hidl_test_helper b/test/hidl_test/hidl_test_helper
new file mode 100644
index 0000000..22c416f
--- /dev/null
+++ b/test/hidl_test/hidl_test_helper
@@ -0,0 +1,140 @@
+function usage() {
+    echo "runs $TEST_NAME"
+    echo "\t -h help"
+    echo "\t -c [CLIENT64_SERVER64 | CLIENT32_SERVER32 | CLIENT64_SERVER32 | CLIENT32_SERVER64] configures whether to run 32-bit or 64-bit versions of the servers and client"
+    echo "\t -x [/ld/library/path32] set the LD_LIBRARY_PATH for servers32 and client32"
+    echo "\t -y [/ld/library/path64] set the LD_LIBRARY_PATH for servers64 and client64"
+}
+
+failed_test_cases=()
+
+function run_test() {
+    if [ $1 -eq 32 ]; then
+        CLIENT_PATH=$CLIENT_PATH32
+        LD_LIB_PATH_CLIENT=$LD_LIB_PATH32
+    else
+        CLIENT_PATH=$CLIENT_PATH64
+        LD_LIB_PATH_CLIENT=$LD_LIB_PATH64
+    fi
+
+    if [ $2 -eq 32 ]; then
+        SERVER_PATH=$SERVER_PATH32
+        LD_LIB_PATH_SERVER=$LD_LIB_PATH32
+    else
+        SERVER_PATH=$SERVER_PATH64
+        LD_LIB_PATH_SERVER=$LD_LIB_PATH64
+    fi
+
+    echo "Running $1-bit client with $2-bit servers"
+    echo "$LD_LIB_PATH_SERVER=$LD_LIB_PATH_SERVER"
+    LD_LIBRARY_PATH=$LD_LIB_PATH_SERVER:$LD_LIBRARY_PATH $SERVER_PATH &
+    SERVER_PID=$!
+    LD_LIBRARY_PATH=$LD_LIB_PATH_CLIENT:$LD_LIBRARY_PATH $CLIENT_PATH
+    if [ $? -ne 0 ]; then
+        failed_test_cases+=("$1-bit client with $2-bit servers")
+    fi
+    kill $SERVER_PID
+}
+
+function check_env() {
+    if [ -z ${TEST_NAME+x} ]; then
+        echo "TEST_NAME is unset";
+        exit 1
+    fi
+
+    if [ -z ${CLIENT_PATH32+x} ]; then
+        echo "CLIENT_PATH32 is unset";
+        exit 1
+    fi
+
+    if [ -z ${CLIENT_PATH64+x} ]; then
+        echo "CLIENT_PATH64 is unset";
+        exit 1
+    fi
+
+    if [ -z ${SERVER_PATH32+x} ]; then
+        echo "SERVER_PATH32 is unset";
+        exit 1
+    fi
+
+    if [ -z ${SERVER_PATH64+x} ]; then
+        echo "SERVER_PATH64 is unset";
+        exit 1
+    fi
+}
+
+#usage: run_all_tests server_path32 server_path64 client_path32 client_path64 test_name [-h/-c config/-x lib32/-y ldlib64]
+function run_all_tests() {
+    SERVER_PATH32=$1
+    SERVER_PATH64=$2
+    CLIENT_PATH32=$3
+    CLIENT_PATH64=$4
+    TEST_NAME=$5
+    check_env
+    shift 5
+
+    while getopts hc:x:y: opt;
+    do
+        case $opt in
+            h)
+                usage
+                exit 0
+                ;;
+            c)
+                case $OPTARG in
+                    CLIENT64_SERVER64)
+                        run_test 64 64
+                        ;;
+                    CLIENT32_SERVER32)
+                        run_test 32 32
+                        ;;
+                    CLIENT64_SERVER32)
+                        run_test 64 32
+                        ;;
+                    CLIENT32_SERVER64)
+                        run_test 32 64
+                        ;;
+                    *)
+                        echo "Error: unknown config value \"$OPTARG\""
+                        exit 1
+                        ;;
+                esac
+                exit 0
+                ;;
+            x)
+                LD_LIB_PATH32=$OPTARG
+                ;;
+            y)
+                LD_LIB_PATH64=$OPTARG
+                ;;
+            *)
+                echo "Error: unknown param \"$opt\""
+                usage
+                exit 1
+                ;;
+        esac
+    done
+
+    for i in 32 64
+        do
+            for j in 32 64
+                do
+                    run_test $i $j
+                done
+        done
+    count_failed_tests=${#failed_test_cases[@]}
+    echo "*********************************************************"
+    echo "    $TEST_NAME Final Summary:\n"
+    if [ $count_failed_tests -gt 0 ]; then
+        echo "    $TEST_NAME failed for the following cases:\n\t"
+        for each in "${failed_test_cases[@]}"
+            do
+                echo "\t$each"
+            done
+    else
+        echo "    $TEST_NAME passed for all cases!"
+    fi
+    echo "*********************************************************"
+
+    exit ${#failed_test_cases[@]}
+}
diff --git a/test/hidl_test/hidl_test_servers.cpp b/test/hidl_test/hidl_test_servers.cpp
index 9668321..3105199 100644
--- a/test/hidl_test/hidl_test_servers.cpp
+++ b/test/hidl_test/hidl_test_servers.cpp
@@ -89,7 +89,7 @@
 }
 
 int main(int /* argc */, char* /* argv */ []) {
-    android::hardware::details::setTrebleTestingOverride(true);
+    setenv("TREBLE_TESTING_OVERRIDE", "true", true);
 
     runOnEachServer<ForkServer>();
 
diff --git a/test/host_test/Android.bp b/test/host_test/Android.bp
index 15c46c3..f7d1fe0 100644
--- a/test/host_test/Android.bp
+++ b/test/host_test/Android.bp
@@ -12,15 +12,6 @@
 // See the License for the specific language governing permissions and
 // limitations under the License.
 
-package {
-    // See: http://go/android-license-faq
-    // A large-scale-change added 'default_applicable_licenses' to import
-    // all of the 'license_kinds' from "system_tools_hidl_license"
-    // to get the below license kinds:
-    //   SPDX-license-identifier-Apache-2.0
-    default_applicable_licenses: ["system_tools_hidl_license"],
-}
-
 cc_test_host {
     name: "hidl-gen-host_test",
     defaults: ["hidl-gen-defaults"],
@@ -35,4 +26,5 @@
         "liblog",
     ],
     srcs: ["main.cpp"],
+    test_suites: ["device-tests"],
 }
diff --git a/test/host_utils_test/Android.bp b/test/host_utils_test/Android.bp
index e585162..adc2019 100644
--- a/test/host_utils_test/Android.bp
+++ b/test/host_utils_test/Android.bp
@@ -12,15 +12,6 @@
 // See the License for the specific language governing permissions and
 // limitations under the License.
 
-package {
-    // See: http://go/android-license-faq
-    // A large-scale-change added 'default_applicable_licenses' to import
-    // all of the 'license_kinds' from "system_tools_hidl_license"
-    // to get the below license kinds:
-    //   SPDX-license-identifier-Apache-2.0
-    default_applicable_licenses: ["system_tools_hidl_license"],
-}
-
 cc_test_host {
     name: "libhidl-gen-host-utils_test",
     defaults: ["hidl-gen-defaults"],
@@ -30,4 +21,5 @@
         "liblog",
     ],
     srcs: ["main.cpp"],
+    test_suites: ["device-tests"],
 }
diff --git a/test/java_impl_test/Android.bp b/test/java_impl_test/Android.bp
index b9d274a..81b1398 100644
--- a/test/java_impl_test/Android.bp
+++ b/test/java_impl_test/Android.bp
@@ -14,21 +14,14 @@
  * limitations under the License.
  */
 
-package {
-    // See: http://go/android-license-faq
-    // A large-scale-change added 'default_applicable_licenses' to import
-    // all of the 'license_kinds' from "system_tools_hidl_license"
-    // to get the below license kinds:
-    //   SPDX-license-identifier-Apache-2.0
-    default_applicable_licenses: ["system_tools_hidl_license"],
-}
-
 java_genrule {
     name: "hidl_java_impl_test_gen",
     tools: [
         "hidl-gen",
     ],
-    srcs: [":android.hardware.tests.baz@1.0_hal"],
+    required: [
+        "android.hardware.tests.baz-V1.0-java",
+    ],
     cmd: "$(location hidl-gen) -o $(genDir) -Ljava-impl android.hardware.tests.baz@1.0",
     out: [
         "Base.java",
diff --git a/test/java_partial_test/Android.bp b/test/java_partial_test/Android.bp
index 64dfe43..3f856af 100644
--- a/test/java_partial_test/Android.bp
+++ b/test/java_partial_test/Android.bp
@@ -1,12 +1,3 @@
-package {
-    // See: http://go/android-license-faq
-    // A large-scale-change added 'default_applicable_licenses' to import
-    // all of the 'license_kinds' from "system_tools_hidl_license"
-    // to get the below license kinds:
-    //   SPDX-license-identifier-Apache-2.0
-    default_applicable_licenses: ["system_tools_hidl_license"],
-}
-
 java_genrule {
     name: "hidl_partial_java_test_gen",
     tools: [
diff --git a/test/java_test/Android.bp b/test/java_test/Android.bp
index 1b3f495..7bebc74 100644
--- a/test/java_test/Android.bp
+++ b/test/java_test/Android.bp
@@ -1,38 +1,8 @@
-package {
-    // See: http://go/android-license-faq
-    // A large-scale-change added 'default_applicable_licenses' to import
-    // all of the 'license_kinds' from "system_tools_hidl_license"
-    // to get the below license kinds:
-    //   SPDX-license-identifier-Apache-2.0
-    default_applicable_licenses: ["system_tools_hidl_license"],
-}
-
-python_test_host {
-    name: "hidl_test_java",
-    main: "hidl_test_java.py",
-    srcs: ["hidl_test_java.py"],
-    test_config: "hidl_test_java.xml",
-    target_required: [
-        "hidl_test_java_native",
-        "hidl_test_java_java",
-    ],
-    test_suites: [
-        "general-tests",
-        "vts",
-    ],
-    test_options: {
-        unit_test: false,
-    },
-}
-
 cc_test {
     name: "hidl_test_java_native",
     srcs: ["hidl_test_java_native.cpp"],
 
-    cflags: [
-        "-Wall",
-        "-Werror",
-    ],
+    cflags: ["-Wall", "-Werror"],
 
     // Allow dlsym'ing self for statically linked passthrough implementations
     ldflags: ["-rdynamic"],
@@ -64,19 +34,6 @@
     ],
 
     compile_multilib: "both",
-    multilib: {
-        lib32: {
-            suffix: "32",
-        },
-        lib64: {
-            suffix: "64",
-        },
-    },
-    test_suites: [
-        "general-tests",
-        "vts",
-    ],
-    auto_gen_config: false,
 }
 
 java_test {
@@ -91,9 +48,4 @@
         "android.hardware.tests.memory-V2.0-java",
         "android.hardware.tests.safeunion-V1.0-java",
     ],
-    test_suites: [
-        "general-tests",
-        "vts",
-    ],
-    auto_gen_config: false,
 }
diff --git a/test/java_test/Android.mk b/test/java_test/Android.mk
new file mode 100644
index 0000000..7e277a4
--- /dev/null
+++ b/test/java_test/Android.mk
@@ -0,0 +1,18 @@
+LOCAL_PATH:= $(call my-dir)
+
+include $(CLEAR_VARS)
+LOCAL_MODULE := hidl_test_java
+LOCAL_MODULE_CLASS := NATIVE_TESTS
+LOCAL_SRC_FILES := hidl_test_java
+
+LOCAL_MODULE_PATH := $(TARGET_OUT_DATA)/nativetest64
+
+LOCAL_REQUIRED_MODULES :=                       \
+    hidl_test_java_java                         \
+    hidl_test_java_native
+
+ifneq ($(TARGET_2ND_ARCH),)
+LOCAL_REQUIRED_MODULES += hidl_test_java_native$(TARGET_2ND_ARCH_MODULE_SUFFIX)
+endif
+
+include $(BUILD_PREBUILT)
diff --git a/test/java_test/hidl_test_java b/test/java_test/hidl_test_java
new file mode 100644
index 0000000..fdcb00f
--- /dev/null
+++ b/test/java_test/hidl_test_java
@@ -0,0 +1,41 @@
+export CLASSPATH=/data/framework/hidl_test_java_java.jar
+export TREBLE_TESTING_OVERRIDE=true
+
+e=0
+for SIZE in 64 32; do
+    native=/data/nativetest${SIZE/32}/hidl_test_java_native/hidl_test_java_native
+
+    if [ -f $native ]; then
+        echo "Testing $SIZE bit native client/server"
+
+        # Test native server with Java client
+        $native -s &
+        sleep 1
+        NATIVE_PID=$!
+        app_process /data/framework com.android.commands.hidl_test_java.HidlTestJava -c \
+            && echo "Java client => native server PASSED" \
+            || (echo "Java client => native server FAILED" && false) || e=1
+
+        kill $NATIVE_PID 2>/dev/null
+
+        # Test Java server with native client
+        app_process /data/framework com.android.commands.hidl_test_java.HidlTestJava -s &
+        NATIVE_PID=$!
+        $native -c \
+            && echo "native client => Java server PASSED" \
+            || (echo "native client => Java server FAILED" && false) || e=1
+
+        kill $NATIVE_PID 2>/dev/null
+    else
+        echo "FAILED: Not running $native because it doesn't exist."
+        e=1
+    fi
+done
+
+echo
+echo "Summary: $e"
+[ $e -eq 0 ] && echo "All tests PASSED." || echo "Test(s) FAILED."
+
+export TREBLE_TESTING_OVERRIDE=false
+
+exit $e
diff --git a/test/java_test/hidl_test_java.py b/test/java_test/hidl_test_java.py
deleted file mode 100644
index ccafd88..0000000
--- a/test/java_test/hidl_test_java.py
+++ /dev/null
@@ -1,81 +0,0 @@
-#!/usr/bin/env python3
-#
-# Copyright (C) 2020 The Android Open Source Project
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-#      http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-
-import os
-import subprocess
-import unittest
-import time
-
-def run_cmd(cmd, ignore_error=False):
-    print("Running command:", cmd)
-    p = subprocess.Popen(cmd, shell=True)
-    p.communicate()
-    if not ignore_error and p.returncode:
-        raise subprocess.CalledProcessError(p.returncode, cmd)
-    return p.returncode
-
-class TestHidlJava(unittest.TestCase):
-    pass
-
-def cleanup(cmd):
-    binary = cmd.split()[0]
-    run_cmd("adb shell killall %s >/dev/null 2>&1" % binary, ignore_error=True)
-
-def make_test(client, server):
-    def test(self):
-        try:
-            env = "CLASSPATH=/data/framework/hidl_test_java_java.jar"
-
-            cleanup(client)
-            cleanup(server)
-            run_cmd("adb shell \"( %s %s -s ) </dev/null >/dev/null 2>&1 &\"" % (env, server))
-            time.sleep(2)
-            run_cmd("adb shell %s %s -c" % (env, client))
-        finally:
-            cleanup(client)
-            cleanup(server)
-    return test
-
-def has_bitness(bitness):
-    return 0 == run_cmd("echo '[[ \"$(getprop ro.product.cpu.abilist%s)\" != \"\" ]]' | adb shell sh" % bitness, ignore_error=True)
-
-if __name__ == '__main__':
-    cmds = ["app_process /data/framework com.android.commands.hidl_test_java.HidlTestJava"]
-
-    if has_bitness(32):
-        cmds += ["/data/nativetest/hidl_test_java_native/hidl_test_java_native"]
-
-    if has_bitness(64):
-        cmds += ["/data/nativetest64/hidl_test_java_native/hidl_test_java_native"]
-
-    assert len(cmds) >= 2
-
-    def short_name(cmd):
-        if "app" in cmd:
-            return "java"
-        if "64" in cmd:
-            return "64"
-        return "32"
-
-    for client in cmds:
-        for server in cmds:
-            test_name = 'test_%s_to_%s' % (short_name(client), short_name(server))
-            test = make_test(client, server)
-            setattr(TestHidlJava, test_name, test)
-
-    suite = unittest.TestLoader().loadTestsFromTestCase(TestHidlJava)
-    unittest.TextTestRunner(verbosity=2).run(suite)
diff --git a/test/java_test/hidl_test_java.xml b/test/java_test/hidl_test_java.xml
deleted file mode 100644
index c2146a6..0000000
--- a/test/java_test/hidl_test_java.xml
+++ /dev/null
@@ -1,39 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2020 The Android Open Source Project
-
-     Licensed under the Apache License, Version 2.0 (the "License");
-     you may not use this file except in compliance with the License.
-     You may obtain a copy of the License at
-
-          http://www.apache.org/licenses/LICENSE-2.0
-
-     Unless required by applicable law or agreed to in writing, software
-     distributed under the License is distributed on an "AS IS" BASIS,
-     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-     See the License for the specific language governing permissions and
-     limitations under the License.
--->
-<configuration description="Runs HIDL Java on-device integration tests.">
-    <option name="test-suite-tag" value="apct" />
-    <option name="test-suite-tag" value="apct-native" />
-
-    <target_preparer class="com.android.tradefed.targetprep.RootTargetPreparer"/>
-
-    <target_preparer class="com.android.tradefed.targetprep.PushFilePreparer">
-      <!-- We would like to abort, but currently there is not a simple way to specify installation of both bitnesses of targets. -->
-      <option name="abort-on-push-failure" value="false"/>
-
-      <option name="push" value="hidl_test_java_native32->/data/nativetest/hidl_test_java_native/hidl_test_java_native" />
-      <option name="push" value="hidl_test_java_native64->/data/nativetest64/hidl_test_java_native/hidl_test_java_native" />
-
-      <option name="push" value="hidl_test_java_java.jar->/data/framework/hidl_test_java_java.jar" />
-
-      <option name="cleanup" value="true" />
-    </target_preparer>
-
-    <test class="com.android.tradefed.testtype.python.PythonBinaryHostTest" >
-        <option name="par-file-name" value="hidl_test_java" />
-        <option name="test-timeout" value="2m" />
-    </test>
-</configuration>
-
diff --git a/test/java_test/hidl_test_java_native.cpp b/test/java_test/hidl_test_java_native.cpp
index 9827f07..4c479f2 100644
--- a/test/java_test/hidl_test_java_native.cpp
+++ b/test/java_test/hidl_test_java_native.cpp
@@ -23,9 +23,9 @@
 #include <android/hardware/tests/baz/1.0/IBaz.h>
 #include <android/hardware/tests/memory/2.0/IMemoryInterface.h>
 #include <android/hardware/tests/memory/2.0/types.h>
+#include <android/hardware/tests/safeunion/1.0/IOtherInterface.h>
 #include <android/hardware/tests/safeunion/1.0/ISafeUnion.h>
 #include <android/hidl/allocator/1.0/IAllocator.h>
-#include <android/hidl/manager/1.0/IServiceManager.h>
 
 #include <hidlmemory/mapping.h>
 #include <hidl/LegacySupport.h>
@@ -44,6 +44,7 @@
 using ::android::hardware::tests::baz::V1_0::IBazCallback;
 using ::android::hardware::tests::memory::V2_0::IMemoryInterface;
 using ::android::hardware::tests::memory::V2_0::TwoMemory;
+using ::android::hardware::tests::safeunion::V1_0::IOtherInterface;
 using ::android::hardware::tests::safeunion::V1_0::ISafeUnion;
 
 using ::android::hardware::hidl_array;
@@ -82,6 +83,16 @@
     return Void();
 }
 
+struct OtherInterface : public IOtherInterface {
+    Return<void> concatTwoStrings(const hidl_string& a, const hidl_string& b,
+                                  concatTwoStrings_cb _hidl_cb) override {
+        hidl_string result = std::string(a) + std::string(b);
+        _hidl_cb(result);
+
+        return Void();
+    }
+};
+
 struct MemoryInterface : public IMemoryInterface {
     MemoryInterface() {
         sp<IAllocator> ashmem = IAllocator::getService("ashmem");
@@ -211,6 +222,7 @@
 struct HidlTest : public ::testing::Test {
     sp<IBaz> baz;
     sp<ISafeUnion> safeunionInterface;
+    sp<IOtherInterface> otherInterface;
 
     void SetUp() override {
         using namespace ::android::hardware;
@@ -224,6 +236,11 @@
         safeunionInterface = ISafeUnion::getService();
         CHECK(safeunionInterface != nullptr);
         CHECK(safeunionInterface->isRemote());
+
+        ::android::hardware::details::waitForHwService(IOtherInterface::descriptor, "default");
+        otherInterface = IOtherInterface::getService();
+        CHECK(otherInterface != nullptr);
+        CHECK(otherInterface->isRemote());
     }
 
     void TearDown() override {
@@ -278,12 +295,6 @@
 }
 
 TEST_F(HidlTest, SomeOtherBaseMethodInvalidString) {
-    Return<bool> isJava = baz->isJava();
-    ASSERT_TRUE(isJava.isOk());
-    if (!isJava) {
-        GTEST_SKIP() << "Test only applies to Java";
-    }
-
     IBase::Foo foo {
         .y = {
             .s = "\xff",
@@ -758,7 +769,7 @@
     EXPECT_EQ(::android::OK, request.writeInterfaceToken(IBaz::descriptor));
     EXPECT_EQ(::android::OK, request.writeInt64(1234));
     // IBaz::doThatAndReturnSomething is two-way but we call it using FLAG_ONEWAY.
-    EXPECT_EQ(::android::OK, binder->transact(19 /*doThatAndReturnSomething*/, request, &reply,
+    EXPECT_EQ(::android::OK, binder->transact(18 /*doThatAndReturnSomething*/, request, &reply,
                                               IBinder::FLAG_ONEWAY));
 
     ::android::hardware::Status status;
@@ -769,9 +780,6 @@
 }
 
 TEST_F(HidlTest, OnewayMethodOnewayDisabledTest) {
-    Return<bool> isJava = baz->isJava();
-    ASSERT_TRUE(isJava.isOk());
-
     using ::android::hardware::IBinder;
     using ::android::hardware::Parcel;
 
@@ -785,10 +793,8 @@
             // Expect UNKNOWN_ERROR because the JNI class JHwBinder always sets
             // the reply to UNKNOWN_ERROR for two-way transactions if the
             // transaction itself did not send a reply.
-            //
-            // C++ does not specifically check this error case.
-            (isJava ? ::android::UNKNOWN_ERROR : 0),
-            binder->transact(18 /*doThis*/, request, &reply, 0 /* Not FLAG_ONEWAY */));
+            ::android::UNKNOWN_ERROR,
+            binder->transact(17 /*doThis*/, request, &reply, 0 /* Not FLAG_ONEWAY */));
 
     EXPECT_OK(baz->ping());  // still works
 }
@@ -960,14 +966,17 @@
                 }));
         }));
 
-    using android::hardware::defaultServiceManager;
-    using android::hardware::interfacesEqual;
-
+    // Same-process interface calls are not supported in Java, so we use
+    // a safe_union instance bound to this (client) process instead of
+    // safeunionInterface to exercise this test-case. Ref: b/110957763.
     InterfaceTypeSafeUnion safeUnion;
-    safeUnion.c(defaultServiceManager());
+    safeUnion.c(otherInterface);
 
     EXPECT_EQ(InterfaceTypeSafeUnion::hidl_discriminator::c, safeUnion.getDiscriminator());
-    EXPECT_TRUE(interfacesEqual(safeUnion.c(), defaultServiceManager()));
+    EXPECT_OK(safeUnion.c()->concatTwoStrings(
+        hidl_string(testStringA), hidl_string(testStringB), [&](const hidl_string& result) {
+            EXPECT_EQ(testStringA + testStringB, std::string(result));
+        }));
 
     native_handle_delete(h);
 }
@@ -1194,12 +1203,6 @@
 }
 
 TEST_F(HidlTest, UninitTest) {
-    Return<bool> isJava = baz->isJava();
-    ASSERT_TRUE(isJava.isOk());
-    if (!isJava) {
-        GTEST_SKIP() << "Test only applies to Java";
-    }
-
     IBase::Foo foo;
     foo.x = 1;
     foo.y = {0, ""};
@@ -1223,8 +1226,9 @@
 }
 
 int main(int argc, char **argv) {
+    setenv("TREBLE_TESTING_OVERRIDE", "true", true);
+
     using namespace android::hardware;
-    details::setTrebleTestingOverride(true);
 
     const char *me = argv[0];
 
@@ -1278,6 +1282,10 @@
     status = registerPassthroughServiceImplementation<ISafeUnion>();
     CHECK(status == ::android::OK) << "ISafeUnion didn't register";
 
+    sp<IOtherInterface> otherInterface = new OtherInterface();
+    status = otherInterface->registerAsService();
+    CHECK(status == ::android::OK) << "IOtherInterface didn't register";
+
     sp<IMemoryInterface> memoryInterface = new MemoryInterface();
     status = memoryInterface->registerAsService();
     CHECK(status == ::android::OK) << "IMemoryInterface didn't register";
diff --git a/test/java_test/src/com/android/commands/hidl_test_java/HidlTestJava.java b/test/java_test/src/com/android/commands/hidl_test_java/HidlTestJava.java
index a0311fe..db6cd5a 100644
--- a/test/java_test/src/com/android/commands/hidl_test_java/HidlTestJava.java
+++ b/test/java_test/src/com/android/commands/hidl_test_java/HidlTestJava.java
@@ -20,34 +20,35 @@
 import static android.system.OsConstants.PROT_READ;
 import static android.system.OsConstants.PROT_WRITE;
 
+import android.hidl.manager.V1_0.IServiceManager;
 import android.hardware.tests.baz.V1_0.IBase;
 import android.hardware.tests.baz.V1_0.IBaz;
+import android.hardware.tests.baz.V1_0.IQuux;
 import android.hardware.tests.baz.V1_0.IBaz.MyHandle;
 import android.hardware.tests.baz.V1_0.IBaz.NestedStruct;
 import android.hardware.tests.baz.V1_0.IBazCallback;
-import android.hardware.tests.baz.V1_0.IQuux;
 import android.hardware.tests.memory.V2_0.IMemoryInterface;
 import android.hardware.tests.memory.V2_0.TwoMemory;
+import android.hardware.tests.safeunion.V1_0.IOtherInterface;
 import android.hardware.tests.safeunion.V1_0.ISafeUnion;
 import android.hardware.tests.safeunion.V1_0.ISafeUnion.HandleTypeSafeUnion;
 import android.hardware.tests.safeunion.V1_0.ISafeUnion.InterfaceTypeSafeUnion;
 import android.hardware.tests.safeunion.V1_0.ISafeUnion.LargeSafeUnion;
 import android.hardware.tests.safeunion.V1_0.ISafeUnion.SmallSafeUnion;
-import android.hidl.manager.V1_0.IServiceManager;
-import android.os.DeadObjectException;
 import android.os.HidlMemory;
 import android.os.HidlMemoryUtil;
-import android.os.HidlSupport;
 import android.os.HwBinder;
 import android.os.HwParcel;
 import android.os.IBinder;
 import android.os.IHwBinder;
 import android.os.NativeHandle;
 import android.os.RemoteException;
+import android.os.HidlSupport;
 import android.os.SharedMemory;
 import android.system.ErrnoException;
 import android.system.Os;
 import android.util.Log;
+
 import java.io.File;
 import java.io.FileDescriptor;
 import java.io.FileInputStream;
@@ -75,8 +76,6 @@
     }
 
     public int run(String[] args) throws RemoteException, IOException, ErrnoException {
-        HwBinder.setTrebleTestingOverride(true);
-
         if (args[0].equals("-c")) {
             client();
         } else if (args[0].equals("-s")) {
@@ -368,6 +367,8 @@
             String testStringA = "Hello";
             String testStringB = "World";
 
+            IOtherInterface otherInterface = IOtherInterface.getService();
+
             ArrayList<NativeHandle> testHandlesVector = new ArrayList<>();
             for (int i = 0; i < 128; i++) {
                 testHandlesVector.add(new NativeHandle());
@@ -378,10 +379,11 @@
             ExpectTrue(safeUnion.getDiscriminator() == InterfaceTypeSafeUnion.hidl_discriminator.b);
             ExpectDeepEq(testArray, safeUnion.b());
 
-            IServiceManager anInterface = IServiceManager.getService();
-            safeUnion.c(anInterface);
+            safeUnion.c(otherInterface);
             ExpectTrue(safeUnion.getDiscriminator() == InterfaceTypeSafeUnion.hidl_discriminator.c);
-            ExpectTrue(HidlSupport.interfacesEqual(anInterface, safeUnion.c()));
+            ExpectTrue(HidlSupport.interfacesEqual(otherInterface, safeUnion.c()));
+            String result = safeUnion.c().concatTwoStrings(testStringA, testStringB);
+            Expect(result, testStringA + testStringB);
 
             safeUnion = safeunionInterface.setInterfaceD(safeUnion, testStringA);
             ExpectTrue(safeUnion.getDiscriminator() == InterfaceTypeSafeUnion.hidl_discriminator.d);
@@ -599,18 +601,6 @@
         }
 
         {
-            // Test proper exceptions are thrown
-            try {
-                // not in manifest, so won't wait
-                IBase proxy = IBase.getService("this-doesn't-exist", true /*retry*/);
-                // this should never run
-                ExpectTrue(false);
-            } catch (Exception e) {
-                ExpectTrue(e instanceof NoSuchElementException);
-            }
-        }
-
-        {
             // Test access through base interface binder.
             IBase baseProxy = IBase.getService();
             baseProxy.someBaseMethod();
@@ -651,7 +641,7 @@
             request.writeInterfaceToken(IBaz.kInterfaceName);
             request.writeInt64(1234);
             // IBaz::doThatAndReturnSomething is not oneway but we call it using FLAG_ONEWAY.
-            binder.transact(19 /*doThatAndReturnSomething*/, request, reply, IBinder.FLAG_ONEWAY);
+            binder.transact(18 /*doThatAndReturnSomething*/, request, reply, IBinder.FLAG_ONEWAY);
 
             try {
                 reply.verifySuccess();
@@ -673,16 +663,11 @@
             request.writeInterfaceToken(IBaz.kInterfaceName);
             request.writeFloat(1.0f);
             // IBaz::doThis is oneway but we call it without using FLAG_ONEWAY.
-            // This does not raise an exception in C++ because
+            // This does not raise an exception because
             // IPCThreadState::executeCommand for BR_TRANSACTION sends an empty
             // reply for two-way transactions if the transaction itself did not
             // send a reply.
-            try {
-                binder.transact(18 /*doThis*/, request, reply, 0 /* Not FLAG_ONEWAY */);
-                ExpectTrue(!proxy.isJava());
-            } catch (RemoteException e) {
-                ExpectTrue(proxy.isJava());
-            }
+            binder.transact(17 /*doThis*/, request, reply, 0 /* Not FLAG_ONEWAY */);
 
             proxy.ping();
         }
@@ -941,7 +926,7 @@
         proxy.callMe(cb);
         ExpectTrue(cb.wasCalled());
 
-        ExpectTrue(proxy.useAnEnum(IBaz.SomeEnum.goober) == IBaz.SomeEnum.quux);
+        ExpectTrue(proxy.useAnEnum(IBaz.SomeEnum.goober) == -64);
 
         {
             String[] stringArray = new String[3];
@@ -1005,12 +990,9 @@
             ExpectTrue(!t1.equals(t2));
         }
 
-        // server currently only implements this in C++
-        if (!proxy.isJava()) {
-            ArrayList<NestedStruct> structs = proxy.getNestedStructs();
-            ExpectTrue(structs.size() == 5);
-            ExpectTrue(structs.get(1).matrices.size() == 6);
-        }
+        ArrayList<NestedStruct> structs = proxy.getNestedStructs();
+        ExpectTrue(structs.size() == 5);
+        ExpectTrue(structs.get(1).matrices.size() == 6);
 
         {
             IBaz.Everything e = new IBaz.Everything();
@@ -1214,21 +1196,17 @@
             IBaz baz = IBaz.getService();
             ExpectTrue(baz != null);
             IBaz.StructWithInterface swi = new IBaz.StructWithInterface();
-            swi.iface = IServiceManager.getService();
+            swi.dummy = baz;
             swi.number = 12345678;
             IBaz.StructWithInterface swi_back = baz.haveSomeStructWithInterface(swi);
             ExpectTrue(swi_back != null);
-            ExpectTrue(swi_back.iface != null);
-            ExpectTrue(HidlSupport.interfacesEqual(swi.iface, swi_back.iface));
+            ExpectTrue(swi_back.dummy != null);
+            ExpectTrue(HidlSupport.interfacesEqual(baz, swi_back.dummy));
             ExpectTrue(swi_back.number == 12345678);
         }
 
         runClientSafeUnionTests();
-
-        // currently no Java implementation of this
-        if (!proxy.isJava()) {
-            runClientMemoryTests();
-        }
+        runClientMemoryTests();
 
         // --- DEATH RECIPIENT TESTING ---
         // This must always be done last, since it will kill the native server process
@@ -1247,7 +1225,7 @@
         ExpectTrue(proxy.unlinkToDeath(recipient2));
         try {
             proxy.dieNow();
-        } catch (DeadObjectException e) {
+        } catch (RemoteException e) {
             // Expected
         }
         ExpectTrue(recipient1.waitUntilServiceDied(2000 /*timeoutMillis*/));
@@ -1258,11 +1236,6 @@
 
     class Baz extends IBaz.Stub {
         // from IBase
-        public boolean isJava() {
-            Log.d(TAG, "Baz isJava");
-            return true;
-        }
-
         public void someBaseMethod() {
             Log.d(TAG, "Baz someBaseMethod");
         }
@@ -1481,7 +1454,9 @@
             }
         }
 
-        public void dieNow() { System.exit(0); }
+        public void dieNow() {
+            // Not tested in Java
+        }
 
         public byte useAnEnum(byte zzz) {
             Log.d(TAG, "useAnEnum " + zzz);
@@ -1669,7 +1644,7 @@
 
         @Override
         public InterfaceTypeSafeUnion setInterfaceC(
-                InterfaceTypeSafeUnion safeUnion, android.hidl.base.V1_0.IBase c) {
+            InterfaceTypeSafeUnion safeUnion, IOtherInterface c) {
             Log.d(TAG, "SERVER: setInterfaceC(" + c + ")");
             safeUnion.c(c);
 
@@ -1743,6 +1718,13 @@
         }
     }
 
+    class OtherInterface extends IOtherInterface.Stub {
+        @Override
+        public String concatTwoStrings(String a, String b) {
+            return a.concat(b);
+        }
+    }
+
     private void server() throws RemoteException {
         HwBinder.configureRpcThreadpool(1, true);
 
@@ -1759,6 +1741,9 @@
         SafeUnion safeunionInterface = new SafeUnion();
         safeunionInterface.registerAsService("default");
 
+        OtherInterface otherInterface = new OtherInterface();
+        otherInterface.registerAsService("default");
+
         HwBinder.joinRpcThreadpool();
     }
 }
diff --git a/test/lazy_test/Android.bp b/test/lazy_test/Android.bp
index 418f84a..a2c67cb 100644
--- a/test/lazy_test/Android.bp
+++ b/test/lazy_test/Android.bp
@@ -1,19 +1,9 @@
-package {
-    // See: http://go/android-license-faq
-    // A large-scale-change added 'default_applicable_licenses' to import
-    // all of the 'license_kinds' from "system_tools_hidl_license"
-    // to get the below license kinds:
-    //   SPDX-license-identifier-Apache-2.0
-    default_applicable_licenses: ["system_tools_hidl_license"],
-}
-
 cc_test {
     name: "hidl_lazy_test",
     defaults: ["hidl-gen-defaults"],
     srcs: ["hidl_lazy_test.cpp"],
 
     shared_libs: [
-        "android.hardware.tests.lazy@1.1",
         "libbase",
         "libhidl-gen-utils",
         "libhidlbase",
@@ -35,7 +25,7 @@
     srcs: ["hidl_lazy_test_server.cpp"],
 
     shared_libs: [
-        "android.hardware.tests.lazy@1.1",
+        "android.hardware.tests.lazy@1.0",
         "libbase",
         "libhidlbase",
         "libutils",
diff --git a/test/lazy_test/hidl_lazy_test.cpp b/test/lazy_test/hidl_lazy_test.cpp
index 0a1aba9..9becc35 100644
--- a/test/lazy_test/hidl_lazy_test.cpp
+++ b/test/lazy_test/hidl_lazy_test.cpp
@@ -23,7 +23,6 @@
 
 #include <unistd.h>
 
-#include <android/hardware/tests/lazy/1.1/ILazy.h>
 #include <android/hidl/manager/1.2/IServiceManager.h>
 #include <gtest/gtest.h>
 #include <hidl-util/FqInstance.h>
@@ -37,15 +36,14 @@
 using ::android::hardware::hidl_string;
 using ::android::hardware::hidl_vec;
 using ::android::hardware::IPCThreadState;
-using ::android::hardware::tests::lazy::V1_1::ILazy;
 using ::android::hidl::base::V1_0::IBase;
 using ::android::hidl::manager::V1_2::IServiceManager;
 
-static std::vector<FqInstance> gInstances;
+static FqInstance gInstance;
 
-sp<IBase> getHal(const FqInstance& instance) {
-    return ::android::hardware::details::getRawServiceInternal(instance.getFqName().string(),
-                                                               instance.getInstance(),
+sp<IBase> getHal() {
+    return ::android::hardware::details::getRawServiceInternal(gInstance.getFqName().string(),
+                                                               gInstance.getInstance(),
                                                                true /*retry*/, false /*getStub*/);
 }
 
@@ -57,13 +55,10 @@
         manager = IServiceManager::getService();
         ASSERT_NE(manager, nullptr);
 
-        for (const auto& instance : gInstances) {
-            ASSERT_FALSE(isServiceRunning(instance))
-                    << "Service '" << instance.string()
-                    << "' is already running. Please ensure this "
-                    << "service is implemented as a lazy HAL, then kill all "
-                    << "clients of this service and try again.";
-        }
+        ASSERT_FALSE(isServiceRunning())
+                << "Service '" << gInstance.string() << "' is already running. Please ensure this "
+                << "service is implemented as a lazy HAL, then kill all "
+                << "clients of this service and try again.";
     }
 
     static constexpr size_t SHUTDOWN_WAIT_TIME = 10;
@@ -72,24 +67,22 @@
                   << "service has shut down." << std::endl;
         IPCThreadState::self()->flushCommands();
         sleep(SHUTDOWN_WAIT_TIME);
-        for (const auto& instance : gInstances) {
-            ASSERT_FALSE(isServiceRunning(instance))
-                    << "Service failed to shutdown " << instance.string();
-        }
+        ASSERT_FALSE(isServiceRunning()) << "Service failed to shutdown.";
     }
 
-    bool isServiceRunning(const FqInstance& instance) {
+    bool isServiceRunning() {
         bool isRunning = false;
-        EXPECT_TRUE(manager->listByInterface(instance.getFqName().string(),
-                                             [&](const hidl_vec<hidl_string>& instanceNames) {
-                                                 for (const hidl_string& name : instanceNames) {
-                                                     if (name == instance.getInstance()) {
-                                                         isRunning = true;
-                                                         break;
-                                                     }
+        EXPECT_TRUE(
+                manager->listByInterface(gInstance.getFqName().string(),
+                                         [&isRunning](const hidl_vec<hidl_string>& instanceNames) {
+                                             for (const hidl_string& name : instanceNames) {
+                                                 if (name == gInstance.getInstance()) {
+                                                     isRunning = true;
+                                                     break;
                                                  }
-                                             })
-                            .isOk());
+                                             }
+                                         })
+                        .isOk());
         return isRunning;
     }
 };
@@ -98,11 +91,9 @@
 TEST_F(HidlLazyTest, GetUnget) {
     for (size_t i = 0; i < NUM_IMMEDIATE_GET_UNGETS; i++) {
         IPCThreadState::self()->flushCommands();
-        for (const auto& instance : gInstances) {
-            sp<IBase> hal = getHal(instance);
-            ASSERT_NE(hal.get(), nullptr);
-            EXPECT_TRUE(hal->ping().isOk());
-        }
+        sp<IBase> hal = getHal();
+        ASSERT_NE(hal.get(), nullptr);
+        EXPECT_TRUE(hal->ping().isOk());
     }
 }
 
@@ -114,17 +105,16 @@
     return times;
 }
 
-static void testWithTimes(const std::vector<size_t>& waitTimes, const FqInstance& instance) {
+static void testWithTimes(const std::vector<size_t>& waitTimes) {
     std::cout << "Note runtime expected from sleeps: "
               << std::accumulate(waitTimes.begin(), waitTimes.end(), 0) << " second(s)."
               << std::endl;
 
     for (size_t sleepTime : waitTimes) {
         IPCThreadState::self()->flushCommands();
-        std::cout << "Thread for " << instance.string() << " waiting " << sleepTime
-                  << " while not holding HAL." << std::endl;
+        std::cout << "Thread waiting " << sleepTime << " while not holding HAL." << std::endl;
         sleep(sleepTime);
-        sp<IBase> hal = getHal(instance);
+        sp<IBase> hal = getHal();
         ASSERT_NE(hal.get(), nullptr);
         ASSERT_TRUE(hal->ping().isOk());
     }
@@ -142,8 +132,7 @@
 
     std::vector<std::thread> threads(NUM_CONCURRENT_THREADS);
     for (size_t i = 0; i < threads.size(); i++) {
-        const FqInstance& instance = gInstances[i % gInstances.size()];
-        threads[i] = std::thread(testWithTimes, threadWaitTimes[i], instance);
+        threads[i] = std::thread(testWithTimes, threadWaitTimes[i]);
     }
 
     for (auto& thread : threads) {
@@ -151,43 +140,25 @@
     }
 }
 
-TEST_F(HidlLazyTest, ActiveServicesCallbackTest) {
-    sp<ILazy> lazy;
-
-    for (const auto& instance : gInstances) {
-        sp<IBase> hal = getHal(instance);
-        EXPECT_NE(hal, nullptr);
-        lazy = ILazy::castFrom(hal);
-        if (lazy) break;
-    }
-    if (!lazy) GTEST_SKIP() << "Services under test do not include ILazy";
-
-    ASSERT_TRUE(lazy->setCustomActiveServicesCallback().isOk());
-}
-
 int main(int argc, char** argv) {
     ::testing::InitGoogleTest(&argc, argv);
 
     srand(time(nullptr));
 
-    std::vector<std::string> fqInstances;
+    std::string fqInstance;
 
     if (argc == 1) {
-        fqInstances.push_back("android.hardware.tests.lazy@1.0::ILazy/default1");
-        fqInstances.push_back("android.hardware.tests.lazy@1.0::ILazy/default2");
+        fqInstance = "android.hardware.tests.lazy@1.0::ILazy/default";
+    } else if (argc == 2) {
+        fqInstance = argv[1];
     } else {
-        for (size_t arg = 1; arg < argc; arg++) {
-            fqInstances.push_back(argv[arg]);
-        }
+        std::cerr << "Usage: lazy_test fqinstance" << std::endl;
+        return 1;
     }
 
-    for (const std::string& instance : fqInstances) {
-        FqInstance fqInstance;
-        if (!fqInstance.setTo(instance)) {
-            std::cerr << "Invalid fqinstance: " << instance << std::endl;
-            return 1;
-        }
-        gInstances.push_back(fqInstance);
+    if (!gInstance.setTo(fqInstance)) {
+        std::cerr << "Invalid fqinstance: " << fqInstance << std::endl;
+        return 1;
     }
 
     return RUN_ALL_TESTS();
diff --git a/test/lazy_test/hidl_lazy_test_server.cpp b/test/lazy_test/hidl_lazy_test_server.cpp
index 50f8b0f..f1b381c 100644
--- a/test/lazy_test/hidl_lazy_test_server.cpp
+++ b/test/lazy_test/hidl_lazy_test_server.cpp
@@ -15,7 +15,7 @@
  */
 
 #include <android-base/logging.h>
-#include <android/hardware/tests/lazy/1.1/ILazy.h>
+#include <android/hardware/tests/lazy/1.0/ILazy.h>
 #include <hidl/HidlLazyUtils.h>
 #include <hidl/HidlTransportSupport.h>
 
@@ -23,46 +23,13 @@
 using android::hardware::configureRpcThreadpool;
 using android::hardware::joinRpcThreadpool;
 using android::hardware::LazyServiceRegistrar;
-using android::hardware::tests::lazy::V1_1::ILazy;
+using android::hardware::tests::lazy::V1_0::ILazy;
 
-class Lazy : public ILazy {
-  public:
-    ::android::hardware::Return<void> setCustomActiveServicesCallback();
-};
-
-::android::hardware::Return<void> Lazy::setCustomActiveServicesCallback() {
-    auto lazyRegistrar = android::hardware::LazyServiceRegistrar::getInstance();
-    lazyRegistrar.setActiveServicesCallback([lazyRegistrar](bool hasClients) mutable -> bool {
-        if (hasClients) {
-            return false;
-        }
-
-        // Unregister all services
-        if (!lazyRegistrar.tryUnregister()) {
-            // Prevent shutdown (test will fail)
-            return true;
-        }
-
-        // Re-register all services
-        lazyRegistrar.reRegister();
-
-        // Unregister again before shutdown
-        if (!lazyRegistrar.tryUnregister()) {
-            // Prevent shutdown (test will fail)
-            return true;
-        }
-
-        exit(EXIT_SUCCESS);
-        // Unreachable
-    });
-
-    return ::android::hardware::Status::ok();
-}
+class Lazy : public ILazy {};
 
 int main() {
     configureRpcThreadpool(1, true /*willJoin*/);
-    CHECK(OK == LazyServiceRegistrar::getInstance().registerService(new Lazy, "default1"));
-    CHECK(OK == LazyServiceRegistrar::getInstance().registerService(new Lazy, "default2"));
+    CHECK(OK == LazyServiceRegistrar::getInstance().registerService(new Lazy, "default"));
     joinRpcThreadpool();
     return EXIT_FAILURE;  // should not reach
 }
diff --git a/test/lazy_test/hidl_lazy_test_server.rc b/test/lazy_test/hidl_lazy_test_server.rc
index 54300f8..00a5237 100644
--- a/test/lazy_test/hidl_lazy_test_server.rc
+++ b/test/lazy_test/hidl_lazy_test_server.rc
@@ -1,8 +1,5 @@
 service hidl_lazy_test_server /system_ext/bin/hidl_lazy_test_server
-    interface android.hardware.tests.lazy@1.0::ILazy default1
-    interface android.hardware.tests.lazy@1.0::ILazy default2
-    interface android.hardware.tests.lazy@1.1::ILazy default1
-    interface android.hardware.tests.lazy@1.1::ILazy default2
+    interface android.hardware.tests.lazy@1.0::ILazy default
     user nobody
     group nobody
     oneshot
diff --git a/test/lazy_test/hidl_lazy_test_server.xml b/test/lazy_test/hidl_lazy_test_server.xml
index 0a88ed4..e5e071e 100644
--- a/test/lazy_test/hidl_lazy_test_server.xml
+++ b/test/lazy_test/hidl_lazy_test_server.xml
@@ -2,7 +2,6 @@
     <hal format="hidl">
         <name>android.hardware.tests.lazy</name>
         <transport>hwbinder</transport>
-        <fqname>@1.1::ILazy/default1</fqname>
-        <fqname>@1.1::ILazy/default2</fqname>
+        <fqname>@1.0::ILazy/default</fqname>
     </hal>
 </manifest>
diff --git a/test/run_all_device_tests.sh b/test/run_all_device_tests.sh
new file mode 100755
index 0000000..4d8f0b3
--- /dev/null
+++ b/test/run_all_device_tests.sh
@@ -0,0 +1,62 @@
+#!/bin/bash
+
+function run() {
+    local FAILED_TESTS=()
+
+    # Tests directly relevant to HIDL infrustructure but aren't
+    # located in system/tools/hidl
+    local RELATED_RUNTIME_TESTS=(\
+        libhidl_test \
+    )
+
+    local RUN_TIME_TESTS=(\
+        libhidl-gen-utils_test \
+    )
+    RUN_TIME_TESTS+=(${RELATED_RUNTIME_TESTS[@]})
+
+    local SCRIPT_TESTS=(\
+        hidl_test\
+        hidl_test_java\
+        fmq_test\
+    )
+
+    $ANDROID_BUILD_TOP/build/soong/soong_ui.bash --make-mode -j \
+        ${RUN_TIME_TESTS[*]} ${SCRIPT_TESTS[*]} || exit 1
+
+    # TODO(b/129507417): build with supported configurations
+    mkdir -p $ANDROID_PRODUCT_OUT/data/framework/hidl_test_java.jar || exit 1
+    cp $ANDROID_PRODUCT_OUT/testcases/hidl_test_java_java/*/hidl_test_java_java.jar \
+       $ANDROID_PRODUCT_OUT/data/framework/hidl_test_java_java.jar || exit 1
+
+    adb sync data || exit 1
+
+    local BITNESS=("nativetest" "nativetest64")
+
+    for test in ${RUN_TIME_TESTS[@]}; do
+        for bits in ${BITNESS[@]}; do
+            echo $bits $test
+            adb shell /data/$bits/$test/$test ||
+                FAILED_TESTS+=("$bits:$test")
+        done
+    done
+
+    for test in ${SCRIPT_TESTS[@]}; do
+        echo $test
+        adb shell /data/nativetest64/$test ||
+            FAILED_TESTS+=("$test")
+    done
+
+    echo
+    echo ===== ALL DEVICE TESTS SUMMARY =====
+    echo
+    if [ ${#FAILED_TESTS[@]} -gt 0 ]; then
+        for failed in ${FAILED_TESTS[@]}; do
+            echo "FAILED TEST: $failed"
+        done
+        exit 1
+    else
+        echo "SUCCESS"
+    fi
+}
+
+run
\ No newline at end of file
diff --git a/test/run_all_host_tests.sh b/test/run_all_host_tests.sh
new file mode 100755
index 0000000..6542d6f
--- /dev/null
+++ b/test/run_all_host_tests.sh
@@ -0,0 +1,50 @@
+#!/bin/bash
+
+function run() {
+    local FAILED_TESTS=()
+
+    local COMPILE_TIME_TESTS=(\
+        hidl_hash_test \
+        hidl2aidl_test \
+        hidl_error_test \
+        hidl_export_test \
+        hidl_format_test \
+        hidl_cpp_impl_test \
+        hidl_java_impl_test \
+        hidl_system_api_test \
+        android.hardware.tests.foo@1.0-vts.driver \
+        android.hardware.tests.foo@1.0-vts.profiler)
+
+    local RUN_TIME_TESTS=(\
+        libhidl-gen-utils_test \
+        libhidl-gen-host-utils_test \
+        hidl-gen-host_test \
+        hidl-lint_test \
+    )
+
+    $ANDROID_BUILD_TOP/build/soong/soong_ui.bash --make-mode -j \
+        ${COMPILE_TIME_TESTS[*]} ${RUN_TIME_TESTS[*]} || return
+
+    local BITNESS=("nativetest" "nativetest64")
+
+    for bits in ${BITNESS[@]}; do
+        for test in ${RUN_TIME_TESTS[@]}; do
+            echo $bits $test
+            $ANDROID_BUILD_TOP/out/host/linux-x86/$bits/$test/$test ||
+                FAILED_TESTS+=("$bits:$test")
+        done
+    done
+
+    echo
+    echo ===== ALL HOST TESTS SUMMARY =====
+    echo
+    if [ ${#FAILED_TESTS[@]} -gt 0 ]; then
+        for failed in ${FAILED_TESTS[@]}; do
+            echo "FAILED TEST: $failed"
+        done
+    else
+        echo "SUCCESS"
+    fi
+}
+
+run
diff --git a/test/run_tradefed_incompatible_tests.sh b/test/run_tradefed_incompatible_tests.sh
deleted file mode 100755
index e21985a..0000000
--- a/test/run_tradefed_incompatible_tests.sh
+++ /dev/null
@@ -1,37 +0,0 @@
-#!/bin/bash
-
-function run() {
-    local FAILED_TESTS=()
-
-    # the linter test requires having the source tree available in order
-    # to run, so it isn't using TEST_MAPPING/tradefed/etc
-    local RUN_TIME_TESTS=(\
-        hidl-lint_test \
-    )
-
-    $ANDROID_BUILD_TOP/build/soong/soong_ui.bash --make-mode -j \
-        ${RUN_TIME_TESTS[*]} || return
-
-    local BITNESS=("nativetest" "nativetest64")
-
-    for bits in ${BITNESS[@]}; do
-        for test in ${RUN_TIME_TESTS[@]}; do
-            echo $bits $test
-            $ANDROID_BUILD_TOP/out/host/linux-x86/$bits/$test/$test ||
-                FAILED_TESTS+=("$bits:$test")
-        done
-    done
-
-    echo
-    echo ===== ALL HOST TESTS SUMMARY =====
-    echo
-    if [ ${#FAILED_TESTS[@]} -gt 0 ]; then
-        for failed in ${FAILED_TESTS[@]}; do
-            echo "FAILED TEST: $failed"
-        done
-    else
-        echo "SUCCESS"
-    fi
-}
-
-run
diff --git a/test/system_api_test/Android.bp b/test/system_api_test/Android.bp
index 95163e6..fff313a 100644
--- a/test/system_api_test/Android.bp
+++ b/test/system_api_test/Android.bp
@@ -13,15 +13,6 @@
 // limitations under the License.
 
 // hidl-generated libs should only depend on @SystemApi
-package {
-    // See: http://go/android-license-faq
-    // A large-scale-change added 'default_applicable_licenses' to import
-    // all of the 'license_kinds' from "system_tools_hidl_license"
-    // to get the below license kinds:
-    //   SPDX-license-identifier-Apache-2.0
-    default_applicable_licenses: ["system_tools_hidl_license"],
-}
-
 java_library {
     name: "hidl_system_api_test",
     sdk_version: "system_current",
diff --git a/test/utils_test/Android.bp b/test/utils_test/Android.bp
index 8232bc8..d1aa2a4 100644
--- a/test/utils_test/Android.bp
+++ b/test/utils_test/Android.bp
@@ -12,21 +12,11 @@
 // See the License for the specific language governing permissions and
 // limitations under the License.
 
-package {
-    // See: http://go/android-license-faq
-    // A large-scale-change added 'default_applicable_licenses' to import
-    // all of the 'license_kinds' from "system_tools_hidl_license"
-    // to get the below license kinds:
-    //   SPDX-license-identifier-Apache-2.0
-    default_applicable_licenses: ["system_tools_hidl_license"],
-}
-
 cc_test {
     name: "libhidl-gen-utils_test",
     defaults: ["hidl-gen-defaults"],
     host_supported: true,
     shared_libs: ["libhidl-gen-utils"],
-    static_libs: ["libgmock"],
     srcs: ["main.cpp"],
     test_suites: ["general-tests"],
 }
diff --git a/test/utils_test/main.cpp b/test/utils_test/main.cpp
index 41185c2..0d88d26 100644
--- a/test/utils_test/main.cpp
+++ b/test/utils_test/main.cpp
@@ -18,14 +18,11 @@
 
 #include <hidl-util/FqInstance.h>
 
-#include <gmock/gmock.h>
 #include <gtest/gtest.h>
 #include <vector>
 
 using ::android::FqInstance;
 using ::android::FQName;
-using ::testing::Optional;
-using ::testing::Property;
 
 static const std::vector<std::string> kValidFqNames = {
         "android.hardware.foo@1.0::IFoo.Type",
@@ -194,21 +191,6 @@
     EXPECT_EQ((std::make_pair<size_t, size_t>(1u, 2u)), i.getVersion());
 }
 
-TEST(LibHidlGenUtilsTest, FqInstanceFrom) {
-    EXPECT_THAT(FqInstance::from("android.hardware.foo", 1, 0, "IFoo", "default"),
-                Optional(Property(&FqInstance::string, "android.hardware.foo@1.0::IFoo/default")));
-    EXPECT_THAT(FqInstance::from("android.hardware.foo", 1, 0, "IFoo"),
-                Optional(Property(&FqInstance::string, "android.hardware.foo@1.0::IFoo")));
-    EXPECT_THAT(FqInstance::from("android.hardware.foo", 1, 0),
-                Optional(Property(&FqInstance::string, "android.hardware.foo@1.0")));
-    EXPECT_THAT(FqInstance::from(1, 0, "IFoo", "default"),
-                Optional(Property(&FqInstance::string, "@1.0::IFoo/default")));
-    EXPECT_THAT(FqInstance::from(1, 0, "IFoo"),
-                Optional(Property(&FqInstance::string, "@1.0::IFoo")));
-    EXPECT_THAT(FqInstance::from("IFoo", "default"),
-                Optional(Property(&FqInstance::string, "IFoo/default")));
-}
-
 int main(int argc, char **argv) {
     ::testing::InitGoogleTest(&argc, argv);
     return RUN_ALL_TESTS();
diff --git a/test/vendor/1.0/Android.bp b/test/vendor/1.0/Android.bp
index cdb613a..c02197e 100644
--- a/test/vendor/1.0/Android.bp
+++ b/test/vendor/1.0/Android.bp
@@ -1,12 +1,3 @@
-package {
-    // See: http://go/android-license-faq
-    // A large-scale-change added 'default_applicable_licenses' to import
-    // all of the 'license_kinds' from "system_tools_hidl_license"
-    // to get the below license kinds:
-    //   SPDX-license-identifier-Apache-2.0
-    default_applicable_licenses: ["system_tools_hidl_license"],
-}
-
 hidl_interface {
     name: "hidl.tests.vendor@1.0",
     owner: "some-owner-name",
diff --git a/test/vendor/1.0/IVendor.hal b/test/vendor/1.0/IVendor.hal
index a9e6050..c963d3f 100644
--- a/test/vendor/1.0/IVendor.hal
+++ b/test/vendor/1.0/IVendor.hal
@@ -36,11 +36,4 @@
     // overriding virtual functions in parent class

     // due to namespace resolution.

     registerForNotifications();

-

-    // Testing namespace reference with safe union generation

-    safe_union ReturnError {

-        IVendor problem;

-        uint32_t error;

-    };

-    returnInterfaceOrError() generates (ReturnError result);

 };

diff --git a/test/vendor/1.1/Android.bp b/test/vendor/1.1/Android.bp
index 54f0379..5c01903 100644
--- a/test/vendor/1.1/Android.bp
+++ b/test/vendor/1.1/Android.bp
@@ -1,14 +1,5 @@
 // This file is autogenerated by hidl-gen -Landroidbp.
 
-package {
-    // See: http://go/android-license-faq
-    // A large-scale-change added 'default_applicable_licenses' to import
-    // all of the 'license_kinds' from "system_tools_hidl_license"
-    // to get the below license kinds:
-    //   SPDX-license-identifier-Apache-2.0
-    default_applicable_licenses: ["system_tools_hidl_license"],
-}
-
 hidl_interface {
     name: "hidl.tests.vendor@1.1",
     owner: "some-owner-name",
diff --git a/test/vendor/android/1.0/Android.bp b/test/vendor/android/1.0/Android.bp
index ad21afa..1627b78 100644
--- a/test/vendor/android/1.0/Android.bp
+++ b/test/vendor/android/1.0/Android.bp
@@ -1,14 +1,5 @@
 // This file is autogenerated by hidl-gen -Landroidbp.
 
-package {
-    // See: http://go/android-license-faq
-    // A large-scale-change added 'default_applicable_licenses' to import
-    // all of the 'license_kinds' from "system_tools_hidl_license"
-    // to get the below license kinds:
-    //   SPDX-license-identifier-Apache-2.0
-    default_applicable_licenses: ["system_tools_hidl_license"],
-}
-
 hidl_interface {
     name: "hidl.tests.vendor.android@1.0",
     owner: "some-owner-name",
diff --git a/test/version_test/Android.bp b/test/version_test/Android.bp
index f579657..3629b8a 100644
--- a/test/version_test/Android.bp
+++ b/test/version_test/Android.bp
@@ -1,12 +1,3 @@
-package {
-    // See: http://go/android-license-faq
-    // A large-scale-change added 'default_applicable_licenses' to import
-    // all of the 'license_kinds' from "system_tools_hidl_license"
-    // to get the below license kinds:
-    //   SPDX-license-identifier-Apache-2.0
-    default_applicable_licenses: ["system_tools_hidl_license"],
-}
-
 genrule {
     name: "hidl_hash_version_gen",
     tools: [
@@ -84,5 +75,4 @@
     name: "hidl_version_test",
     cflags: ["-Wall", "-Werror"],
     generated_sources: ["hidl_hash_version_gen"],
-    gtest: false,
 }
diff --git a/utils/Android.bp b/utils/Android.bp
index a0ba8b9..e9fd0c3 100644
--- a/utils/Android.bp
+++ b/utils/Android.bp
@@ -12,19 +12,9 @@
 // See the License for the specific language governing permissions and
 // limitations under the License.
 
-package {
-    // See: http://go/android-license-faq
-    // A large-scale-change added 'default_applicable_licenses' to import
-    // all of the 'license_kinds' from "system_tools_hidl_license"
-    // to get the below license kinds:
-    //   SPDX-license-identifier-Apache-2.0
-    default_applicable_licenses: ["system_tools_hidl_license"],
-}
-
 cc_library {
     name: "libhidl-gen-utils",
     host_supported: true,
-    product_available: true,
     recovery_available: true,
     defaults: ["hidl-gen-defaults"],
     srcs: [
diff --git a/utils/FQName.cpp b/utils/FQName.cpp
index 28d681c..93b4f30 100644
--- a/utils/FQName.cpp
+++ b/utils/FQName.cpp
@@ -52,6 +52,14 @@
     return true;
 }
 
+FQName::FQName(const FQName& other)
+    : mIsIdentifier(other.mIsIdentifier),
+      mPackage(other.mPackage),
+      mMajor(other.mMajor),
+      mMinor(other.mMinor),
+      mName(other.mName),
+      mValueName(other.mValueName) {}
+
 bool FQName::isIdentifier() const {
     return mIsIdentifier;
 }
diff --git a/utils/include/hidl-util/FQName.h b/utils/include/hidl-util/FQName.h
index 4f49b43..df12cb5 100644
--- a/utils/include/hidl-util/FQName.h
+++ b/utils/include/hidl-util/FQName.h
@@ -31,6 +31,8 @@
     FQName(const std::string& package, const std::string& version, const std::string& name = "",
            const std::string& valueName = "");
 
+    FQName(const FQName& other);
+
     bool isIdentifier() const;
 
     // Returns false if string isn't a valid FQName object.
diff --git a/utils/include/hidl-util/FqInstance.h b/utils/include/hidl-util/FqInstance.h
index 35d7a93..486845f 100644
--- a/utils/include/hidl-util/FqInstance.h
+++ b/utils/include/hidl-util/FqInstance.h
@@ -18,7 +18,6 @@
 
 #define ANDROID_FQINSTANCE_H_
 
-#include <optional>
 #include <string>
 #include <utility>
 
@@ -70,6 +69,7 @@
     // IFoo.Type:MY_ENUM_VALUE
     //
     // If no "/instance", hasInstance() will return false afterwards.
+    // TODO(b/73774955): deprecate this and use std::optional.
     __attribute__((warn_unused_result)) bool setTo(const std::string& s);
 
     // Convenience method when an FQName and instance are already available.
@@ -95,15 +95,6 @@
     __attribute__((warn_unused_result)) bool setTo(const std::string& interface,
                                                    const std::string& instance);
 
-    // Same as creating an FqInstance then call setTo. See setTo for all valid signatures.
-    // If setTo returns false, this function returns nullopt.
-    template <typename... Args>
-    static std::optional<FqInstance> from(Args&&... args) {
-        FqInstance fqInstance;
-        if (fqInstance.setTo(std::forward<Args>(args)...)) return fqInstance;
-        return std::nullopt;
-    }
-
     // undefined behavior if:
     // - Default constructor is called without setTo();
     // - setTo is called but returned false.