Merge "remove time-consuming tests from presubmit.xml"
diff --git a/agents/hal/AgentRequestHandler.cpp b/agents/hal/AgentRequestHandler.cpp
index e94e039..c31c0b7 100644
--- a/agents/hal/AgentRequestHandler.cpp
+++ b/agents/hal/AgentRequestHandler.cpp
@@ -116,7 +116,7 @@
 bool AgentRequestHandler::LaunchDriverService(
     int driver_type, const string& service_name, const string& file_path,
     int target_class, int target_type, float target_version,
-    const string& module_name, int bits) {
+    const string& target_package, const string& module_name, int bits) {
   cout << "[runner->agent] command " << __FUNCTION__ << endl;
   ResponseCode result = FAIL;
 
@@ -252,7 +252,7 @@
             driver_type == VTS_DRIVER_TYPE_HAL_HIDL) {
           cout << "[agent->driver]: LoadHal " << module_name << endl;
           result = client->LoadHal(file_path, target_class, target_type,
-                                   target_version, module_name);
+                                   target_version, target_package, module_name);
           cout << "[driver->agent]: LoadHal returns " << result << endl;
           if (result == VTS_DRIVER_RESPONSE_SUCCESS) {
             response_msg.set_response_code(SUCCESS);
@@ -505,7 +505,8 @@
           command_msg.driver_type(), command_msg.service_name(),
           command_msg.file_path(), command_msg.target_class(),
           command_msg.target_type(), command_msg.target_version() / 100.0,
-          command_msg.module_name(), command_msg.bits());
+          command_msg.target_package(), command_msg.module_name(),
+          command_msg.bits());
     case VTS_AGENT_COMMAND_READ_SPECIFICATION:
       return ReadSpecification(command_msg.service_name());
     case LIST_APIS:
diff --git a/agents/hal/AgentRequestHandler.h b/agents/hal/AgentRequestHandler.h
index c8700c4..be0008b 100644
--- a/agents/hal/AgentRequestHandler.h
+++ b/agents/hal/AgentRequestHandler.h
@@ -65,6 +65,7 @@
   bool LaunchDriverService(int driver_type, const string& service_name,
                            const string& file_path, int target_class,
                            int target_type, float target_version,
+                           const string& target_package,
                            const string& module_name, int bits);
 
   // for the VTS_AGENT_COMMAND_READ_SPECIFICATION`
diff --git a/agents/hal/SocketClientToDriver.cpp b/agents/hal/SocketClientToDriver.cpp
index e0cac13..d4e33ac 100644
--- a/agents/hal/SocketClientToDriver.cpp
+++ b/agents/hal/SocketClientToDriver.cpp
@@ -67,6 +67,7 @@
 int32_t VtsDriverSocketClient::LoadHal(const string& file_path,
                                        int target_class, int target_type,
                                        float target_version,
+                                       const string& target_package,
                                        const string& module_name) {
   VtsDriverControlCommandMessage command_message;
   command_message.set_command_type(LOAD_HAL);
@@ -74,6 +75,7 @@
   command_message.set_target_class(target_class);
   command_message.set_target_type(target_type);
   command_message.set_target_version(target_version);
+  command_message.set_target_package(target_package);
   command_message.set_module_name(module_name);
   if (!VtsSocketSendMessage(command_message)) return -1;
 
diff --git a/agents/hal/SocketClientToDriver.h b/agents/hal/SocketClientToDriver.h
index dd1ac17..1008ac1 100644
--- a/agents/hal/SocketClientToDriver.h
+++ b/agents/hal/SocketClientToDriver.h
@@ -41,7 +41,8 @@
 
   // Sends a LOAD_HAL request.
   int32_t LoadHal(const string& file_path, int target_class, int target_type,
-                  float target_version, const string& module_name);
+                  float target_version, const string& target_package,
+                  const string& module_name);
 
   // Sends a LIST_FUNCTIONS request.
   const char* GetFunctions();
diff --git a/hals/light/bullhead/Android.mk b/hals/light/bullhead/Android.mk
index efaddbe..d30ba12 100644
--- a/hals/light/bullhead/Android.mk
+++ b/hals/light/bullhead/Android.mk
@@ -53,6 +53,8 @@
 include test/vts/tools/build/Android.packaging_gcno.mk
 
 # Sancov-enabled target.
+# TODO(trong): enable for mips.
+ifeq (,$(findstring mips, $(TARGET_PRODUCT)))
 include $(CLEAR_VARS)
 LOCAL_MODULE := lights.vts.sancov
 LOCAL_MODULE_TAGS := optional
@@ -62,21 +64,13 @@
     liblog \
 
 LOCAL_ARM_MODE := arm
-LOCAL_CLANG := true
 LOCAL_CFLAGS += \
-    -fsanitize=address \
-    -fsanitize-coverage=edge \
     -fno-omit-frame-pointer
 
-LOCAL_LDFLAGS += \
-    -fsanitize=address \
-    -fsanitize-coverage=edge \
-
-LOCAL_ADDRESS_SANITIZER := true
-
+LOCAL_SANITIZE := address coverage
 LOCAL_MULTILIB := both
-
 LOCAL_COMPATIBILITY_SUITE := vts
 
 include $(BUILD_SHARED_LIBRARY)
 include test/vts/tools/build/Android.packaging_sharedlib.mk
+endif
diff --git a/proto/AndroidSystemControlMessage.proto b/proto/AndroidSystemControlMessage.proto
index 5451290..dd517c6 100644
--- a/proto/AndroidSystemControlMessage.proto
+++ b/proto/AndroidSystemControlMessage.proto
@@ -110,6 +110,9 @@
   // the name of a HAL module to open.
   optional bytes module_name = 3007;
 
+  // the package name of a HIDL HAL.
+  optional bytes target_package = 3008;
+
   // for LIST_APIS
   // none
 
diff --git a/proto/AndroidSystemControlMessage_pb2.py b/proto/AndroidSystemControlMessage_pb2.py
index 6ac883a..54233a3 100644
--- a/proto/AndroidSystemControlMessage_pb2.py
+++ b/proto/AndroidSystemControlMessage_pb2.py
@@ -15,7 +15,7 @@
 DESCRIPTOR = _descriptor.FileDescriptor(
   name='AndroidSystemControlMessage.proto',
   package='android.vts',
-  serialized_pb='\n!AndroidSystemControlMessage.proto\x12\x0b\x61ndroid.vts\x1a#ComponentSpecificationMessage.proto\"\xea\x02\n\"AndroidSystemControlCommandMessage\x12.\n\x0c\x63ommand_type\x18\x01 \x01(\x0e\x32\x18.android.vts.CommandType\x12\x0e\n\x05paths\x18\xe9\x07 \x03(\x0c\x12\x16\n\rcallback_port\x18\xcd\x08 \x01(\x05\x12\x15\n\x0cservice_name\x18\xd1\x0f \x01(\x0c\x12\x30\n\x0b\x64river_type\x18\xb9\x17 \x01(\x0e\x32\x1a.android.vts.VtsDriverType\x12\x12\n\tfile_path\x18\xba\x17 \x01(\x0c\x12\r\n\x04\x62its\x18\xbb\x17 \x01(\x05\x12\x15\n\x0ctarget_class\x18\xbc\x17 \x01(\x05\x12\x14\n\x0btarget_type\x18\xbd\x17 \x01(\x05\x12\x17\n\x0etarget_version\x18\xbe\x17 \x01(\x05\x12\x14\n\x0bmodule_name\x18\xbf\x17 \x01(\x0c\x12\x0c\n\x03\x61rg\x18\xa1\x1f \x01(\x0c\x12\x16\n\rshell_command\x18\x89\' \x03(\x0c\"\xd3\x01\n#AndroidSystemControlResponseMessage\x12\x30\n\rresponse_code\x18\x01 \x01(\x0e\x32\x19.android.vts.ResponseCode\x12\x0f\n\x06reason\x18\xe9\x07 \x01(\x0c\x12\x13\n\nfile_names\x18\xea\x07 \x03(\x0c\x12\r\n\x04spec\x18\xeb\x07 \x01(\x0c\x12\x0f\n\x06result\x18\xec\x07 \x01(\x0c\x12\x0f\n\x06stdout\x18\xd1\x0f \x03(\x0c\x12\x0f\n\x06stderr\x18\xd2\x0f \x03(\x0c\x12\x12\n\texit_code\x18\xd3\x0f \x03(\x05\"i\n#AndroidSystemCallbackRequestMessage\x12\n\n\x02id\x18\x01 \x01(\x0c\x12\x36\n\x03\x61rg\x18\x0b \x03(\x0b\x32).android.vts.VariableSpecificationMessage\"X\n$AndroidSystemCallbackResponseMessage\x12\x30\n\rresponse_code\x18\x01 \x01(\x0e\x32\x19.android.vts.ResponseCode*\xa5\x02\n\x0b\x43ommandType\x12\x18\n\x14UNKNOWN_COMMAND_TYPE\x10\x00\x12\r\n\tLIST_HALS\x10\x01\x12\x11\n\rSET_HOST_INFO\x10\x02\x12\x08\n\x04PING\x10\x03\x12\x18\n\x14\x43HECK_DRIVER_SERVICE\x10\x65\x12\x19\n\x15LAUNCH_DRIVER_SERVICE\x10\x66\x12(\n$VTS_AGENT_COMMAND_READ_SPECIFICATION\x10g\x12\x0e\n\tLIST_APIS\x10\xc9\x01\x12\r\n\x08\x43\x41LL_API\x10\xca\x01\x12$\n\x1fVTS_AGENT_COMMAND_GET_ATTRIBUTE\x10\xcb\x01\x12,\n\'VTS_AGENT_COMMAND_EXECUTE_SHELL_COMMAND\x10\xad\x02*@\n\x0cResponseCode\x12\x19\n\x15UNKNOWN_RESPONSE_CODE\x10\x00\x12\x0b\n\x07SUCCESS\x10\x01\x12\x08\n\x04\x46\x41IL\x10\x02*\xfd\x01\n\rVtsDriverType\x12\x1a\n\x16UKNOWN_VTS_DRIVER_TYPE\x10\x00\x12$\n VTS_DRIVER_TYPE_HAL_CONVENTIONAL\x10\x01\x12\x1e\n\x1aVTS_DRIVER_TYPE_HAL_LEGACY\x10\x02\x12\x1c\n\x18VTS_DRIVER_TYPE_HAL_HIDL\x10\x03\x12\x31\n-VTS_DRIVER_TYPE_HAL_HIDL_WRAPPED_CONVENTIONAL\x10\x04\x12\x1e\n\x1aVTS_DRIVER_TYPE_LIB_SHARED\x10\x0b\x12\x19\n\x15VTS_DRIVER_TYPE_SHELL\x10\x15')
+  serialized_pb='\n!AndroidSystemControlMessage.proto\x12\x0b\x61ndroid.vts\x1a#ComponentSpecificationMessage.proto\"\x83\x03\n\"AndroidSystemControlCommandMessage\x12.\n\x0c\x63ommand_type\x18\x01 \x01(\x0e\x32\x18.android.vts.CommandType\x12\x0e\n\x05paths\x18\xe9\x07 \x03(\x0c\x12\x16\n\rcallback_port\x18\xcd\x08 \x01(\x05\x12\x15\n\x0cservice_name\x18\xd1\x0f \x01(\x0c\x12\x30\n\x0b\x64river_type\x18\xb9\x17 \x01(\x0e\x32\x1a.android.vts.VtsDriverType\x12\x12\n\tfile_path\x18\xba\x17 \x01(\x0c\x12\r\n\x04\x62its\x18\xbb\x17 \x01(\x05\x12\x15\n\x0ctarget_class\x18\xbc\x17 \x01(\x05\x12\x14\n\x0btarget_type\x18\xbd\x17 \x01(\x05\x12\x17\n\x0etarget_version\x18\xbe\x17 \x01(\x05\x12\x14\n\x0bmodule_name\x18\xbf\x17 \x01(\x0c\x12\x17\n\x0etarget_package\x18\xc0\x17 \x01(\x0c\x12\x0c\n\x03\x61rg\x18\xa1\x1f \x01(\x0c\x12\x16\n\rshell_command\x18\x89\' \x03(\x0c\"\xd3\x01\n#AndroidSystemControlResponseMessage\x12\x30\n\rresponse_code\x18\x01 \x01(\x0e\x32\x19.android.vts.ResponseCode\x12\x0f\n\x06reason\x18\xe9\x07 \x01(\x0c\x12\x13\n\nfile_names\x18\xea\x07 \x03(\x0c\x12\r\n\x04spec\x18\xeb\x07 \x01(\x0c\x12\x0f\n\x06result\x18\xec\x07 \x01(\x0c\x12\x0f\n\x06stdout\x18\xd1\x0f \x03(\x0c\x12\x0f\n\x06stderr\x18\xd2\x0f \x03(\x0c\x12\x12\n\texit_code\x18\xd3\x0f \x03(\x05\"i\n#AndroidSystemCallbackRequestMessage\x12\n\n\x02id\x18\x01 \x01(\x0c\x12\x36\n\x03\x61rg\x18\x0b \x03(\x0b\x32).android.vts.VariableSpecificationMessage\"X\n$AndroidSystemCallbackResponseMessage\x12\x30\n\rresponse_code\x18\x01 \x01(\x0e\x32\x19.android.vts.ResponseCode*\xa5\x02\n\x0b\x43ommandType\x12\x18\n\x14UNKNOWN_COMMAND_TYPE\x10\x00\x12\r\n\tLIST_HALS\x10\x01\x12\x11\n\rSET_HOST_INFO\x10\x02\x12\x08\n\x04PING\x10\x03\x12\x18\n\x14\x43HECK_DRIVER_SERVICE\x10\x65\x12\x19\n\x15LAUNCH_DRIVER_SERVICE\x10\x66\x12(\n$VTS_AGENT_COMMAND_READ_SPECIFICATION\x10g\x12\x0e\n\tLIST_APIS\x10\xc9\x01\x12\r\n\x08\x43\x41LL_API\x10\xca\x01\x12$\n\x1fVTS_AGENT_COMMAND_GET_ATTRIBUTE\x10\xcb\x01\x12,\n\'VTS_AGENT_COMMAND_EXECUTE_SHELL_COMMAND\x10\xad\x02*@\n\x0cResponseCode\x12\x19\n\x15UNKNOWN_RESPONSE_CODE\x10\x00\x12\x0b\n\x07SUCCESS\x10\x01\x12\x08\n\x04\x46\x41IL\x10\x02*\xfd\x01\n\rVtsDriverType\x12\x1a\n\x16UKNOWN_VTS_DRIVER_TYPE\x10\x00\x12$\n VTS_DRIVER_TYPE_HAL_CONVENTIONAL\x10\x01\x12\x1e\n\x1aVTS_DRIVER_TYPE_HAL_LEGACY\x10\x02\x12\x1c\n\x18VTS_DRIVER_TYPE_HAL_HIDL\x10\x03\x12\x31\n-VTS_DRIVER_TYPE_HAL_HIDL_WRAPPED_CONVENTIONAL\x10\x04\x12\x1e\n\x1aVTS_DRIVER_TYPE_LIB_SHARED\x10\x0b\x12\x19\n\x15VTS_DRIVER_TYPE_SHELL\x10\x15')
 
 _COMMANDTYPE = _descriptor.EnumDescriptor(
   name='CommandType',
@@ -70,8 +70,8 @@
   ],
   containing_type=None,
   options=None,
-  serialized_start=864,
-  serialized_end=1157,
+  serialized_start=889,
+  serialized_end=1182,
 )
 
 CommandType = enum_type_wrapper.EnumTypeWrapper(_COMMANDTYPE)
@@ -96,8 +96,8 @@
   ],
   containing_type=None,
   options=None,
-  serialized_start=1159,
-  serialized_end=1223,
+  serialized_start=1184,
+  serialized_end=1248,
 )
 
 ResponseCode = enum_type_wrapper.EnumTypeWrapper(_RESPONSECODE)
@@ -138,8 +138,8 @@
   ],
   containing_type=None,
   options=None,
-  serialized_start=1226,
-  serialized_end=1479,
+  serialized_start=1251,
+  serialized_end=1504,
 )
 
 VtsDriverType = enum_type_wrapper.EnumTypeWrapper(_VTSDRIVERTYPE)
@@ -252,14 +252,21 @@
       is_extension=False, extension_scope=None,
       options=None),
     _descriptor.FieldDescriptor(
-      name='arg', full_name='android.vts.AndroidSystemControlCommandMessage.arg', index=11,
+      name='target_package', full_name='android.vts.AndroidSystemControlCommandMessage.target_package', index=11,
+      number=3008, type=12, cpp_type=9, label=1,
+      has_default_value=False, default_value="",
+      message_type=None, enum_type=None, containing_type=None,
+      is_extension=False, extension_scope=None,
+      options=None),
+    _descriptor.FieldDescriptor(
+      name='arg', full_name='android.vts.AndroidSystemControlCommandMessage.arg', index=12,
       number=4001, type=12, cpp_type=9, label=1,
       has_default_value=False, default_value="",
       message_type=None, enum_type=None, containing_type=None,
       is_extension=False, extension_scope=None,
       options=None),
     _descriptor.FieldDescriptor(
-      name='shell_command', full_name='android.vts.AndroidSystemControlCommandMessage.shell_command', index=12,
+      name='shell_command', full_name='android.vts.AndroidSystemControlCommandMessage.shell_command', index=13,
       number=5001, type=12, cpp_type=9, label=3,
       has_default_value=False, default_value=[],
       message_type=None, enum_type=None, containing_type=None,
@@ -275,7 +282,7 @@
   is_extendable=False,
   extension_ranges=[],
   serialized_start=88,
-  serialized_end=450,
+  serialized_end=475,
 )
 
 
@@ -351,8 +358,8 @@
   options=None,
   is_extendable=False,
   extension_ranges=[],
-  serialized_start=453,
-  serialized_end=664,
+  serialized_start=478,
+  serialized_end=689,
 )
 
 
@@ -386,8 +393,8 @@
   options=None,
   is_extendable=False,
   extension_ranges=[],
-  serialized_start=666,
-  serialized_end=771,
+  serialized_start=691,
+  serialized_end=796,
 )
 
 
@@ -414,8 +421,8 @@
   options=None,
   is_extendable=False,
   extension_ranges=[],
-  serialized_start=773,
-  serialized_end=861,
+  serialized_start=798,
+  serialized_end=886,
 )
 
 _ANDROIDSYSTEMCONTROLCOMMANDMESSAGE.fields_by_name['command_type'].enum_type = _COMMANDTYPE
diff --git a/proto/VtsDriverControlMessage.proto b/proto/VtsDriverControlMessage.proto
index b5db7e3..aa0368a 100644
--- a/proto/VtsDriverControlMessage.proto
+++ b/proto/VtsDriverControlMessage.proto
@@ -80,6 +80,8 @@
   optional float target_version = 1204;
   // the name of a HAL module to open.
   optional bytes module_name = 1205;
+  // the package of a HIDL HAL to open.
+  optional bytes target_package = 1206;
 
   // for LIST_FUNCTIONS
   // none
diff --git a/runners/host/tcp_client/vts_tcp_client.py b/runners/host/tcp_client/vts_tcp_client.py
index 7197929..3ab7b32 100755
--- a/runners/host/tcp_client/vts_tcp_client.py
+++ b/runners/host/tcp_client/vts_tcp_client.py
@@ -134,7 +134,7 @@
 
     def LaunchDriverService(self, driver_type, service_name, bits,
                             file_path=None, target_class=None, target_type=None,
-                            target_version=None):
+                            target_version=None, target_package=None):
         """RPC to LAUNCH_DRIVER_SERVICE."""
         logging.info("service_name: %s", service_name)
         logging.info("file_path: %s", file_path)
@@ -147,7 +147,8 @@
                          file_path=file_path,
                          target_class=target_class,
                          target_type=target_type,
-                         target_version=target_version)
+                         target_version=target_version,
+                         target_package=target_package)
         resp = self.RecvResponse()
         logging.info("resp for LAUNCH_DRIVER_SERVICE: %s", resp)
         return (resp.response_code == SysMsg_pb2.SUCCESS)
@@ -280,6 +281,7 @@
                     target_class=None,
                     target_type=None,
                     target_version=None,
+                    target_package=None,
                     module_name=None,
                     service_name=None,
                     callback_port=None,
@@ -313,6 +315,9 @@
         if target_version is not None:
             command_msg.target_version = int(target_version * 100)
 
+        if target_package is not None:
+            command_msg.target_package = target_package
+
         if module_name is not None:
             command_msg.module_name = module_name
 
diff --git a/sysfuzzer/common/Android.mk b/sysfuzzer/common/Android.mk
index 5e0f99d..6139f5c 100644
--- a/sysfuzzer/common/Android.mk
+++ b/sysfuzzer/common/Android.mk
@@ -32,6 +32,7 @@
   specification_parser/InterfaceSpecificationParser.cpp \
   specification_parser/SpecificationBuilder.cpp \
   utils/InterfaceSpecUtil.cpp \
+  utils/StringUtil.cpp \
 
 LOCAL_C_INCLUDES := \
   $(LOCAL_PATH)/include \
@@ -74,7 +75,8 @@
 # Files needed for VTSC.
 LOCAL_SRC_FILES := \
   specification_parser/InterfaceSpecificationParser.cpp \
-  utils/InterfaceSpecUtil.cpp
+  utils/InterfaceSpecUtil.cpp \
+  utils/StringUtil.cpp \
 
 LOCAL_C_INCLUDES := \
   $(LOCAL_PATH)/include \
diff --git a/sysfuzzer/common/include/specification_parser/SpecificationBuilder.h b/sysfuzzer/common/include/specification_parser/SpecificationBuilder.h
index 32eb050..982dd43 100644
--- a/sysfuzzer/common/include/specification_parser/SpecificationBuilder.h
+++ b/sysfuzzer/common/include/specification_parser/SpecificationBuilder.h
@@ -48,7 +48,7 @@
   // component.
   vts::ComponentSpecificationMessage* FindComponentSpecification(
       const int target_class, const int target_type, const float target_version,
-      const string submodule_name = "");
+      const string submodule_name = "", const string package = "");
 
   vts::ComponentSpecificationMessage*
       FindComponentSpecification(const string& component_name);
@@ -68,12 +68,13 @@
   // library file, and the rest three arguments are the basic information of
   // the target component.
   bool Process(const char* dll_file_name, const char* spec_lib_file_path,
-               int target_class, int target_type, float target_version);
+               int target_class, int target_type, float target_version,
+               const char* target_package);
 
   bool LoadTargetComponent(const char* dll_file_name,
                            const char* spec_lib_file_path, int target_class,
                            int target_type, float target_version,
-                           const char* module_name);
+                           const char* target_package, const char* module_name);
 
   FuzzerBase* GetFuzzerBase(
       const ComponentSpecificationMessage& iface_spec_msg,
diff --git a/sysfuzzer/common/include/utils/StringUtil.h b/sysfuzzer/common/include/utils/StringUtil.h
new file mode 100644
index 0000000..0591366
--- /dev/null
+++ b/sysfuzzer/common/include/utils/StringUtil.h
@@ -0,0 +1,35 @@
+/*
+ * 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.
+ */
+
+#ifndef __VTS_SYSFUZZER_COMMON_UTILS_STRINGUTIL_H__
+#define __VTS_SYSFUZZER_COMMON_UTILS_STRINGUTIL_H__
+
+#include <string>
+
+using namespace std;
+
+namespace android {
+namespace vts {
+
+// custom util function to replace all occurrences of a substring.
+extern void ReplaceSubString(
+    string& original, const string& from, const string& to);
+
+
+}  // namespace vts
+}  // namespace android
+
+#endif  // __VTS_SYSFUZZER_COMMON_UTILS_STRINGUTIL_H__
diff --git a/sysfuzzer/common/specification_parser/SpecificationBuilder.cpp b/sysfuzzer/common/specification_parser/SpecificationBuilder.cpp
index 6177d70..bee9e2b 100644
--- a/sysfuzzer/common/specification_parser/SpecificationBuilder.cpp
+++ b/sysfuzzer/common/specification_parser/SpecificationBuilder.cpp
@@ -45,7 +45,8 @@
 SpecificationBuilder::FindComponentSpecification(const int target_class,
                                                  const int target_type,
                                                  const float target_version,
-                                                 const string submodule_name) {
+                                                 const string submodule_name,
+                                                 const string package) {
   DIR* dir;
   struct dirent* ent;
 
@@ -61,17 +62,26 @@
       vts::ComponentSpecificationMessage* message =
           new vts::ComponentSpecificationMessage();
       if (InterfaceSpecificationParser::parse(file_path.c_str(), message)) {
-        if (message->component_type() == target_type &&
-            message->component_type_version() == target_version) {
-          if (submodule_name.length() > 0) {
-            if (message->component_class() != HAL_CONVENTIONAL_SUBMODULE ||
-                message->original_data_structure_name() != submodule_name) {
-              continue;
+        if (message->component_class() != target_class) continue;
+
+        if (message->component_class() != HAL_HIDL) {
+          if (message->component_type() == target_type &&
+              message->component_type_version() == target_version) {
+            if (submodule_name.length() > 0) {
+              if (message->component_class() != HAL_CONVENTIONAL_SUBMODULE ||
+                  message->original_data_structure_name() != submodule_name) {
+                continue;
+              }
             }
-          } else if (message->component_class() != target_class)
-            continue;
-          closedir(dir);
-          return message;
+            closedir(dir);
+            return message;
+          }
+        } else {
+          if (message->package() == package &&
+              message->component_type_version() == target_version) {
+            closedir(dir);
+            return message;
+          }
         }
       }
       delete message;
@@ -213,9 +223,11 @@
 
 bool SpecificationBuilder::LoadTargetComponent(
     const char* dll_file_name, const char* spec_lib_file_path, int target_class,
-    int target_type, float target_version, const char* module_name) {
+    int target_type, float target_version, const char* target_package,
+    const char* module_name) {
   if_spec_msg_ =
-      FindComponentSpecification(target_class, target_type, target_version);
+      FindComponentSpecification(target_class, target_type, target_version,
+                                 module_name, target_package);
   if (!if_spec_msg_) {
     cerr << __FUNCTION__ << ": no interface specification file found for "
          << "class " << target_class << " type " << target_type << " version "
@@ -426,7 +438,8 @@
         submodule_iface_spec_msg =
             FindComponentSpecification(
                 if_spec_msg_->component_class(), if_spec_msg_->component_type(),
-                if_spec_msg_->component_type_version(), submodule_name);
+                if_spec_msg_->component_type_version(), submodule_name,
+                if_spec_msg_->package());
         if (!submodule_iface_spec_msg) {
           cerr << __func__ << " submodule InterfaceSpecification not found" << endl;
         } else {
@@ -575,7 +588,8 @@
         submodule_iface_spec_msg =
             FindComponentSpecification(
                 if_spec_msg_->component_class(), if_spec_msg_->component_type(),
-                if_spec_msg_->component_type_version(), submodule_name);
+                if_spec_msg_->component_type_version(), submodule_name,
+                if_spec_msg_->package());
         if (!submodule_iface_spec_msg) {
           cerr << __func__ << " submodule InterfaceSpecification not found" << endl;
         } else {
@@ -599,9 +613,11 @@
 bool SpecificationBuilder::Process(const char* dll_file_name,
                                    const char* spec_lib_file_path,
                                    int target_class, int target_type,
-                                   float target_version) {
+                                   float target_version,
+                                   const char* target_package) {
   vts::ComponentSpecificationMessage* interface_specification_message =
-      FindComponentSpecification(target_class, target_type, target_version);
+      FindComponentSpecification(target_class, target_type, target_version,
+                                 target_package);
   cout << "ifspec addr " << interface_specification_message << endl;
 
   if (!interface_specification_message) {
diff --git a/sysfuzzer/common/utils/InterfaceSpecUtil.cpp b/sysfuzzer/common/utils/InterfaceSpecUtil.cpp
index 7de71e1..2e28a6b 100644
--- a/sysfuzzer/common/utils/InterfaceSpecUtil.cpp
+++ b/sysfuzzer/common/utils/InterfaceSpecUtil.cpp
@@ -20,6 +20,7 @@
 #include <sstream>
 #include <string>
 
+#include "utils/StringUtil.h"
 #include "test/vts/proto/ComponentSpecificationMessage.pb.h"
 
 using namespace std;
@@ -29,9 +30,17 @@
 
 string GetFunctionNamePrefix(const ComponentSpecificationMessage& message) {
   stringstream prefix_ss;
-  prefix_ss << VTS_INTERFACE_SPECIFICATION_FUNCTION_NAME_PREFIX
-            << message.component_class() << "_" << message.component_type()
-            << "_" << int(message.component_type_version()) << "_";
+  if (message.component_class() != HAL_HIDL) {
+    prefix_ss << VTS_INTERFACE_SPECIFICATION_FUNCTION_NAME_PREFIX
+              << message.component_class() << "_" << message.component_type()
+              << "_" << int(message.component_type_version()) << "_";
+  } else {
+    string package_as_function_name(message.package());
+    ReplaceSubString(package_as_function_name, ".", "_");
+    prefix_ss << VTS_INTERFACE_SPECIFICATION_FUNCTION_NAME_PREFIX
+              << message.component_class() << "_" << package_as_function_name
+              << "_" << int(message.component_type_version()) << "_";
+  }
   return prefix_ss.str();
 }
 
diff --git a/sysfuzzer/common/utils/StringUtil.cpp b/sysfuzzer/common/utils/StringUtil.cpp
new file mode 100644
index 0000000..6f61a09
--- /dev/null
+++ b/sysfuzzer/common/utils/StringUtil.cpp
@@ -0,0 +1,39 @@
+/*
+ * 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.
+ */
+
+#include "utils/StringUtil.h"
+
+#include <string>
+
+using namespace std;
+
+namespace android {
+namespace vts {
+
+void ReplaceSubString(string& original, const string& from, const string& to) {
+  size_t index = 0;
+  int from_len = from.length();
+  while (true) {
+    index = original.find(from, index);
+    if (index == std::string::npos) break;
+    original.replace(index, from_len, to);
+    index += from_len;
+  }
+}
+
+
+}  // namespace vts
+}  // namespace android
diff --git a/sysfuzzer/framework/SocketServer.cpp b/sysfuzzer/framework/SocketServer.cpp
index 42e3439..e515791 100644
--- a/sysfuzzer/framework/SocketServer.cpp
+++ b/sysfuzzer/framework/SocketServer.cpp
@@ -64,11 +64,12 @@
 
 int32_t VtsDriverHalSocketServer::LoadHal(const string& path, int target_class,
                                           int target_type, float target_version,
+                                          const string& target_package,
                                           const string& module_name) {
   printf("VtsFuzzerServer::LoadHal(%s)\n", path.c_str());
   bool success = spec_builder_.LoadTargetComponent(
       path.c_str(), lib_path_, target_class, target_type, target_version,
-      module_name.c_str());
+      target_package.c_str(), module_name.c_str());
   cout << "Result: " << success << std::endl;
   if (success) {
     return 0;
@@ -151,7 +152,7 @@
       int32_t result = LoadHal(
           command_message.file_path(), command_message.target_class(),
           command_message.target_type(), command_message.target_version(),
-          command_message.module_name());
+          command_message.target_package(), command_message.module_name());
       VtsDriverControlResponseMessage response_message;
       response_message.set_response_code(VTS_DRIVER_RESPONSE_SUCCESS);
       response_message.set_return_value(result);
diff --git a/sysfuzzer/framework/SocketServer.h b/sysfuzzer/framework/SocketServer.h
index ba3d998..229d52a 100644
--- a/sysfuzzer/framework/SocketServer.h
+++ b/sysfuzzer/framework/SocketServer.h
@@ -38,7 +38,8 @@
  protected:
   void Exit();
   int32_t LoadHal(const string& path, int target_class, int target_type,
-                  float target_version, const string& module_name);
+                  float target_version, const string& target_package,
+                  const string& module_name);
   int32_t Status(int32_t type);
   const char* ReadSpecification(const string& name);
   const char* Call(const string& arg);
diff --git a/sysfuzzer/framework/VtsFuzzerMain.cpp b/sysfuzzer/framework/VtsFuzzerMain.cpp
index 758dd8b..253302a 100644
--- a/sysfuzzer/framework/VtsFuzzerMain.cpp
+++ b/sysfuzzer/framework/VtsFuzzerMain.cpp
@@ -84,6 +84,7 @@
       {"version", required_argument, NULL, 'v'},
       {"epoch_count", required_argument, NULL, 'e'},
       {"spec_dir", required_argument, NULL, 's'},
+      {"target_package", optional_argument, NULL, 'k'},
 #ifndef VTS_AGENT_DRIVER_COMM_BINDER  // socket
       {"server_socket_path", optional_argument, NULL, 'f'},
 #else  // binder
@@ -103,6 +104,7 @@
 #else  // binder
   string service_name(VTS_FUZZER_BINDER_SERVICE_NAME);
 #endif
+  string target_package;
   string callback_socket_name;
 
   while (true) {
@@ -172,6 +174,9 @@
       case 'd':
         server = true;
         break;
+      case 'k':
+        target_package = string(optarg);
+        break;
       default:
         if (ic != '?') {
           fprintf(stderr, "getopt_long returned unexpected value 0x%x\n", ic);
@@ -190,7 +195,8 @@
 
     bool success =
         spec_builder.Process(argv[optind], INTERFACE_SPEC_LIB_FILENAME,
-                             target_class, target_type, target_version);
+                             target_class, target_type, target_version,
+                             target_package.c_str());
     cout << "Result: " << success << endl;
     if (success) {
       cout << endl << PASSED_MARKER << endl;
diff --git a/sysfuzzer/vtscompiler/VtsCompilerUtils.cpp b/sysfuzzer/vtscompiler/VtsCompilerUtils.cpp
index 43cb614..80b76ea 100644
--- a/sysfuzzer/vtscompiler/VtsCompilerUtils.cpp
+++ b/sysfuzzer/vtscompiler/VtsCompilerUtils.cpp
@@ -362,17 +362,6 @@
 }
 
 
-void ReplaceSubString(string& original, const string& from, const string& to) {
-  size_t index = 0;
-  int from_len = from.length();
-  while (true) {
-    index = original.find(from, index);
-    if (index == std::string::npos) break;
-    original.replace(index, from_len, to);
-    index += from_len;
-  }
-}
-
 string GetVersionString(float version, bool for_macro) {
   std::ostringstream out;
   if (for_macro) {
diff --git a/sysfuzzer/vtscompiler/VtsCompilerUtils.h b/sysfuzzer/vtscompiler/VtsCompilerUtils.h
index 0d7c404..c2f8d12 100644
--- a/sysfuzzer/vtscompiler/VtsCompilerUtils.h
+++ b/sysfuzzer/vtscompiler/VtsCompilerUtils.h
@@ -52,9 +52,6 @@
 // fs_mkdirs for VTS.
 extern int vts_fs_mkdirs(char* file_path, mode_t mode);
 
-// custom util function to replace all occurrences of a substring.
-void ReplaceSubString(string& original, const string& from, const string& to);
-
 // Get HAL version string to be used to build a relevant dir path.
 string GetVersionString(float version, bool for_macro=false);
 
diff --git a/sysfuzzer/vtscompiler/code_gen/driver/DriverCodeGenBase.cpp b/sysfuzzer/vtscompiler/code_gen/driver/DriverCodeGenBase.cpp
index 0c5ffb1..26cf4e7 100644
--- a/sysfuzzer/vtscompiler/code_gen/driver/DriverCodeGenBase.cpp
+++ b/sysfuzzer/vtscompiler/code_gen/driver/DriverCodeGenBase.cpp
@@ -26,6 +26,7 @@
 #include "utils/InterfaceSpecUtil.h"
 
 #include "VtsCompilerUtils.h"
+#include "utils/StringUtil.h"
 
 using namespace std;
 
@@ -447,8 +448,10 @@
           message.attribute(attr_idx) :
           message.interface().attribute(attr_idx - message.attribute_size());
       if (attribute.type() == TYPE_ENUM) {
-        h_ss << attribute.name() << " " << "Random" << attribute.name() << "();"
-               << endl;
+        GenerateNamespaceName(h_ss, message);
+        h_ss << "::" << attribute.name() << " "
+             << "Random" << attribute.name() << "();"
+             << endl;
       } else if (attribute.type() == TYPE_STRUCT) {
         h_ss << "void " << "MessageTo" << attribute.name()
              << "(const VariableSpecificationMessage& var_msg, "
@@ -478,16 +481,27 @@
   }
 }
 
+void DriverCodeGenBase::GenerateNamespaceName(
+    std::stringstream& ss, const ComponentSpecificationMessage& message) {
+  if (message.component_class() == HAL_HIDL && message.has_package()) {
+    string name = message.package();
+    ReplaceSubString(name, ".", "::");
+    ss << name
+       << "::"
+       << GetVersionString(message.component_type_version(), true);
+  } else {
+    cerr << __func__ << ":" << __LINE__ << " no namespace" << endl;
+    exit(-1);
+  }
+}
+
 void DriverCodeGenBase::GenerateOpenNameSpaces(
     std::stringstream& ss, const ComponentSpecificationMessage& message) {
   if (message.component_class() == HAL_HIDL && message.has_package()) {
     ss << "using namespace android::hardware;" << endl;
     ss << "using namespace ";
-    string name = message.package();
-    ReplaceSubString(name, ".", "::");
-    ss << name << "::"
-       << GetVersionString(message.component_type_version(), true)
-       << ";" << endl;
+    GenerateNamespaceName(ss, message);
+    ss << ";" << endl;
   }
 
   ss << "namespace android {" << endl;
diff --git a/sysfuzzer/vtscompiler/code_gen/driver/DriverCodeGenBase.h b/sysfuzzer/vtscompiler/code_gen/driver/DriverCodeGenBase.h
index 6b91ebd..4d9a87a 100644
--- a/sysfuzzer/vtscompiler/code_gen/driver/DriverCodeGenBase.h
+++ b/sysfuzzer/vtscompiler/code_gen/driver/DriverCodeGenBase.h
@@ -66,6 +66,10 @@
       std::stringstream& cpp_ss, const string& function_prototype,
       const string& fuzzer_extended_class_name) = 0;
 
+  // Generates the namespace name of a HIDL component, crashes otherwise.
+  void GenerateNamespaceName(
+      std::stringstream& ss, const ComponentSpecificationMessage& message);
+
   // Generates code that opens the default namespaces.
   void GenerateOpenNameSpaces(
       std::stringstream& ss, const ComponentSpecificationMessage& message);
diff --git a/sysfuzzer/vtscompiler/code_gen/driver/HalCodeGen.cpp b/sysfuzzer/vtscompiler/code_gen/driver/HalCodeGen.cpp
index 3bfb28a..3cfc32e 100644
--- a/sysfuzzer/vtscompiler/code_gen/driver/HalCodeGen.cpp
+++ b/sysfuzzer/vtscompiler/code_gen/driver/HalCodeGen.cpp
@@ -24,6 +24,7 @@
 #include "test/vts/proto/ComponentSpecificationMessage.pb.h"
 
 #include "VtsCompilerUtils.h"
+#include "utils/StringUtil.h"
 
 using namespace std;
 using namespace android;
diff --git a/sysfuzzer/vtscompiler/code_gen/driver/HalHidlCodeGen.cpp b/sysfuzzer/vtscompiler/code_gen/driver/HalHidlCodeGen.cpp
index 17b45b3..d63bcf2 100644
--- a/sysfuzzer/vtscompiler/code_gen/driver/HalHidlCodeGen.cpp
+++ b/sysfuzzer/vtscompiler/code_gen/driver/HalHidlCodeGen.cpp
@@ -26,6 +26,7 @@
 
 #include "VtsCompilerUtils.h"
 #include "code_gen/driver/HalCodeGen.h"
+#include "utils/StringUtil.h"
 
 using namespace std;
 using namespace android;
@@ -198,11 +199,15 @@
       cpp_ss << "static void " << fuzzer_extended_class_name << api.name() << "_cb_func(";
       if (api.return_type_hidl(0).type() == TYPE_SCALAR) {
         cpp_ss << api.return_type_hidl(0).scalar_type();
+      } else if (api.return_type_hidl(0).type() == TYPE_ENUM) {
+        GenerateNamespaceName(cpp_ss, message);
+        cpp_ss << "::" << GetCppVariableType(api.return_type_hidl(0), &message);
       } else if (api.return_type_hidl(0).type() == TYPE_VECTOR) {
         cpp_ss << GetCppVariableType(api.return_type_hidl(0), &message);
       } else {
         cerr << __func__ << ":" << __LINE__ << " ERROR unsupported type "
              << api.return_type_hidl(0).type() << endl;
+        exit(-1);
       }
       cpp_ss << " arg) {" << endl;
       // TODO: support other non-scalar type and multiple args.
@@ -213,6 +218,9 @@
               << "void(";
       if (api.return_type_hidl(0).type() == TYPE_SCALAR) {
         cpp_ss << api.return_type_hidl(0).scalar_type();
+      } else if (api.return_type_hidl(0).type() == TYPE_ENUM) {
+        GenerateNamespaceName(cpp_ss, message);
+        cpp_ss << "::" << GetCppVariableType(api.return_type_hidl(0), &message);
       } else if (api.return_type_hidl(0).type() == TYPE_VECTOR) {
         cpp_ss << GetCppVariableType(api.return_type_hidl(0), &message);
       } else {
@@ -495,11 +503,27 @@
           api.return_type_hidl(0).type() == TYPE_VOID) {
         cpp_ss << "    *result = NULL;" << endl;
         cpp_ss << "    " << kInstanceVariableName << "->" << api.name() << "(";
-      } else if (api.return_type_hidl(0).type() == TYPE_SCALAR ||
-                 api.return_type_hidl(0).type() == TYPE_ENUM) {
+      } else if (api.return_type_hidl(0).type() == TYPE_SCALAR) {
         cpp_ss << "    *result = reinterpret_cast<void*>("
                << "(" << api.return_type_hidl(0).scalar_type() << ")"
                << kInstanceVariableName << "->" << api.name() << "(";
+      } else if (api.return_type_hidl(0).type() == TYPE_ENUM) {
+        if (api.return_type_hidl(0).has_scalar_type()) {
+          cpp_ss << "    *result = reinterpret_cast<void*>("
+                 << "(" << api.return_type_hidl(0).scalar_type() << ")"
+                 << kInstanceVariableName << "->" << api.name() << "(";
+        } else if (api.return_type_hidl(0).has_predefined_type()) {
+          cpp_ss << "    *result = reinterpret_cast<void*>("
+                 << "(";
+          GenerateNamespaceName(cpp_ss, message);
+          // TODO(yim): check whether predefined_type is defined in the
+          // message's namespace.
+          cpp_ss << "::" << api.return_type_hidl(0).predefined_type() << ")"
+                 << kInstanceVariableName << "->" << api.name() << "(";
+        } else {
+          cerr << __func__ << ":" << __LINE__ << " unknown return type" << endl;
+          exit(-1);
+        }
       } else {
         cpp_ss << "    *result = const_cast<void*>(reinterpret_cast<"
                << "const void*>(new string("
diff --git a/sysfuzzer/vtscompiler/code_gen/profiler/HalHidlProfilerCodeGen.cpp b/sysfuzzer/vtscompiler/code_gen/profiler/HalHidlProfilerCodeGen.cpp
index 8a1e220..f67709e 100644
--- a/sysfuzzer/vtscompiler/code_gen/profiler/HalHidlProfilerCodeGen.cpp
+++ b/sysfuzzer/vtscompiler/code_gen/profiler/HalHidlProfilerCodeGen.cpp
@@ -16,6 +16,7 @@
 
 #include "HalHidlProfilerCodeGen.h"
 #include "utils/InterfaceSpecUtil.h"
+#include "utils/StringUtil.h"
 #include "VtsCompilerUtils.h"
 
 namespace android {
diff --git a/sysfuzzer/vtscompiler/test/golden/DRIVER/Nfc.driver.cpp b/sysfuzzer/vtscompiler/test/golden/DRIVER/Nfc.driver.cpp
index 26170ec..9ecad2d 100644
--- a/sysfuzzer/vtscompiler/test/golden/DRIVER/Nfc.driver.cpp
+++ b/sysfuzzer/vtscompiler/test/golden/DRIVER/Nfc.driver.cpp
@@ -181,7 +181,7 @@
 }
 extern "C" {
 android::vts::FuzzerBase* 
-vts_func_4_8_1_(
+vts_func_4_android_hardware_nfc_1_(
 ) {
   return (android::vts::FuzzerBase*) new android::vts::FuzzerExtended_INfc();
 }
diff --git a/sysfuzzer/vtscompiler/test/golden/DRIVER/hardware/interfaces/nfc/1.0/vts/Nfc.vts.h b/sysfuzzer/vtscompiler/test/golden/DRIVER/hardware/interfaces/nfc/1.0/vts/Nfc.vts.h
index d4068ce..c5e1f0d 100644
--- a/sysfuzzer/vtscompiler/test/golden/DRIVER/hardware/interfaces/nfc/1.0/vts/Nfc.vts.h
+++ b/sysfuzzer/vtscompiler/test/golden/DRIVER/hardware/interfaces/nfc/1.0/vts/Nfc.vts.h
@@ -37,7 +37,7 @@
 
 extern "C" {
 extern android::vts::FuzzerBase* 
-vts_func_4_8_1_(
+vts_func_4_android_hardware_nfc_1_(
 );
 }
 }  // namespace vts
diff --git a/sysfuzzer/vtscompiler/test/golden/DRIVER/hardware/interfaces/nfc/1.0/vts/types.vts.h b/sysfuzzer/vtscompiler/test/golden/DRIVER/hardware/interfaces/nfc/1.0/vts/types.vts.h
index 01a1343..169f6b1 100644
--- a/sysfuzzer/vtscompiler/test/golden/DRIVER/hardware/interfaces/nfc/1.0/vts/types.vts.h
+++ b/sysfuzzer/vtscompiler/test/golden/DRIVER/hardware/interfaces/nfc/1.0/vts/types.vts.h
@@ -20,8 +20,8 @@
 using namespace android::hardware::nfc::V1_0;
 namespace android {
 namespace vts {
-NfcEvent RandomNfcEvent();
-NfcStatus RandomNfcStatus();
+android::hardware::nfc::V1_0::NfcEvent RandomNfcEvent();
+android::hardware::nfc::V1_0::NfcStatus RandomNfcStatus();
 
 }  // namespace vts
 }  // namespace android
diff --git a/testcases/host/nfc/hidl/NfcHidlBasicTest.py b/testcases/host/nfc/hidl/NfcHidlBasicTest.py
index f75b9c5..363b380 100644
--- a/testcases/host/nfc/hidl/NfcHidlBasicTest.py
+++ b/testcases/host/nfc/hidl/NfcHidlBasicTest.py
@@ -36,6 +36,7 @@
         self.dut.hal.InitHidlHal(target_type="nfc",
                                  target_basepaths=["/system/lib64"],
                                  target_version=1.0,
+                                 target_package="android.hardware.nfc",
                                  bits=64)
 
         self.dut.shell.InvokeTerminal("one")
diff --git a/tools/build/tasks/list/vts_test_lib_hidl_package_list.mk b/tools/build/tasks/list/vts_test_lib_hidl_package_list.mk
index 681d95d..572eaf0 100644
--- a/tools/build/tasks/list/vts_test_lib_hidl_package_list.mk
+++ b/tools/build/tasks/list/vts_test_lib_hidl_package_list.mk
@@ -18,3 +18,4 @@
   libhidl \
   libvts_driver_hidl_nfc@1.0 \
   libvts_profiler_hidl_nfc@1.0 \
+  libvts_driver_hidl_vibrator@1.0 \
diff --git a/utils/python/mirror/hal_mirror.py b/utils/python/mirror/hal_mirror.py
index e67d168..8dee7d0 100644
--- a/utils/python/mirror/hal_mirror.py
+++ b/utils/python/mirror/hal_mirror.py
@@ -112,7 +112,7 @@
         self._CreateMirrorObject("hal_conventional",
                                  target_type,
                                  target_version,
-                                 target_basepaths,
+                                 target_basepaths=target_basepaths,
                                  handler_name=handler_name,
                                  bits=bits)
 
@@ -139,13 +139,14 @@
         self._CreateMirrorObject("hal_legacy",
                                  target_type,
                                  target_version,
-                                 target_basepaths,
+                                 target_basepaths=target_basepaths,
                                  handler_name=handler_name,
                                  bits=bits)
 
     def InitHidlHal(self,
                     target_type,
                     target_version,
+                    target_package=None,
                     target_basepaths=_DEFAULT_TARGET_BASE_PATHS,
                     handler_name=None,
                     bits=64):
@@ -157,6 +158,7 @@
         Args:
             target_type: string, the target type name (e.g., light, camera).
             target_version: float, the target component version (e.g., 1.0).
+            target_package: string, the package name of a target HIDL HAL.
             target_basepaths: list of strings, the paths to look for target
                               files in. Default is _DEFAULT_TARGET_BASE_PATHS.
             handler_name: string, the name of the handler. target_type is used
@@ -166,7 +168,8 @@
         self._CreateMirrorObject("hal_hidl",
                                  target_type,
                                  target_version,
-                                 target_basepaths,
+                                 target_package=target_package,
+                                 target_basepaths=target_basepaths,
                                  handler_name=handler_name,
                                  bits=bits)
 
@@ -192,6 +195,7 @@
                             target_class,
                             target_type,
                             target_version,
+                            target_package=None,
                             target_basepaths=_DEFAULT_TARGET_BASE_PATHS,
                             handler_name=None,
                             bits=64):
@@ -204,6 +208,7 @@
             target_class: string, the target class name (e.g., hal).
             target_type: string, the target type name (e.g., light, camera).
             target_version: float, the target component version (e.g., 1.0).
+            target_package: string, the package name of a HIDL HAL.
             target_basepaths: list of strings, the paths to look for target
                              files in. Default is _DEFAULT_TARGET_BASE_PATHS.
             handler_name: string, the name of the handler. target_type is used
@@ -269,7 +274,8 @@
             file_path=target_filename,
             target_class=target_class_id,
             target_type=target_type_id,
-            target_version=target_version)
+            target_version=target_version,
+            target_package=target_package)
 
         if not launched:
             raise errors.ComponentLoadingError(