Add test for importing a single type.

Test: `cd system/tools/hidl && mma`

Bug: 31821285

Change-Id: I0be97b16b84f76b64c09f9dc52709416601cbbdf
diff --git a/tests/bar/1.0/Android.bp b/tests/bar/1.0/Android.bp
index b879741..617b08f 100644
--- a/tests/bar/1.0/Android.bp
+++ b/tests/bar/1.0/Android.bp
@@ -6,9 +6,11 @@
     cmd: "$tool -o $genDir -Lc++ -randroid.hardware:hardware/interfaces android.hardware.tests.bar@1.0",
     srcs: [
         "IBar.hal",
+        "IImportTypes.hal",
     ],
     out: [
         "android/hardware/tests/bar/1.0/BarAll.cpp",
+        "android/hardware/tests/bar/1.0/ImportTypesAll.cpp",
     ],
 }
 
@@ -18,6 +20,7 @@
     cmd: "$tool -o $genDir -Lc++ -randroid.hardware:hardware/interfaces android.hardware.tests.bar@1.0",
     srcs: [
         "IBar.hal",
+        "IImportTypes.hal",
     ],
     out: [
         "android/hardware/tests/bar/1.0/IBar.h",
@@ -25,6 +28,11 @@
         "android/hardware/tests/bar/1.0/BnBar.h",
         "android/hardware/tests/bar/1.0/BpBar.h",
         "android/hardware/tests/bar/1.0/BsBar.h",
+        "android/hardware/tests/bar/1.0/IImportTypes.h",
+        "android/hardware/tests/bar/1.0/IHwImportTypes.h",
+        "android/hardware/tests/bar/1.0/BnImportTypes.h",
+        "android/hardware/tests/bar/1.0/BpImportTypes.h",
+        "android/hardware/tests/bar/1.0/BsImportTypes.h",
     ],
 }
 
diff --git a/tests/bar/1.0/IBar.hal b/tests/bar/1.0/IBar.hal
index f41c1a5..b57d9a0 100644
--- a/tests/bar/1.0/IBar.hal
+++ b/tests/bar/1.0/IBar.hal
@@ -17,10 +17,16 @@
 package android.hardware.tests.bar@1.0;
 
 import android.hardware.tests.foo@1.0::IFoo;
+import android.hardware.tests.foo@1.0::Unrelated;
 
 interface IBar extends android.hardware.tests.foo@1.0::IFoo {
 
     typedef android.hardware.tests.foo@1.0::IFoo FunkyAlias;
+    typedef Unrelated Related;
+
+    struct SomethingRelated {
+        Related myRelated;
+    };
 
     thisIsNew();
 };
diff --git a/tests/bar/1.0/IImportTypes.hal b/tests/bar/1.0/IImportTypes.hal
new file mode 100644
index 0000000..a74e55c
--- /dev/null
+++ b/tests/bar/1.0/IImportTypes.hal
@@ -0,0 +1,28 @@
+/*
+ * 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.
+ */
+
+package android.hardware.tests.bar@1.0;
+
+import android.hardware.tests.foo@1.0::types;
+
+interface IImportTypes {
+    typedef Unrelated Related;
+    struct GoodStruct {
+        Outer outer;
+        android.hardware.tests.foo@1.0::Outer.Inner inner;
+        @1.0::Outer.Inner.Deep deep;
+    };
+};