Merge "getprop: add -T option to return a property's type"
diff --git a/base/include/android-base/thread_annotations.h b/base/include/android-base/thread_annotations.h
index fbb5923..1307f0e 100644
--- a/base/include/android-base/thread_annotations.h
+++ b/base/include/android-base/thread_annotations.h
@@ -38,6 +38,12 @@
 #define PT_GUARDED_BY(x) \
       THREAD_ANNOTATION_ATTRIBUTE__(pt_guarded_by(x))
 
+#define EXCLUSIVE_LOCKS_REQUIRED(...) \
+      THREAD_ANNOTATION_ATTRIBUTE__(exclusive_locks_required(__VA_ARGS__))
+
+#define SHARED_LOCKS_REQUIRED(...) \
+      THREAD_ANNOTATION_ATTRIBUTE__(shared_locks_required(__VA_ARGS__))
+
 #define ACQUIRED_BEFORE(...) \
       THREAD_ANNOTATION_ATTRIBUTE__(acquired_before(__VA_ARGS__))
 
diff --git a/init/action.cpp b/init/action.cpp
index ab51eea..16ecdcd 100644
--- a/init/action.cpp
+++ b/init/action.cpp
@@ -50,12 +50,19 @@
     : func_(std::move(f)), execute_in_subcontext_(execute_in_subcontext), args_(args), line_(line) {}
 
 Result<Success> Command::InvokeFunc(Subcontext* subcontext) const {
-    if (execute_in_subcontext_ && subcontext) {
-        return subcontext->Execute(args_);
-    } else {
-        const std::string& context = subcontext ? subcontext->context() : kInitContext;
-        return RunBuiltinFunction(func_, args_, context);
+    if (subcontext) {
+        if (execute_in_subcontext_) {
+            return subcontext->Execute(args_);
+        }
+
+        auto expanded_args = subcontext->ExpandArgs(args_);
+        if (!expanded_args) {
+            return expanded_args.error();
+        }
+        return RunBuiltinFunction(func_, *expanded_args, subcontext->context());
     }
+
+    return RunBuiltinFunction(func_, args_, kInitContext);
 }
 
 std::string Command::BuildCommandString() const {
diff --git a/init/subcontext.cpp b/init/subcontext.cpp
index 068be6e..be754da 100644
--- a/init/subcontext.cpp
+++ b/init/subcontext.cpp
@@ -28,7 +28,6 @@
 
 #include "action.h"
 #include "selinux.h"
-#include "system/core/init/subcontext.pb.h"
 #include "util.h"
 
 using android::base::GetExecutablePath;
@@ -84,7 +83,9 @@
 
   private:
     void RunCommand(const SubcontextCommand::ExecuteCommand& execute_command,
-                    SubcontextReply::ResultMessage* result_message) const;
+                    SubcontextReply* reply) const;
+    void ExpandArgs(const SubcontextCommand::ExpandArgsCommand& expand_args_command,
+                    SubcontextReply* reply) const;
 
     const KeywordFunctionMap* function_map_;
     const std::string context_;
@@ -92,7 +93,7 @@
 };
 
 void SubcontextProcess::RunCommand(const SubcontextCommand::ExecuteCommand& execute_command,
-                                   SubcontextReply::ResultMessage* result_message) const {
+                                   SubcontextReply* reply) const {
     // Need to use ArraySplice instead of this code.
     auto args = std::vector<std::string>();
     for (const auto& string : execute_command.args()) {
@@ -108,11 +109,27 @@
     }
 
     if (result) {
-        result_message->set_success(true);
+        reply->set_success(true);
     } else {
-        result_message->set_success(false);
-        result_message->set_error_string(result.error_string());
-        result_message->set_error_errno(result.error_errno());
+        auto* failure = reply->mutable_failure();
+        failure->set_error_string(result.error_string());
+        failure->set_error_errno(result.error_errno());
+    }
+}
+
+void SubcontextProcess::ExpandArgs(const SubcontextCommand::ExpandArgsCommand& expand_args_command,
+                                   SubcontextReply* reply) const {
+    for (const auto& arg : expand_args_command.args()) {
+        auto expanded_prop = std::string{};
+        if (!expand_props(arg, &expanded_prop)) {
+            auto* failure = reply->mutable_failure();
+            failure->set_error_string("Failed to expand '" + arg + "'");
+            failure->set_error_errno(0);
+            return;
+        } else {
+            auto* expand_args_reply = reply->mutable_expand_args_reply();
+            expand_args_reply->add_expanded_args(expanded_prop);
+        }
     }
 }
 
@@ -142,7 +159,11 @@
         auto reply = SubcontextReply();
         switch (subcontext_command.command_case()) {
             case SubcontextCommand::kExecuteCommand: {
-                RunCommand(subcontext_command.execute_command(), reply.mutable_result());
+                RunCommand(subcontext_command.execute_command(), &reply);
+                break;
+            }
+            case SubcontextCommand::kExpandArgsCommand: {
+                ExpandArgs(subcontext_command.expand_args_command(), &reply);
                 break;
             }
             default:
@@ -219,12 +240,7 @@
     Fork();
 }
 
-Result<Success> Subcontext::Execute(const std::vector<std::string>& args) {
-    auto subcontext_command = SubcontextCommand();
-    std::copy(
-        args.begin(), args.end(),
-        RepeatedPtrFieldBackInserter(subcontext_command.mutable_execute_command()->mutable_args()));
-
+Result<SubcontextReply> Subcontext::TransmitMessage(const SubcontextCommand& subcontext_command) {
     if (auto result = SendMessage(socket_, subcontext_command); !result) {
         Restart();
         return ErrnoError() << "Failed to send message to subcontext";
@@ -236,25 +252,59 @@
         return Error() << "Failed to receive result from subcontext: " << subcontext_message.error();
     }
 
-    auto subcontext_reply = SubcontextReply();
+    auto subcontext_reply = SubcontextReply{};
     if (!subcontext_reply.ParseFromString(*subcontext_message)) {
         Restart();
         return Error() << "Unable to parse message from subcontext";
     }
-
-    switch (subcontext_reply.reply_case()) {
-        case SubcontextReply::kResult: {
-            auto result = subcontext_reply.result();
-            if (result.success()) {
-                return Success();
-            } else {
-                return ResultError(result.error_string(), result.error_errno());
-            }
-        }
-        default:
-            return Error() << "Unknown message type from subcontext: "
-                           << subcontext_reply.reply_case();
+    if (subcontext_reply.reply_case() == SubcontextReply::kFailure) {
+        auto& failure = subcontext_reply.failure();
+        return ResultError(failure.error_string(), failure.error_errno());
     }
+    return subcontext_reply;
+}
+
+Result<Success> Subcontext::Execute(const std::vector<std::string>& args) {
+    auto subcontext_command = SubcontextCommand();
+    std::copy(
+        args.begin(), args.end(),
+        RepeatedPtrFieldBackInserter(subcontext_command.mutable_execute_command()->mutable_args()));
+
+    auto subcontext_reply = TransmitMessage(subcontext_command);
+    if (!subcontext_reply) {
+        return subcontext_reply.error();
+    }
+
+    if (subcontext_reply->reply_case() != SubcontextReply::kSuccess) {
+        return Error() << "Unexpected message type from subcontext: "
+                       << subcontext_reply->reply_case();
+    }
+
+    return Success();
+}
+
+Result<std::vector<std::string>> Subcontext::ExpandArgs(const std::vector<std::string>& args) {
+    auto subcontext_command = SubcontextCommand{};
+    std::copy(args.begin(), args.end(),
+              RepeatedPtrFieldBackInserter(
+                  subcontext_command.mutable_expand_args_command()->mutable_args()));
+
+    auto subcontext_reply = TransmitMessage(subcontext_command);
+    if (!subcontext_reply) {
+        return subcontext_reply.error();
+    }
+
+    if (subcontext_reply->reply_case() != SubcontextReply::kExpandArgsReply) {
+        return Error() << "Unexpected message type from subcontext: "
+                       << subcontext_reply->reply_case();
+    }
+
+    auto& reply = subcontext_reply->expand_args_reply();
+    auto expanded_args = std::vector<std::string>{};
+    for (const auto& string : reply.expanded_args()) {
+        expanded_args.emplace_back(string);
+    }
+    return expanded_args;
 }
 
 static std::vector<Subcontext> subcontexts;
diff --git a/init/subcontext.h b/init/subcontext.h
index eadabee..262440d 100644
--- a/init/subcontext.h
+++ b/init/subcontext.h
@@ -25,6 +25,7 @@
 #include <android-base/unique_fd.h>
 
 #include "builtins.h"
+#include "system/core/init/subcontext.pb.h"
 
 namespace android {
 namespace init {
@@ -39,7 +40,8 @@
         Fork();
     }
 
-    Result<Success> Execute(const std::vector<std::string>& command);
+    Result<Success> Execute(const std::vector<std::string>& args);
+    Result<std::vector<std::string>> ExpandArgs(const std::vector<std::string>& args);
     void Restart();
 
     const std::string& path_prefix() const { return path_prefix_; }
@@ -48,6 +50,7 @@
 
   private:
     void Fork();
+    Result<SubcontextReply> TransmitMessage(const SubcontextCommand& subcontext_command);
 
     std::string path_prefix_;
     std::string context_;
diff --git a/init/subcontext.proto b/init/subcontext.proto
index 0d89734..e68115e 100644
--- a/init/subcontext.proto
+++ b/init/subcontext.proto
@@ -19,15 +19,23 @@
 
 message SubcontextCommand {
     message ExecuteCommand { repeated string args = 1; }
-    oneof command { ExecuteCommand execute_command = 1; }
+    message ExpandArgsCommand { repeated string args = 1; }
+    oneof command {
+        ExecuteCommand execute_command = 1;
+        ExpandArgsCommand expand_args_command = 2;
+    }
 }
 
 message SubcontextReply {
-    message ResultMessage {
-        optional bool success = 1;
-        optional string error_string = 2;
-        optional int32 error_errno = 3;
+    message Failure {
+        optional string error_string = 1;
+        optional int32 error_errno = 2;
     }
+    message ExpandArgsReply { repeated string expanded_args = 1; }
 
-    oneof reply { ResultMessage result = 1; }
+    oneof reply {
+        bool success = 1;
+        Failure failure = 2;
+        ExpandArgsReply expand_args_reply = 3;
+    }
 }
\ No newline at end of file
diff --git a/init/subcontext_test.cpp b/init/subcontext_test.cpp
index ca45266..230203a 100644
--- a/init/subcontext_test.cpp
+++ b/init/subcontext_test.cpp
@@ -143,6 +143,34 @@
     });
 }
 
+TEST(subcontext, ExpandArgs) {
+    RunTest([](auto& subcontext, auto& context_string) {
+        auto args = std::vector<std::string>{
+            "first",
+            "${ro.hardware}",
+            "$$third",
+        };
+        auto result = subcontext.ExpandArgs(args);
+        ASSERT_TRUE(result) << result.error();
+        ASSERT_EQ(3U, result->size());
+        EXPECT_EQ(args[0], result->at(0));
+        EXPECT_EQ(GetProperty("ro.hardware", ""), result->at(1));
+        EXPECT_EQ("$third", result->at(2));
+    });
+}
+
+TEST(subcontext, ExpandArgsFailure) {
+    RunTest([](auto& subcontext, auto& context_string) {
+        auto args = std::vector<std::string>{
+            "first",
+            "${",
+        };
+        auto result = subcontext.ExpandArgs(args);
+        ASSERT_FALSE(result);
+        EXPECT_EQ("Failed to expand '" + args[1] + "'", result.error_string());
+    });
+}
+
 TestFunctionMap BuildTestFunctionMap() {
     TestFunctionMap test_function_map;
     // For CheckDifferentPid
diff --git a/property_service/libpropertyinfoparser/include/property_info_parser/property_info_parser.h b/property_service/libpropertyinfoparser/include/property_info_parser/property_info_parser.h
index 2ee8161..0548021 100644
--- a/property_service/libpropertyinfoparser/include/property_info_parser/property_info_parser.h
+++ b/property_service/libpropertyinfoparser/include/property_info_parser/property_info_parser.h
@@ -32,8 +32,8 @@
 
   // This is the context match for this node_; ~0u if it doesn't correspond to any.
   uint32_t context_index;
-  // This is the schema for this node_; ~0u if it doesn't correspond to any.
-  uint32_t schema_index;
+  // This is the type for this node_; ~0u if it doesn't correspond to any.
+  uint32_t type_index;
 };
 
 struct TrieNodeInternal {
@@ -61,7 +61,7 @@
   uint32_t minimum_supported_version;
   uint32_t size;
   uint32_t contexts_offset;
-  uint32_t schemas_offset;
+  uint32_t types_offset;
   uint32_t root_offset;
 };
 
@@ -103,7 +103,7 @@
   }
 
   uint32_t context_index() const { return node_property_entry()->context_index; }
-  uint32_t schema_index() const { return node_property_entry()->schema_index; }
+  uint32_t type_index() const { return node_property_entry()->type_index; }
 
   uint32_t num_child_nodes() const { return trie_node_base_->num_child_nodes; }
   TrieNode child_node(int n) const {
@@ -143,12 +143,11 @@
 
 class PropertyInfoArea : private SerializedData {
  public:
-  void GetPropertyInfoIndexes(const char* name, uint32_t* context_index,
-                              uint32_t* schema_index) const;
-  void GetPropertyInfo(const char* property, const char** context, const char** schema) const;
+  void GetPropertyInfoIndexes(const char* name, uint32_t* context_index, uint32_t* type_index) const;
+  void GetPropertyInfo(const char* property, const char** context, const char** type) const;
 
   int FindContextIndex(const char* context) const;
-  int FindSchemaIndex(const char* schema) const;
+  int FindTypeIndex(const char* type) const;
 
   const char* context(uint32_t index) const {
     uint32_t context_array_size_offset = contexts_offset();
@@ -156,10 +155,10 @@
     return data_base() + context_array[index];
   }
 
-  const char* schema(uint32_t index) const {
-    uint32_t schema_array_size_offset = schemas_offset();
-    const uint32_t* schema_array = uint32_array(schema_array_size_offset + sizeof(uint32_t));
-    return data_base() + schema_array[index];
+  const char* type(uint32_t index) const {
+    uint32_t type_array_size_offset = types_offset();
+    const uint32_t* type_array = uint32_array(type_array_size_offset + sizeof(uint32_t));
+    return data_base() + type_array[index];
   }
 
   uint32_t current_version() const { return header()->current_version; }
@@ -168,21 +167,21 @@
   uint32_t size() const { return SerializedData::size(); }
 
   uint32_t num_contexts() const { return uint32_array(contexts_offset())[0]; }
-  uint32_t num_schemas() const { return uint32_array(schemas_offset())[0]; }
+  uint32_t num_types() const { return uint32_array(types_offset())[0]; }
 
   TrieNode root_node() const { return trie(header()->root_offset); }
 
  private:
   void CheckPrefixMatch(const char* remaining_name, const TrieNode& trie_node,
-                        uint32_t* context_index, uint32_t* schema_index) const;
+                        uint32_t* context_index, uint32_t* type_index) const;
 
   const PropertyInfoAreaHeader* header() const {
     return reinterpret_cast<const PropertyInfoAreaHeader*>(data_base());
   }
   uint32_t contexts_offset() const { return header()->contexts_offset; }
   uint32_t contexts_array_offset() const { return contexts_offset() + sizeof(uint32_t); }
-  uint32_t schemas_offset() const { return header()->schemas_offset; }
-  uint32_t schemas_array_offset() const { return schemas_offset() + sizeof(uint32_t); }
+  uint32_t types_offset() const { return header()->types_offset; }
+  uint32_t types_array_offset() const { return types_offset() + sizeof(uint32_t); }
 
   TrieNode trie(uint32_t offset) const {
     if (offset != 0 && offset > size()) return TrieNode();
diff --git a/property_service/libpropertyinfoparser/property_info_parser.cpp b/property_service/libpropertyinfoparser/property_info_parser.cpp
index a8f6636..489d81a 100644
--- a/property_service/libpropertyinfoparser/property_info_parser.cpp
+++ b/property_service/libpropertyinfoparser/property_info_parser.cpp
@@ -56,12 +56,12 @@
   });
 }
 
-// Binary search the list of schemas to find the index of a given schema string.
+// Binary search the list of types to find the index of a given type string.
 // Only should be used for TrieSerializer to construct the Trie.
-int PropertyInfoArea::FindSchemaIndex(const char* schema) const {
-  return Find(num_schemas(), [this, schema](auto array_offset) {
-    auto string_offset = uint32_array(schemas_array_offset())[array_offset];
-    return strcmp(c_string(string_offset), schema);
+int PropertyInfoArea::FindTypeIndex(const char* type) const {
+  return Find(num_types(), [this, type](auto array_offset) {
+    auto string_offset = uint32_array(types_array_offset())[array_offset];
+    return strcmp(c_string(string_offset), type);
   });
 }
 
@@ -89,7 +89,7 @@
 }
 
 void PropertyInfoArea::CheckPrefixMatch(const char* remaining_name, const TrieNode& trie_node,
-                                        uint32_t* context_index, uint32_t* schema_index) const {
+                                        uint32_t* context_index, uint32_t* type_index) const {
   const uint32_t remaining_name_size = strlen(remaining_name);
   for (uint32_t i = 0; i < trie_node.num_prefixes(); ++i) {
     auto prefix_len = trie_node.prefix(i)->namelen;
@@ -99,8 +99,8 @@
       if (trie_node.prefix(i)->context_index != ~0u) {
         *context_index = trie_node.prefix(i)->context_index;
       }
-      if (trie_node.prefix(i)->schema_index != ~0u) {
-        *schema_index = trie_node.prefix(i)->schema_index;
+      if (trie_node.prefix(i)->type_index != ~0u) {
+        *type_index = trie_node.prefix(i)->type_index;
       }
       return;
     }
@@ -108,9 +108,9 @@
 }
 
 void PropertyInfoArea::GetPropertyInfoIndexes(const char* name, uint32_t* context_index,
-                                              uint32_t* schema_index) const {
+                                              uint32_t* type_index) const {
   uint32_t return_context_index = ~0u;
-  uint32_t return_schema_index = ~0u;
+  uint32_t return_type_index = ~0u;
   const char* remaining_name = name;
   auto trie_node = root_node();
   while (true) {
@@ -120,13 +120,13 @@
     if (trie_node.context_index() != ~0u) {
       return_context_index = trie_node.context_index();
     }
-    if (trie_node.schema_index() != ~0u) {
-      return_schema_index = trie_node.schema_index();
+    if (trie_node.type_index() != ~0u) {
+      return_type_index = trie_node.type_index();
     }
 
     // Check prefixes at this node.  This comes after the node check since these prefixes are by
     // definition longer than the node itself.
-    CheckPrefixMatch(remaining_name, trie_node, &return_context_index, &return_schema_index);
+    CheckPrefixMatch(remaining_name, trie_node, &return_context_index, &return_type_index);
 
     if (sep == nullptr) {
       break;
@@ -153,29 +153,29 @@
           *context_index = return_context_index;
         }
       }
-      if (schema_index != nullptr) {
-        if (trie_node.exact_match(i)->schema_index != ~0u) {
-          *schema_index = trie_node.exact_match(i)->schema_index;
+      if (type_index != nullptr) {
+        if (trie_node.exact_match(i)->type_index != ~0u) {
+          *type_index = trie_node.exact_match(i)->type_index;
         } else {
-          *schema_index = return_schema_index;
+          *type_index = return_type_index;
         }
       }
       return;
     }
   }
   // Check prefix matches for prefixes not deliminated with '.'
-  CheckPrefixMatch(remaining_name, trie_node, &return_context_index, &return_schema_index);
+  CheckPrefixMatch(remaining_name, trie_node, &return_context_index, &return_type_index);
   // Return previously found prefix match.
   if (context_index != nullptr) *context_index = return_context_index;
-  if (schema_index != nullptr) *schema_index = return_schema_index;
+  if (type_index != nullptr) *type_index = return_type_index;
   return;
 }
 
 void PropertyInfoArea::GetPropertyInfo(const char* property, const char** context,
-                                       const char** schema) const {
+                                       const char** type) const {
   uint32_t context_index;
-  uint32_t schema_index;
-  GetPropertyInfoIndexes(property, &context_index, &schema_index);
+  uint32_t type_index;
+  GetPropertyInfoIndexes(property, &context_index, &type_index);
   if (context != nullptr) {
     if (context_index == ~0u) {
       *context = nullptr;
@@ -183,11 +183,11 @@
       *context = this->context(context_index);
     }
   }
-  if (schema != nullptr) {
-    if (schema_index == ~0u) {
-      *schema = nullptr;
+  if (type != nullptr) {
+    if (type_index == ~0u) {
+      *type = nullptr;
     } else {
-      *schema = this->schema(schema_index);
+      *type = this->type(type_index);
     }
   }
 }
diff --git a/property_service/libpropertyinfoserializer/include/property_info_serializer/property_info_serializer.h b/property_service/libpropertyinfoserializer/include/property_info_serializer/property_info_serializer.h
index d2ec385..439813d 100644
--- a/property_service/libpropertyinfoserializer/include/property_info_serializer/property_info_serializer.h
+++ b/property_service/libpropertyinfoserializer/include/property_info_serializer/property_info_serializer.h
@@ -26,19 +26,19 @@
 struct PropertyInfoEntry {
   PropertyInfoEntry() {}
   template <typename T, typename U, typename V>
-  PropertyInfoEntry(T&& name, U&& context, V&& schema, bool exact_match)
+  PropertyInfoEntry(T&& name, U&& context, V&& type, bool exact_match)
       : name(std::forward<T>(name)),
         context(std::forward<U>(context)),
-        schema(std::forward<V>(schema)),
+        type(std::forward<V>(type)),
         exact_match(exact_match) {}
   std::string name;
   std::string context;
-  std::string schema;
+  std::string type;
   bool exact_match;
 };
 
 bool BuildTrie(const std::vector<PropertyInfoEntry>& property_info,
-               const std::string& default_context, const std::string& default_schema,
+               const std::string& default_context, const std::string& default_type,
                std::string* serialized_trie, std::string* error);
 
 void ParsePropertyInfoFile(const std::string& file_contents,
diff --git a/property_service/libpropertyinfoserializer/property_info_file.cpp b/property_service/libpropertyinfoserializer/property_info_file.cpp
index 702f219..bf96d88 100644
--- a/property_service/libpropertyinfoserializer/property_info_file.cpp
+++ b/property_service/libpropertyinfoserializer/property_info_file.cpp
@@ -28,9 +28,9 @@
 
   // It is not an error to not find these, as older files will not contain them.
   auto exact_match = tokenizer.GetNext();
-  auto schema = tokenizer.GetRemaining();
+  auto type = tokenizer.GetRemaining();
 
-  *out = {property, context, schema, exact_match == "exact"};
+  *out = {property, context, type, exact_match == "exact"};
   return true;
 }
 
diff --git a/property_service/libpropertyinfoserializer/property_info_serializer.cpp b/property_service/libpropertyinfoserializer/property_info_serializer.cpp
index 656c96e..803657a 100644
--- a/property_service/libpropertyinfoserializer/property_info_serializer.cpp
+++ b/property_service/libpropertyinfoserializer/property_info_serializer.cpp
@@ -27,13 +27,13 @@
 namespace properties {
 
 bool BuildTrie(const std::vector<PropertyInfoEntry>& property_info,
-               const std::string& default_context, const std::string& default_schema,
+               const std::string& default_context, const std::string& default_type,
                std::string* serialized_trie, std::string* error) {
   // Check that names are legal first
-  auto trie_builder = TrieBuilder(default_context, default_schema);
+  auto trie_builder = TrieBuilder(default_context, default_type);
 
-  for (const auto& [name, context, schema, is_exact] : property_info) {
-    if (!trie_builder.AddToTrie(name, context, schema, is_exact, error)) {
+  for (const auto& [name, context, type, is_exact] : property_info) {
+    if (!trie_builder.AddToTrie(name, context, type, is_exact, error)) {
       return false;
     }
   }
diff --git a/property_service/libpropertyinfoserializer/property_info_serializer_test.cpp b/property_service/libpropertyinfoserializer/property_info_serializer_test.cpp
index 46c2d06..f484550 100644
--- a/property_service/libpropertyinfoserializer/property_info_serializer_test.cpp
+++ b/property_service/libpropertyinfoserializer/property_info_serializer_test.cpp
@@ -46,7 +46,7 @@
   auto root_node = property_info_area->root_node();
   EXPECT_STREQ("root", root_node.name());
   EXPECT_STREQ("default", property_info_area->context(root_node.context_index()));
-  EXPECT_STREQ("default", property_info_area->schema(root_node.schema_index()));
+  EXPECT_STREQ("default", property_info_area->type(root_node.type_index()));
 
   EXPECT_EQ(0U, root_node.num_prefixes());
   EXPECT_EQ(0U, root_node.num_exact_matches());
@@ -59,7 +59,7 @@
 
   EXPECT_STREQ("test", test_node.name());
   EXPECT_STREQ("1st", property_info_area->context(test_node.context_index()));
-  EXPECT_STREQ("1st", property_info_area->schema(test_node.schema_index()));
+  EXPECT_STREQ("1st", property_info_area->type(test_node.type_index()));
 
   EXPECT_EQ(0U, test_node.num_child_nodes());
 
@@ -69,7 +69,7 @@
     EXPECT_STREQ("test", serialized_trie.data() + prefix->name_offset);
     EXPECT_EQ(4U, prefix->namelen);
     EXPECT_STREQ("2nd", property_info_area->context(prefix->context_index));
-    EXPECT_STREQ("2nd", property_info_area->schema(prefix->schema_index));
+    EXPECT_STREQ("2nd", property_info_area->type(prefix->type_index));
   }
 
   EXPECT_EQ(3U, test_node.num_exact_matches());
@@ -85,9 +85,9 @@
     EXPECT_STREQ("3rd", property_info_area->context(match2->context_index));
     EXPECT_STREQ("3rd", property_info_area->context(match3->context_index));
 
-    EXPECT_STREQ("3rd", property_info_area->schema(match1->schema_index));
-    EXPECT_STREQ("3rd", property_info_area->schema(match2->schema_index));
-    EXPECT_STREQ("3rd", property_info_area->schema(match3->schema_index));
+    EXPECT_STREQ("3rd", property_info_area->type(match1->type_index));
+    EXPECT_STREQ("3rd", property_info_area->type(match2->type_index));
+    EXPECT_STREQ("3rd", property_info_area->type(match3->type_index));
   }
 
   // Check the long string node
@@ -120,7 +120,7 @@
   auto final_match = long_string_node.exact_match(0);
   EXPECT_STREQ("string", serialized_trie.data() + final_match->name_offset);
   EXPECT_STREQ("4th", property_info_area->context(final_match->context_index));
-  EXPECT_STREQ("4th", property_info_area->schema(final_match->schema_index));
+  EXPECT_STREQ("4th", property_info_area->type(final_match->type_index));
 }
 
 TEST(propertyinfoserializer, GetPropertyInfo) {
@@ -143,109 +143,109 @@
   auto root_node = property_info_area->root_node();
   EXPECT_STREQ("root", root_node.name());
   EXPECT_STREQ("default", property_info_area->context(root_node.context_index()));
-  EXPECT_STREQ("default", property_info_area->schema(root_node.schema_index()));
+  EXPECT_STREQ("default", property_info_area->type(root_node.type_index()));
 
   const char* context;
-  const char* schema;
-  property_info_area->GetPropertyInfo("abc", &context, &schema);
+  const char* type;
+  property_info_area->GetPropertyInfo("abc", &context, &type);
   EXPECT_STREQ("default", context);
-  EXPECT_STREQ("default", schema);
-  property_info_area->GetPropertyInfo("abc.abc", &context, &schema);
+  EXPECT_STREQ("default", type);
+  property_info_area->GetPropertyInfo("abc.abc", &context, &type);
   EXPECT_STREQ("default", context);
-  EXPECT_STREQ("default", schema);
-  property_info_area->GetPropertyInfo("123.abc", &context, &schema);
+  EXPECT_STREQ("default", type);
+  property_info_area->GetPropertyInfo("123.abc", &context, &type);
   EXPECT_STREQ("default", context);
-  EXPECT_STREQ("default", schema);
+  EXPECT_STREQ("default", type);
 
-  property_info_area->GetPropertyInfo("test.a", &context, &schema);
+  property_info_area->GetPropertyInfo("test.a", &context, &type);
   EXPECT_STREQ("1st", context);
-  EXPECT_STREQ("1st", schema);
-  property_info_area->GetPropertyInfo("test.b", &context, &schema);
+  EXPECT_STREQ("1st", type);
+  property_info_area->GetPropertyInfo("test.b", &context, &type);
   EXPECT_STREQ("1st", context);
-  EXPECT_STREQ("1st", schema);
-  property_info_area->GetPropertyInfo("test.c", &context, &schema);
+  EXPECT_STREQ("1st", type);
+  property_info_area->GetPropertyInfo("test.c", &context, &type);
   EXPECT_STREQ("1st", context);
-  EXPECT_STREQ("1st", schema);
+  EXPECT_STREQ("1st", type);
 
-  property_info_area->GetPropertyInfo("test.test", &context, &schema);
+  property_info_area->GetPropertyInfo("test.test", &context, &type);
   EXPECT_STREQ("5th", context);
-  EXPECT_STREQ("5th", schema);
-  property_info_area->GetPropertyInfo("test.testa", &context, &schema);
+  EXPECT_STREQ("5th", type);
+  property_info_area->GetPropertyInfo("test.testa", &context, &type);
   EXPECT_STREQ("2nd", context);
-  EXPECT_STREQ("2nd", schema);
-  property_info_area->GetPropertyInfo("test.testb", &context, &schema);
+  EXPECT_STREQ("2nd", type);
+  property_info_area->GetPropertyInfo("test.testb", &context, &type);
   EXPECT_STREQ("2nd", context);
-  EXPECT_STREQ("2nd", schema);
-  property_info_area->GetPropertyInfo("test.testc", &context, &schema);
+  EXPECT_STREQ("2nd", type);
+  property_info_area->GetPropertyInfo("test.testc", &context, &type);
   EXPECT_STREQ("2nd", context);
-  EXPECT_STREQ("2nd", schema);
+  EXPECT_STREQ("2nd", type);
 
-  property_info_area->GetPropertyInfo("test.test.a", &context, &schema);
+  property_info_area->GetPropertyInfo("test.test.a", &context, &type);
   EXPECT_STREQ("2nd", context);
-  EXPECT_STREQ("2nd", schema);
-  property_info_area->GetPropertyInfo("test.test.b", &context, &schema);
+  EXPECT_STREQ("2nd", type);
+  property_info_area->GetPropertyInfo("test.test.b", &context, &type);
   EXPECT_STREQ("2nd", context);
-  EXPECT_STREQ("2nd", schema);
-  property_info_area->GetPropertyInfo("test.test.c", &context, &schema);
+  EXPECT_STREQ("2nd", type);
+  property_info_area->GetPropertyInfo("test.test.c", &context, &type);
   EXPECT_STREQ("2nd", context);
-  EXPECT_STREQ("2nd", schema);
+  EXPECT_STREQ("2nd", type);
 
-  property_info_area->GetPropertyInfo("test.test1", &context, &schema);
+  property_info_area->GetPropertyInfo("test.test1", &context, &type);
   EXPECT_STREQ("3rd", context);
-  EXPECT_STREQ("3rd", schema);
-  property_info_area->GetPropertyInfo("test.test2", &context, &schema);
+  EXPECT_STREQ("3rd", type);
+  property_info_area->GetPropertyInfo("test.test2", &context, &type);
   EXPECT_STREQ("7th", context);
-  EXPECT_STREQ("7th", schema);
-  property_info_area->GetPropertyInfo("test.test3", &context, &schema);
+  EXPECT_STREQ("7th", type);
+  property_info_area->GetPropertyInfo("test.test3", &context, &type);
   EXPECT_STREQ("3rd", context);
-  EXPECT_STREQ("3rd", schema);
+  EXPECT_STREQ("3rd", type);
 
-  property_info_area->GetPropertyInfo("test.test11", &context, &schema);
+  property_info_area->GetPropertyInfo("test.test11", &context, &type);
   EXPECT_STREQ("2nd", context);
-  EXPECT_STREQ("2nd", schema);
-  property_info_area->GetPropertyInfo("test.test22", &context, &schema);
+  EXPECT_STREQ("2nd", type);
+  property_info_area->GetPropertyInfo("test.test22", &context, &type);
   EXPECT_STREQ("2nd", context);
-  EXPECT_STREQ("2nd", schema);
-  property_info_area->GetPropertyInfo("test.test33", &context, &schema);
+  EXPECT_STREQ("2nd", type);
+  property_info_area->GetPropertyInfo("test.test33", &context, &type);
   EXPECT_STREQ("2nd", context);
-  EXPECT_STREQ("2nd", schema);
+  EXPECT_STREQ("2nd", type);
 
-  property_info_area->GetPropertyInfo("this.is.a.long.string", &context, &schema);
+  property_info_area->GetPropertyInfo("this.is.a.long.string", &context, &type);
   EXPECT_STREQ("4th", context);
-  EXPECT_STREQ("4th", schema);
+  EXPECT_STREQ("4th", type);
 
-  property_info_area->GetPropertyInfo("this.is.a.long", &context, &schema);
+  property_info_area->GetPropertyInfo("this.is.a.long", &context, &type);
   EXPECT_STREQ("default", context);
-  EXPECT_STREQ("default", schema);
-  property_info_area->GetPropertyInfo("this.is.a", &context, &schema);
+  EXPECT_STREQ("default", type);
+  property_info_area->GetPropertyInfo("this.is.a", &context, &type);
   EXPECT_STREQ("default", context);
-  EXPECT_STREQ("default", schema);
-  property_info_area->GetPropertyInfo("this.is", &context, &schema);
+  EXPECT_STREQ("default", type);
+  property_info_area->GetPropertyInfo("this.is", &context, &type);
   EXPECT_STREQ("default", context);
-  EXPECT_STREQ("default", schema);
-  property_info_area->GetPropertyInfo("this", &context, &schema);
+  EXPECT_STREQ("default", type);
+  property_info_area->GetPropertyInfo("this", &context, &type);
   EXPECT_STREQ("default", context);
-  EXPECT_STREQ("default", schema);
+  EXPECT_STREQ("default", type);
 
-  property_info_area->GetPropertyInfo("test.test2.a", &context, &schema);
+  property_info_area->GetPropertyInfo("test.test2.a", &context, &type);
   EXPECT_STREQ("6th", context);
-  EXPECT_STREQ("6th", schema);
+  EXPECT_STREQ("6th", type);
 
-  property_info_area->GetPropertyInfo("testoneword", &context, &schema);
+  property_info_area->GetPropertyInfo("testoneword", &context, &type);
   EXPECT_STREQ("8th", context);
-  EXPECT_STREQ("8th", schema);
+  EXPECT_STREQ("8th", type);
 
-  property_info_area->GetPropertyInfo("testwordprefix", &context, &schema);
+  property_info_area->GetPropertyInfo("testwordprefix", &context, &type);
   EXPECT_STREQ("9th", context);
-  EXPECT_STREQ("9th", schema);
+  EXPECT_STREQ("9th", type);
 
-  property_info_area->GetPropertyInfo("testwordprefixblah", &context, &schema);
+  property_info_area->GetPropertyInfo("testwordprefixblah", &context, &type);
   EXPECT_STREQ("9th", context);
-  EXPECT_STREQ("9th", schema);
+  EXPECT_STREQ("9th", type);
 
-  property_info_area->GetPropertyInfo("testwordprefix.blah", &context, &schema);
+  property_info_area->GetPropertyInfo("testwordprefix.blah", &context, &type);
   EXPECT_STREQ("9th", context);
-  EXPECT_STREQ("9th", schema);
+  EXPECT_STREQ("9th", type);
 }
 
 TEST(propertyinfoserializer, RealProperties) {
@@ -777,35 +777,34 @@
   auto property_info_area = reinterpret_cast<const PropertyInfoArea*>(serialized_trie.data());
 
   const char* context;
-  const char* schema;
-  property_info_area->GetPropertyInfo("persist.radio", &context, &schema);
+  const char* type;
+  property_info_area->GetPropertyInfo("persist.radio", &context, &type);
   EXPECT_STREQ("1st", context);
-  EXPECT_STREQ("1st", schema);
-  property_info_area->GetPropertyInfo("persist.radio.subproperty", &context, &schema);
+  EXPECT_STREQ("1st", type);
+  property_info_area->GetPropertyInfo("persist.radio.subproperty", &context, &type);
   EXPECT_STREQ("1st", context);
-  EXPECT_STREQ("1st", schema);
-  property_info_area->GetPropertyInfo("persist.radiowords", &context, &schema);
+  EXPECT_STREQ("1st", type);
+  property_info_area->GetPropertyInfo("persist.radiowords", &context, &type);
   EXPECT_STREQ("1st", context);
-  EXPECT_STREQ("1st", schema);
-  property_info_area->GetPropertyInfo("persist.radio.long.long.long.sub.property", &context,
-                                      &schema);
+  EXPECT_STREQ("1st", type);
+  property_info_area->GetPropertyInfo("persist.radio.long.long.long.sub.property", &context, &type);
   EXPECT_STREQ("1st", context);
-  EXPECT_STREQ("1st", schema);
-  property_info_area->GetPropertyInfo("persist.radio.something.else.here", &context, &schema);
+  EXPECT_STREQ("1st", type);
+  property_info_area->GetPropertyInfo("persist.radio.something.else.here", &context, &type);
   EXPECT_STREQ("2nd", context);
-  EXPECT_STREQ("2nd", schema);
-  property_info_area->GetPropertyInfo("persist.radio.something.else.here2", &context, &schema);
+  EXPECT_STREQ("2nd", type);
+  property_info_area->GetPropertyInfo("persist.radio.something.else.here2", &context, &type);
   EXPECT_STREQ("2nd", context);
-  EXPECT_STREQ("2nd", schema);
-  property_info_area->GetPropertyInfo("persist.radio.something.else.here.after", &context, &schema);
+  EXPECT_STREQ("2nd", type);
+  property_info_area->GetPropertyInfo("persist.radio.something.else.here.after", &context, &type);
   EXPECT_STREQ("2nd", context);
-  EXPECT_STREQ("2nd", schema);
-  property_info_area->GetPropertyInfo("persist.radio.something.else.nothere", &context, &schema);
+  EXPECT_STREQ("2nd", type);
+  property_info_area->GetPropertyInfo("persist.radio.something.else.nothere", &context, &type);
   EXPECT_STREQ("1st", context);
-  EXPECT_STREQ("1st", schema);
-  property_info_area->GetPropertyInfo("persist.radio.something.else", &context, &schema);
+  EXPECT_STREQ("1st", type);
+  property_info_area->GetPropertyInfo("persist.radio.something.else", &context, &type);
   EXPECT_STREQ("1st", context);
-  EXPECT_STREQ("1st", schema);
+  EXPECT_STREQ("1st", type);
 }
 
 TEST(propertyinfoserializer, GetPropertyInfo_prefix_with_dot_vs_without) {
@@ -823,28 +822,28 @@
   auto property_info_area = reinterpret_cast<const PropertyInfoArea*>(serialized_trie.data());
 
   const char* context;
-  const char* schema;
-  property_info_area->GetPropertyInfo("persist.notradio", &context, &schema);
+  const char* type;
+  property_info_area->GetPropertyInfo("persist.notradio", &context, &type);
   EXPECT_STREQ("1st", context);
-  EXPECT_STREQ("1st", schema);
-  property_info_area->GetPropertyInfo("persist.radio", &context, &schema);
+  EXPECT_STREQ("1st", type);
+  property_info_area->GetPropertyInfo("persist.radio", &context, &type);
   EXPECT_STREQ("2nd", context);
-  EXPECT_STREQ("2nd", schema);
-  property_info_area->GetPropertyInfo("persist.radio.subproperty", &context, &schema);
+  EXPECT_STREQ("2nd", type);
+  property_info_area->GetPropertyInfo("persist.radio.subproperty", &context, &type);
   EXPECT_STREQ("2nd", context);
-  EXPECT_STREQ("2nd", schema);
-  property_info_area->GetPropertyInfo("persist.radiowords", &context, &schema);
+  EXPECT_STREQ("2nd", type);
+  property_info_area->GetPropertyInfo("persist.radiowords", &context, &type);
   EXPECT_STREQ("2nd", context);
-  EXPECT_STREQ("2nd", schema);
-  property_info_area->GetPropertyInfo("persist.radio.long.property.prefix.match", &context, &schema);
+  EXPECT_STREQ("2nd", type);
+  property_info_area->GetPropertyInfo("persist.radio.long.property.prefix.match", &context, &type);
   EXPECT_STREQ("2nd", context);
-  EXPECT_STREQ("2nd", schema);
-  property_info_area->GetPropertyInfo("persist.radio.long.property.exact.match", &context, &schema);
+  EXPECT_STREQ("2nd", type);
+  property_info_area->GetPropertyInfo("persist.radio.long.property.exact.match", &context, &type);
   EXPECT_STREQ("3rd", context);
-  EXPECT_STREQ("3rd", schema);
+  EXPECT_STREQ("3rd", type);
 }
 
-TEST(propertyinfoserializer, GetPropertyInfo_empty_context_and_schema) {
+TEST(propertyinfoserializer, GetPropertyInfo_empty_context_and_type) {
   auto property_info = std::vector<PropertyInfoEntry>{
       {"persist.", "1st", "", false},
       {"persist.dot_prefix.", "2nd", "", false},
@@ -862,28 +861,28 @@
   auto property_info_area = reinterpret_cast<const PropertyInfoArea*>(serialized_trie.data());
 
   const char* context;
-  const char* schema;
-  property_info_area->GetPropertyInfo("notpersist.radio.something", &context, &schema);
+  const char* type;
+  property_info_area->GetPropertyInfo("notpersist.radio.something", &context, &type);
   EXPECT_STREQ("default", context);
-  EXPECT_STREQ("default", schema);
-  property_info_area->GetPropertyInfo("persist.nomatch", &context, &schema);
+  EXPECT_STREQ("default", type);
+  property_info_area->GetPropertyInfo("persist.nomatch", &context, &type);
   EXPECT_STREQ("1st", context);
-  EXPECT_STREQ("default", schema);
-  property_info_area->GetPropertyInfo("persist.dot_prefix.something", &context, &schema);
+  EXPECT_STREQ("default", type);
+  property_info_area->GetPropertyInfo("persist.dot_prefix.something", &context, &type);
   EXPECT_STREQ("2nd", context);
-  EXPECT_STREQ("default", schema);
-  property_info_area->GetPropertyInfo("persist.non_dot_prefix.something", &context, &schema);
+  EXPECT_STREQ("default", type);
+  property_info_area->GetPropertyInfo("persist.non_dot_prefix.something", &context, &type);
   EXPECT_STREQ("3rd", context);
-  EXPECT_STREQ("default", schema);
-  property_info_area->GetPropertyInfo("persist.exact_match", &context, &schema);
+  EXPECT_STREQ("default", type);
+  property_info_area->GetPropertyInfo("persist.exact_match", &context, &type);
   EXPECT_STREQ("1st", context);
-  EXPECT_STREQ("default", schema);
-  property_info_area->GetPropertyInfo("persist.dot_prefix2.something", &context, &schema);
+  EXPECT_STREQ("default", type);
+  property_info_area->GetPropertyInfo("persist.dot_prefix2.something", &context, &type);
   EXPECT_STREQ("1st", context);
-  EXPECT_STREQ("4th", schema);
-  property_info_area->GetPropertyInfo("persist.non_dot_prefix2.something", &context, &schema);
+  EXPECT_STREQ("4th", type);
+  property_info_area->GetPropertyInfo("persist.non_dot_prefix2.something", &context, &type);
   EXPECT_STREQ("1st", context);
-  EXPECT_STREQ("5th", schema);
+  EXPECT_STREQ("5th", type);
 }
 
 }  // namespace properties
diff --git a/property_service/libpropertyinfoserializer/trie_builder.cpp b/property_service/libpropertyinfoserializer/trie_builder.cpp
index feb753b..8c5ce84 100644
--- a/property_service/libpropertyinfoserializer/trie_builder.cpp
+++ b/property_service/libpropertyinfoserializer/trie_builder.cpp
@@ -23,23 +23,23 @@
 namespace android {
 namespace properties {
 
-TrieBuilder::TrieBuilder(const std::string& default_context, const std::string& default_schema)
+TrieBuilder::TrieBuilder(const std::string& default_context, const std::string& default_type)
     : builder_root_("root") {
   auto* context_pointer = StringPointerFromContainer(default_context, &contexts_);
   builder_root_.set_context(context_pointer);
-  auto* schema_pointer = StringPointerFromContainer(default_schema, &schemas_);
-  builder_root_.set_schema(schema_pointer);
+  auto* type_pointer = StringPointerFromContainer(default_type, &types_);
+  builder_root_.set_type(type_pointer);
 }
 
 bool TrieBuilder::AddToTrie(const std::string& name, const std::string& context,
-                            const std::string& schema, bool exact, std::string* error) {
+                            const std::string& type, bool exact, std::string* error) {
   auto* context_pointer = StringPointerFromContainer(context, &contexts_);
-  auto* schema_pointer = StringPointerFromContainer(schema, &schemas_);
-  return AddToTrie(name, context_pointer, schema_pointer, exact, error);
+  auto* type_pointer = StringPointerFromContainer(type, &types_);
+  return AddToTrie(name, context_pointer, type_pointer, exact, error);
 }
 
 bool TrieBuilder::AddToTrie(const std::string& name, const std::string* context,
-                            const std::string* schema, bool exact, std::string* error) {
+                            const std::string* type, bool exact, std::string* error) {
   TrieBuilderNode* current_node = &builder_root_;
 
   auto name_pieces = Split(name, ".");
@@ -66,12 +66,12 @@
 
   // Store our context based on what type of match it is.
   if (exact) {
-    if (!current_node->AddExactMatchContext(name_pieces.front(), context, schema)) {
+    if (!current_node->AddExactMatchContext(name_pieces.front(), context, type)) {
       *error = "Duplicate exact match detected for '" + name + "'";
       return false;
     }
   } else if (!ends_with_dot) {
-    if (!current_node->AddPrefixContext(name_pieces.front(), context, schema)) {
+    if (!current_node->AddPrefixContext(name_pieces.front(), context, type)) {
       *error = "Duplicate prefix match detected for '" + name + "'";
       return false;
     }
@@ -84,12 +84,12 @@
       *error = "Unable to allocate Trie node";
       return false;
     }
-    if (child->context() != nullptr || child->schema() != nullptr) {
+    if (child->context() != nullptr || child->type() != nullptr) {
       *error = "Duplicate prefix match detected for '" + name + "'";
       return false;
     }
     child->set_context(context);
-    child->set_schema(schema);
+    child->set_type(type);
   }
   return true;
 }
diff --git a/property_service/libpropertyinfoserializer/trie_builder.h b/property_service/libpropertyinfoserializer/trie_builder.h
index f928e76..b971589 100644
--- a/property_service/libpropertyinfoserializer/trie_builder.h
+++ b/property_service/libpropertyinfoserializer/trie_builder.h
@@ -26,13 +26,12 @@
 namespace properties {
 
 struct PropertyEntryBuilder {
-  PropertyEntryBuilder() : context(nullptr), schema(nullptr) {}
-  PropertyEntryBuilder(const std::string& name, const std::string* context,
-                       const std::string* schema)
-      : name(name), context(context), schema(schema) {}
+  PropertyEntryBuilder() : context(nullptr), type(nullptr) {}
+  PropertyEntryBuilder(const std::string& name, const std::string* context, const std::string* type)
+      : name(name), context(context), type(type) {}
   std::string name;
   const std::string* context;
-  const std::string* schema;
+  const std::string* type;
 };
 
 class TrieBuilderNode {
@@ -56,33 +55,33 @@
   TrieBuilderNode* AddChild(const std::string& name) { return &children_.emplace_back(name); }
 
   bool AddPrefixContext(const std::string& prefix, const std::string* context,
-                        const std::string* schema) {
+                        const std::string* type) {
     if (std::find_if(prefixes_.begin(), prefixes_.end(),
                      [&prefix](const auto& t) { return t.name == prefix; }) != prefixes_.end()) {
       return false;
     }
 
-    prefixes_.emplace_back(prefix, context, schema);
+    prefixes_.emplace_back(prefix, context, type);
     return true;
   }
 
   bool AddExactMatchContext(const std::string& exact_match, const std::string* context,
-                            const std::string* schema) {
+                            const std::string* type) {
     if (std::find_if(exact_matches_.begin(), exact_matches_.end(), [&exact_match](const auto& t) {
           return t.name == exact_match;
         }) != exact_matches_.end()) {
       return false;
     }
 
-    exact_matches_.emplace_back(exact_match, context, schema);
+    exact_matches_.emplace_back(exact_match, context, type);
     return true;
   }
 
   const std::string& name() const { return property_entry_.name; }
   const std::string* context() const { return property_entry_.context; }
   void set_context(const std::string* context) { property_entry_.context = context; }
-  const std::string* schema() const { return property_entry_.schema; }
-  void set_schema(const std::string* schema) { property_entry_.schema = schema; }
+  const std::string* type() const { return property_entry_.type; }
+  void set_type(const std::string* type) { property_entry_.type = type; }
 
   const PropertyEntryBuilder property_entry() const { return property_entry_; }
 
@@ -99,23 +98,23 @@
 
 class TrieBuilder {
  public:
-  TrieBuilder(const std::string& default_context, const std::string& default_schema);
-  bool AddToTrie(const std::string& name, const std::string& context, const std::string& schema,
+  TrieBuilder(const std::string& default_context, const std::string& default_type);
+  bool AddToTrie(const std::string& name, const std::string& context, const std::string& type,
                  bool exact, std::string* error);
 
   const TrieBuilderNode builder_root() const { return builder_root_; }
   const std::set<std::string>& contexts() const { return contexts_; }
-  const std::set<std::string>& schemas() const { return schemas_; }
+  const std::set<std::string>& types() const { return types_; }
 
  private:
-  bool AddToTrie(const std::string& name, const std::string* context, const std::string* schema,
+  bool AddToTrie(const std::string& name, const std::string* context, const std::string* type,
                  bool exact, std::string* error);
   const std::string* StringPointerFromContainer(const std::string& string,
                                                 std::set<std::string>* container);
 
   TrieBuilderNode builder_root_;
   std::set<std::string> contexts_;
-  std::set<std::string> schemas_;
+  std::set<std::string> types_;
 };
 
 }  // namespace properties
diff --git a/property_service/libpropertyinfoserializer/trie_builder_test.cpp b/property_service/libpropertyinfoserializer/trie_builder_test.cpp
index 2b948f3..5078810 100644
--- a/property_service/libpropertyinfoserializer/trie_builder_test.cpp
+++ b/property_service/libpropertyinfoserializer/trie_builder_test.cpp
@@ -22,19 +22,19 @@
 namespace properties {
 
 TEST(propertyinfoserializer, BuildTrie_Simple) {
-  auto trie_builder = TrieBuilder("default", "default_schema");
+  auto trie_builder = TrieBuilder("default", "default_type");
 
   // Add test data to tree
   auto error = std::string();
-  EXPECT_TRUE(trie_builder.AddToTrie("test.", "1st", "1st_schema", false, &error));
-  EXPECT_TRUE(trie_builder.AddToTrie("test.test", "2nd", "2nd_schema", false, &error));
-  EXPECT_TRUE(trie_builder.AddToTrie("test.test1", "3rd", "3rd_schema", true, &error));
-  EXPECT_TRUE(trie_builder.AddToTrie("test.test2", "3rd", "3rd_schema", true, &error));
-  EXPECT_TRUE(trie_builder.AddToTrie("test.test3", "3rd", "3rd_schema", true, &error));
-  EXPECT_TRUE(trie_builder.AddToTrie("this.is.a.long.string", "4th", "4th_schema", true, &error));
+  EXPECT_TRUE(trie_builder.AddToTrie("test.", "1st", "1st_type", false, &error));
+  EXPECT_TRUE(trie_builder.AddToTrie("test.test", "2nd", "2nd_type", false, &error));
+  EXPECT_TRUE(trie_builder.AddToTrie("test.test1", "3rd", "3rd_type", true, &error));
+  EXPECT_TRUE(trie_builder.AddToTrie("test.test2", "3rd", "3rd_type", true, &error));
+  EXPECT_TRUE(trie_builder.AddToTrie("test.test3", "3rd", "3rd_type", true, &error));
+  EXPECT_TRUE(trie_builder.AddToTrie("this.is.a.long.string", "4th", "4th_type", true, &error));
 
   ASSERT_EQ(5U, trie_builder.contexts().size());
-  ASSERT_EQ(5U, trie_builder.schemas().size());
+  ASSERT_EQ(5U, trie_builder.types().size());
 
   auto& builder_root = trie_builder.builder_root();
 
@@ -42,8 +42,8 @@
   EXPECT_EQ("root", builder_root.name());
   ASSERT_NE(nullptr, builder_root.context());
   EXPECT_EQ("default", *builder_root.context());
-  ASSERT_NE(nullptr, builder_root.schema());
-  EXPECT_EQ("default_schema", *builder_root.schema());
+  ASSERT_NE(nullptr, builder_root.type());
+  EXPECT_EQ("default_type", *builder_root.type());
 
   EXPECT_EQ(0U, builder_root.prefixes().size());
   EXPECT_EQ(0U, builder_root.exact_matches().size());
@@ -55,8 +55,8 @@
   EXPECT_EQ("test", test_node->name());
   ASSERT_NE(nullptr, test_node->context());
   EXPECT_EQ("1st", *test_node->context());
-  ASSERT_NE(nullptr, test_node->schema());
-  EXPECT_EQ("1st_schema", *test_node->schema());
+  ASSERT_NE(nullptr, test_node->type());
+  EXPECT_EQ("1st_type", *test_node->type());
 
   EXPECT_EQ(0U, test_node->children().size());
   EXPECT_EQ(1U, test_node->prefixes().size());
@@ -65,8 +65,8 @@
     EXPECT_EQ("test", property_entry.name);
     ASSERT_NE(nullptr, property_entry.context);
     EXPECT_EQ("2nd", *property_entry.context);
-    ASSERT_NE(nullptr, property_entry.schema);
-    EXPECT_EQ("2nd_schema", *property_entry.schema);
+    ASSERT_NE(nullptr, property_entry.type);
+    EXPECT_EQ("2nd_type", *property_entry.type);
   }
   EXPECT_EQ(3U, test_node->exact_matches().size());
   EXPECT_EQ("test1", test_node->exact_matches()[0].name);
@@ -80,18 +80,18 @@
   EXPECT_EQ("3rd", *test_node->exact_matches()[1].context);
   EXPECT_EQ("3rd", *test_node->exact_matches()[2].context);
 
-  ASSERT_NE(nullptr, test_node->exact_matches()[0].schema);
-  ASSERT_NE(nullptr, test_node->exact_matches()[1].schema);
-  ASSERT_NE(nullptr, test_node->exact_matches()[2].schema);
-  EXPECT_EQ("3rd_schema", *test_node->exact_matches()[0].schema);
-  EXPECT_EQ("3rd_schema", *test_node->exact_matches()[1].schema);
-  EXPECT_EQ("3rd_schema", *test_node->exact_matches()[2].schema);
+  ASSERT_NE(nullptr, test_node->exact_matches()[0].type);
+  ASSERT_NE(nullptr, test_node->exact_matches()[1].type);
+  ASSERT_NE(nullptr, test_node->exact_matches()[2].type);
+  EXPECT_EQ("3rd_type", *test_node->exact_matches()[0].type);
+  EXPECT_EQ("3rd_type", *test_node->exact_matches()[1].type);
+  EXPECT_EQ("3rd_type", *test_node->exact_matches()[2].type);
 
   // Check the long string node
   auto expect_empty_one_child = [](auto* node) {
     ASSERT_NE(nullptr, node);
     EXPECT_EQ(nullptr, node->context());
-    EXPECT_EQ(nullptr, node->schema());
+    EXPECT_EQ(nullptr, node->type());
     EXPECT_EQ(0U, node->prefixes().size());
     EXPECT_EQ(0U, node->exact_matches().size());
     EXPECT_EQ(1U, node->children().size());
@@ -120,8 +120,8 @@
     EXPECT_EQ("string", property_entry.name);
     ASSERT_NE(nullptr, property_entry.context);
     EXPECT_EQ("4th", *property_entry.context);
-    ASSERT_NE(nullptr, property_entry.schema);
-    EXPECT_EQ("4th_schema", *property_entry.schema);
+    ASSERT_NE(nullptr, property_entry.type);
+    EXPECT_EQ("4th_type", *property_entry.type);
   }
 }
 
diff --git a/property_service/libpropertyinfoserializer/trie_serializer.cpp b/property_service/libpropertyinfoserializer/trie_serializer.cpp
index 5326537..adeed1b 100644
--- a/property_service/libpropertyinfoserializer/trie_serializer.cpp
+++ b/property_service/libpropertyinfoserializer/trie_serializer.cpp
@@ -43,15 +43,15 @@
   uint32_t context_index = property_entry.context != nullptr && !property_entry.context->empty()
                                ? serialized_info()->FindContextIndex(property_entry.context->c_str())
                                : ~0u;
-  uint32_t schema_index = property_entry.schema != nullptr && !property_entry.schema->empty()
-                              ? serialized_info()->FindSchemaIndex(property_entry.schema->c_str())
-                              : ~0u;
+  uint32_t type_index = property_entry.type != nullptr && !property_entry.type->empty()
+                            ? serialized_info()->FindTypeIndex(property_entry.type->c_str())
+                            : ~0u;
   uint32_t offset;
   auto serialized_property_entry = arena_->AllocateObject<PropertyEntry>(&offset);
   serialized_property_entry->name_offset = arena_->AllocateAndWriteString(property_entry.name);
   serialized_property_entry->namelen = property_entry.name.size();
   serialized_property_entry->context_index = context_index;
-  serialized_property_entry->schema_index = schema_index;
+  serialized_property_entry->type_index = type_index;
   return offset;
 }
 
@@ -122,9 +122,9 @@
   header->contexts_offset = arena_->size();
   SerializeStrings(trie_builder.contexts());
 
-  // Store where we're about to write the schemas.
-  header->schemas_offset = arena_->size();
-  SerializeStrings(trie_builder.schemas());
+  // Store where we're about to write the types.
+  header->types_offset = arena_->size();
+  SerializeStrings(trie_builder.types());
 
   // We need to store size() up to this point now for Find*Offset() to work.
   header->size = arena_->size();