Mutation logic has been rewritten for readability and maintainability.

Test: mmma test/vts-testcase/fuzz

Change-Id: I99df15aea27e59182ba5060eeac9149bd8636dce
diff --git a/Android.bp b/Android.bp
index a8a2886..a19cdfd 100644
--- a/Android.bp
+++ b/Android.bp
@@ -16,5 +16,4 @@
     "func_fuzzer",
     "iface_fuzzer",
     "iface_fuzzer/proto",
-    "iface_fuzzer/test",
 ]
diff --git a/iface_fuzzer/Android.bp b/iface_fuzzer/Android.bp
index e930024..ffc5987 100644
--- a/iface_fuzzer/Android.bp
+++ b/iface_fuzzer/Android.bp
@@ -19,12 +19,7 @@
     srcs: [
         "ProtoFuzzerUtils.cpp",
         "ProtoFuzzerMutator.cpp",
-        "type_mutators/ProtoFuzzerTypeMutator.cpp",
-        "type_mutators/ProtoFuzzerArrayMutator.cpp",
-        "type_mutators/ProtoFuzzerEnumMutator.cpp",
-        "type_mutators/ProtoFuzzerScalarMutator.cpp",
-        "type_mutators/ProtoFuzzerStructMutator.cpp",
-        "type_mutators/ProtoFuzzerUnionMutator.cpp",
+        "ProtoFuzzerMutateFns.cpp",
     ],
     include_dirs: [
         "test/vts/drivers/hal/common/include",
diff --git a/iface_fuzzer/ProtoFuzzerMain.cpp b/iface_fuzzer/ProtoFuzzerMain.cpp
index ae8fece..58fb2a0 100644
--- a/iface_fuzzer/ProtoFuzzerMain.cpp
+++ b/iface_fuzzer/ProtoFuzzerMain.cpp
@@ -14,7 +14,6 @@
  * limitations under the License.
  */
 
-#include <FuzzerInterface.h>
 #include "ProtoFuzzerMutator.h"
 
 #include "specification_parser/InterfaceSpecificationParser.h"
@@ -36,14 +35,15 @@
 
 namespace android {
 namespace vts {
+namespace fuzzer {
 
 // 64-bit random number generator.
 static Random random{static_cast<uint64_t>(time(0))};
 // Parameters that passed in to fuzzer.
 static ProtoFuzzerParams params;
-// ComponentSpecificationMessage corresponding to the interface targeted by
+// CompSpec corresponding to the interface targeted by
 // fuzzer.
-static ComponentSpecificationMessage target_comp_spec;
+static CompSpec target_comp_spec;
 // VTS hal driver used to call functions of targeted interface.
 static unique_ptr<FuzzerBase> hal;
 // Used to mutate inputs to hal driver.
@@ -86,13 +86,14 @@
 
 extern "C" size_t LLVMFuzzerCustomMutator(uint8_t *data, size_t size,
                                           size_t max_size, unsigned int seed) {
-  ExecutionSpecificationMessage exec_spec;
+  ExecSpec exec_spec;
   if (!exec_spec.ParseFromArray(data, size)) {
     exec_spec =
         mutator->RandomGen(target_comp_spec.interface(), params.exec_size_);
   } else {
     mutator->Mutate(target_comp_spec.interface(), &exec_spec);
   }
+  cout << exec_spec.DebugString() << endl;
   exec_spec.SerializeToArray(data, exec_spec.ByteSize());
   return exec_spec.ByteSize();
 }
@@ -107,7 +108,7 @@
 }
 
 extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
-  ExecutionSpecificationMessage exec_spec;
+  ExecSpec exec_spec;
   if (!exec_spec.ParseFromArray(data, size) || exec_spec.api_size() == 0) {
     return 0;
   }
@@ -115,5 +116,6 @@
   return 0;
 }
 
+}  // namespace fuzzer
 }  // namespace vts
 }  // namespace android
diff --git a/iface_fuzzer/ProtoFuzzerMutateFns.cpp b/iface_fuzzer/ProtoFuzzerMutateFns.cpp
new file mode 100644
index 0000000..f27f2bf
--- /dev/null
+++ b/iface_fuzzer/ProtoFuzzerMutateFns.cpp
@@ -0,0 +1,270 @@
+/*
+ * Copyright 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.
+ */
+
+#include "ProtoFuzzerMutator.h"
+
+using std::cerr;
+using std::endl;
+
+namespace android {
+namespace vts {
+namespace fuzzer {
+
+// Creates an inital stub of mutation/random generation result.
+static VarInstance VarInstanceStubFromSpec(const VarSpec &var_spec) {
+  VarInstance result{};
+  if (var_spec.has_type()) {
+    result.set_type(var_spec.type());
+  } else {
+    cerr << "VarInstance with no type field: " << var_spec.DebugString();
+    exit(1);
+  }
+  if (var_spec.has_name()) {
+    result.set_name(var_spec.name());
+  }
+  if (var_spec.has_predefined_type()) {
+    result.set_predefined_type(var_spec.predefined_type());
+  }
+  return result;
+}
+
+VarInstance ProtoFuzzerMutator::ArrayRandomGen(const VarSpec &var_spec) {
+  VarInstance result{VarInstanceStubFromSpec(var_spec)};
+  size_t vector_size = var_spec.vector_size();
+  result.set_vector_size(vector_size);
+  for (size_t i = 0; i < vector_size; ++i) {
+    *result.add_vector_value() = this->RandomGen(var_spec.vector_value(0));
+  }
+  return result;
+}
+
+VarInstance ProtoFuzzerMutator::ArrayMutate(const VarInstance &var_instance) {
+  VarInstance result{var_instance};
+  size_t vector_size = result.vector_size();
+  size_t idx = rand_(vector_size);
+  *result.mutable_vector_value(idx) = this->Mutate(result.vector_value(idx));
+  return result;
+}
+
+VarInstance ProtoFuzzerMutator::EnumRandomGen(const VarSpec &var_spec) {
+  VarInstance result{VarInstanceStubFromSpec(var_spec)};
+  const EnumData &blueprint =
+      FindPredefinedType(result.predefined_type()).enum_value();
+
+  size_t size = blueprint.enumerator_size();
+  size_t idx = rand_(size);
+
+  ScalarData scalar_value = blueprint.scalar_value(idx);
+  string scalar_type = blueprint.scalar_type();
+
+  // Mutate this enum like a scalar with probability
+  // odds_for/(odds_for + odds_against).
+  uint64_t odds_for = (this->mutator_bias_).enum_bias_.first;
+  uint64_t odds_against = (this->mutator_bias_).enum_bias_.second;
+  uint64_t rand_num = rand_(odds_for + odds_against);
+  if (rand_num < odds_for) {
+    scalar_value = Mutate(scalar_value, scalar_type);
+  }
+
+  *(result.mutable_scalar_value()) = scalar_value;
+  result.set_scalar_type(scalar_type);
+  return result;
+}
+
+VarInstance ProtoFuzzerMutator::EnumMutate(const VarInstance &var_instance) {
+  // For TYPE_ENUM, VarInstance contains superset info of VarSpec.
+  return RandomGen(var_instance);
+}
+
+VarInstance ProtoFuzzerMutator::ScalarRandomGen(const VarSpec &var_spec) {
+  VarInstance result{VarInstanceStubFromSpec(var_spec)};
+  (*result.mutable_scalar_value()) =
+      RandomGen(var_spec.scalar_value(), var_spec.scalar_type());
+  return result;
+}
+
+VarInstance ProtoFuzzerMutator::ScalarMutate(const VarInstance &var_instance) {
+  VarInstance result{var_instance};
+  (*result.mutable_scalar_value()) =
+      Mutate(result.scalar_value(), result.scalar_type());
+  return result;
+}
+
+VarInstance ProtoFuzzerMutator::StructRandomGen(const VarSpec &var_spec) {
+  VarInstance result{VarInstanceStubFromSpec(var_spec)};
+  const TypeSpec &blueprint = FindPredefinedType(result.predefined_type());
+  for (const VarSpec &struct_value : blueprint.struct_value()) {
+    *result.add_struct_value() = this->RandomGen(struct_value);
+  }
+  return result;
+}
+
+VarInstance ProtoFuzzerMutator::StructMutate(const VarInstance &var_instance) {
+  VarInstance result{var_instance};
+  size_t size = result.struct_value_size();
+  size_t idx = rand_(size);
+  *result.mutable_struct_value(idx) = this->Mutate(result.struct_value(idx));
+  return result;
+}
+
+VarInstance ProtoFuzzerMutator::UnionRandomGen(const VarSpec &var_spec) {
+  VarInstance result{VarInstanceStubFromSpec(var_spec)};
+  size_t size = var_spec.union_value_size();
+  for (size_t i = 0; i < size; ++i) {
+    result.add_union_value();
+  }
+  const TypeSpec &blueprint = FindPredefinedType(result.name());
+  size_t idx = rand_(size);
+  *result.mutable_union_value(idx) =
+      this->RandomGen(blueprint.union_value(idx));
+  return result;
+}
+
+VarInstance ProtoFuzzerMutator::UnionMutate(const VarInstance &var_instance) {
+  VarInstance result{var_instance};
+  size_t size = result.union_value_size();
+  size_t idx = rand_(size);
+  *result.mutable_union_value(idx) = this->Mutate(result.union_value(idx));
+  return result;
+}
+
+VarInstance ProtoFuzzerMutator::VectorRandomGen(const VarSpec &var_spec) {
+  VarInstance result{VarInstanceStubFromSpec(var_spec)};
+  // TODO(trong): implement way to specify size of randomly generated vector.
+  *result.add_vector_value() = this->RandomGen(var_spec.vector_value(0));
+  return result;
+}
+
+VarInstance ProtoFuzzerMutator::VectorMutate(const VarInstance &var_instance) {
+  VarInstance result{var_instance};
+  size_t size = result.vector_size();
+  size_t idx = rand_(size);
+  *result.mutable_vector_value(idx) = this->Mutate(result.vector_value(idx));
+  return result;
+}
+
+ScalarData ProtoFuzzerMutator::RandomGen(const ScalarData &scalar_value,
+                                         const string &scalar_type) {
+  ScalarData result{};
+
+  if (scalar_type == "bool_t") {
+    result.set_bool_t(RandomGen(static_cast<bool>(scalar_value.bool_t())));
+  } else if (scalar_type == "int8_t") {
+    result.set_int8_t(RandomGen(scalar_value.int8_t()));
+  } else if (scalar_type == "uint8_t") {
+    result.set_uint8_t(RandomGen(scalar_value.uint8_t()));
+  } else if (scalar_type == "int16_t") {
+    result.set_int16_t(RandomGen(scalar_value.int16_t()));
+  } else if (scalar_type == "uint16_t") {
+    result.set_uint16_t(RandomGen(scalar_value.uint16_t()));
+  } else if (scalar_type == "int32_t") {
+    result.set_int32_t(RandomGen(scalar_value.int32_t()));
+  } else if (scalar_type == "uint32_t") {
+    result.set_uint32_t(RandomGen(scalar_value.uint32_t()));
+  } else if (scalar_type == "int64_t") {
+    result.set_int64_t(RandomGen(scalar_value.int64_t()));
+  } else if (scalar_type == "uint64_t") {
+    result.set_uint64_t(RandomGen(scalar_value.uint64_t()));
+  } else if (scalar_type == "float_t") {
+    result.set_float_t(RandomGen(scalar_value.float_t()));
+  } else if (scalar_type == "double_t") {
+    result.set_double_t(RandomGen(scalar_value.double_t()));
+  } else {
+    cout << scalar_type << " not supported.\n";
+  }
+
+  return result;
+}
+
+ScalarData ProtoFuzzerMutator::Mutate(const ScalarData &scalar_value,
+                                      const string &scalar_type) {
+  ScalarData result{};
+
+  if (scalar_type == "bool_t") {
+    result.set_bool_t(Mutate(static_cast<bool>(scalar_value.bool_t())));
+  } else if (scalar_type == "int8_t") {
+    result.set_int8_t(Mutate(scalar_value.int8_t()));
+  } else if (scalar_type == "uint8_t") {
+    result.set_uint8_t(Mutate(scalar_value.uint8_t()));
+  } else if (scalar_type == "int16_t") {
+    result.set_int16_t(Mutate(scalar_value.int16_t()));
+  } else if (scalar_type == "uint16_t") {
+    result.set_uint16_t(Mutate(scalar_value.uint16_t()));
+  } else if (scalar_type == "int32_t") {
+    result.set_int32_t(Mutate(scalar_value.int32_t()));
+  } else if (scalar_type == "uint32_t") {
+    result.set_uint32_t(Mutate(scalar_value.uint32_t()));
+  } else if (scalar_type == "int64_t") {
+    result.set_int64_t(Mutate(scalar_value.int64_t()));
+  } else if (scalar_type == "uint64_t") {
+    result.set_uint64_t(Mutate(scalar_value.uint64_t()));
+  } else if (scalar_type == "float_t") {
+    result.set_float_t(Mutate(scalar_value.float_t()));
+  } else if (scalar_type == "double_t") {
+    result.set_double_t(Mutate(scalar_value.double_t()));
+  } else {
+    cout << scalar_type << " not supported.\n";
+  }
+
+  return result;
+}
+
+template <typename T>
+T ProtoFuzzerMutator::RandomGen(T value) {
+  // Generate a biased random scalar.
+  uint64_t rand_int = mutator_bias_.scalar_bias_(rand_);
+
+  T result;
+  memcpy(&result, &rand_int, sizeof(T));
+  return result;
+}
+
+bool ProtoFuzzerMutator::RandomGen(bool value) {
+  return static_cast<bool>(rand_(2));
+}
+
+template <typename T>
+T ProtoFuzzerMutator::Mutate(T value) {
+  size_t num_bits = 8 * sizeof(T);
+  T mask = static_cast<T>(1) << rand_(num_bits);
+  return value ^ mask;
+}
+
+bool ProtoFuzzerMutator::Mutate(bool value) {
+  return RandomGen(value);
+}
+
+float ProtoFuzzerMutator::Mutate(float value) {
+  uint32_t copy;
+  memcpy(&copy, &value, sizeof(float));
+  uint32_t mask = static_cast<uint32_t>(1) << rand_(32);
+  copy ^= mask;
+  memcpy(&value, &copy, sizeof(float));
+  return value;
+}
+
+double ProtoFuzzerMutator::Mutate(double value) {
+  uint64_t copy;
+  memcpy(&copy, &value, sizeof(double));
+  uint64_t mask = static_cast<uint64_t>(1) << rand_(64);
+  copy ^= mask;
+  memcpy(&value, &copy, sizeof(double));
+  return value;
+}
+
+}  // namespace fuzzer
+}  // namespace vts
+}  // namespace android
diff --git a/iface_fuzzer/ProtoFuzzerMutator.cpp b/iface_fuzzer/ProtoFuzzerMutator.cpp
index 5a7a9bb..fe59f1d 100644
--- a/iface_fuzzer/ProtoFuzzerMutator.cpp
+++ b/iface_fuzzer/ProtoFuzzerMutator.cpp
@@ -15,67 +15,92 @@
  */
 
 #include "ProtoFuzzerMutator.h"
-#include "type_mutators/ProtoFuzzerArrayMutator.h"
-#include "type_mutators/ProtoFuzzerEnumMutator.h"
-#include "type_mutators/ProtoFuzzerHandleMutator.h"
-#include "type_mutators/ProtoFuzzerScalarMutator.h"
-#include "type_mutators/ProtoFuzzerStructMutator.h"
-#include "type_mutators/ProtoFuzzerUnionMutator.h"
-
 #include <iostream>
 
 using std::endl;
 using std::cerr;
 using std::cout;
 using std::make_unique;
+using std::unordered_map;
+using namespace std::placeholders;
 
 namespace android {
 namespace vts {
+namespace fuzzer {
 
 ProtoFuzzerMutator::ProtoFuzzerMutator(
-    Random &rand,
-    unordered_map<string, VariableSpecificationMessage> predefined_types,
-    const ProtoFuzzerMutatorBias &mutator_bias)
-    : mutator_bias_(mutator_bias),
-      rand_(rand),
-      predefined_types_(predefined_types) {
-  type_mutators_[TYPE_ARRAY] =
-      make_unique<ProtoFuzzerArrayMutator>(rand, this, predefined_types_);
-  type_mutators_[TYPE_ENUM] =
-      make_unique<ProtoFuzzerEnumMutator>(rand, this, predefined_types_);
-  type_mutators_[TYPE_HANDLE] =
-      make_unique<ProtoFuzzerHandleMutator>(rand, this, predefined_types_);
-  type_mutators_[TYPE_SCALAR] =
-      make_unique<ProtoFuzzerScalarMutator>(rand, this, predefined_types_);
-  type_mutators_[TYPE_STRUCT] =
-      make_unique<ProtoFuzzerStructMutator>(rand, this, predefined_types_);
-  type_mutators_[TYPE_UNION] =
-      make_unique<ProtoFuzzerUnionMutator>(rand, this, predefined_types_);
+    Random &rand, unordered_map<string, TypeSpec> predefined_types,
+    ProtoFuzzerMutatorBias mutator_bias)
+    : rand_(rand),
+      predefined_types_(predefined_types),
+      mutator_bias_(mutator_bias) {
+  // Default function used for mutation/random generation. Used for types for
+  // which the notion of mutation/random generation is not defined, e.g.
+  // TYPE_HANDLE, TYPE_HIDL_CALLBACK.
+  VarTransformFn default_transform =
+      [](const VariableSpecificationMessage &var_spec) {
+        return VariableSpecificationMessage{var_spec};
+      };
+
+  // Initialize random_gen_fns_ and mutate_fns_ tables.
+  random_gen_fns_[TYPE_ARRAY] =
+      std::bind(&ProtoFuzzerMutator::ArrayRandomGen, this, _1);
+  mutate_fns_[TYPE_ARRAY] =
+      std::bind(&ProtoFuzzerMutator::ArrayMutate, this, _1);
+
+  random_gen_fns_[TYPE_ENUM] =
+      std::bind(&ProtoFuzzerMutator::EnumRandomGen, this, _1);
+  mutate_fns_[TYPE_ENUM] = std::bind(&ProtoFuzzerMutator::EnumMutate, this, _1);
+
+  random_gen_fns_[TYPE_HANDLE] = default_transform;
+  mutate_fns_[TYPE_HANDLE] = default_transform;
+
+  random_gen_fns_[TYPE_HIDL_CALLBACK] = default_transform;
+  mutate_fns_[TYPE_HIDL_CALLBACK] = default_transform;
+
+  random_gen_fns_[TYPE_SCALAR] =
+      std::bind(&ProtoFuzzerMutator::ScalarRandomGen, this, _1);
+  mutate_fns_[TYPE_SCALAR] =
+      std::bind(&ProtoFuzzerMutator::ScalarMutate, this, _1);
+
+  random_gen_fns_[TYPE_STRUCT] =
+      std::bind(&ProtoFuzzerMutator::StructRandomGen, this, _1);
+  mutate_fns_[TYPE_STRUCT] =
+      std::bind(&ProtoFuzzerMutator::StructMutate, this, _1);
+
+  random_gen_fns_[TYPE_UNION] =
+      std::bind(&ProtoFuzzerMutator::UnionRandomGen, this, _1);
+  mutate_fns_[TYPE_UNION] =
+      std::bind(&ProtoFuzzerMutator::UnionMutate, this, _1);
+
+  random_gen_fns_[TYPE_VECTOR] =
+      std::bind(&ProtoFuzzerMutator::VectorRandomGen, this, _1);
+  mutate_fns_[TYPE_VECTOR] =
+      std::bind(&ProtoFuzzerMutator::VectorMutate, this, _1);
 }
 
-ExecutionSpecificationMessage ProtoFuzzerMutator::RandomGen(
-    const InterfaceSpecificationMessage &iface_spec, size_t num_calls) {
-  ExecutionSpecificationMessage result{};
+ExecSpec ProtoFuzzerMutator::RandomGen(const IfaceSpec &iface_spec,
+                                       size_t num_calls) {
+  ExecSpec result{};
 
   for (size_t i = 0; i < num_calls; ++i) {
     size_t num_apis = iface_spec.api_size();
     size_t rand_api_idx = rand_(num_apis);
-    FunctionSpecificationMessage rand_api =
-        RandomGen(iface_spec.api(rand_api_idx));
+    FuncSpec rand_api = RandomGen(iface_spec.api(rand_api_idx));
     result.add_api()->Swap(&rand_api);
   }
 
   return result;
 }
 
-void ProtoFuzzerMutator::Mutate(const InterfaceSpecificationMessage &iface_spec,
-                                ExecutionSpecificationMessage *exec_spec) {
+void ProtoFuzzerMutator::Mutate(const IfaceSpec &iface_spec,
+                                ExecSpec *exec_spec) {
   bool coin_flip = rand_(2);
 
   if (coin_flip) {
     // Mutate a random function in execution.
     size_t idx = rand_(exec_spec->api_size());
-    const FunctionSpecificationMessage &rand_api = exec_spec->api(idx);
+    const FuncSpec &rand_api = exec_spec->api(idx);
     (*exec_spec->mutable_api(idx)) = Mutate(rand_api);
   } else {
     // Generate a random function call in place of randomly chosen function in
@@ -87,56 +112,58 @@
   }
 }
 
-FunctionSpecificationMessage ProtoFuzzerMutator::RandomGen(
-    const FunctionSpecificationMessage &func_spec) {
-  FunctionSpecificationMessage result{func_spec};
+FuncSpec ProtoFuzzerMutator::RandomGen(const FuncSpec &func_spec) {
+  FuncSpec result{func_spec};
   // We'll repopulate arg field.
   result.clear_arg();
-
   for (const auto &var_spec : func_spec.arg()) {
-    VariableSpecificationMessage rand_var_spec = RandomGen(var_spec);
+    VarInstance rand_var_spec = RandomGen(var_spec);
     auto *new_var = result.add_arg();
     new_var->Swap(&rand_var_spec);
   }
-
   return result;
 }
 
-FunctionSpecificationMessage ProtoFuzzerMutator::Mutate(
-    const FunctionSpecificationMessage &func_spec) {
-  FunctionSpecificationMessage result{func_spec};
-
+FuncSpec ProtoFuzzerMutator::Mutate(const FuncSpec &func_spec) {
+  FuncSpec result{func_spec};
   size_t num_args = result.arg_size();
   if (num_args > 0) {
     size_t rand_arg_idx = rand_(num_args);
-    VariableSpecificationMessage rand_arg = Mutate(result.arg(rand_arg_idx));
+    VarInstance rand_arg = Mutate(result.arg(rand_arg_idx));
     result.mutable_arg(rand_arg_idx)->Swap(&rand_arg);
   }
   return result;
 }
 
-VariableSpecificationMessage ProtoFuzzerMutator::RandomGen(
-    const VariableSpecificationMessage &var_spec) {
-  VariableSpecificationMessage result{};
-  result = FindTypeMutator(var_spec.type())->RandomGen(var_spec);
-  return result;
-}
-
-VariableSpecificationMessage ProtoFuzzerMutator::Mutate(
-    const VariableSpecificationMessage &var_spec) {
-  VariableSpecificationMessage result{};
-  result = FindTypeMutator(var_spec.type())->Mutate(var_spec);
-  return result;
-}
-
-ProtoFuzzerTypeMutator *ProtoFuzzerMutator::FindTypeMutator(VariableType type) {
-  auto type_mutator = type_mutators_.find(type);
-  if (type_mutator == type_mutators_.end()) {
-    cerr << "Type mutator not found for type: " << type << endl;
+static VariableSpecificationMessage Transform(
+    const VariableSpecificationMessage &var_spec,
+    unordered_map<VariableType, VarTransformFn> &transform_fns) {
+  auto type = var_spec.type();
+  auto transform_fn = transform_fns.find(type);
+  if (transform_fn == transform_fns.end()) {
+    cerr << "Transformation function not found for type: " << type << endl;
     exit(1);
   }
-  return type_mutator->second.get();
+  return transform_fn->second(var_spec);
 }
 
+VarInstance ProtoFuzzerMutator::RandomGen(const VarSpec &var_spec) {
+  return Transform(var_spec, random_gen_fns_);
+}
+
+VarInstance ProtoFuzzerMutator::Mutate(const VarInstance &var_instance) {
+  return Transform(var_instance, mutate_fns_);
+}
+
+const TypeSpec &ProtoFuzzerMutator::FindPredefinedType(string name) {
+  auto type_spec = predefined_types_.find(name);
+  if (type_spec == predefined_types_.end()) {
+    cerr << "Predefined type not found: " << name << endl;
+    exit(1);
+  }
+  return type_spec->second;
+}
+
+}  // namespace fuzzer
 }  // namespace vts
 }  // namespace android
diff --git a/iface_fuzzer/ProtoFuzzerUtils.cpp b/iface_fuzzer/ProtoFuzzerUtils.cpp
index b5ab10f..a6cbe9a 100644
--- a/iface_fuzzer/ProtoFuzzerUtils.cpp
+++ b/iface_fuzzer/ProtoFuzzerUtils.cpp
@@ -33,6 +33,7 @@
 
 namespace android {
 namespace vts {
+namespace fuzzer {
 
 static void usage() {
   fprintf(
@@ -58,7 +59,7 @@
     {"vts_service_name", required_argument, 0, 's'},
     {"vts_target_iface", required_argument, 0, 't'}};
 
-static string GetDriverName(const ComponentSpecificationMessage &comp_spec) {
+static string GetDriverName(const CompSpec &comp_spec) {
   stringstream version;
   version.precision(1);
   version << fixed << comp_spec.component_type_version();
@@ -67,15 +68,29 @@
   return driver_name;
 }
 
-static string GetServiceName(const ComponentSpecificationMessage &comp_spec) {
+static string GetServiceName(const CompSpec &comp_spec) {
   // Infer HAL service name from its package name.
   string prefix = "android.hardware.";
   string service_name = comp_spec.package().substr(prefix.size());
   return service_name;
 }
 
-static vector<ComponentSpecificationMessage> ExtractCompSpecs(string dir_path) {
-  vector<ComponentSpecificationMessage> result{};
+// Removes information from CompSpec not needed by fuzzer.
+static void TrimCompSpec(CompSpec *comp_spec) {
+  if (comp_spec == nullptr) {
+    cerr << __func__ << ": empty CompSpec." << endl;
+    return;
+  }
+  if (comp_spec->has_interface()) {
+    auto *iface_spec = comp_spec->mutable_interface();
+    for (auto i = 0; i < iface_spec->api_size(); ++i) {
+      iface_spec->mutable_api(i)->clear_callflow();
+    }
+  }
+}
+
+static vector<CompSpec> ExtractCompSpecs(string dir_path) {
+  vector<CompSpec> result{};
   DIR *dir;
   struct dirent *ent;
   if (!(dir = opendir(dir_path.c_str()))) {
@@ -86,8 +101,9 @@
     string vts_spec_name{ent->d_name};
     if (vts_spec_name.find(".vts") != string::npos) {
       string vts_spec_path = dir_path + "/" + vts_spec_name;
-      ComponentSpecificationMessage comp_spec{};
+      CompSpec comp_spec{};
       InterfaceSpecificationParser::parse(vts_spec_path.c_str(), &comp_spec);
+      TrimCompSpec(&comp_spec);
       result.emplace_back(std::move(comp_spec));
     }
   }
@@ -95,8 +111,8 @@
 }
 
 static void ExtractPredefinedTypesFromVar(
-    const VariableSpecificationMessage &var_spec,
-    unordered_map<string, VariableSpecificationMessage> &predefined_types) {
+    const TypeSpec &var_spec,
+    unordered_map<string, TypeSpec> &predefined_types) {
   predefined_types[var_spec.name()] = var_spec;
   for (const auto &sub_var_spec : var_spec.sub_struct()) {
     ExtractPredefinedTypesFromVar(sub_var_spec, predefined_types);
@@ -132,9 +148,8 @@
   return params;
 }
 
-ComponentSpecificationMessage FindTargetCompSpec(
-    const std::vector<ComponentSpecificationMessage> &specs,
-    const std::string& target_iface) {
+CompSpec FindTargetCompSpec(const vector<CompSpec> &specs,
+                            const string &target_iface) {
   if (target_iface.empty()) {
     cerr << "Target interface not specified." << endl;
     exit(1);
@@ -151,8 +166,7 @@
 }
 
 // TODO(trong): this should be done using FuzzerWrapper.
-FuzzerBase *InitHalDriver(const ComponentSpecificationMessage &comp_spec,
-                          string service_name) {
+FuzzerBase *InitHalDriver(const CompSpec &comp_spec, string service_name) {
   const char *error;
   string driver_name = GetDriverName(comp_spec);
   void *handle = dlopen(driver_name.c_str(), RTLD_LAZY);
@@ -175,10 +189,6 @@
 
   FuzzerBase *hal = hal_loader();
   // For fuzzing, we always use passthrough mode.
-  // If service_name was not specified, use "default".
-  if (service_name.empty()) {
-    service_name = "default";
-  }
   if (!hal->GetService(true, service_name.c_str())) {
     cerr << __func__ << ": GetService(true, " << service_name << ") failed."
          << endl;
@@ -187,9 +197,9 @@
   return hal;
 }
 
-unordered_map<string, VariableSpecificationMessage> ExtractPredefinedTypes(
-    const vector<ComponentSpecificationMessage> &specs) {
-  unordered_map<string, VariableSpecificationMessage> predefined_types;
+unordered_map<string, TypeSpec> ExtractPredefinedTypes(
+    const vector<CompSpec> &specs) {
+  unordered_map<string, TypeSpec> predefined_types;
   for (const auto &comp_spec : specs) {
     for (const auto &var_spec : comp_spec.attribute()) {
       ExtractPredefinedTypesFromVar(var_spec, predefined_types);
@@ -198,12 +208,13 @@
   return predefined_types;
 }
 
-void Execute(FuzzerBase *hal, const ExecutionSpecificationMessage &exec_spec) {
-  FunctionSpecificationMessage result{};
+void Execute(FuzzerBase *hal, const ExecSpec &exec_spec) {
+  FuncSpec result{};
   for (const auto &func_spec : exec_spec.api()) {
     hal->CallFunction(func_spec, "", &result);
   }
 }
 
+}  // namespace fuzzer
 }  // namespace vts
 }  // namespace android
diff --git a/iface_fuzzer/include/ProtoFuzzerMutator.h b/iface_fuzzer/include/ProtoFuzzerMutator.h
index ca48a33..44622e8 100644
--- a/iface_fuzzer/include/ProtoFuzzerMutator.h
+++ b/iface_fuzzer/include/ProtoFuzzerMutator.h
@@ -17,6 +17,7 @@
 #ifndef __VTS_PROTO_FUZZER_MUTATOR_H_
 #define __VTS_PROTO_FUZZER_MUTATOR_H_
 
+#include <functional>
 #include <memory>
 #include <string>
 #include <unordered_map>
@@ -24,17 +25,17 @@
 #include "ProtoFuzzerUtils.h"
 #include "test/vts-testcase/fuzz/iface_fuzzer/proto/ExecutionSpecificationMessage.pb.h"
 #include "test/vts/proto/ComponentSpecificationMessage.pb.h"
-#include "type_mutators/ProtoFuzzerTypeMutator.h"
-
-using std::string;
-using std::unique_ptr;
-using std::unordered_map;
 
 namespace android {
 namespace vts {
+namespace fuzzer {
 
 using BiasedRandomScalarGen = std::function<uint64_t(Random &rand)>;
 using OddsEnumTreatedLikeScalar = std::pair<uint64_t, uint64_t>;
+using VarMutateFn = std::function<VarInstance(const VarInstance &)>;
+using VarRandomGenFn = std::function<VarInstance(const VarSpec &)>;
+using VarTransformFn = std::function<VariableSpecificationMessage(
+    const VariableSpecificationMessage &)>;
 
 // Encapsulates heuristic strategy for biased mutation/random generation.
 struct ProtoFuzzerMutatorBias {
@@ -49,53 +50,70 @@
   OddsEnumTreatedLikeScalar enum_bias_;
 };
 
-// Provides methods to mutate or randomly generate
-// ExecutionSpecificationMessage, FunctionSpecificationMessage, or
-// VariableSpecificationMessage.
+// Provides methods for mutation or random generation.
 class ProtoFuzzerMutator {
  public:
-  ProtoFuzzerMutator(
-      Random &rand,
-      unordered_map<string, VariableSpecificationMessage> predefined_types,
-      const ProtoFuzzerMutatorBias &mutator_bias);
-
-  // Generates a random ExecutionSpecificationMessage.
-  ExecutionSpecificationMessage RandomGen(
-      const InterfaceSpecificationMessage &iface_spec, size_t num_calls);
-  // Mutates in-place an ExecutionSpecificationMessage.
-  void Mutate(const InterfaceSpecificationMessage &iface_spec,
-              ExecutionSpecificationMessage *exec_spec);
-
-  // Generates a random FunctionSpecificationMessage.
-  FunctionSpecificationMessage RandomGen(
-      const FunctionSpecificationMessage &func_spec);
-  // Mutates a FunctionSpecificationMessage.
-  FunctionSpecificationMessage Mutate(
-      const FunctionSpecificationMessage &func_spec);
-
-  // Generates a random VariableSpecificationMessage.
-  VariableSpecificationMessage RandomGen(
-      const VariableSpecificationMessage &var_spec);
-  // Mutates a VariableSpecificationMessage.
-  VariableSpecificationMessage Mutate(
-      const VariableSpecificationMessage &var_spec);
-
-  // Used for biased mutation/random generation of variables.
-  const ProtoFuzzerMutatorBias &mutator_bias_;
+  ProtoFuzzerMutator(Random &, std::unordered_map<std::string, TypeSpec>,
+                     ProtoFuzzerMutatorBias);
+  // Generates a random ExecSpec.
+  ExecSpec RandomGen(const IfaceSpec &, size_t);
+  // Mutates in-place an ExecSpec.
+  void Mutate(const IfaceSpec &, ExecSpec *);
+  // Generates a random FuncSpec.
+  FuncSpec RandomGen(const FuncSpec &);
+  // Mutates a FuncSpec.
+  FuncSpec Mutate(const FuncSpec &);
+  // Generates a random VarInstance.
+  VarInstance RandomGen(const VarSpec &);
+  // Mutates a VarInstance.
+  VarInstance Mutate(const VarInstance &);
 
  private:
-  // Finds mutator of given type.
-  ProtoFuzzerTypeMutator *FindTypeMutator(VariableType type);
+  // Used for mutation/random generation of VarInstance.
+  VarInstance ArrayRandomGen(const VarSpec &);
+  VarInstance ArrayMutate(const VarInstance &);
+  VarInstance EnumRandomGen(const VarSpec &);
+  VarInstance EnumMutate(const VarInstance &);
+  VarInstance ScalarRandomGen(const VarSpec &);
+  VarInstance ScalarMutate(const VarInstance &);
+  VarInstance StructRandomGen(const VarSpec &);
+  VarInstance StructMutate(const VarInstance &);
+  VarInstance UnionRandomGen(const VarSpec &);
+  VarInstance UnionMutate(const VarInstance &);
+  VarInstance VectorRandomGen(const VarSpec &);
+  VarInstance VectorMutate(const VarInstance &);
+
+  // Used for mutation/random generation of ScalarData.
+  ScalarData RandomGen(const ScalarData &, const std::string &);
+  ScalarData Mutate(const ScalarData &, const string &);
+  // Used for mutation/random generation of variables of fundamental data types
+  // e.g. char, int, double.
+  template <typename T>
+  T RandomGen(T);
+  template <typename T>
+  T Mutate(T);
+  bool RandomGen(bool);
+  bool Mutate(bool);
+  float Mutate(float);
+  double Mutate(double);
+
+  // Looks up predefined type by name.
+  const TypeSpec &FindPredefinedType(std::string);
+
   // 64-bit random number generator.
   Random &rand_;
   // Used to look up definition of a predefined type by its name.
-  unordered_map<string, VariableSpecificationMessage> predefined_types_;
-  // Used to delegate mutation/random generation of VariableSpecifationMessages
-  // of different VariableType to mutator for that VariableType.
-  unordered_map<VariableType, unique_ptr<ProtoFuzzerTypeMutator>>
-      type_mutators_;
+  std::unordered_map<std::string, TypeSpec> predefined_types_;
+  // Used to delegate mutation/random generation of VariableSpecifationMessage
+  // of different VariableType to mutation/random delegation function for that
+  // VariableType.
+  std::unordered_map<VariableType, VarMutateFn> mutate_fns_;
+  std::unordered_map<VariableType, VarRandomGenFn> random_gen_fns_;
+  // Used for biased mutation/random generation of variables.
+  ProtoFuzzerMutatorBias mutator_bias_;
 };
 
+}  // namespace fuzzer
 }  // namespace vts
 }  // namespace android
 
diff --git a/iface_fuzzer/include/ProtoFuzzerUtils.h b/iface_fuzzer/include/ProtoFuzzerUtils.h
index 7c4aff4..2d724dc 100644
--- a/iface_fuzzer/include/ProtoFuzzerUtils.h
+++ b/iface_fuzzer/include/ProtoFuzzerUtils.h
@@ -29,6 +29,23 @@
 
 namespace android {
 namespace vts {
+namespace fuzzer {
+
+// Use shorter names for convenience.
+using CompSpec = ComponentSpecificationMessage;
+using ExecSpec = ExecutionSpecificationMessage;
+using FuncSpec = FunctionSpecificationMessage;
+using IfaceSpec = InterfaceSpecificationMessage;
+
+// VariableSpecificationMessage can be used to describe 3 things: a type
+// declaration, a variable declaration, or a runtime variable instance. These
+// use cases correspond to TypeSpec, VarSpec, and VarInstance respectively.
+using TypeSpec = VariableSpecificationMessage;
+using VarInstance = TypeSpec;
+using VarSpec = TypeSpec;
+
+using EnumData = EnumDataValueMessage;
+using ScalarData = ScalarDataValueMessage;
 
 // 64-bit random number generator.
 class Random {
@@ -51,34 +68,32 @@
   // Number of function calls per execution (fixed throughout fuzzer run).
   size_t exec_size_;
   // VTS specs supplied to the fuzzer.
-  std::vector<ComponentSpecificationMessage> comp_specs_;
+  std::vector<CompSpec> comp_specs_;
   // Service name of target interface, e.g. "INfc".
-  std::string service_name_;
+  std::string service_name_ = "default";
   // Name of target interface, e.g. "default".
   std::string target_iface_;
 };
 
 // Parses command-line flags to create a ProtoFuzzerParams instance.
-ProtoFuzzerParams ExtractProtoFuzzerParams(int argc, char **argv);
+ProtoFuzzerParams ExtractProtoFuzzerParams(int, char **);
 
-// Returns ComponentSpecificationMessage corresponding to targeted interface.
-ComponentSpecificationMessage FindTargetCompSpec(
-    const std::vector<ComponentSpecificationMessage> &specs,
-    const std::string &target_iface);
+// Returns CompSpec corresponding to targeted interface.
+CompSpec FindTargetCompSpec(const std::vector<CompSpec> &, const std::string &);
 
 // Loads VTS HAL driver library.
-FuzzerBase *InitHalDriver(const ComponentSpecificationMessage &comp_spec,
-                          std::string service_name);
+FuzzerBase *InitHalDriver(const CompSpec &, std::string);
 
 // Creates a key, value look-up table with keys being names of predefined types,
 // and values being their definitions.
-std::unordered_map<std::string, VariableSpecificationMessage>
-ExtractPredefinedTypes(const std::vector<ComponentSpecificationMessage> &specs);
+std::unordered_map<std::string, TypeSpec> ExtractPredefinedTypes(
+    const std::vector<CompSpec> &);
 
 // Call every API from call sequence specified by the
 // ExecutionSpecificationMessage.
-void Execute(FuzzerBase *hal, const ExecutionSpecificationMessage &exec_spec);
+void Execute(FuzzerBase *, const ExecutionSpecificationMessage &);
 
+}  // namespace fuzzer
 }  // namespace vts
 }  // namespace android
 
diff --git a/iface_fuzzer/include/type_mutators/ProtoFuzzerArrayMutator.h b/iface_fuzzer/include/type_mutators/ProtoFuzzerArrayMutator.h
deleted file mode 100644
index 3468fe3..0000000
--- a/iface_fuzzer/include/type_mutators/ProtoFuzzerArrayMutator.h
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * Copyright 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_PROTO_FUZZER_ARRAY_MUTATOR_H__
-#define __VTS_PROTO_FUZZER_ARRAY_MUTATOR_H__
-
-#include "test/vts/proto/ComponentSpecificationMessage.pb.h"
-#include "type_mutators/ProtoFuzzerTypeMutator.h"
-
-#include "ProtoFuzzerMutator.h"
-
-using std::string;
-using std::unordered_map;
-
-namespace android {
-namespace vts {
-
-// Mutates/random generates VariableSpecificationMessage of TYPE_ARRAY.
-class ProtoFuzzerArrayMutator : public ProtoFuzzerTypeMutator {
- public:
-  ProtoFuzzerArrayMutator(
-      Random &rand, ProtoFuzzerMutator *mutator,
-      const unordered_map<string, VariableSpecificationMessage>
-          &predefined_types)
-      : ProtoFuzzerTypeMutator(rand, mutator, predefined_types) {}
-
-  VariableSpecificationMessage RandomGen(
-      const VariableSpecificationMessage &var_spec) override;
-
-  VariableSpecificationMessage Mutate(
-      const VariableSpecificationMessage &var_spec) override;
-};
-
-}  // namespace vts
-}  // namespace android
-
-#endif  // __VTS_PROTO_FUZZER_ARRAY_MUTATOR_H__
diff --git a/iface_fuzzer/include/type_mutators/ProtoFuzzerEnumMutator.h b/iface_fuzzer/include/type_mutators/ProtoFuzzerEnumMutator.h
deleted file mode 100644
index 596f036..0000000
--- a/iface_fuzzer/include/type_mutators/ProtoFuzzerEnumMutator.h
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * Copyright 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_PROTO_FUZZER_ENUM_MUTATOR_H__
-#define __VTS_PROTO_FUZZER_ENUM_MUTATOR_H__
-
-#include "ProtoFuzzerMutator.h"
-#include "test/vts/proto/ComponentSpecificationMessage.pb.h"
-#include "type_mutators/ProtoFuzzerScalarMutator.h"
-
-namespace android {
-namespace vts {
-
-// Mutates/random generates VariableSpecificationMessage of TYPE_ENUM.
-class ProtoFuzzerEnumMutator : public ProtoFuzzerScalarMutator {
- public:
-  ProtoFuzzerEnumMutator(
-      Random &rand, ProtoFuzzerMutator *mutator,
-      const unordered_map<string, VariableSpecificationMessage>
-          &predefined_types)
-      : ProtoFuzzerScalarMutator(rand, mutator, predefined_types) {}
-
-  VariableSpecificationMessage RandomGen(
-      const VariableSpecificationMessage &var_spec) override;
-
-  VariableSpecificationMessage Mutate(
-      const VariableSpecificationMessage &var_spec) override;
-};
-
-}  // namespace vts
-}  // namespace android
-
-#endif  // __VTS_PROTO_FUZZER_ENUM_MUTATOR_H__
diff --git a/iface_fuzzer/include/type_mutators/ProtoFuzzerHandleMutator.h b/iface_fuzzer/include/type_mutators/ProtoFuzzerHandleMutator.h
deleted file mode 100644
index b489b69..0000000
--- a/iface_fuzzer/include/type_mutators/ProtoFuzzerHandleMutator.h
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- * Copyright 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_PROTO_FUZZER_HANDLE_MUTATOR_H__
-#define __VTS_PROTO_FUZZER_HANDLE_MUTATOR_H__
-
-#include "test/vts/proto/ComponentSpecificationMessage.pb.h"
-#include "type_mutators/ProtoFuzzerTypeMutator.h"
-
-#include "ProtoFuzzerMutator.h"
-
-using std::string;
-using std::unordered_map;
-
-namespace android {
-namespace vts {
-
-// Mutates/random generates VariableSpecificationMessage of TYPE_HANDLE.
-class ProtoFuzzerHandleMutator : public ProtoFuzzerTypeMutator {
- public:
-  ProtoFuzzerHandleMutator(
-      Random &rand, ProtoFuzzerMutator *mutator,
-      const unordered_map<string, VariableSpecificationMessage>
-          &predefined_types)
-      : ProtoFuzzerTypeMutator(rand, mutator, predefined_types) {}
-
-  // TODO(trong): once vts driver suports TYPE_HANDLE, these will need
-  // implementation.
-  VariableSpecificationMessage RandomGen(
-      const VariableSpecificationMessage &var_spec) override {
-    return VariableSpecificationMessage{var_spec};
-  }
-
-  VariableSpecificationMessage Mutate(
-      const VariableSpecificationMessage &var_spec) override {
-    return VariableSpecificationMessage{var_spec};
-  }
-};
-
-}  // namespace vts
-}  // namespace android
-
-#endif  // __VTS_PROTO_FUZZER_HANDLE_MUTATOR_H__
diff --git a/iface_fuzzer/include/type_mutators/ProtoFuzzerScalarMutator.h b/iface_fuzzer/include/type_mutators/ProtoFuzzerScalarMutator.h
deleted file mode 100644
index b6f95b9..0000000
--- a/iface_fuzzer/include/type_mutators/ProtoFuzzerScalarMutator.h
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
- * Copyright 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_PROTO_FUZZER_SCALAR_MUTATOR_H__
-#define __VTS_PROTO_FUZZER_SCALAR_MUTATOR_H__
-
-#include "ProtoFuzzerMutator.h"
-#include "test/vts/proto/ComponentSpecificationMessage.pb.h"
-#include "type_mutators/ProtoFuzzerTypeMutator.h"
-
-namespace android {
-namespace vts {
-
-// Mutates/random generates VariableSpecificationMessage of TYPE_SCALAR.
-class ProtoFuzzerScalarMutator : public ProtoFuzzerTypeMutator {
- public:
-  ProtoFuzzerScalarMutator(
-      Random &rand, ProtoFuzzerMutator *mutator,
-      const unordered_map<string, VariableSpecificationMessage>
-          &predefined_types)
-      : ProtoFuzzerTypeMutator(rand, mutator, predefined_types) {}
-
-  VariableSpecificationMessage RandomGen(
-      const VariableSpecificationMessage &var_spec) override;
-  VariableSpecificationMessage Mutate(
-      const VariableSpecificationMessage &var_spec) override;
-
-  // Generates a random ScalarDataValueMessage.
-  ScalarDataValueMessage RandomGen(const ScalarDataValueMessage &scalar_value,
-                                   const string &scalar_type);
-  // Mutates a ScalarDataValueMessage.
-  ScalarDataValueMessage Mutate(const ScalarDataValueMessage &scalar_value,
-                                const string &scalar_type);
-
- private:
-  // Methods to generate a random value of primitive type.
-  template <typename T>
-  T RandomGen(T value);
-  bool RandomGen(bool value);
-
-  // Methods to mutate value of primitive type.
-  template <typename T>
-  T Mutate(T value);
-  bool Mutate(bool value);
-  float Mutate(float value);
-  double Mutate(double value);
-};
-
-}  // namespace vts
-}  // namespace android
-
-#endif  // __VTS_PROTO_FUZZER_SCALAR_MUTATOR_H__
diff --git a/iface_fuzzer/include/type_mutators/ProtoFuzzerStructMutator.h b/iface_fuzzer/include/type_mutators/ProtoFuzzerStructMutator.h
deleted file mode 100644
index 0dcfb4a..0000000
--- a/iface_fuzzer/include/type_mutators/ProtoFuzzerStructMutator.h
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * Copyright 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_PROTO_FUZZER_STRUCT_MUTATOR_H__
-#define __VTS_PROTO_FUZZER_STRUCT_MUTATOR_H__
-
-#include "test/vts/proto/ComponentSpecificationMessage.pb.h"
-#include "type_mutators/ProtoFuzzerTypeMutator.h"
-
-#include "ProtoFuzzerMutator.h"
-
-using std::string;
-using std::unordered_map;
-
-namespace android {
-namespace vts {
-
-// Mutates/random generates VariableSpecificationMessage of TYPE_STRUCT.
-class ProtoFuzzerStructMutator : public ProtoFuzzerTypeMutator {
- public:
-  ProtoFuzzerStructMutator(
-      Random &rand, ProtoFuzzerMutator *mutator,
-      const unordered_map<string, VariableSpecificationMessage>
-          &predefined_types)
-      : ProtoFuzzerTypeMutator(rand, mutator, predefined_types) {}
-
-  VariableSpecificationMessage RandomGen(
-      const VariableSpecificationMessage &var_spec) override;
-
-  VariableSpecificationMessage Mutate(
-      const VariableSpecificationMessage &var_spec) override;
-};
-
-}  // namespace vts
-}  // namespace android
-
-#endif  // __VTS_PROTO_FUZZER_STRUCT_MUTATOR_H__
diff --git a/iface_fuzzer/include/type_mutators/ProtoFuzzerTypeMutator.h b/iface_fuzzer/include/type_mutators/ProtoFuzzerTypeMutator.h
deleted file mode 100644
index f62fc4b..0000000
--- a/iface_fuzzer/include/type_mutators/ProtoFuzzerTypeMutator.h
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
- * Copyright 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_PROTO_FUZZER_TYPE_MUTATOR_H__
-#define __VTS_PROTO_FUZZER_TYPE_MUTATOR_H__
-
-#include <string>
-#include <unordered_map>
-
-#include "ProtoFuzzerUtils.h"
-#include "test/vts/proto/ComponentSpecificationMessage.pb.h"
-
-using std::string;
-using std::unordered_map;
-
-namespace android {
-namespace vts {
-
-class ProtoFuzzerMutator;
-
-// Base class for type-specific mutators.
-class ProtoFuzzerTypeMutator {
- public:
-  ProtoFuzzerTypeMutator(
-      Random &rand, ProtoFuzzerMutator *mutator,
-      const unordered_map<string, VariableSpecificationMessage>
-          &predefined_types)
-      : rand_(rand), mutator_(mutator), predefined_types_(predefined_types) {}
-
-  virtual ~ProtoFuzzerTypeMutator() {}
-
-  // Generates a random VariableSpecificationMessage.
-  virtual VariableSpecificationMessage RandomGen(
-      const VariableSpecificationMessage &scalar_value) = 0;
-  // Mutates a VariableSpecificationMessage.
-  virtual VariableSpecificationMessage Mutate(
-      const VariableSpecificationMessage &scalar_value) = 0;
-
- protected:
-  // Looks up predefined type by name.
-  const VariableSpecificationMessage &FindPredefinedType(string name);
-  // 64-bit random number generator.
-  Random &rand_;
-  // Mutates/random generates a nested VariableSpecificationMessage.
-  ProtoFuzzerMutator *mutator_;
-  // Used to look up definition of a predefined type by its name.
-  const unordered_map<string, VariableSpecificationMessage> &predefined_types_;
-};
-
-}  // namespace vts
-}  // namespace android
-
-#endif  // __VTS_PROTO_FUZZER_TYPE_MUTATOR_H__
diff --git a/iface_fuzzer/include/type_mutators/ProtoFuzzerUnionMutator.h b/iface_fuzzer/include/type_mutators/ProtoFuzzerUnionMutator.h
deleted file mode 100644
index 1b551c0..0000000
--- a/iface_fuzzer/include/type_mutators/ProtoFuzzerUnionMutator.h
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * Copyright 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_PROTO_FUZZER_UNION_MUTATOR_H__
-#define __VTS_PROTO_FUZZER_UNION_MUTATOR_H__
-
-#include "test/vts/proto/ComponentSpecificationMessage.pb.h"
-#include "type_mutators/ProtoFuzzerTypeMutator.h"
-
-#include "ProtoFuzzerMutator.h"
-
-using std::string;
-using std::unordered_map;
-
-namespace android {
-namespace vts {
-
-// Mutates/random generates VariableSpecificationMessage of TYPE_UNION.
-class ProtoFuzzerUnionMutator : public ProtoFuzzerTypeMutator {
- public:
-  ProtoFuzzerUnionMutator(
-      Random &rand, ProtoFuzzerMutator *mutator,
-      const unordered_map<string, VariableSpecificationMessage>
-          &predefined_types)
-      : ProtoFuzzerTypeMutator(rand, mutator, predefined_types) {}
-
-  VariableSpecificationMessage RandomGen(
-      const VariableSpecificationMessage &var_spec) override;
-
-  VariableSpecificationMessage Mutate(
-      const VariableSpecificationMessage &var_spec) override;
-};
-
-}  // namespace vts
-}  // namespace android
-
-#endif  // __VTS_PROTO_FUZZER_UNION_MUTATOR_H__
diff --git a/iface_fuzzer/test/Android.bp b/iface_fuzzer/test/Android.bp
deleted file mode 100644
index 7b6771d..0000000
--- a/iface_fuzzer/test/Android.bp
+++ /dev/null
@@ -1,42 +0,0 @@
-//
-// 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.
-//
-
-cc_test {
-    name: "scalar_mutator_test",
-    srcs: [
-        "type_mutators/ProtoFuzzerScalarMutatorTest.cpp",
-    ],
-    include_dirs: [
-        "test/vts-testcase/fuzz/iface_fuzzer/include",
-        "test/vts-testcase/fuzz/iface_fuzzer/test",
-    ],
-    shared_libs: [
-        "libprotobuf-cpp-full",
-        "libvts_common",
-        "libvts_multidevice_proto",
-        "libvts_proto_fuzzer",
-        "libvts_proto_fuzzer_proto",
-    ],
-    static_libs: [
-        "libgtest",
-    ],
-    cflags: [
-        "-Wno-unused-parameter",
-        "-Wno-macro-redefined",
-        "-Wno-sign-compare",
-        "-fno-omit-frame-pointer",
-    ],
-}
diff --git a/iface_fuzzer/test/type_mutators/ProtoFuzzerScalarMutatorTest.cpp b/iface_fuzzer/test/type_mutators/ProtoFuzzerScalarMutatorTest.cpp
deleted file mode 100644
index 3334d85..0000000
--- a/iface_fuzzer/test/type_mutators/ProtoFuzzerScalarMutatorTest.cpp
+++ /dev/null
@@ -1,140 +0,0 @@
-/*
- * Copyright 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 "ProtoFuzzerTest.h"
-#include "type_mutators/ProtoFuzzerScalarMutator.h"
-
-#include <gtest/gtest.h>
-
-#include <iostream>
-
-using ::std::cout;
-using ::android::vts::FakeRandom;
-using ::android::vts::ProtoFuzzerScalarMutator;
-using ::android::vts::VariableSpecificationMessage;
-using ::android::vts::ScalarDataValueMessage;
-using ::std::make_unique;
-using ::std::unique_ptr;
-using ::std::unordered_map;
-
-class ProtoFuzzerScalarMutatorTest : public ::testing::Test {
- public:
-  virtual void SetUp() override {
-    unordered_map<string, VariableSpecificationMessage> predefined_types{};
-    mutator_ =
-        make_unique<ProtoFuzzerScalarMutator>(rand_, nullptr, predefined_types);
-  }
-
-  FakeRandom rand_;
-  unique_ptr<ProtoFuzzerScalarMutator> mutator_;
-};
-
-// Test ProtoFuzzerScalarMutator::RandomGen() methods.
-TEST_F(ProtoFuzzerScalarMutatorTest, RandomGenTest) {
-  // Assume little-endianness.
-  {
-    ScalarDataValueMessage value = mutator_->RandomGen(value, "bool_t");
-    EXPECT_FALSE(value.bool_t());
-  }
-  {
-    ScalarDataValueMessage value = mutator_->RandomGen(value, "int8_t");
-    EXPECT_EQ(0xbeef0000, value.int8_t());
-  }
-  {
-    ScalarDataValueMessage value = mutator_->RandomGen(value, "uint8_t");
-    EXPECT_EQ(0xbeef0000, value.uint8_t());
-  }
-  {
-    ScalarDataValueMessage value = mutator_->RandomGen(value, "int16_t");
-    EXPECT_EQ(0xbeef0000, value.int16_t());
-  }
-  {
-    ScalarDataValueMessage value = mutator_->RandomGen(value, "uint16_t");
-    EXPECT_EQ(0xbeef0000, value.uint16_t());
-  }
-  {
-    ScalarDataValueMessage value = mutator_->RandomGen(value, "int32_t");
-    EXPECT_EQ(0xbeef0000, value.int32_t());
-  }
-  {
-    ScalarDataValueMessage value = mutator_->RandomGen(value, "uint32_t");
-    EXPECT_EQ(0xbeef0000, value.uint32_t());
-  }
-  {
-    ScalarDataValueMessage value = mutator_->RandomGen(value, "int64_t");
-    EXPECT_EQ(0xffffdeadbeef0000, value.int64_t());
-  }
-  {
-    ScalarDataValueMessage value = mutator_->RandomGen(value, "uint64_t");
-    EXPECT_EQ(0xffffdeadbeef0000, value.uint64_t());
-  }
-}
-
-// Test ProtoFuzzerScalarMutator::Mutate() methods.
-TEST_F(ProtoFuzzerScalarMutatorTest, MutateTest) {
-  {
-    ScalarDataValueMessage value{};
-    value.set_bool_t(0xdeadbeef);
-    EXPECT_FALSE((mutator_->Mutate(value, "bool_t")).bool_t());
-  }
-  {
-    ScalarDataValueMessage value{};
-    value.set_int8_t(0xdeadbeef);
-    EXPECT_EQ(0x9eadbeef, (mutator_->Mutate(value, "int8_t")).int8_t());
-  }
-  {
-    ScalarDataValueMessage value{};
-    value.set_uint8_t(0xdeadbeef);
-    EXPECT_EQ(0x9eadbeef, (mutator_->Mutate(value, "uint8_t")).uint8_t());
-  }
-  {
-    ScalarDataValueMessage value{};
-    value.set_int16_t(0xdeadbeef);
-    EXPECT_EQ(0x9eadbeef, (mutator_->Mutate(value, "int16_t")).int16_t());
-  }
-  {
-    ScalarDataValueMessage value{};
-    value.set_uint16_t(0xdeadbeef);
-    EXPECT_EQ(0x9eadbeef, (mutator_->Mutate(value, "uint16_t")).uint16_t());
-  }
-  {
-    ScalarDataValueMessage value{};
-    value.set_int32_t(0xdeadbeef);
-    EXPECT_EQ(0x9eadbeef, (mutator_->Mutate(value, "int32_t")).int32_t());
-  }
-  {
-    ScalarDataValueMessage value{};
-    value.set_uint32_t(0xdeadbeef);
-    EXPECT_EQ(0x9eadbeef, (mutator_->Mutate(value, "uint32_t")).uint32_t());
-  }
-  {
-    ScalarDataValueMessage value{};
-    value.set_int64_t(0xffffdeadbeef0000);
-    EXPECT_EQ(0xbfffdeadbeef0000,
-              (mutator_->Mutate(value, "int64_t")).int64_t());
-  }
-  {
-    ScalarDataValueMessage value{};
-    value.set_uint64_t(0xffffdeadbeef0000);
-    EXPECT_EQ(0xbfffdeadbeef0000,
-              (mutator_->Mutate(value, "uint64_t")).uint64_t());
-  }
-}
-
-int main(int argc, char **argv) {
-  ::testing::InitGoogleTest(&argc, argv);
-  return RUN_ALL_TESTS();
-}
diff --git a/iface_fuzzer/type_mutators/ProtoFuzzerArrayMutator.cpp b/iface_fuzzer/type_mutators/ProtoFuzzerArrayMutator.cpp
deleted file mode 100644
index a0d304c..0000000
--- a/iface_fuzzer/type_mutators/ProtoFuzzerArrayMutator.cpp
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * Copyright 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 "type_mutators/ProtoFuzzerArrayMutator.h"
-
-namespace android {
-namespace vts {
-
-VariableSpecificationMessage ProtoFuzzerArrayMutator::RandomGen(
-    const VariableSpecificationMessage &var_spec) {
-  VariableSpecificationMessage result{};
-  result.set_type(TYPE_ARRAY);
-  int vector_size = var_spec.vector_value(0).vector_size();
-  result.set_vector_size(vector_size);
-  for (int i = 0; i < vector_size; ++i) {
-    *result.add_vector_value() = mutator_->RandomGen(var_spec.vector_value(0));
-  }
-  return result;
-}
-
-VariableSpecificationMessage ProtoFuzzerArrayMutator::Mutate(
-    const VariableSpecificationMessage &var_spec) {
-  VariableSpecificationMessage result{var_spec};
-  size_t vector_size = static_cast<size_t>(var_spec.vector_size());
-  size_t idx = rand_(vector_size);
-  *result.mutable_vector_value(idx) =
-      mutator_->Mutate(var_spec.vector_value(idx));
-  return result;
-}
-
-}  // namespace vts
-}  // namespace android
diff --git a/iface_fuzzer/type_mutators/ProtoFuzzerEnumMutator.cpp b/iface_fuzzer/type_mutators/ProtoFuzzerEnumMutator.cpp
deleted file mode 100644
index 9918ad0..0000000
--- a/iface_fuzzer/type_mutators/ProtoFuzzerEnumMutator.cpp
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- * Copyright 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 "type_mutators/ProtoFuzzerEnumMutator.h"
-
-using std::string;
-
-namespace android {
-namespace vts {
-
-VariableSpecificationMessage ProtoFuzzerEnumMutator::RandomGen(
-    const VariableSpecificationMessage &var_spec) {
-  VariableSpecificationMessage result;
-  string name = (var_spec.has_predefined_type()) ? var_spec.predefined_type()
-                                                 : var_spec.name();
-  result.set_name(name);
-  result.set_type(TYPE_ENUM);
-
-  const EnumDataValueMessage &blueprint =
-      FindPredefinedType(result.name()).enum_value();
-
-  size_t size = blueprint.enumerator_size();
-  size_t idx = rand_(size);
-
-  ScalarDataValueMessage scalar_value = blueprint.scalar_value(idx);
-  string scalar_type = blueprint.scalar_type();
-
-  // Mutate this enum like a scalar with probability
-  // odds_for/(odds_for + odds_against).
-  uint64_t odds_for = (mutator_->mutator_bias_).enum_bias_.first;
-  uint64_t odds_against = (mutator_->mutator_bias_).enum_bias_.second;
-  uint64_t rand_num = rand_(odds_for + odds_against);
-  if (rand_num < odds_for) {
-    scalar_value = ProtoFuzzerScalarMutator::Mutate(scalar_value, scalar_type);
-  }
-
-  *(result.mutable_scalar_value()) = scalar_value;
-  result.set_scalar_type(scalar_type);
-  return result;
-}
-
-VariableSpecificationMessage ProtoFuzzerEnumMutator::Mutate(
-    const VariableSpecificationMessage &var_spec) {
-  return RandomGen(var_spec);
-}
-
-}  // namespace vts
-}  // namespace android
diff --git a/iface_fuzzer/type_mutators/ProtoFuzzerScalarMutator.cpp b/iface_fuzzer/type_mutators/ProtoFuzzerScalarMutator.cpp
deleted file mode 100644
index 477f20f..0000000
--- a/iface_fuzzer/type_mutators/ProtoFuzzerScalarMutator.cpp
+++ /dev/null
@@ -1,151 +0,0 @@
-/*
- * Copyright 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 "type_mutators/ProtoFuzzerScalarMutator.h"
-
-using std::memcpy;
-using std::string;
-
-namespace android {
-namespace vts {
-
-VariableSpecificationMessage ProtoFuzzerScalarMutator::RandomGen(
-    const VariableSpecificationMessage &var_spec) {
-  VariableSpecificationMessage result{var_spec};
-  (*result.mutable_scalar_value()) =
-      RandomGen(var_spec.scalar_value(), var_spec.scalar_type());
-
-  return result;
-}
-
-VariableSpecificationMessage ProtoFuzzerScalarMutator::Mutate(
-    const VariableSpecificationMessage &var_spec) {
-  VariableSpecificationMessage result{var_spec};
-  (*result.mutable_scalar_value()) =
-      Mutate(var_spec.scalar_value(), var_spec.scalar_type());
-
-  return result;
-}
-
-ScalarDataValueMessage ProtoFuzzerScalarMutator::RandomGen(
-    const ScalarDataValueMessage &scalar_value, const string &scalar_type) {
-  ScalarDataValueMessage result;
-
-  if (scalar_type == "bool_t") {
-    result.set_bool_t(RandomGen(static_cast<bool>(scalar_value.bool_t())));
-  } else if (scalar_type == "int8_t") {
-    result.set_int8_t(RandomGen(scalar_value.int8_t()));
-  } else if (scalar_type == "uint8_t") {
-    result.set_uint8_t(RandomGen(scalar_value.uint8_t()));
-  } else if (scalar_type == "int16_t") {
-    result.set_int16_t(RandomGen(scalar_value.int16_t()));
-  } else if (scalar_type == "uint16_t") {
-    result.set_uint16_t(RandomGen(scalar_value.uint16_t()));
-  } else if (scalar_type == "int32_t") {
-    result.set_int32_t(RandomGen(scalar_value.int32_t()));
-  } else if (scalar_type == "uint32_t") {
-    result.set_uint32_t(RandomGen(scalar_value.uint32_t()));
-  } else if (scalar_type == "int64_t") {
-    result.set_int64_t(RandomGen(scalar_value.int64_t()));
-  } else if (scalar_type == "uint64_t") {
-    result.set_uint64_t(RandomGen(scalar_value.uint64_t()));
-  } else if (scalar_type == "float_t") {
-    result.set_float_t(RandomGen(scalar_value.float_t()));
-  } else if (scalar_type == "double_t") {
-    result.set_double_t(RandomGen(scalar_value.double_t()));
-  } else {
-    cout << scalar_type << " not supported.\n";
-  }
-
-  return result;
-}
-
-ScalarDataValueMessage ProtoFuzzerScalarMutator::Mutate(
-    const ScalarDataValueMessage &scalar_value, const string &scalar_type) {
-  ScalarDataValueMessage result;
-
-  if (scalar_type == "bool_t") {
-    result.set_bool_t(Mutate(static_cast<bool>(scalar_value.bool_t())));
-  } else if (scalar_type == "int8_t") {
-    result.set_int8_t(Mutate(scalar_value.int8_t()));
-  } else if (scalar_type == "uint8_t") {
-    result.set_uint8_t(Mutate(scalar_value.uint8_t()));
-  } else if (scalar_type == "int16_t") {
-    result.set_int16_t(Mutate(scalar_value.int16_t()));
-  } else if (scalar_type == "uint16_t") {
-    result.set_uint16_t(Mutate(scalar_value.uint16_t()));
-  } else if (scalar_type == "int32_t") {
-    result.set_int32_t(Mutate(scalar_value.int32_t()));
-  } else if (scalar_type == "uint32_t") {
-    result.set_uint32_t(Mutate(scalar_value.uint32_t()));
-  } else if (scalar_type == "int64_t") {
-    result.set_int64_t(Mutate(scalar_value.int64_t()));
-  } else if (scalar_type == "uint64_t") {
-    result.set_uint64_t(Mutate(scalar_value.uint64_t()));
-  } else if (scalar_type == "float_t") {
-    result.set_float_t(Mutate(scalar_value.float_t()));
-  } else if (scalar_type == "double_t") {
-    result.set_double_t(Mutate(scalar_value.double_t()));
-  } else {
-    cout << scalar_type << " not supported.\n";
-  }
-
-  return result;
-}
-
-template <typename T>
-T ProtoFuzzerScalarMutator::RandomGen(T value) {
-  // Generate a biased random scalar.
-  uint64_t rand_int = (mutator_->mutator_bias_).scalar_bias_(rand_);
-
-  T result;
-  memcpy(&result, &rand_int, sizeof(T));
-  return result;
-}
-
-bool ProtoFuzzerScalarMutator::RandomGen(bool value) {
-  return static_cast<bool>(rand_(2));
-}
-
-template <typename T>
-T ProtoFuzzerScalarMutator::Mutate(T value) {
-  size_t num_bits = 8 * sizeof(T);
-  T mask = static_cast<T>(1) << rand_(num_bits);
-  return value ^ mask;
-}
-
-bool ProtoFuzzerScalarMutator::Mutate(bool value) { return rand_(2); }
-
-float ProtoFuzzerScalarMutator::Mutate(float value) {
-  uint32_t copy;
-  memcpy(&copy, &value, sizeof(float));
-  uint32_t mask = static_cast<uint32_t>(1) << rand_(32);
-  copy ^= mask;
-  memcpy(&value, &copy, sizeof(float));
-  return value;
-}
-
-double ProtoFuzzerScalarMutator::Mutate(double value) {
-  uint64_t copy;
-  memcpy(&copy, &value, sizeof(double));
-  uint64_t mask = static_cast<uint64_t>(1) << rand_(64);
-  copy ^= mask;
-  memcpy(&value, &copy, sizeof(double));
-  return value;
-}
-
-}  // namespace vts
-}  // namespace android
diff --git a/iface_fuzzer/type_mutators/ProtoFuzzerStructMutator.cpp b/iface_fuzzer/type_mutators/ProtoFuzzerStructMutator.cpp
deleted file mode 100644
index 7c704cb..0000000
--- a/iface_fuzzer/type_mutators/ProtoFuzzerStructMutator.cpp
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * Copyright 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 "type_mutators/ProtoFuzzerStructMutator.h"
-
-namespace android {
-namespace vts {
-
-VariableSpecificationMessage ProtoFuzzerStructMutator::RandomGen(
-    const VariableSpecificationMessage &var_spec) {
-  VariableSpecificationMessage result{};
-  result.set_name(var_spec.predefined_type());
-  result.set_type(TYPE_STRUCT);
-
-  const VariableSpecificationMessage &blueprint =
-      FindPredefinedType(result.name());
-  for (const auto &struct_value : blueprint.struct_value()) {
-    *result.add_struct_value() = mutator_->RandomGen(struct_value);
-  }
-  return result;
-}
-
-VariableSpecificationMessage ProtoFuzzerStructMutator::Mutate(
-    const VariableSpecificationMessage &var_spec) {
-  VariableSpecificationMessage result{var_spec};
-
-  size_t size = var_spec.struct_value_size();
-  size_t idx = rand_(size);
-  *result.mutable_struct_value(idx) =
-      mutator_->Mutate(var_spec.struct_value(idx));
-  return result;
-}
-
-}  // namespace vts
-}  // namespace android
diff --git a/iface_fuzzer/type_mutators/ProtoFuzzerTypeMutator.cpp b/iface_fuzzer/type_mutators/ProtoFuzzerTypeMutator.cpp
deleted file mode 100644
index 69276d2..0000000
--- a/iface_fuzzer/type_mutators/ProtoFuzzerTypeMutator.cpp
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * Copyright 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 "type_mutators/ProtoFuzzerTypeMutator.h"
-
-using std::cout;
-using std::cerr;
-using std::endl;
-using std::string;
-
-namespace android {
-namespace vts {
-
-const VariableSpecificationMessage &ProtoFuzzerTypeMutator::FindPredefinedType(
-    string name) {
-  auto var_spec = predefined_types_.find(name);
-  if (var_spec == predefined_types_.end()) {
-    cerr << "Predefined type not found: " << name << endl;
-    exit(1);
-  }
-  return var_spec->second;
-}
-
-}  // namespace vts
-}  // namespace android
diff --git a/iface_fuzzer/type_mutators/ProtoFuzzerUnionMutator.cpp b/iface_fuzzer/type_mutators/ProtoFuzzerUnionMutator.cpp
deleted file mode 100644
index f87a57f..0000000
--- a/iface_fuzzer/type_mutators/ProtoFuzzerUnionMutator.cpp
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- * Copyright 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 "type_mutators/ProtoFuzzerUnionMutator.h"
-
-namespace android {
-namespace vts {
-
-VariableSpecificationMessage ProtoFuzzerUnionMutator::RandomGen(
-    const VariableSpecificationMessage &var_spec) {
-  VariableSpecificationMessage result{};
-  result.set_name(var_spec.predefined_type());
-  result.set_type(TYPE_UNION);
-
-  const VariableSpecificationMessage &blueprint =
-      FindPredefinedType(result.name());
-
-  // TODO(trong): once vts driver supports TYPE_UNION, there should be only 1
-  // union_value.
-  for (const auto &union_value : blueprint.union_value()) {
-    *result.add_union_value() = mutator_->RandomGen(union_value);
-  }
-
-  /*
-  // Generate only 1 randomly chosen union_value field.
-  size_t size = var_spec.union_value_size();
-  size_t idx = rand_(size);
-  *result.add_union_value() =
-      mutator_->RandomGen(blueprint.union_value(idx));
-  */
-  return result;
-}
-
-VariableSpecificationMessage ProtoFuzzerUnionMutator::Mutate(
-    const VariableSpecificationMessage &var_spec) {
-  VariableSpecificationMessage result{var_spec};
-  // Assume contains exactly 1 union_value field.
-  *result.mutable_union_value(0) = mutator_->Mutate(var_spec.union_value(0));
-  return result;
-}
-
-}  // namespace vts
-}  // namespace android