Make tests use APKs instead of exploded APKs

Tests would expect parts of the APK to be unzipped and
maintained. Instead, we now decompress the required files
from the test APKs on test setup. This simplifies
test maintenance substantially.

Test: make libandroidfw_tests && libandroidfw_tests --testdata=frameworks/base/libs/androidfw/tests/data
Change-Id: I3d2100af22df913e02401dedcf9842cdb32b2a3b
diff --git a/libs/androidfw/AttributeResolution.cpp b/libs/androidfw/AttributeResolution.cpp
index d71fc39..f5aef05 100644
--- a/libs/androidfw/AttributeResolution.cpp
+++ b/libs/androidfw/AttributeResolution.cpp
@@ -14,34 +14,41 @@
  * limitations under the License.
  */
 
-#include "AttributeFinder.h"
-
 #include "androidfw/AttributeResolution.h"
-#include "androidfw/ResourceTypes.h"
+
+#include <cstdint>
 
 #include <android/log.h>
-#include <cstdint>
+
+#include "androidfw/AttributeFinder.h"
+#include "androidfw/ResourceTypes.h"
 
 constexpr bool kDebugStyles = false;
 
 namespace android {
 
-class XmlAttributeFinder : public BackTrackingAttributeFinder<XmlAttributeFinder, size_t> {
+class XmlAttributeFinder
+    : public BackTrackingAttributeFinder<XmlAttributeFinder, size_t> {
  public:
   explicit XmlAttributeFinder(const ResXMLParser* parser)
-      : BackTrackingAttributeFinder(0, parser != NULL ? parser->getAttributeCount() : 0),
+      : BackTrackingAttributeFinder(
+            0, parser != nullptr ? parser->getAttributeCount() : 0),
         parser_(parser) {}
 
-  inline uint32_t GetAttribute(size_t index) const { return parser_->getAttributeNameResID(index); }
+  inline uint32_t GetAttribute(size_t index) const {
+    return parser_->getAttributeNameResID(index);
+  }
 
  private:
   const ResXMLParser* parser_;
 };
 
 class BagAttributeFinder
-    : public BackTrackingAttributeFinder<BagAttributeFinder, const ResTable::bag_entry*> {
+    : public BackTrackingAttributeFinder<BagAttributeFinder,
+                                         const ResTable::bag_entry*> {
  public:
-  BagAttributeFinder(const ResTable::bag_entry* start, const ResTable::bag_entry* end)
+  BagAttributeFinder(const ResTable::bag_entry* start,
+                     const ResTable::bag_entry* end)
       : BackTrackingAttributeFinder(start, end) {}
 
   inline uint32_t GetAttribute(const ResTable::bag_entry* entry) const {
@@ -49,12 +56,14 @@
   }
 };
 
-bool ResolveAttrs(ResTable::Theme* theme, uint32_t def_style_attr, uint32_t def_style_res,
-                  uint32_t* src_values, size_t src_values_length, uint32_t* attrs,
-                  size_t attrs_length, uint32_t* out_values, uint32_t* out_indices) {
+bool ResolveAttrs(ResTable::Theme* theme, uint32_t def_style_attr,
+                  uint32_t def_style_res, uint32_t* src_values,
+                  size_t src_values_length, uint32_t* attrs,
+                  size_t attrs_length, uint32_t* out_values,
+                  uint32_t* out_indices) {
   if (kDebugStyles) {
-    ALOGI("APPLY STYLE: theme=0x%p defStyleAttr=0x%x defStyleRes=0x%x", theme, def_style_attr,
-          def_style_res);
+    ALOGI("APPLY STYLE: theme=0x%p defStyleAttr=0x%x defStyleRes=0x%x", theme,
+          def_style_attr, def_style_res);
   }
 
   const ResTable& res = theme->getResTable();
@@ -67,7 +76,8 @@
   uint32_t def_style_bag_type_set_flags = 0;
   if (def_style_attr != 0) {
     Res_value value;
-    if (theme->getAttribute(def_style_attr, &value, &def_style_bag_type_set_flags) >= 0) {
+    if (theme->getAttribute(def_style_attr, &value,
+                            &def_style_bag_type_set_flags) >= 0) {
       if (value.dataType == Res_value::TYPE_REFERENCE) {
         def_style_res = value.data;
       }
@@ -78,14 +88,15 @@
   res.lock();
 
   // Retrieve the default style bag, if requested.
-  const ResTable::bag_entry* def_style_start = NULL;
+  const ResTable::bag_entry* def_style_start = nullptr;
   uint32_t def_style_type_set_flags = 0;
-  ssize_t bag_off =
-      def_style_res != 0
-          ? res.getBagLocked(def_style_res, &def_style_start, &def_style_type_set_flags)
-          : -1;
+  ssize_t bag_off = def_style_res != 0
+                        ? res.getBagLocked(def_style_res, &def_style_start,
+                                           &def_style_type_set_flags)
+                        : -1;
   def_style_type_set_flags |= def_style_bag_type_set_flags;
-  const ResTable::bag_entry* const def_style_end = def_style_start + (bag_off >= 0 ? bag_off : 0);
+  const ResTable::bag_entry* const def_style_end =
+      def_style_start + (bag_off >= 0 ? bag_off : 0);
   BagAttributeFinder def_style_attr_finder(def_style_start, def_style_end);
 
   // Now iterate through all of the attributes that the client has requested,
@@ -113,18 +124,21 @@
       value.dataType = Res_value::TYPE_ATTRIBUTE;
       value.data = src_values[ii];
       if (kDebugStyles) {
-        ALOGI("-> From values: type=0x%x, data=0x%08x", value.dataType, value.data);
+        ALOGI("-> From values: type=0x%x, data=0x%08x", value.dataType,
+              value.data);
       }
     }
 
     if (value.dataType == Res_value::TYPE_NULL) {
-      const ResTable::bag_entry* const def_style_entry = def_style_attr_finder.Find(cur_ident);
+      const ResTable::bag_entry* const def_style_entry =
+          def_style_attr_finder.Find(cur_ident);
       if (def_style_entry != def_style_end) {
         block = def_style_entry->stringBlock;
         type_set_flags = def_style_type_set_flags;
         value = def_style_entry->map.value;
         if (kDebugStyles) {
-          ALOGI("-> From def style: type=0x%x, data=0x%08x", value.dataType, value.data);
+          ALOGI("-> From def style: type=0x%x, data=0x%08x", value.dataType,
+                value.data);
         }
       }
     }
@@ -132,24 +146,29 @@
     uint32_t resid = 0;
     if (value.dataType != Res_value::TYPE_NULL) {
       // Take care of resolving the found resource to its final value.
-      ssize_t new_block =
-          theme->resolveAttributeReference(&value, block, &resid, &type_set_flags, &config);
+      ssize_t new_block = theme->resolveAttributeReference(
+          &value, block, &resid, &type_set_flags, &config);
       if (new_block >= 0) block = new_block;
       if (kDebugStyles) {
-        ALOGI("-> Resolved attr: type=0x%x, data=0x%08x", value.dataType, value.data);
+        ALOGI("-> Resolved attr: type=0x%x, data=0x%08x", value.dataType,
+              value.data);
       }
     } else {
       // If we still don't have a value for this attribute, try to find
       // it in the theme!
-      ssize_t new_block = theme->getAttribute(cur_ident, &value, &type_set_flags);
+      ssize_t new_block =
+          theme->getAttribute(cur_ident, &value, &type_set_flags);
       if (new_block >= 0) {
         if (kDebugStyles) {
-          ALOGI("-> From theme: type=0x%x, data=0x%08x", value.dataType, value.data);
+          ALOGI("-> From theme: type=0x%x, data=0x%08x", value.dataType,
+                value.data);
         }
-        new_block = res.resolveReference(&value, new_block, &resid, &type_set_flags, &config);
+        new_block = res.resolveReference(&value, new_block, &resid,
+                                         &type_set_flags, &config);
         if (new_block >= 0) block = new_block;
         if (kDebugStyles) {
-          ALOGI("-> Resolved theme: type=0x%x, data=0x%08x", value.dataType, value.data);
+          ALOGI("-> Resolved theme: type=0x%x, data=0x%08x", value.dataType,
+                value.data);
         }
       }
     }
@@ -165,19 +184,21 @@
     }
 
     if (kDebugStyles) {
-      ALOGI("Attribute 0x%08x: type=0x%x, data=0x%08x", cur_ident, value.dataType, value.data);
+      ALOGI("Attribute 0x%08x: type=0x%x, data=0x%08x", cur_ident,
+            value.dataType, value.data);
     }
 
     // Write the final value back to Java.
     out_values[STYLE_TYPE] = value.dataType;
     out_values[STYLE_DATA] = value.data;
     out_values[STYLE_ASSET_COOKIE] =
-        block != -1 ? static_cast<uint32_t>(res.getTableCookie(block)) : static_cast<uint32_t>(-1);
+        block != -1 ? static_cast<uint32_t>(res.getTableCookie(block))
+                    : static_cast<uint32_t>(-1);
     out_values[STYLE_RESOURCE_ID] = resid;
     out_values[STYLE_CHANGING_CONFIGURATIONS] = type_set_flags;
     out_values[STYLE_DENSITY] = config.density;
 
-    if (out_indices != NULL && value.dataType != Res_value::TYPE_NULL) {
+    if (out_indices != nullptr && value.dataType != Res_value::TYPE_NULL) {
       indices_idx++;
       out_indices[indices_idx] = ii;
     }
@@ -187,7 +208,7 @@
 
   res.unlock();
 
-  if (out_indices != NULL) {
+  if (out_indices != nullptr) {
     out_indices[0] = indices_idx;
   }
   return true;
@@ -197,8 +218,8 @@
                 uint32_t def_style_res, const uint32_t* attrs, size_t attrs_length,
                 uint32_t* out_values, uint32_t* out_indices) {
   if (kDebugStyles) {
-    ALOGI("APPLY STYLE: theme=0x%p defStyleAttr=0x%x defStyleRes=0x%x xml=0x%p", theme,
-          def_style_attr, def_style_res, xml_parser);
+    ALOGI("APPLY STYLE: theme=0x%p defStyleAttr=0x%x defStyleRes=0x%x xml=0x%p",
+          theme, def_style_attr, def_style_res, xml_parser);
   }
 
   const ResTable& res = theme->getResTable();
@@ -211,7 +232,8 @@
   uint32_t def_style_bag_type_set_flags = 0;
   if (def_style_attr != 0) {
     Res_value value;
-    if (theme->getAttribute(def_style_attr, &value, &def_style_bag_type_set_flags) >= 0) {
+    if (theme->getAttribute(def_style_attr, &value,
+                            &def_style_bag_type_set_flags) >= 0) {
       if (value.dataType == Res_value::TYPE_REFERENCE) {
         def_style_res = value.data;
       }
@@ -221,11 +243,12 @@
   // Retrieve the style class associated with the current XML tag.
   int style = 0;
   uint32_t style_bag_type_set_flags = 0;
-  if (xml_parser != NULL) {
+  if (xml_parser != nullptr) {
     ssize_t idx = xml_parser->indexOfStyle();
     if (idx >= 0 && xml_parser->getAttributeValue(idx, &value) >= 0) {
       if (value.dataType == value.TYPE_ATTRIBUTE) {
-        if (theme->getAttribute(value.data, &value, &style_bag_type_set_flags) < 0) {
+        if (theme->getAttribute(value.data, &value, &style_bag_type_set_flags) <
+            0) {
           value.dataType = Res_value::TYPE_NULL;
         }
       }
@@ -239,29 +262,35 @@
   res.lock();
 
   // Retrieve the default style bag, if requested.
-  const ResTable::bag_entry* def_style_attr_start = NULL;
+  const ResTable::bag_entry* def_style_attr_start = nullptr;
   uint32_t def_style_type_set_flags = 0;
-  ssize_t bag_off =
-      def_style_res != 0
-          ? res.getBagLocked(def_style_res, &def_style_attr_start, &def_style_type_set_flags)
-          : -1;
+  ssize_t bag_off = def_style_res != 0
+                        ? res.getBagLocked(def_style_res, &def_style_attr_start,
+                                           &def_style_type_set_flags)
+                        : -1;
   def_style_type_set_flags |= def_style_bag_type_set_flags;
   const ResTable::bag_entry* const def_style_attr_end =
       def_style_attr_start + (bag_off >= 0 ? bag_off : 0);
-  BagAttributeFinder def_style_attr_finder(def_style_attr_start, def_style_attr_end);
+  BagAttributeFinder def_style_attr_finder(def_style_attr_start,
+                                           def_style_attr_end);
 
   // Retrieve the style class bag, if requested.
-  const ResTable::bag_entry* style_attr_start = NULL;
+  const ResTable::bag_entry* style_attr_start = nullptr;
   uint32_t style_type_set_flags = 0;
-  bag_off = style != 0 ? res.getBagLocked(style, &style_attr_start, &style_type_set_flags) : -1;
+  bag_off =
+      style != 0
+          ? res.getBagLocked(style, &style_attr_start, &style_type_set_flags)
+          : -1;
   style_type_set_flags |= style_bag_type_set_flags;
-  const ResTable::bag_entry* const style_attr_end = style_attr_start + (bag_off >= 0 ? bag_off : 0);
+  const ResTable::bag_entry* const style_attr_end =
+      style_attr_start + (bag_off >= 0 ? bag_off : 0);
   BagAttributeFinder style_attr_finder(style_attr_start, style_attr_end);
 
   // Retrieve the XML attributes, if requested.
   static const ssize_t kXmlBlock = 0x10000000;
   XmlAttributeFinder xml_attr_finder(xml_parser);
-  const size_t xml_attr_end = xml_parser != NULL ? xml_parser->getAttributeCount() : 0;
+  const size_t xml_attr_end =
+      xml_parser != nullptr ? xml_parser->getAttributeCount() : 0;
 
   // Now iterate through all of the attributes that the client has requested,
   // filling in each with whatever data we can find.
@@ -289,34 +318,41 @@
       // We found the attribute we were looking for.
       xml_parser->getAttributeValue(xml_attr_idx, &value);
       if (kDebugStyles) {
-        ALOGI("-> From XML: type=0x%x, data=0x%08x", value.dataType, value.data);
+        ALOGI("-> From XML: type=0x%x, data=0x%08x", value.dataType,
+              value.data);
       }
     }
 
     if (value.dataType == Res_value::TYPE_NULL) {
-      // Walk through the style class values looking for the requested attribute.
-      const ResTable::bag_entry* const style_attr_entry = style_attr_finder.Find(cur_ident);
+      // Walk through the style class values looking for the requested
+      // attribute.
+      const ResTable::bag_entry* const style_attr_entry =
+          style_attr_finder.Find(cur_ident);
       if (style_attr_entry != style_attr_end) {
         // We found the attribute we were looking for.
         block = style_attr_entry->stringBlock;
         type_set_flags = style_type_set_flags;
         value = style_attr_entry->map.value;
         if (kDebugStyles) {
-          ALOGI("-> From style: type=0x%x, data=0x%08x", value.dataType, value.data);
+          ALOGI("-> From style: type=0x%x, data=0x%08x", value.dataType,
+                value.data);
         }
       }
     }
 
     if (value.dataType == Res_value::TYPE_NULL) {
-      // Walk through the default style values looking for the requested attribute.
-      const ResTable::bag_entry* const def_style_attr_entry = def_style_attr_finder.Find(cur_ident);
+      // Walk through the default style values looking for the requested
+      // attribute.
+      const ResTable::bag_entry* const def_style_attr_entry =
+          def_style_attr_finder.Find(cur_ident);
       if (def_style_attr_entry != def_style_attr_end) {
         // We found the attribute we were looking for.
         block = def_style_attr_entry->stringBlock;
         type_set_flags = style_type_set_flags;
         value = def_style_attr_entry->map.value;
         if (kDebugStyles) {
-          ALOGI("-> From def style: type=0x%x, data=0x%08x", value.dataType, value.data);
+          ALOGI("-> From def style: type=0x%x, data=0x%08x", value.dataType,
+                value.data);
         }
       }
     }
@@ -324,30 +360,35 @@
     uint32_t resid = 0;
     if (value.dataType != Res_value::TYPE_NULL) {
       // Take care of resolving the found resource to its final value.
-      ssize_t new_block =
-          theme->resolveAttributeReference(&value, block, &resid, &type_set_flags, &config);
+      ssize_t new_block = theme->resolveAttributeReference(
+          &value, block, &resid, &type_set_flags, &config);
       if (new_block >= 0) {
         block = new_block;
       }
 
       if (kDebugStyles) {
-        ALOGI("-> Resolved attr: type=0x%x, data=0x%08x", value.dataType, value.data);
+        ALOGI("-> Resolved attr: type=0x%x, data=0x%08x", value.dataType,
+              value.data);
       }
     } else {
       // If we still don't have a value for this attribute, try to find
       // it in the theme!
-      ssize_t new_block = theme->getAttribute(cur_ident, &value, &type_set_flags);
+      ssize_t new_block =
+          theme->getAttribute(cur_ident, &value, &type_set_flags);
       if (new_block >= 0) {
         if (kDebugStyles) {
-          ALOGI("-> From theme: type=0x%x, data=0x%08x", value.dataType, value.data);
+          ALOGI("-> From theme: type=0x%x, data=0x%08x", value.dataType,
+                value.data);
         }
-        new_block = res.resolveReference(&value, new_block, &resid, &type_set_flags, &config);
+        new_block = res.resolveReference(&value, new_block, &resid,
+                                         &type_set_flags, &config);
         if (new_block >= 0) {
           block = new_block;
         }
 
         if (kDebugStyles) {
-          ALOGI("-> Resolved theme: type=0x%x, data=0x%08x", value.dataType, value.data);
+          ALOGI("-> Resolved theme: type=0x%x, data=0x%08x", value.dataType,
+                value.data);
         }
       }
     }
@@ -363,20 +404,21 @@
     }
 
     if (kDebugStyles) {
-      ALOGI("Attribute 0x%08x: type=0x%x, data=0x%08x", cur_ident, value.dataType, value.data);
+      ALOGI("Attribute 0x%08x: type=0x%x, data=0x%08x", cur_ident,
+            value.dataType, value.data);
     }
 
     // Write the final value back to Java.
     out_values[STYLE_TYPE] = value.dataType;
     out_values[STYLE_DATA] = value.data;
-    out_values[STYLE_ASSET_COOKIE] = block != kXmlBlock
-                                         ? static_cast<uint32_t>(res.getTableCookie(block))
-                                         : static_cast<uint32_t>(-1);
+    out_values[STYLE_ASSET_COOKIE] =
+        block != kXmlBlock ? static_cast<uint32_t>(res.getTableCookie(block))
+                           : static_cast<uint32_t>(-1);
     out_values[STYLE_RESOURCE_ID] = resid;
     out_values[STYLE_CHANGING_CONFIGURATIONS] = type_set_flags;
     out_values[STYLE_DENSITY] = config.density;
 
-    if (value.dataType != Res_value::TYPE_NULL) {
+    if (out_indices != nullptr && value.dataType != Res_value::TYPE_NULL) {
       indices_idx++;
       out_indices[indices_idx] = ii;
     }
@@ -386,11 +428,14 @@
 
   res.unlock();
 
-  out_indices[0] = indices_idx;
+  if (out_indices != nullptr) {
+    out_indices[0] = indices_idx;
+  }
 }
 
-bool RetrieveAttributes(const ResTable* res, ResXMLParser* xml_parser, uint32_t* attrs,
-                        size_t attrs_length, uint32_t* out_values, uint32_t* out_indices) {
+bool RetrieveAttributes(const ResTable* res, ResXMLParser* xml_parser,
+                        uint32_t* attrs, size_t attrs_length,
+                        uint32_t* out_values, uint32_t* out_indices) {
   ResTable_config config;
   Res_value value;
 
@@ -434,7 +479,8 @@
     if (value.dataType != Res_value::TYPE_NULL) {
       // Take care of resolving the found resource to its final value.
       // printf("Resolving attribute reference\n");
-      ssize_t new_block = res->resolveReference(&value, block, &resid, &type_set_flags, &config);
+      ssize_t new_block = res->resolveReference(&value, block, &resid,
+                                                &type_set_flags, &config);
       if (new_block >= 0) block = new_block;
     }
 
@@ -448,14 +494,14 @@
     // Write the final value back to Java.
     out_values[STYLE_TYPE] = value.dataType;
     out_values[STYLE_DATA] = value.data;
-    out_values[STYLE_ASSET_COOKIE] = block != kXmlBlock
-                                         ? static_cast<uint32_t>(res->getTableCookie(block))
-                                         : static_cast<uint32_t>(-1);
+    out_values[STYLE_ASSET_COOKIE] =
+        block != kXmlBlock ? static_cast<uint32_t>(res->getTableCookie(block))
+                           : static_cast<uint32_t>(-1);
     out_values[STYLE_RESOURCE_ID] = resid;
     out_values[STYLE_CHANGING_CONFIGURATIONS] = type_set_flags;
     out_values[STYLE_DENSITY] = config.density;
 
-    if (out_indices != NULL && value.dataType != Res_value::TYPE_NULL) {
+    if (out_indices != nullptr && value.dataType != Res_value::TYPE_NULL) {
       indices_idx++;
       out_indices[indices_idx] = ii;
     }
@@ -465,7 +511,7 @@
 
   res->unlock();
 
-  if (out_indices != NULL) {
+  if (out_indices != nullptr) {
     out_indices[0] = indices_idx;
   }
   return true;
diff --git a/libs/androidfw/AttributeFinder.h b/libs/androidfw/include/androidfw/AttributeFinder.h
similarity index 100%
rename from libs/androidfw/AttributeFinder.h
rename to libs/androidfw/include/androidfw/AttributeFinder.h
diff --git a/libs/androidfw/tests/Android.mk b/libs/androidfw/tests/Android.mk
index d18cb8f..d91a133 100644
--- a/libs/androidfw/tests/Android.mk
+++ b/libs/androidfw/tests/Android.mk
@@ -24,6 +24,7 @@
     AppAsLib_test.cpp \
     Asset_test.cpp \
     AttributeFinder_test.cpp \
+    AttributeResolution_test.cpp \
     ByteBucketArray_test.cpp \
     Config_test.cpp \
     ConfigLocale_test.cpp \
@@ -53,14 +54,15 @@
 
 LOCAL_MODULE := libandroidfw_tests
 LOCAL_CFLAGS := $(androidfw_test_cflags)
-LOCAL_SRC_FILES := $(testFiles) AttributeResolution_test.cpp
+LOCAL_SRC_FILES := $(testFiles)
 LOCAL_STATIC_LIBRARIES := \
     libandroidfw \
     libbase \
     libutils \
     libcutils \
     liblog \
-    libz
+    libz \
+    libziparchive
 LOCAL_PICKUP_FILES := $(LOCAL_PATH)/data
 
 include $(BUILD_HOST_NATIVE_TEST)
@@ -82,7 +84,8 @@
     libbase \
     libcutils \
     libutils \
-    libui
+    libui \
+    libziparchive 
 LOCAL_PICKUP_FILES := $(LOCAL_PATH)/data
 
 include $(BUILD_NATIVE_TEST)
diff --git a/libs/androidfw/tests/AppAsLib_test.cpp b/libs/androidfw/tests/AppAsLib_test.cpp
index 8489acf..ddaa46d 100644
--- a/libs/androidfw/tests/AppAsLib_test.cpp
+++ b/libs/androidfw/tests/AppAsLib_test.cpp
@@ -14,55 +14,69 @@
  * limitations under the License.
  */
 
-#include <androidfw/ResourceTypes.h>
+#include "androidfw/ResourceTypes.h"
 
+#include "TestHelpers.h"
 #include "data/appaslib/R.h"
 
-#include <gtest/gtest.h>
+namespace app = com::android::appaslib::app;
+namespace lib = com::android::appaslib::lib;
 
-using namespace android;
-
-namespace {
-
-#include "data/appaslib/appaslib_arsc.h"
-#include "data/appaslib/appaslib_lib_arsc.h"
+namespace android {
 
 // This tests the app resources loaded as app.
-TEST(AppAsLibTest, loadedAsApp) {
+TEST(AppAsLibTest, LoadedAsApp) {
+  std::string contents;
+  ASSERT_TRUE(
+      ReadFileFromZipToString(GetTestDataPath() + "/appaslib/appaslib.apk",
+                              "resources.arsc", &contents));
+
   ResTable table;
-  ASSERT_EQ(NO_ERROR, table.add(appaslib_arsc, appaslib_arsc_len));
+  ASSERT_EQ(NO_ERROR, table.add(contents.data(), contents.size()));
 
   Res_value val;
-  ssize_t block = table.getResource(appaslib::R::app::integer::number1, &val);
+  ssize_t block = table.getResource(app::R::integer::number1, &val);
   ASSERT_GE(block, 0);
   ASSERT_EQ(Res_value::TYPE_REFERENCE, val.dataType);
-  ASSERT_EQ(appaslib::R::app::array::integerArray1, val.data);
+  ASSERT_EQ(app::R::array::integerArray1, val.data);
 }
 
 // This tests the app resources loaded as shared-lib.
-TEST(AppAsLibTest, loadedAsSharedLib) {
+TEST(AppAsLibTest, LoadedAsSharedLib) {
+  std::string contents;
+  ASSERT_TRUE(
+      ReadFileFromZipToString(GetTestDataPath() + "/appaslib/appaslib.apk",
+                              "resources.arsc", &contents));
+
   ResTable table;
   // Load as shared library.
-  ASSERT_EQ(NO_ERROR, table.add(appaslib_arsc, appaslib_arsc_len, NULL, 0, -1, false, true));
+  ASSERT_EQ(NO_ERROR, table.add(contents.data(), contents.size(), NULL, 0, -1,
+                                false, true));
 
   Res_value val;
-  ssize_t block = table.getResource(appaslib::R::lib::integer::number1, &val);
+  ssize_t block = table.getResource(lib::R::integer::number1, &val);
   ASSERT_GE(block, 0);
   ASSERT_EQ(Res_value::TYPE_REFERENCE, val.dataType);
-  ASSERT_EQ(appaslib::R::lib::array::integerArray1, val.data);
+  ASSERT_EQ(lib::R::array::integerArray1, val.data);
 }
 
 // This tests the shared-lib loaded with appAsLib as true.
-TEST(AppAsLibTest, loadedSharedLib) {
+TEST(AppAsLibTest, LoadedSharedLib) {
+  std::string contents;
+  ASSERT_TRUE(
+      ReadFileFromZipToString(GetTestDataPath() + "/appaslib/appaslib_lib.apk",
+                              "resources.arsc", &contents));
+
   ResTable table;
   // Load shared library with appAsLib as true.
-  ASSERT_EQ(NO_ERROR, table.add(appaslib_lib_arsc, appaslib_lib_arsc_len, NULL, 0, -1, false, true));
+  ASSERT_EQ(NO_ERROR, table.add(contents.data(), contents.size(), NULL, 0, -1,
+                                false, true));
 
   Res_value val;
-  ssize_t block = table.getResource(appaslib::R::lib::integer::number1, &val);
+  ssize_t block = table.getResource(lib::R::integer::number1, &val);
   ASSERT_GE(block, 0);
   ASSERT_EQ(Res_value::TYPE_REFERENCE, val.dataType);
-  ASSERT_EQ(appaslib::R::lib::array::integerArray1, val.data);
+  ASSERT_EQ(lib::R::array::integerArray1, val.data);
 }
 
-}
+}  // namespace android
diff --git a/libs/androidfw/tests/Asset_test.cpp b/libs/androidfw/tests/Asset_test.cpp
index 45c8cef..5018218 100644
--- a/libs/androidfw/tests/Asset_test.cpp
+++ b/libs/androidfw/tests/Asset_test.cpp
@@ -14,24 +14,26 @@
  * limitations under the License.
  */
 
-#include <androidfw/Asset.h>
+#include "androidfw/Asset.h"
 
-#include <gtest/gtest.h>
+#include "gtest/gtest.h"
 
-using namespace android;
+namespace android {
 
 TEST(AssetTest, FileAssetRegistersItself) {
-    const int32_t count = Asset::getGlobalCount();
-    Asset* asset = new _FileAsset();
-    EXPECT_EQ(count + 1, Asset::getGlobalCount());
-    delete asset;
-    EXPECT_EQ(count, Asset::getGlobalCount());
+  const int32_t count = Asset::getGlobalCount();
+  Asset* asset = new _FileAsset();
+  EXPECT_EQ(count + 1, Asset::getGlobalCount());
+  delete asset;
+  EXPECT_EQ(count, Asset::getGlobalCount());
 }
 
 TEST(AssetTest, CompressedAssetRegistersItself) {
-    const int32_t count = Asset::getGlobalCount();
-    Asset* asset = new _CompressedAsset();
-    EXPECT_EQ(count + 1, Asset::getGlobalCount());
-    delete asset;
-    EXPECT_EQ(count, Asset::getGlobalCount());
+  const int32_t count = Asset::getGlobalCount();
+  Asset* asset = new _CompressedAsset();
+  EXPECT_EQ(count + 1, Asset::getGlobalCount());
+  delete asset;
+  EXPECT_EQ(count, Asset::getGlobalCount());
 }
+
+}  // nameapce android
diff --git a/libs/androidfw/tests/AttributeFinder_test.cpp b/libs/androidfw/tests/AttributeFinder_test.cpp
index d9ed48e..7264b81 100644
--- a/libs/androidfw/tests/AttributeFinder_test.cpp
+++ b/libs/androidfw/tests/AttributeFinder_test.cpp
@@ -14,16 +14,18 @@
  * limitations under the License.
  */
 
-#include "../AttributeFinder.h"
+#include "androidfw/AttributeFinder.h"
 
-#include <android-base/macros.h>
-#include <gtest/gtest.h>
+#include "android-base/macros.h"
+#include "gtest/gtest.h"
 
-using android::BackTrackingAttributeFinder;
+namespace android {
 
-class MockAttributeFinder : public BackTrackingAttributeFinder<MockAttributeFinder, int> {
+class MockAttributeFinder
+    : public BackTrackingAttributeFinder<MockAttributeFinder, int> {
  public:
-  MockAttributeFinder(const uint32_t* attrs, int len) : BackTrackingAttributeFinder(0, len) {
+  MockAttributeFinder(const uint32_t* attrs, int len)
+      : BackTrackingAttributeFinder(0, len) {
     attrs_ = new uint32_t[len];
     memcpy(attrs_, attrs, sizeof(*attrs) * len);
   }
@@ -36,13 +38,16 @@
   uint32_t* attrs_;
 };
 
-static const uint32_t kSortedAttributes[] = {0x01010000, 0x01010001, 0x01010002, 0x01010004,
-                                             0x02010001, 0x02010010, 0x7f010001};
+static const uint32_t kSortedAttributes[] = {0x01010000, 0x01010001, 0x01010002,
+                                             0x01010004, 0x02010001, 0x02010010,
+                                             0x7f010001};
 
 static const uint32_t kPackageUnsortedAttributes[] = {
-    0x02010001, 0x02010010, 0x01010000, 0x01010001, 0x01010002, 0x01010004, 0x7f010001};
+    0x02010001, 0x02010010, 0x01010000, 0x01010001,
+    0x01010002, 0x01010004, 0x7f010001};
 
-static const uint32_t kSinglePackageAttributes[] = {0x7f010007, 0x7f01000a, 0x7f01000d, 0x00000000};
+static const uint32_t kSinglePackageAttributes[] = {0x7f010007, 0x7f01000a,
+                                                    0x7f01000d, 0x00000000};
 
 TEST(AttributeFinderTest, IteratesSequentially) {
   const int end = arraysize(kSortedAttributes);
@@ -116,3 +121,5 @@
   EXPECT_EQ(end, finder.Find(0x010100fa));
   EXPECT_EQ(0, finder.Find(0x7f010007));
 }
+
+}  // namespace android
diff --git a/libs/androidfw/tests/AttributeResolution_test.cpp b/libs/androidfw/tests/AttributeResolution_test.cpp
index 3aac178..d417aba 100644
--- a/libs/androidfw/tests/AttributeResolution_test.cpp
+++ b/libs/androidfw/tests/AttributeResolution_test.cpp
@@ -30,12 +30,11 @@
 class AttributeResolutionTest : public ::testing::Test {
  public:
   virtual void SetUp() override {
-    std::string test_source_dir = GetTestDataPath();
     std::string contents;
-    CHECK(base::ReadFileToString(test_source_dir + "/styles/resources.arsc",
-                                 &contents));
-    CHECK(table_.add(contents.data(), contents.size(), 1 /*cookie*/,
-                     true /*copyData*/) == NO_ERROR);
+    ASSERT_TRUE(ReadFileFromZipToString(
+        GetTestDataPath() + "/styles/styles.apk", "resources.arsc", &contents));
+    ASSERT_EQ(NO_ERROR, table_.add(contents.data(), contents.size(),
+                                   1 /*cookie*/, true /*copyData*/));
   }
 
  protected:
@@ -46,12 +45,14 @@
  public:
   virtual void SetUp() override {
     AttributeResolutionTest::SetUp();
-    std::string test_source_dir = GetTestDataPath();
+
     std::string contents;
-    CHECK(base::ReadFileToString(test_source_dir + "/styles/layout.xml",
-                                 &contents));
-    CHECK(xml_parser_.setTo(contents.data(), contents.size(),
-                            true /*copyData*/) == NO_ERROR);
+    ASSERT_TRUE(
+        ReadFileFromZipToString(GetTestDataPath() + "/styles/styles.apk",
+                                "res/layout/layout.xml", &contents));
+
+    ASSERT_EQ(NO_ERROR, xml_parser_.setTo(contents.data(), contents.size(),
+                                          true /*copyData*/));
 
     // Skip to the first tag.
     while (xml_parser_.next() != ResXMLParser::START_TAG) {
diff --git a/libs/androidfw/tests/ByteBucketArray_test.cpp b/libs/androidfw/tests/ByteBucketArray_test.cpp
index 376e79c..5d464c7 100644
--- a/libs/androidfw/tests/ByteBucketArray_test.cpp
+++ b/libs/androidfw/tests/ByteBucketArray_test.cpp
@@ -14,28 +14,42 @@
  * limitations under the License.
  */
 
-#include <androidfw/ByteBucketArray.h>
+#include "androidfw/ByteBucketArray.h"
 
-#include <gtest/gtest.h>
+#include "gtest/gtest.h"
 
-using android::ByteBucketArray;
+namespace android {
 
 TEST(ByteBucketArrayTest, TestSparseInsertion) {
-    ByteBucketArray<int> bba;
-    ASSERT_TRUE(bba.set(0, 1));
-    ASSERT_TRUE(bba.set(10, 2));
-    ASSERT_TRUE(bba.set(26, 3));
-    ASSERT_TRUE(bba.set(129, 4));
-    ASSERT_TRUE(bba.set(234, 5));
+  ByteBucketArray<int> bba;
+  ASSERT_TRUE(bba.set(0, 1));
+  ASSERT_TRUE(bba.set(10, 2));
+  ASSERT_TRUE(bba.set(26, 3));
+  ASSERT_TRUE(bba.set(129, 4));
+  ASSERT_TRUE(bba.set(234, 5));
 
-    for (size_t i = 0; i < bba.size(); i++) {
-        switch (i) {
-            case 0: EXPECT_EQ(1, bba[i]); break;
-            case 10: EXPECT_EQ(2, bba[i]); break;
-            case 26: EXPECT_EQ(3, bba[i]); break;
-            case 129: EXPECT_EQ(4, bba[i]); break;
-            case 234: EXPECT_EQ(5, bba[i]); break;
-            default: EXPECT_EQ(0, bba[i]); break;
-        }
+  for (size_t i = 0; i < bba.size(); i++) {
+    switch (i) {
+      case 0:
+        EXPECT_EQ(1, bba[i]);
+        break;
+      case 10:
+        EXPECT_EQ(2, bba[i]);
+        break;
+      case 26:
+        EXPECT_EQ(3, bba[i]);
+        break;
+      case 129:
+        EXPECT_EQ(4, bba[i]);
+        break;
+      case 234:
+        EXPECT_EQ(5, bba[i]);
+        break;
+      default:
+        EXPECT_EQ(0, bba[i]);
+        break;
     }
+  }
 }
+
+}  // namespace android
diff --git a/libs/androidfw/tests/Config_test.cpp b/libs/androidfw/tests/Config_test.cpp
index 738947a..778c7bf 100644
--- a/libs/androidfw/tests/Config_test.cpp
+++ b/libs/androidfw/tests/Config_test.cpp
@@ -14,168 +14,172 @@
  * limitations under the License.
  */
 
-#include <androidfw/ResourceTypes.h>
-#include <utils/Log.h>
-#include <utils/String8.h>
-#include <utils/Vector.h>
+#include "androidfw/ResourceTypes.h"
+
+#include "utils/Log.h"
+#include "utils/String8.h"
+#include "utils/Vector.h"
 
 #include "TestHelpers.h"
-#include <gtest/gtest.h>
+#include "gtest/gtest.h"
 
 namespace android {
 
 static ResTable_config selectBest(const ResTable_config& target,
-        const Vector<ResTable_config>& configs) {
-    ResTable_config bestConfig;
-    memset(&bestConfig, 0, sizeof(bestConfig));
-    const size_t configCount = configs.size();
-    for (size_t i = 0; i < configCount; i++) {
-        const ResTable_config& thisConfig = configs[i];
-        if (!thisConfig.match(target)) {
-            continue;
-        }
-
-        if (thisConfig.isBetterThan(bestConfig, &target)) {
-            bestConfig = thisConfig;
-        }
+                                  const Vector<ResTable_config>& configs) {
+  ResTable_config bestConfig;
+  memset(&bestConfig, 0, sizeof(bestConfig));
+  const size_t configCount = configs.size();
+  for (size_t i = 0; i < configCount; i++) {
+    const ResTable_config& thisConfig = configs[i];
+    if (!thisConfig.match(target)) {
+      continue;
     }
-    return bestConfig;
+
+    if (thisConfig.isBetterThan(bestConfig, &target)) {
+      bestConfig = thisConfig;
+    }
+  }
+  return bestConfig;
 }
 
 static ResTable_config buildDensityConfig(int density) {
-    ResTable_config config;
-    memset(&config, 0, sizeof(config));
-    config.density = uint16_t(density);
-    config.sdkVersion = 4;
-    return config;
+  ResTable_config config;
+  memset(&config, 0, sizeof(config));
+  config.density = uint16_t(density);
+  config.sdkVersion = 4;
+  return config;
 }
 
 TEST(ConfigTest, shouldSelectBestDensity) {
-    ResTable_config deviceConfig;
-    memset(&deviceConfig, 0, sizeof(deviceConfig));
-    deviceConfig.density = ResTable_config::DENSITY_XHIGH;
-    deviceConfig.sdkVersion = 21;
+  ResTable_config deviceConfig;
+  memset(&deviceConfig, 0, sizeof(deviceConfig));
+  deviceConfig.density = ResTable_config::DENSITY_XHIGH;
+  deviceConfig.sdkVersion = 21;
 
-    Vector<ResTable_config> configs;
+  Vector<ResTable_config> configs;
 
-    ResTable_config expectedBest = buildDensityConfig(ResTable_config::DENSITY_HIGH);
-    configs.add(expectedBest);
-    ASSERT_EQ(expectedBest, selectBest(deviceConfig, configs));
+  ResTable_config expectedBest =
+      buildDensityConfig(ResTable_config::DENSITY_HIGH);
+  configs.add(expectedBest);
+  ASSERT_EQ(expectedBest, selectBest(deviceConfig, configs));
 
-    expectedBest = buildDensityConfig(ResTable_config::DENSITY_XXHIGH);
-    configs.add(expectedBest);
-    ASSERT_EQ(expectedBest, selectBest(deviceConfig, configs));
+  expectedBest = buildDensityConfig(ResTable_config::DENSITY_XXHIGH);
+  configs.add(expectedBest);
+  ASSERT_EQ(expectedBest, selectBest(deviceConfig, configs));
 
-    expectedBest = buildDensityConfig(int(ResTable_config::DENSITY_XXHIGH) - 20);
-    configs.add(expectedBest);
-    ASSERT_EQ(expectedBest, selectBest(deviceConfig, configs));
+  expectedBest = buildDensityConfig(int(ResTable_config::DENSITY_XXHIGH) - 20);
+  configs.add(expectedBest);
+  ASSERT_EQ(expectedBest, selectBest(deviceConfig, configs));
 
-    configs.add(buildDensityConfig(int(ResTable_config::DENSITY_HIGH) + 20));
-    ASSERT_EQ(expectedBest, selectBest(deviceConfig, configs));
+  configs.add(buildDensityConfig(int(ResTable_config::DENSITY_HIGH) + 20));
+  ASSERT_EQ(expectedBest, selectBest(deviceConfig, configs));
 
-    expectedBest = buildDensityConfig(ResTable_config::DENSITY_XHIGH);
-    configs.add(expectedBest);
-    ASSERT_EQ(expectedBest, selectBest(deviceConfig, configs));
+  expectedBest = buildDensityConfig(ResTable_config::DENSITY_XHIGH);
+  configs.add(expectedBest);
+  ASSERT_EQ(expectedBest, selectBest(deviceConfig, configs));
 
-    expectedBest = buildDensityConfig(ResTable_config::DENSITY_ANY);
-    expectedBest.sdkVersion = 21;
-    configs.add(expectedBest);
-    ASSERT_EQ(expectedBest, selectBest(deviceConfig, configs));
+  expectedBest = buildDensityConfig(ResTable_config::DENSITY_ANY);
+  expectedBest.sdkVersion = 21;
+  configs.add(expectedBest);
+  ASSERT_EQ(expectedBest, selectBest(deviceConfig, configs));
 }
 
 TEST(ConfigTest, shouldSelectBestDensityWhenNoneSpecified) {
-    ResTable_config deviceConfig;
-    memset(&deviceConfig, 0, sizeof(deviceConfig));
-    deviceConfig.sdkVersion = 21;
+  ResTable_config deviceConfig;
+  memset(&deviceConfig, 0, sizeof(deviceConfig));
+  deviceConfig.sdkVersion = 21;
 
-    Vector<ResTable_config> configs;
-    configs.add(buildDensityConfig(ResTable_config::DENSITY_HIGH));
+  Vector<ResTable_config> configs;
+  configs.add(buildDensityConfig(ResTable_config::DENSITY_HIGH));
 
-    ResTable_config expectedBest = buildDensityConfig(ResTable_config::DENSITY_MEDIUM);
-    configs.add(expectedBest);
-    ASSERT_EQ(expectedBest, selectBest(deviceConfig, configs));
+  ResTable_config expectedBest =
+      buildDensityConfig(ResTable_config::DENSITY_MEDIUM);
+  configs.add(expectedBest);
+  ASSERT_EQ(expectedBest, selectBest(deviceConfig, configs));
 
-    expectedBest = buildDensityConfig(ResTable_config::DENSITY_ANY);
-    configs.add(expectedBest);
-    ASSERT_EQ(expectedBest, selectBest(deviceConfig, configs));
+  expectedBest = buildDensityConfig(ResTable_config::DENSITY_ANY);
+  configs.add(expectedBest);
+  ASSERT_EQ(expectedBest, selectBest(deviceConfig, configs));
 }
 
 TEST(ConfigTest, shouldMatchRoundQualifier) {
-    ResTable_config deviceConfig;
-    memset(&deviceConfig, 0, sizeof(deviceConfig));
+  ResTable_config deviceConfig;
+  memset(&deviceConfig, 0, sizeof(deviceConfig));
 
-    ResTable_config roundConfig;
-    memset(&roundConfig, 0, sizeof(roundConfig));
-    roundConfig.screenLayout2 = ResTable_config::SCREENROUND_YES;
+  ResTable_config roundConfig;
+  memset(&roundConfig, 0, sizeof(roundConfig));
+  roundConfig.screenLayout2 = ResTable_config::SCREENROUND_YES;
 
-    EXPECT_FALSE(roundConfig.match(deviceConfig));
+  EXPECT_FALSE(roundConfig.match(deviceConfig));
 
-    deviceConfig.screenLayout2 = ResTable_config::SCREENROUND_YES;
+  deviceConfig.screenLayout2 = ResTable_config::SCREENROUND_YES;
 
-    EXPECT_TRUE(roundConfig.match(deviceConfig));
+  EXPECT_TRUE(roundConfig.match(deviceConfig));
 
-    deviceConfig.screenLayout2 = ResTable_config::SCREENROUND_NO;
+  deviceConfig.screenLayout2 = ResTable_config::SCREENROUND_NO;
 
-    EXPECT_FALSE(roundConfig.match(deviceConfig));
+  EXPECT_FALSE(roundConfig.match(deviceConfig));
 
-    ResTable_config notRoundConfig;
-    memset(&notRoundConfig, 0, sizeof(notRoundConfig));
-    notRoundConfig.screenLayout2 = ResTable_config::SCREENROUND_NO;
+  ResTable_config notRoundConfig;
+  memset(&notRoundConfig, 0, sizeof(notRoundConfig));
+  notRoundConfig.screenLayout2 = ResTable_config::SCREENROUND_NO;
 
-    EXPECT_TRUE(notRoundConfig.match(deviceConfig));
+  EXPECT_TRUE(notRoundConfig.match(deviceConfig));
 }
 
 TEST(ConfigTest, RoundQualifierShouldHaveStableSortOrder) {
-    ResTable_config defaultConfig;
-    memset(&defaultConfig, 0, sizeof(defaultConfig));
+  ResTable_config defaultConfig;
+  memset(&defaultConfig, 0, sizeof(defaultConfig));
 
-    ResTable_config longConfig = defaultConfig;
-    longConfig.screenLayout = ResTable_config::SCREENLONG_YES;
+  ResTable_config longConfig = defaultConfig;
+  longConfig.screenLayout = ResTable_config::SCREENLONG_YES;
 
-    ResTable_config longRoundConfig = longConfig;
-    longRoundConfig.screenLayout2 = ResTable_config::SCREENROUND_YES;
+  ResTable_config longRoundConfig = longConfig;
+  longRoundConfig.screenLayout2 = ResTable_config::SCREENROUND_YES;
 
-    ResTable_config longRoundPortConfig = longConfig;
-    longRoundPortConfig.orientation = ResTable_config::ORIENTATION_PORT;
+  ResTable_config longRoundPortConfig = longConfig;
+  longRoundPortConfig.orientation = ResTable_config::ORIENTATION_PORT;
 
-    EXPECT_TRUE(longConfig.compare(longRoundConfig) < 0);
-    EXPECT_TRUE(longConfig.compareLogical(longRoundConfig) < 0);
-    EXPECT_TRUE(longRoundConfig.compare(longConfig) > 0);
-    EXPECT_TRUE(longRoundConfig.compareLogical(longConfig) > 0);
+  EXPECT_TRUE(longConfig.compare(longRoundConfig) < 0);
+  EXPECT_TRUE(longConfig.compareLogical(longRoundConfig) < 0);
+  EXPECT_TRUE(longRoundConfig.compare(longConfig) > 0);
+  EXPECT_TRUE(longRoundConfig.compareLogical(longConfig) > 0);
 
-    EXPECT_TRUE(longRoundConfig.compare(longRoundPortConfig) < 0);
-    EXPECT_TRUE(longRoundConfig.compareLogical(longRoundPortConfig) < 0);
-    EXPECT_TRUE(longRoundPortConfig.compare(longRoundConfig) > 0);
-    EXPECT_TRUE(longRoundPortConfig.compareLogical(longRoundConfig) > 0);
+  EXPECT_TRUE(longRoundConfig.compare(longRoundPortConfig) < 0);
+  EXPECT_TRUE(longRoundConfig.compareLogical(longRoundPortConfig) < 0);
+  EXPECT_TRUE(longRoundPortConfig.compare(longRoundConfig) > 0);
+  EXPECT_TRUE(longRoundPortConfig.compareLogical(longRoundConfig) > 0);
 }
 
 TEST(ConfigTest, ScreenShapeHasCorrectDiff) {
-    ResTable_config defaultConfig;
-    memset(&defaultConfig, 0, sizeof(defaultConfig));
+  ResTable_config defaultConfig;
+  memset(&defaultConfig, 0, sizeof(defaultConfig));
 
-    ResTable_config roundConfig = defaultConfig;
-    roundConfig.screenLayout2 = ResTable_config::SCREENROUND_YES;
+  ResTable_config roundConfig = defaultConfig;
+  roundConfig.screenLayout2 = ResTable_config::SCREENROUND_YES;
 
-    EXPECT_EQ(defaultConfig.diff(roundConfig), ResTable_config::CONFIG_SCREEN_ROUND);
+  EXPECT_EQ(defaultConfig.diff(roundConfig),
+            ResTable_config::CONFIG_SCREEN_ROUND);
 }
 
 TEST(ConfigTest, RoundIsMoreSpecific) {
-    ResTable_config deviceConfig;
-    memset(&deviceConfig, 0, sizeof(deviceConfig));
-    deviceConfig.screenLayout2 = ResTable_config::SCREENROUND_YES;
-    deviceConfig.screenLayout = ResTable_config::SCREENLONG_YES;
+  ResTable_config deviceConfig;
+  memset(&deviceConfig, 0, sizeof(deviceConfig));
+  deviceConfig.screenLayout2 = ResTable_config::SCREENROUND_YES;
+  deviceConfig.screenLayout = ResTable_config::SCREENLONG_YES;
 
-    ResTable_config targetConfigA;
-    memset(&targetConfigA, 0, sizeof(targetConfigA));
+  ResTable_config targetConfigA;
+  memset(&targetConfigA, 0, sizeof(targetConfigA));
 
-    ResTable_config targetConfigB = targetConfigA;
-    targetConfigB.screenLayout = ResTable_config::SCREENLONG_YES;
+  ResTable_config targetConfigB = targetConfigA;
+  targetConfigB.screenLayout = ResTable_config::SCREENLONG_YES;
 
-    ResTable_config targetConfigC = targetConfigB;
-    targetConfigC.screenLayout2 = ResTable_config::SCREENROUND_YES;
+  ResTable_config targetConfigC = targetConfigB;
+  targetConfigC.screenLayout2 = ResTable_config::SCREENROUND_YES;
 
-    EXPECT_TRUE(targetConfigB.isBetterThan(targetConfigA, &deviceConfig));
-    EXPECT_TRUE(targetConfigC.isBetterThan(targetConfigB, &deviceConfig));
+  EXPECT_TRUE(targetConfigB.isBetterThan(targetConfigA, &deviceConfig));
+  EXPECT_TRUE(targetConfigC.isBetterThan(targetConfigB, &deviceConfig));
 }
 
 }  // namespace android.
diff --git a/libs/androidfw/tests/Idmap_test.cpp b/libs/androidfw/tests/Idmap_test.cpp
index f50c178..0928b1b 100644
--- a/libs/androidfw/tests/Idmap_test.cpp
+++ b/libs/androidfw/tests/Idmap_test.cpp
@@ -14,102 +14,102 @@
  * limitations under the License.
  */
 
-#include <androidfw/ResourceTypes.h>
+#include "androidfw/ResourceTypes.h"
 
-#include <utils/String8.h>
-#include <utils/String16.h>
+#include "utils/String16.h"
+#include "utils/String8.h"
+
 #include "TestHelpers.h"
 #include "data/basic/R.h"
 
-#include <gtest/gtest.h>
+using com::android::basic::R;
 
-using namespace android;
-
-namespace {
-
-/**
- * Include a binary resource table.
- *
- * Package: com.android.test.basic
- */
-#include "data/basic/basic_arsc.h"
-
-/**
- * Include a binary resource table.
- * This table is an overlay.
- *
- * Package: com.android.test.basic
- */
-#include "data/overlay/overlay_arsc.h"
-
-enum { MAY_NOT_BE_BAG = false };
+namespace android {
 
 class IdmapTest : public ::testing::Test {
-protected:
-    virtual void SetUp() {
-        ASSERT_EQ(NO_ERROR, mTargetTable.add(basic_arsc, basic_arsc_len));
-        ASSERT_EQ(NO_ERROR, mOverlayTable.add(overlay_arsc, overlay_arsc_len));
-        char targetName[256] = "com.android.test.basic";
-        ASSERT_EQ(NO_ERROR, mTargetTable.createIdmap(mOverlayTable, 0, 0,
-                    targetName, targetName, &mData, &mDataSize));
-    }
+ protected:
+  void SetUp() override {
+    std::string contents;
+    ASSERT_TRUE(ReadFileFromZipToString(GetTestDataPath() + "/basic/basic.apk",
+                                        "resources.arsc", &contents));
+    ASSERT_EQ(NO_ERROR,
+              target_table_.add(contents.data(), contents.size(), 0, true));
 
-    virtual void TearDown() {
-        free(mData);
-    }
+    ASSERT_TRUE(
+        ReadFileFromZipToString(GetTestDataPath() + "/overlay/overlay.apk",
+                                "resources.arsc", &overlay_data_));
+    ResTable overlay_table;
+    ASSERT_EQ(NO_ERROR,
+              overlay_table.add(overlay_data_.data(), overlay_data_.size()));
 
-    ResTable mTargetTable;
-    ResTable mOverlayTable;
-    void* mData;
-    size_t mDataSize;
+    char target_name[256] = "com.android.basic";
+    ASSERT_EQ(NO_ERROR,
+              target_table_.createIdmap(overlay_table, 0, 0, target_name,
+                                        target_name, &data_, &data_size_));
+  }
+
+  void TearDown() override { ::free(data_); }
+
+  ResTable target_table_;
+  std::string overlay_data_;
+  void* data_ = nullptr;
+  size_t data_size_ = 0;
 };
 
 TEST_F(IdmapTest, canLoadIdmap) {
-    ASSERT_EQ(NO_ERROR, mTargetTable.add(overlay_arsc, overlay_arsc_len, mData, mDataSize));
+  ASSERT_EQ(NO_ERROR,
+            target_table_.add(overlay_data_.data(), overlay_data_.size(), data_,
+                              data_size_));
 }
 
 TEST_F(IdmapTest, overlayOverridesResourceValue) {
-    Res_value val;
-    ssize_t block = mTargetTable.getResource(base::R::string::test2, &val, false);
-    ASSERT_GE(block, 0);
-    ASSERT_EQ(Res_value::TYPE_STRING, val.dataType);
-    const ResStringPool* pool = mTargetTable.getTableStringBlock(block);
-    ASSERT_TRUE(pool != NULL);
-    ASSERT_LT(val.data, pool->size());
+  Res_value val;
+  ssize_t block = target_table_.getResource(R::string::test2, &val, false);
+  ASSERT_GE(block, 0);
+  ASSERT_EQ(Res_value::TYPE_STRING, val.dataType);
+  const ResStringPool* pool = target_table_.getTableStringBlock(block);
+  ASSERT_TRUE(pool != NULL);
+  ASSERT_LT(val.data, pool->size());
 
-    size_t strLen;
-    const char16_t* targetStr16 = pool->stringAt(val.data, &strLen);
-    ASSERT_TRUE(targetStr16 != NULL);
-    ASSERT_EQ(String16("test2"), String16(targetStr16, strLen));
+  size_t strLen;
+  const char16_t* targetStr16 = pool->stringAt(val.data, &strLen);
+  ASSERT_TRUE(targetStr16 != NULL);
+  ASSERT_EQ(String16("test2"), String16(targetStr16, strLen));
 
-    ASSERT_EQ(NO_ERROR, mTargetTable.add(overlay_arsc, overlay_arsc_len, mData, mDataSize));
+  ASSERT_EQ(NO_ERROR,
+            target_table_.add(overlay_data_.data(), overlay_data_.size(), data_,
+                              data_size_));
 
-    ssize_t newBlock = mTargetTable.getResource(base::R::string::test2, &val, false);
-    ASSERT_GE(newBlock, 0);
-    ASSERT_NE(block, newBlock);
-    ASSERT_EQ(Res_value::TYPE_STRING, val.dataType);
-    pool = mTargetTable.getTableStringBlock(newBlock);
-    ASSERT_TRUE(pool != NULL);
-    ASSERT_LT(val.data, pool->size());
+  ssize_t newBlock = target_table_.getResource(R::string::test2, &val, false);
+  ASSERT_GE(newBlock, 0);
+  ASSERT_NE(block, newBlock);
+  ASSERT_EQ(Res_value::TYPE_STRING, val.dataType);
+  pool = target_table_.getTableStringBlock(newBlock);
+  ASSERT_TRUE(pool != NULL);
+  ASSERT_LT(val.data, pool->size());
 
-    targetStr16 = pool->stringAt(val.data, &strLen);
-    ASSERT_TRUE(targetStr16 != NULL);
-    ASSERT_EQ(String16("test2-overlay"), String16(targetStr16, strLen));
+  targetStr16 = pool->stringAt(val.data, &strLen);
+  ASSERT_TRUE(targetStr16 != NULL);
+  ASSERT_EQ(String16("test2-overlay"), String16(targetStr16, strLen));
 }
 
 TEST_F(IdmapTest, overlaidResourceHasSameName) {
-    ASSERT_EQ(NO_ERROR, mTargetTable.add(overlay_arsc, overlay_arsc_len, mData, mDataSize));
+  ASSERT_EQ(NO_ERROR,
+            target_table_.add(overlay_data_.data(), overlay_data_.size(), data_,
+                              data_size_));
 
-    ResTable::resource_name resName;
-    ASSERT_TRUE(mTargetTable.getResourceName(base::R::array::integerArray1, false, &resName));
+  ResTable::resource_name resName;
+  ASSERT_TRUE(
+      target_table_.getResourceName(R::array::integerArray1, false, &resName));
 
-    ASSERT_TRUE(resName.package != NULL);
-    ASSERT_TRUE(resName.type != NULL);
-    ASSERT_TRUE(resName.name != NULL);
+  ASSERT_TRUE(resName.package != NULL);
+  ASSERT_TRUE(resName.type != NULL);
+  ASSERT_TRUE(resName.name != NULL);
 
-    EXPECT_EQ(String16("com.android.test.basic"), String16(resName.package, resName.packageLen));
-    EXPECT_EQ(String16("array"), String16(resName.type, resName.typeLen));
-    EXPECT_EQ(String16("integerArray1"), String16(resName.name, resName.nameLen));
+  EXPECT_EQ(String16("com.android.basic"),
+            String16(resName.package, resName.packageLen));
+  EXPECT_EQ(String16("array"), String16(resName.type, resName.typeLen));
+  EXPECT_EQ(String16("integerArray1"), String16(resName.name, resName.nameLen));
 }
 
-} // namespace
+}  // namespace
diff --git a/libs/androidfw/tests/ResTable_test.cpp b/libs/androidfw/tests/ResTable_test.cpp
index 9e53dd2..b151f3f 100644
--- a/libs/androidfw/tests/ResTable_test.cpp
+++ b/libs/androidfw/tests/ResTable_test.cpp
@@ -14,352 +14,386 @@
  * limitations under the License.
  */
 
-#include <androidfw/ResourceTypes.h>
+#include "androidfw/ResourceTypes.h"
 
 #include <codecvt>
 #include <locale>
 #include <string>
 
-#include <utils/String8.h>
-#include <utils/String16.h>
+#include "utils/String16.h"
+#include "utils/String8.h"
+
 #include "TestHelpers.h"
 #include "data/basic/R.h"
 #include "data/lib/R.h"
 
-#include <gtest/gtest.h>
+namespace basic = com::android::basic;
+namespace lib = com::android::lib;
 
-using namespace android;
+namespace android {
 
-namespace {
+TEST(ResTableTest, ShouldLoadSuccessfully) {
+  std::string contents;
+  ASSERT_TRUE(ReadFileFromZipToString(GetTestDataPath() + "/basic/basic.apk",
+                                      "resources.arsc", &contents));
 
-/**
- * Include a binary resource table.
- *
- * Package: com.android.test.basic
- */
-#include "data/basic/basic_arsc.h"
-
-/**
- * Include a binary library resource table.
- *
- * Package: com.android.test.basic
- */
-#include "data/lib/lib_arsc.h"
-
-/**
- * Include a system resource table.
- *
- * Package: android
- */
-#include "data/system/system_arsc.h"
-
-TEST(ResTableTest, shouldLoadSuccessfully) {
-    ResTable table;
-    ASSERT_EQ(NO_ERROR, table.add(basic_arsc, basic_arsc_len));
+  ResTable table;
+  ASSERT_EQ(NO_ERROR, table.add(contents.data(), contents.size()));
 }
 
-TEST(ResTableTest, simpleTypeIsRetrievedCorrectly) {
-    ResTable table;
-    ASSERT_EQ(NO_ERROR, table.add(basic_arsc, basic_arsc_len));
+TEST(ResTableTest, SimpleTypeIsRetrievedCorrectly) {
+  std::string contents;
+  ASSERT_TRUE(ReadFileFromZipToString(GetTestDataPath() + "/basic/basic.apk",
+                                      "resources.arsc", &contents));
 
-    EXPECT_TRUE(IsStringEqual(table, base::R::string::test1, "test1"));
+  ResTable table;
+  ASSERT_EQ(NO_ERROR, table.add(contents.data(), contents.size()));
+
+  EXPECT_TRUE(IsStringEqual(table, basic::R::string::test1, "test1"));
 }
 
-TEST(ResTableTest, resourceNameIsResolved) {
-    ResTable table;
-    ASSERT_EQ(NO_ERROR, table.add(basic_arsc, basic_arsc_len));
+TEST(ResTableTest, ResourceNameIsResolved) {
+  std::string contents;
+  ASSERT_TRUE(ReadFileFromZipToString(GetTestDataPath() + "/basic/basic.apk",
+                                      "resources.arsc", &contents));
 
-    String16 defPackage("com.android.test.basic");
-    String16 testName("@string/test1");
-    uint32_t resID = table.identifierForName(testName.string(), testName.size(),
-                                             0, 0,
-                                             defPackage.string(), defPackage.size());
-    ASSERT_NE(uint32_t(0x00000000), resID);
-    ASSERT_EQ(base::R::string::test1, resID);
+  ResTable table;
+  ASSERT_EQ(NO_ERROR, table.add(contents.data(), contents.size()));
+
+  String16 defPackage("com.android.basic");
+  String16 testName("@string/test1");
+  uint32_t resID =
+      table.identifierForName(testName.string(), testName.size(), 0, 0,
+                              defPackage.string(), defPackage.size());
+  ASSERT_NE(uint32_t(0x00000000), resID);
+  ASSERT_EQ(basic::R::string::test1, resID);
 }
 
-TEST(ResTableTest, noParentThemeIsAppliedCorrectly) {
-    ResTable table;
-    ASSERT_EQ(NO_ERROR, table.add(basic_arsc, basic_arsc_len));
+TEST(ResTableTest, NoParentThemeIsAppliedCorrectly) {
+  std::string contents;
+  ASSERT_TRUE(ReadFileFromZipToString(GetTestDataPath() + "/basic/basic.apk",
+                                      "resources.arsc", &contents));
 
-    ResTable::Theme theme(table);
-    ASSERT_EQ(NO_ERROR, theme.applyStyle(base::R::style::Theme1));
+  ResTable table;
+  ASSERT_EQ(NO_ERROR, table.add(contents.data(), contents.size()));
 
-    Res_value val;
-    uint32_t specFlags = 0;
-    ssize_t index = theme.getAttribute(base::R::attr::attr1, &val, &specFlags);
-    ASSERT_GE(index, 0);
-    ASSERT_EQ(Res_value::TYPE_INT_DEC, val.dataType);
-    ASSERT_EQ(uint32_t(100), val.data);
+  ResTable::Theme theme(table);
+  ASSERT_EQ(NO_ERROR, theme.applyStyle(basic::R::style::Theme1));
 
-    index = theme.getAttribute(base::R::attr::attr2, &val, &specFlags);
-    ASSERT_GE(index, 0);
-    ASSERT_EQ(Res_value::TYPE_REFERENCE, val.dataType);
-    ASSERT_EQ(base::R::integer::number1, val.data);
+  Res_value val;
+  uint32_t specFlags = 0;
+  ssize_t index = theme.getAttribute(basic::R::attr::attr1, &val, &specFlags);
+  ASSERT_GE(index, 0);
+  ASSERT_EQ(Res_value::TYPE_INT_DEC, val.dataType);
+  ASSERT_EQ(uint32_t(100), val.data);
+
+  index = theme.getAttribute(basic::R::attr::attr2, &val, &specFlags);
+  ASSERT_GE(index, 0);
+  ASSERT_EQ(Res_value::TYPE_REFERENCE, val.dataType);
+  ASSERT_EQ(basic::R::integer::number1, val.data);
 }
 
-TEST(ResTableTest, parentThemeIsAppliedCorrectly) {
-    ResTable table;
-    ASSERT_EQ(NO_ERROR, table.add(basic_arsc, basic_arsc_len));
+TEST(ResTableTest, ParentThemeIsAppliedCorrectly) {
+  std::string contents;
+  ASSERT_TRUE(ReadFileFromZipToString(GetTestDataPath() + "/basic/basic.apk",
+                                      "resources.arsc", &contents));
 
-    ResTable::Theme theme(table);
-    ASSERT_EQ(NO_ERROR, theme.applyStyle(base::R::style::Theme2));
+  ResTable table;
+  ASSERT_EQ(NO_ERROR, table.add(contents.data(), contents.size()));
 
-    Res_value val;
-    uint32_t specFlags = 0;
-    ssize_t index = theme.getAttribute(base::R::attr::attr1, &val, &specFlags);
-    ASSERT_GE(index, 0);
-    ASSERT_EQ(Res_value::TYPE_INT_DEC, val.dataType);
-    ASSERT_EQ(uint32_t(300), val.data);
+  ResTable::Theme theme(table);
+  ASSERT_EQ(NO_ERROR, theme.applyStyle(basic::R::style::Theme2));
 
-    index = theme.getAttribute(base::R::attr::attr2, &val, &specFlags);
-    ASSERT_GE(index, 0);
-    ASSERT_EQ(Res_value::TYPE_REFERENCE, val.dataType);
-    ASSERT_EQ(base::R::integer::number1, val.data);
+  Res_value val;
+  uint32_t specFlags = 0;
+  ssize_t index = theme.getAttribute(basic::R::attr::attr1, &val, &specFlags);
+  ASSERT_GE(index, 0);
+  ASSERT_EQ(Res_value::TYPE_INT_DEC, val.dataType);
+  ASSERT_EQ(uint32_t(300), val.data);
+
+  index = theme.getAttribute(basic::R::attr::attr2, &val, &specFlags);
+  ASSERT_GE(index, 0);
+  ASSERT_EQ(Res_value::TYPE_REFERENCE, val.dataType);
+  ASSERT_EQ(basic::R::integer::number1, val.data);
 }
 
-TEST(ResTableTest, libraryThemeIsAppliedCorrectly) {
-    ResTable table;
-    ASSERT_EQ(NO_ERROR, table.add(lib_arsc, lib_arsc_len));
+TEST(ResTableTest, LibraryThemeIsAppliedCorrectly) {
+  std::string contents;
+  ASSERT_TRUE(ReadFileFromZipToString(GetTestDataPath() + "/lib/lib.apk",
+                                      "resources.arsc", &contents));
 
-    ResTable::Theme theme(table);
-    ASSERT_EQ(NO_ERROR, theme.applyStyle(lib::R::style::Theme));
+  ResTable table;
+  ASSERT_EQ(NO_ERROR, table.add(contents.data(), contents.size()));
 
-    Res_value val;
-    uint32_t specFlags = 0;
-    ssize_t index = theme.getAttribute(lib::R::attr::attr1, &val, &specFlags);
-    ASSERT_GE(index, 0);
-    ASSERT_EQ(Res_value::TYPE_INT_DEC, val.dataType);
-    ASSERT_EQ(uint32_t(700), val.data);
+  ResTable::Theme theme(table);
+  ASSERT_EQ(NO_ERROR, theme.applyStyle(lib::R::style::Theme));
 
-    index = theme.getAttribute(lib::R::attr::attr2, &val, &specFlags);
-    ASSERT_GE(index, 0);
-    ASSERT_EQ(Res_value::TYPE_INT_DEC, val.dataType);
-    ASSERT_EQ(uint32_t(700), val.data);
+  Res_value val;
+  uint32_t specFlags = 0;
+  ssize_t index = theme.getAttribute(lib::R::attr::attr1, &val, &specFlags);
+  ASSERT_GE(index, 0);
+  ASSERT_EQ(Res_value::TYPE_INT_DEC, val.dataType);
+  ASSERT_EQ(uint32_t(700), val.data);
+
+  index = theme.getAttribute(lib::R::attr::attr2, &val, &specFlags);
+  ASSERT_GE(index, 0);
+  ASSERT_EQ(Res_value::TYPE_INT_DEC, val.dataType);
+  ASSERT_EQ(uint32_t(700), val.data);
 }
 
-TEST(ResTableTest, referenceToBagIsNotResolved) {
-    ResTable table;
-    ASSERT_EQ(NO_ERROR, table.add(basic_arsc, basic_arsc_len));
+TEST(ResTableTest, ReferenceToBagIsNotResolved) {
+  std::string contents;
+  ASSERT_TRUE(ReadFileFromZipToString(GetTestDataPath() + "/basic/basic.apk",
+                                      "resources.arsc", &contents));
 
-    Res_value val;
-    ssize_t block = table.getResource(base::R::integer::number2, &val, MAY_NOT_BE_BAG);
-    ASSERT_GE(block, 0);
-    ASSERT_EQ(Res_value::TYPE_REFERENCE, val.dataType);
-    ASSERT_EQ(base::R::array::integerArray1, val.data);
+  ResTable table;
+  ASSERT_EQ(NO_ERROR, table.add(contents.data(), contents.size()));
 
-    ssize_t newBlock = table.resolveReference(&val, block);
-    EXPECT_EQ(block, newBlock);
-    EXPECT_EQ(Res_value::TYPE_REFERENCE, val.dataType);
-    EXPECT_EQ(base::R::array::integerArray1, val.data);
+  Res_value val;
+  ssize_t block =
+      table.getResource(basic::R::integer::number2, &val, MAY_NOT_BE_BAG);
+  ASSERT_GE(block, 0);
+  ASSERT_EQ(Res_value::TYPE_REFERENCE, val.dataType);
+  ASSERT_EQ(basic::R::array::integerArray1, val.data);
+
+  ssize_t newBlock = table.resolveReference(&val, block);
+  EXPECT_EQ(block, newBlock);
+  EXPECT_EQ(Res_value::TYPE_REFERENCE, val.dataType);
+  EXPECT_EQ(basic::R::array::integerArray1, val.data);
 }
 
-TEST(ResTableTest, resourcesStillAccessibleAfterParameterChange) {
-    ResTable table;
-    ASSERT_EQ(NO_ERROR, table.add(basic_arsc, basic_arsc_len));
+TEST(ResTableTest, ResourcesStillAccessibleAfterParameterChange) {
+  std::string contents;
+  ASSERT_TRUE(ReadFileFromZipToString(GetTestDataPath() + "/basic/basic.apk",
+                                      "resources.arsc", &contents));
 
-    Res_value val;
-    ssize_t block = table.getResource(base::R::integer::number1, &val, MAY_NOT_BE_BAG);
-    ASSERT_GE(block, 0);
-    ASSERT_EQ(Res_value::TYPE_INT_DEC, val.dataType);
+  ResTable table;
+  ASSERT_EQ(NO_ERROR, table.add(contents.data(), contents.size()));
 
-    const ResTable::bag_entry* entry;
-    ssize_t count = table.lockBag(base::R::array::integerArray1, &entry);
-    ASSERT_GE(count, 0);
-    table.unlockBag(entry);
+  Res_value val;
+  ssize_t block =
+      table.getResource(basic::R::integer::number1, &val, MAY_NOT_BE_BAG);
+  ASSERT_GE(block, 0);
+  ASSERT_EQ(Res_value::TYPE_INT_DEC, val.dataType);
 
-    ResTable_config param;
-    memset(&param, 0, sizeof(param));
-    param.density = 320;
-    table.setParameters(&param);
+  const ResTable::bag_entry* entry;
+  ssize_t count = table.lockBag(basic::R::array::integerArray1, &entry);
+  ASSERT_GE(count, 0);
+  table.unlockBag(entry);
 
-    block = table.getResource(base::R::integer::number1, &val, MAY_NOT_BE_BAG);
-    ASSERT_GE(block, 0);
-    ASSERT_EQ(Res_value::TYPE_INT_DEC, val.dataType);
+  ResTable_config param;
+  memset(&param, 0, sizeof(param));
+  param.density = 320;
+  table.setParameters(&param);
 
-    count = table.lockBag(base::R::array::integerArray1, &entry);
-    ASSERT_GE(count, 0);
-    table.unlockBag(entry);
+  block = table.getResource(basic::R::integer::number1, &val, MAY_NOT_BE_BAG);
+  ASSERT_GE(block, 0);
+  ASSERT_EQ(Res_value::TYPE_INT_DEC, val.dataType);
+
+  count = table.lockBag(basic::R::array::integerArray1, &entry);
+  ASSERT_GE(count, 0);
+  table.unlockBag(entry);
 }
 
-TEST(ResTableTest, resourceIsOverridenWithBetterConfig) {
-    ResTable table;
-    ASSERT_EQ(NO_ERROR, table.add(basic_arsc, basic_arsc_len));
+TEST(ResTableTest, ResourceIsOverridenWithBetterConfig) {
+  std::string contents;
+  ASSERT_TRUE(ReadFileFromZipToString(GetTestDataPath() + "/basic/basic.apk",
+                                      "resources.arsc", &contents));
 
-    Res_value val;
-    ssize_t block = table.getResource(base::R::integer::number1, &val, MAY_NOT_BE_BAG);
-    ASSERT_GE(block, 0);
-    ASSERT_EQ(Res_value::TYPE_INT_DEC, val.dataType);
-    ASSERT_EQ(uint32_t(200), val.data);
+  ResTable table;
+  ASSERT_EQ(NO_ERROR, table.add(contents.data(), contents.size()));
 
-    ResTable_config param;
-    memset(&param, 0, sizeof(param));
-    param.language[0] = 's';
-    param.language[1] = 'v';
-    param.country[0] = 'S';
-    param.country[1] = 'E';
-    table.setParameters(&param);
+  Res_value val;
+  ssize_t block =
+      table.getResource(basic::R::integer::number1, &val, MAY_NOT_BE_BAG);
+  ASSERT_GE(block, 0);
+  ASSERT_EQ(Res_value::TYPE_INT_DEC, val.dataType);
+  ASSERT_EQ(uint32_t(200), val.data);
 
-    block = table.getResource(base::R::integer::number1, &val, MAY_NOT_BE_BAG);
-    ASSERT_GE(block, 0);
-    ASSERT_EQ(Res_value::TYPE_INT_DEC, val.dataType);
-    ASSERT_EQ(uint32_t(400), val.data);
+  ResTable_config param;
+  memset(&param, 0, sizeof(param));
+  param.language[0] = 's';
+  param.language[1] = 'v';
+  param.country[0] = 'S';
+  param.country[1] = 'E';
+  table.setParameters(&param);
+
+  block = table.getResource(basic::R::integer::number1, &val, MAY_NOT_BE_BAG);
+  ASSERT_GE(block, 0);
+  ASSERT_EQ(Res_value::TYPE_INT_DEC, val.dataType);
+  ASSERT_EQ(uint32_t(400), val.data);
 }
 
 TEST(ResTableTest, emptyTableHasSensibleDefaults) {
-    const int32_t assetCookie = 1;
+  const int32_t assetCookie = 1;
 
-    ResTable table;
-    ASSERT_EQ(NO_ERROR, table.addEmpty(assetCookie));
+  ResTable table;
+  ASSERT_EQ(NO_ERROR, table.addEmpty(assetCookie));
 
-    // Adding an empty table gives us one table!
-    ASSERT_EQ(uint32_t(1), table.getTableCount());
+  // Adding an empty table gives us one table!
+  ASSERT_EQ(uint32_t(1), table.getTableCount());
 
-    // Adding an empty table doesn't mean we get packages.
-    ASSERT_EQ(uint32_t(0), table.getBasePackageCount());
+  // Adding an empty table doesn't mean we get packages.
+  ASSERT_EQ(uint32_t(0), table.getBasePackageCount());
 
-    Res_value val;
-    ASSERT_LT(table.getResource(base::R::integer::number1, &val, MAY_NOT_BE_BAG), 0);
+  Res_value val;
+  ASSERT_LT(table.getResource(basic::R::integer::number1, &val, MAY_NOT_BE_BAG),
+            0);
 }
 
 void testU16StringToInt(const char16_t* str, uint32_t expectedValue,
                         bool expectSuccess, bool expectHex) {
-    size_t len = std::char_traits<char16_t>::length(str);
+  size_t len = std::char_traits<char16_t>::length(str);
 
-    // Gtest can't print UTF-16 strings, so we have to convert to UTF-8 :(
-    std::wstring_convert<std::codecvt_utf8_utf16<char16_t>, char16_t> convert;
-    std::string s = convert.to_bytes(std::u16string(str, len));
+  // Gtest can't print UTF-16 strings, so we have to convert to UTF-8 :(
+  std::wstring_convert<std::codecvt_utf8_utf16<char16_t>, char16_t> convert;
+  std::string s = convert.to_bytes(std::u16string(str, len));
 
-    Res_value out = {};
-    ASSERT_EQ(expectSuccess, U16StringToInt(str, len, &out))
-        << "Failed with " << s;
+  Res_value out = {};
+  ASSERT_EQ(expectSuccess, U16StringToInt(str, len, &out)) << "Failed with "
+                                                           << s;
 
-    if (!expectSuccess) {
-        ASSERT_EQ(out.TYPE_NULL, out.dataType) << "Failed with " << s;
-        return;
-    }
+  if (!expectSuccess) {
+    ASSERT_EQ(out.TYPE_NULL, out.dataType) << "Failed with " << s;
+    return;
+  }
 
-    if (expectHex) {
-        ASSERT_EQ(out.TYPE_INT_HEX, out.dataType) << "Failed with " << s;
-    } else {
-        ASSERT_EQ(out.TYPE_INT_DEC, out.dataType) << "Failed with " << s;
-    }
+  if (expectHex) {
+    ASSERT_EQ(out.TYPE_INT_HEX, out.dataType) << "Failed with " << s;
+  } else {
+    ASSERT_EQ(out.TYPE_INT_DEC, out.dataType) << "Failed with " << s;
+  }
 
-    ASSERT_EQ(expectedValue, out.data) << "Failed with " << s;
+  ASSERT_EQ(expectedValue, out.data) << "Failed with " << s;
 }
 
 TEST(ResTableTest, U16StringToInt) {
-    testU16StringToInt(u"", 0U, false, false);
-    testU16StringToInt(u"    ", 0U, false, false);
-    testU16StringToInt(u"\t\n", 0U, false, false);
+  testU16StringToInt(u"", 0U, false, false);
+  testU16StringToInt(u"    ", 0U, false, false);
+  testU16StringToInt(u"\t\n", 0U, false, false);
 
-    testU16StringToInt(u"abcd", 0U, false, false);
-    testU16StringToInt(u"10abcd", 0U, false, false);
-    testU16StringToInt(u"42 42", 0U, false, false);
-    testU16StringToInt(u"- 42", 0U, false, false);
-    testU16StringToInt(u"-", 0U, false, false);
+  testU16StringToInt(u"abcd", 0U, false, false);
+  testU16StringToInt(u"10abcd", 0U, false, false);
+  testU16StringToInt(u"42 42", 0U, false, false);
+  testU16StringToInt(u"- 42", 0U, false, false);
+  testU16StringToInt(u"-", 0U, false, false);
 
-    testU16StringToInt(u"0x", 0U, false, true);
-    testU16StringToInt(u"0xnope", 0U, false, true);
-    testU16StringToInt(u"0X42", 0U, false, true);
-    testU16StringToInt(u"0x42 0x42", 0U, false, true);
-    testU16StringToInt(u"-0x0", 0U, false, true);
-    testU16StringToInt(u"-0x42", 0U, false, true);
-    testU16StringToInt(u"- 0x42", 0U, false, true);
+  testU16StringToInt(u"0x", 0U, false, true);
+  testU16StringToInt(u"0xnope", 0U, false, true);
+  testU16StringToInt(u"0X42", 0U, false, true);
+  testU16StringToInt(u"0x42 0x42", 0U, false, true);
+  testU16StringToInt(u"-0x0", 0U, false, true);
+  testU16StringToInt(u"-0x42", 0U, false, true);
+  testU16StringToInt(u"- 0x42", 0U, false, true);
 
-    // Note that u" 42" would pass. This preserves the old behavior, but it may
-    // not be desired.
-    testU16StringToInt(u"42 ", 0U, false, false);
-    testU16StringToInt(u"0x42 ", 0U, false, true);
+  // Note that u" 42" would pass. This preserves the old behavior, but it may
+  // not be desired.
+  testU16StringToInt(u"42 ", 0U, false, false);
+  testU16StringToInt(u"0x42 ", 0U, false, true);
 
-    // Decimal cases.
-    testU16StringToInt(u"0", 0U, true, false);
-    testU16StringToInt(u"-0", 0U, true, false);
-    testU16StringToInt(u"42", 42U, true, false);
-    testU16StringToInt(u" 42", 42U, true, false);
-    testU16StringToInt(u"-42", static_cast<uint32_t>(-42), true, false);
-    testU16StringToInt(u" -42", static_cast<uint32_t>(-42), true, false);
-    testU16StringToInt(u"042", 42U, true, false);
-    testU16StringToInt(u"-042", static_cast<uint32_t>(-42), true, false);
+  // Decimal cases.
+  testU16StringToInt(u"0", 0U, true, false);
+  testU16StringToInt(u"-0", 0U, true, false);
+  testU16StringToInt(u"42", 42U, true, false);
+  testU16StringToInt(u" 42", 42U, true, false);
+  testU16StringToInt(u"-42", static_cast<uint32_t>(-42), true, false);
+  testU16StringToInt(u" -42", static_cast<uint32_t>(-42), true, false);
+  testU16StringToInt(u"042", 42U, true, false);
+  testU16StringToInt(u"-042", static_cast<uint32_t>(-42), true, false);
 
-    // Hex cases.
-    testU16StringToInt(u"0x0", 0x0, true, true);
-    testU16StringToInt(u"0x42", 0x42, true, true);
-    testU16StringToInt(u" 0x42", 0x42, true, true);
+  // Hex cases.
+  testU16StringToInt(u"0x0", 0x0, true, true);
+  testU16StringToInt(u"0x42", 0x42, true, true);
+  testU16StringToInt(u" 0x42", 0x42, true, true);
 
-    // Just before overflow cases:
-    testU16StringToInt(u"2147483647", INT_MAX, true, false);
-    testU16StringToInt(u"-2147483648", static_cast<uint32_t>(INT_MIN), true,
-                       false);
-    testU16StringToInt(u"0xffffffff", UINT_MAX, true, true);
+  // Just before overflow cases:
+  testU16StringToInt(u"2147483647", INT_MAX, true, false);
+  testU16StringToInt(u"-2147483648", static_cast<uint32_t>(INT_MIN), true,
+                     false);
+  testU16StringToInt(u"0xffffffff", UINT_MAX, true, true);
 
-    // Overflow cases:
-    testU16StringToInt(u"2147483648", 0U, false, false);
-    testU16StringToInt(u"-2147483649", 0U, false, false);
-    testU16StringToInt(u"0x1ffffffff", 0U, false, true);
+  // Overflow cases:
+  testU16StringToInt(u"2147483648", 0U, false, false);
+  testU16StringToInt(u"-2147483649", 0U, false, false);
+  testU16StringToInt(u"0x1ffffffff", 0U, false, true);
 }
 
 TEST(ResTableTest, ShareButDontModifyResTable) {
-    ResTable sharedTable;
-    ASSERT_EQ(NO_ERROR, sharedTable.add(basic_arsc, basic_arsc_len));
+  std::string contents;
+  ASSERT_TRUE(ReadFileFromZipToString(GetTestDataPath() + "/basic/basic.apk",
+                                      "resources.arsc", &contents));
 
-    ResTable_config param;
-    memset(&param, 0, sizeof(param));
-    param.language[0] = 'v';
-    param.language[1] = 's';
-    sharedTable.setParameters(&param);
+  ResTable sharedTable;
+  ASSERT_EQ(NO_ERROR, sharedTable.add(contents.data(), contents.size()));
 
-    // Check that we get the default value for @integer:number1
-    Res_value val;
-    ssize_t block = sharedTable.getResource(base::R::integer::number1, &val, MAY_NOT_BE_BAG);
-    ASSERT_GE(block, 0);
-    ASSERT_EQ(Res_value::TYPE_INT_DEC, val.dataType);
-    ASSERT_EQ(uint32_t(600), val.data);
+  ResTable_config param;
+  memset(&param, 0, sizeof(param));
+  param.language[0] = 'v';
+  param.language[1] = 's';
+  sharedTable.setParameters(&param);
 
-    // Create a new table that shares the entries of the shared table.
-    ResTable table;
-    ASSERT_EQ(NO_ERROR, table.add(&sharedTable, false));
+  // Check that we get the default value for @integer:number1
+  Res_value val;
+  ssize_t block =
+      sharedTable.getResource(basic::R::integer::number1, &val, MAY_NOT_BE_BAG);
+  ASSERT_GE(block, 0);
+  ASSERT_EQ(Res_value::TYPE_INT_DEC, val.dataType);
+  ASSERT_EQ(uint32_t(600), val.data);
 
-    // Set a new configuration on the new table.
-    memset(&param, 0, sizeof(param));
-    param.language[0] = 's';
-    param.language[1] = 'v';
-    param.country[0] = 'S';
-    param.country[1] = 'E';
-    table.setParameters(&param);
+  // Create a new table that shares the entries of the shared table.
+  ResTable table;
+  ASSERT_EQ(NO_ERROR, table.add(&sharedTable, false));
 
-    // Check that we get a new value in the new table.
-    block = table.getResource(base::R::integer::number1, &val, MAY_NOT_BE_BAG);
-    ASSERT_GE(block, 0);
-    ASSERT_EQ(Res_value::TYPE_INT_DEC, val.dataType);
-    ASSERT_EQ(uint32_t(400), val.data);
+  // Set a new configuration on the new table.
+  memset(&param, 0, sizeof(param));
+  param.language[0] = 's';
+  param.language[1] = 'v';
+  param.country[0] = 'S';
+  param.country[1] = 'E';
+  table.setParameters(&param);
 
-    // Check that we still get the old value in the shared table.
-    block = sharedTable.getResource(base::R::integer::number1, &val, MAY_NOT_BE_BAG);
-    ASSERT_GE(block, 0);
-    ASSERT_EQ(Res_value::TYPE_INT_DEC, val.dataType);
-    ASSERT_EQ(uint32_t(600), val.data);
+  // Check that we get a new value in the new table.
+  block = table.getResource(basic::R::integer::number1, &val, MAY_NOT_BE_BAG);
+  ASSERT_GE(block, 0);
+  ASSERT_EQ(Res_value::TYPE_INT_DEC, val.dataType);
+  ASSERT_EQ(uint32_t(400), val.data);
+
+  // Check that we still get the old value in the shared table.
+  block =
+      sharedTable.getResource(basic::R::integer::number1, &val, MAY_NOT_BE_BAG);
+  ASSERT_GE(block, 0);
+  ASSERT_EQ(Res_value::TYPE_INT_DEC, val.dataType);
+  ASSERT_EQ(uint32_t(600), val.data);
 }
 
 TEST(ResTableTest, GetConfigurationsReturnsUniqueList) {
-    ResTable table;
-    ASSERT_EQ(NO_ERROR, table.add(system_arsc, system_arsc_len));
-    ASSERT_EQ(NO_ERROR, table.add(basic_arsc, basic_arsc_len));
+  std::string contents;
+  ASSERT_TRUE(ReadFileFromZipToString(GetTestDataPath() + "/basic/basic.apk",
+                                      "resources.arsc", &contents));
 
-    ResTable_config configSv;
-    memset(&configSv, 0, sizeof(configSv));
-    configSv.language[0] = 's';
-    configSv.language[1] = 'v';
+  std::string system_contents;
+  ASSERT_TRUE(ReadFileFromZipToString(GetTestDataPath() + "/system/system.apk",
+                                      "resources.arsc", &system_contents));
 
-    Vector<ResTable_config> configs;
-    table.getConfigurations(&configs);
+  ResTable table;
+  ASSERT_EQ(NO_ERROR,
+            table.add(system_contents.data(), system_contents.size()));
+  ASSERT_EQ(NO_ERROR, table.add(contents.data(), contents.size()));
 
-    EXPECT_EQ(1, std::count(configs.begin(), configs.end(), configSv));
+  ResTable_config configSv;
+  memset(&configSv, 0, sizeof(configSv));
+  configSv.language[0] = 's';
+  configSv.language[1] = 'v';
 
-    Vector<String8> locales;
-    table.getLocales(&locales);
+  Vector<ResTable_config> configs;
+  table.getConfigurations(&configs);
 
-    EXPECT_EQ(1, std::count(locales.begin(), locales.end(), String8("sv")));
+  EXPECT_EQ(1, std::count(configs.begin(), configs.end(), configSv));
+
+  Vector<String8> locales;
+  table.getLocales(&locales);
+
+  EXPECT_EQ(1, std::count(locales.begin(), locales.end(), String8("sv")));
 }
 
-} // namespace
+}  // namespace android
diff --git a/libs/androidfw/tests/Split_test.cpp b/libs/androidfw/tests/Split_test.cpp
index b69d685..1f207e2 100644
--- a/libs/androidfw/tests/Split_test.cpp
+++ b/libs/androidfw/tests/Split_test.cpp
@@ -14,233 +14,254 @@
  * limitations under the License.
  */
 
-#include <androidfw/ResourceTypes.h>
+#include "androidfw/ResourceTypes.h"
 
-#include <utils/String8.h>
-#include <utils/String16.h>
+#include "utils/String16.h"
+#include "utils/String8.h"
+
 #include "TestHelpers.h"
 #include "data/basic/R.h"
 
-#include <gtest/gtest.h>
+using com::android::basic::R;
 
-using namespace android;
+namespace android {
 
-namespace {
-
-/**
- * Include a binary resource table. This table
- * is a base table for an APK split.
- *
- * Package: com.android.test.basic
- */
-#include "data/basic/basic_arsc.h"
-
-/**
- * Include a binary resource table. This table
- * is a configuration split table for an APK split.
- *
- * Package: com.android.test.basic
- */
-#include "data/basic/split_de_fr_arsc.h"
-#include "data/basic/split_hdpi_v4_arsc.h"
-#include "data/basic/split_xhdpi_v4_arsc.h"
-#include "data/basic/split_xxhdpi_v4_arsc.h"
-
-/**
- * Include a binary resource table. This table
- * is a feature split table for an APK split.
- *
- * Package: com.android.test.basic
- */
-#include "data/feature/feature_arsc.h"
-
-enum { MAY_NOT_BE_BAG = false };
-
-void makeConfigFrench(ResTable_config* config) {
-    memset(config, 0, sizeof(*config));
-    config->language[0] = 'f';
-    config->language[1] = 'r';
+static void makeConfigFrench(ResTable_config* config) {
+  memset(config, 0, sizeof(*config));
+  config->language[0] = 'f';
+  config->language[1] = 'r';
 }
 
-TEST(SplitTest, TestLoadBase) {
-    ResTable table;
-    ASSERT_EQ(NO_ERROR, table.add(basic_arsc, basic_arsc_len));
+class SplitTest : public ::testing::Test {
+ public:
+  void SetUp() override {
+    ASSERT_TRUE(ReadFileFromZipToString(GetTestDataPath() + "/basic/basic.apk",
+                                        "resources.arsc", &basic_contents_));
+    ASSERT_TRUE(
+        ReadFileFromZipToString(GetTestDataPath() + "/basic/basic_de_fr.apk",
+                                "resources.arsc", &basic_de_fr_contents_));
+    ASSERT_TRUE(
+        ReadFileFromZipToString(GetTestDataPath() + "/basic/basic_hdpi-v4.apk",
+                                "resources.arsc", &basic_hdpi_contents_));
+    ASSERT_TRUE(
+        ReadFileFromZipToString(GetTestDataPath() + "/basic/basic_xhdpi-v4.apk",
+                                "resources.arsc", &basic_xhdpi_contents_));
+    ASSERT_TRUE(ReadFileFromZipToString(
+        GetTestDataPath() + "/basic/basic_xxhdpi-v4.apk", "resources.arsc",
+        &basic_xxhdpi_contents_));
+    ASSERT_TRUE(
+        ReadFileFromZipToString(GetTestDataPath() + "/feature/feature.apk",
+                                "resources.arsc", &feature_contents_));
+  }
+
+ protected:
+  std::string basic_contents_;
+  std::string basic_de_fr_contents_;
+  std::string basic_hdpi_contents_;
+  std::string basic_xhdpi_contents_;
+  std::string basic_xxhdpi_contents_;
+  std::string feature_contents_;
+};
+
+TEST_F(SplitTest, TestLoadBase) {
+  ResTable table;
+  ASSERT_EQ(NO_ERROR,
+            table.add(basic_contents_.data(), basic_contents_.size()));
 }
 
-TEST(SplitTest, TestGetResourceFromBase) {
-    ResTable_config frenchConfig;
-    makeConfigFrench(&frenchConfig);
+TEST_F(SplitTest, TestGetResourceFromBase) {
+  ResTable_config frenchConfig;
+  makeConfigFrench(&frenchConfig);
 
-    ResTable table;
-    table.setParameters(&frenchConfig);
+  ResTable table;
+  table.setParameters(&frenchConfig);
 
-    ASSERT_EQ(NO_ERROR, table.add(basic_arsc, basic_arsc_len));
+  ASSERT_EQ(NO_ERROR,
+            table.add(basic_contents_.data(), basic_contents_.size()));
 
-    ResTable_config expectedConfig;
-    memset(&expectedConfig, 0, sizeof(expectedConfig));
+  ResTable_config expectedConfig;
+  memset(&expectedConfig, 0, sizeof(expectedConfig));
 
-    Res_value val;
-    ResTable_config config;
-    ssize_t block = table.getResource(base::R::string::test1, &val, MAY_NOT_BE_BAG, 0, NULL, &config);
+  Res_value val;
+  ResTable_config config;
+  ssize_t block = table.getResource(R::string::test1, &val, MAY_NOT_BE_BAG, 0,
+                                    NULL, &config);
 
-    // The returned block should tell us which string pool to get the value, if it is a string.
-    EXPECT_GE(block, 0);
+  // The returned block should tell us which string pool to get the value, if it
+  // is a string.
+  EXPECT_GE(block, 0);
 
-    // We expect the default resource to be selected since it is the only resource configuration.
-    EXPECT_EQ(0, expectedConfig.compare(config));
+  // We expect the default resource to be selected since it is the only resource
+  // configuration.
+  EXPECT_EQ(0, expectedConfig.compare(config));
 
-    EXPECT_EQ(Res_value::TYPE_STRING, val.dataType);
+  EXPECT_EQ(Res_value::TYPE_STRING, val.dataType);
 }
 
-TEST(SplitTest, TestGetResourceFromSplit) {
-    ResTable_config expectedConfig;
-    makeConfigFrench(&expectedConfig);
+TEST_F(SplitTest, TestGetResourceFromSplit) {
+  ResTable_config expectedConfig;
+  makeConfigFrench(&expectedConfig);
 
-    ResTable table;
-    table.setParameters(&expectedConfig);
+  ResTable table;
+  table.setParameters(&expectedConfig);
 
-    ASSERT_EQ(NO_ERROR, table.add(basic_arsc, basic_arsc_len));
-    ASSERT_EQ(NO_ERROR, table.add(split_de_fr_arsc, split_de_fr_arsc_len));
+  ASSERT_EQ(NO_ERROR,
+            table.add(basic_contents_.data(), basic_contents_.size()));
+  ASSERT_EQ(NO_ERROR, table.add(basic_de_fr_contents_.data(),
+                                basic_de_fr_contents_.size()));
 
-    Res_value val;
-    ResTable_config config;
-    ssize_t block = table.getResource(base::R::string::test1, &val, MAY_NOT_BE_BAG, 0, NULL, &config);
+  Res_value val;
+  ResTable_config config;
+  ssize_t block = table.getResource(R::string::test1, &val, MAY_NOT_BE_BAG, 0,
+                                    NULL, &config);
 
-    EXPECT_GE(block, 0);
+  EXPECT_GE(block, 0);
 
-    EXPECT_EQ(0, expectedConfig.compare(config));
+  EXPECT_EQ(0, expectedConfig.compare(config));
 
-    EXPECT_EQ(Res_value::TYPE_STRING, val.dataType);
+  EXPECT_EQ(Res_value::TYPE_STRING, val.dataType);
 }
 
-TEST(SplitTest, ResourcesFromBaseAndSplitHaveSameNames) {
-    ResTable_config expectedConfig;
-    makeConfigFrench(&expectedConfig);
+TEST_F(SplitTest, ResourcesFromBaseAndSplitHaveSameNames) {
+  ResTable_config expectedConfig;
+  makeConfigFrench(&expectedConfig);
 
-    ResTable table;
-    table.setParameters(&expectedConfig);
+  ResTable table;
+  table.setParameters(&expectedConfig);
 
-    ASSERT_EQ(NO_ERROR, table.add(basic_arsc, basic_arsc_len));
+  ASSERT_EQ(NO_ERROR,
+            table.add(basic_contents_.data(), basic_contents_.size()));
 
-    ResTable::resource_name baseName;
-    EXPECT_TRUE(table.getResourceName(base::R::string::test1, false, &baseName));
+  ResTable::resource_name baseName;
+  EXPECT_TRUE(table.getResourceName(R::string::test1, false, &baseName));
 
-    ASSERT_EQ(NO_ERROR, table.add(split_de_fr_arsc, split_de_fr_arsc_len));
+  ASSERT_EQ(NO_ERROR, table.add(basic_de_fr_contents_.data(),
+                                basic_de_fr_contents_.size()));
 
-    ResTable::resource_name frName;
-    EXPECT_TRUE(table.getResourceName(base::R::string::test1, false, &frName));
+  ResTable::resource_name frName;
+  EXPECT_TRUE(table.getResourceName(R::string::test1, false, &frName));
 
-    EXPECT_EQ(
-            String16(baseName.package, baseName.packageLen),
+  EXPECT_EQ(String16(baseName.package, baseName.packageLen),
             String16(frName.package, frName.packageLen));
 
-    EXPECT_EQ(
-            String16(baseName.type, baseName.typeLen),
+  EXPECT_EQ(String16(baseName.type, baseName.typeLen),
             String16(frName.type, frName.typeLen));
 
-    EXPECT_EQ(
-            String16(baseName.name, baseName.nameLen),
+  EXPECT_EQ(String16(baseName.name, baseName.nameLen),
             String16(frName.name, frName.nameLen));
 }
 
-TEST(SplitTest, TypeEntrySpecFlagsAreUpdated) {
-    ResTable_config defaultConfig;
-    memset(&defaultConfig, 0, sizeof(defaultConfig));
+TEST_F(SplitTest, TypeEntrySpecFlagsAreUpdated) {
+  ResTable_config defaultConfig;
+  memset(&defaultConfig, 0, sizeof(defaultConfig));
 
-    ResTable table;
-    ASSERT_EQ(NO_ERROR, table.add(basic_arsc, basic_arsc_len));
+  ResTable table;
+  ASSERT_EQ(NO_ERROR,
+            table.add(basic_contents_.data(), basic_contents_.size()));
 
-    Res_value val;
-    uint32_t specFlags = 0;
-    ssize_t block = table.getResource(base::R::string::test1, &val, MAY_NOT_BE_BAG, 0, &specFlags, NULL);
-    EXPECT_GE(block, 0);
+  Res_value val;
+  uint32_t specFlags = 0;
+  ssize_t block = table.getResource(R::string::test1, &val, MAY_NOT_BE_BAG, 0,
+                                    &specFlags, NULL);
+  EXPECT_GE(block, 0);
 
-    EXPECT_EQ(static_cast<uint32_t>(0), specFlags);
+  EXPECT_EQ(static_cast<uint32_t>(0), specFlags);
 
-    ASSERT_EQ(NO_ERROR, table.add(split_de_fr_arsc, split_de_fr_arsc_len));
+  ASSERT_EQ(NO_ERROR, table.add(basic_de_fr_contents_.data(),
+                                basic_de_fr_contents_.size()));
 
-    uint32_t frSpecFlags = 0;
-    block = table.getResource(base::R::string::test1, &val, MAY_NOT_BE_BAG, 0, &frSpecFlags, NULL);
-    EXPECT_GE(block, 0);
+  uint32_t frSpecFlags = 0;
+  block = table.getResource(R::string::test1, &val, MAY_NOT_BE_BAG, 0,
+                            &frSpecFlags, NULL);
+  EXPECT_GE(block, 0);
 
-    EXPECT_EQ(ResTable_config::CONFIG_LOCALE, frSpecFlags);
+  EXPECT_EQ(ResTable_config::CONFIG_LOCALE, frSpecFlags);
 }
 
-TEST(SplitTest, SelectBestDensity) {
-    ResTable_config baseConfig;
-    memset(&baseConfig, 0, sizeof(baseConfig));
-    baseConfig.density = ResTable_config::DENSITY_XHIGH;
-    baseConfig.sdkVersion = 21;
+TEST_F(SplitTest, SelectBestDensity) {
+  ResTable_config baseConfig;
+  memset(&baseConfig, 0, sizeof(baseConfig));
+  baseConfig.density = ResTable_config::DENSITY_XHIGH;
+  baseConfig.sdkVersion = 21;
 
-    ResTable table;
-    table.setParameters(&baseConfig);
-    ASSERT_EQ(NO_ERROR, table.add(basic_arsc, basic_arsc_len));
-    ASSERT_EQ(NO_ERROR, table.add(split_hdpi_v4_arsc, split_hdpi_v4_arsc_len));
+  ResTable table;
+  table.setParameters(&baseConfig);
+  ASSERT_EQ(NO_ERROR,
+            table.add(basic_contents_.data(), basic_contents_.size()));
+  ASSERT_EQ(NO_ERROR, table.add(basic_hdpi_contents_.data(),
+                                basic_hdpi_contents_.size()));
 
-    EXPECT_TRUE(IsStringEqual(table, base::R::string::density, "hdpi"));
+  EXPECT_TRUE(IsStringEqual(table, R::string::density, "hdpi"));
 
-    ASSERT_EQ(NO_ERROR, table.add(split_xhdpi_v4_arsc, split_xhdpi_v4_arsc_len));
+  ASSERT_EQ(NO_ERROR, table.add(basic_xhdpi_contents_.data(),
+                                basic_xhdpi_contents_.size()));
 
-    EXPECT_TRUE(IsStringEqual(table, base::R::string::density, "xhdpi"));
+  EXPECT_TRUE(IsStringEqual(table, R::string::density, "xhdpi"));
 
-    ASSERT_EQ(NO_ERROR, table.add(split_xxhdpi_v4_arsc, split_xxhdpi_v4_arsc_len));
+  ASSERT_EQ(NO_ERROR, table.add(basic_xxhdpi_contents_.data(),
+                                basic_xxhdpi_contents_.size()));
 
-    EXPECT_TRUE(IsStringEqual(table, base::R::string::density, "xhdpi"));
+  EXPECT_TRUE(IsStringEqual(table, R::string::density, "xhdpi"));
 
-    baseConfig.density = ResTable_config::DENSITY_XXHIGH;
-    table.setParameters(&baseConfig);
+  baseConfig.density = ResTable_config::DENSITY_XXHIGH;
+  table.setParameters(&baseConfig);
 
-    EXPECT_TRUE(IsStringEqual(table, base::R::string::density, "xxhdpi"));
+  EXPECT_TRUE(IsStringEqual(table, R::string::density, "xxhdpi"));
 }
 
-TEST(SplitFeatureTest, TestNewResourceIsAccessible) {
-    ResTable table;
-    ASSERT_EQ(NO_ERROR, table.add(basic_arsc, basic_arsc_len));
+TEST_F(SplitTest, TestNewResourceIsAccessible) {
+  ResTable table;
+  ASSERT_EQ(NO_ERROR,
+            table.add(basic_contents_.data(), basic_contents_.size()));
 
-    Res_value val;
-    ssize_t block = table.getResource(base::R::string::test3, &val, MAY_NOT_BE_BAG);
-    EXPECT_LT(block, 0);
+  Res_value val;
+  ssize_t block = table.getResource(R::string::test3, &val, MAY_NOT_BE_BAG);
+  EXPECT_LT(block, 0);
 
-    ASSERT_EQ(NO_ERROR, table.add(feature_arsc, feature_arsc_len));
+  ASSERT_EQ(NO_ERROR,
+            table.add(feature_contents_.data(), feature_contents_.size()));
 
-    block = table.getResource(base::R::string::test3, &val, MAY_NOT_BE_BAG);
-    EXPECT_GE(block, 0);
+  block = table.getResource(R::string::test3, &val, MAY_NOT_BE_BAG);
+  EXPECT_GE(block, 0);
 
-    EXPECT_EQ(Res_value::TYPE_STRING, val.dataType);
+  EXPECT_EQ(Res_value::TYPE_STRING, val.dataType);
 }
 
-TEST(SplitFeatureTest, TestNewResourceNameHasCorrectName) {
-    ResTable table;
-    ASSERT_EQ(NO_ERROR, table.add(basic_arsc, basic_arsc_len));
+TEST_F(SplitTest, TestNewResourceNameHasCorrectName) {
+  ResTable table;
+  ASSERT_EQ(NO_ERROR,
+            table.add(basic_contents_.data(), basic_contents_.size()));
 
-    ResTable::resource_name name;
-    EXPECT_FALSE(table.getResourceName(base::R::string::test3, false, &name));
+  ResTable::resource_name name;
+  EXPECT_FALSE(table.getResourceName(R::string::test3, false, &name));
 
-    ASSERT_EQ(NO_ERROR, table.add(feature_arsc, feature_arsc_len));
+  ASSERT_EQ(NO_ERROR,
+            table.add(feature_contents_.data(), feature_contents_.size()));
 
-    ASSERT_TRUE(table.getResourceName(base::R::string::test3, false, &name));
+  ASSERT_TRUE(table.getResourceName(R::string::test3, false, &name));
 
-    EXPECT_EQ(String16("com.android.test.basic"),
+  EXPECT_EQ(String16("com.android.basic"),
             String16(name.package, name.packageLen));
 
-    EXPECT_EQ(String16("string"),
-            String16(name.type, name.typeLen));
+  EXPECT_EQ(String16("string"), String16(name.type, name.typeLen));
 
-    EXPECT_EQ(String16("test3"),
-            String16(name.name, name.nameLen));
+  EXPECT_EQ(String16("test3"), String16(name.name, name.nameLen));
 }
 
-TEST(SplitFeatureTest, TestNewResourceIsAccessibleByName) {
-    ResTable table;
-    ASSERT_EQ(NO_ERROR, table.add(basic_arsc, basic_arsc_len));
-    ASSERT_EQ(NO_ERROR, table.add(feature_arsc, feature_arsc_len));
+TEST_F(SplitTest, TestNewResourceIsAccessibleByName) {
+  ResTable table;
+  ASSERT_EQ(NO_ERROR,
+            table.add(basic_contents_.data(), basic_contents_.size()));
+  ASSERT_EQ(NO_ERROR,
+            table.add(feature_contents_.data(), feature_contents_.size()));
 
-    const String16 name("test3");
-    const String16 type("string");
-    const String16 package("com.android.test.basic");
-    ASSERT_EQ(base::R::string::test3, table.identifierForName(name.string(), name.size(),
-                                                              type.string(), type.size(),
-                                                              package.string(), package.size()));
+  const String16 name("test3");
+  const String16 type("string");
+  const String16 package("com.android.basic");
+  ASSERT_EQ(
+      R::string::test3,
+      table.identifierForName(name.string(), name.size(), type.string(),
+                              type.size(), package.string(), package.size()));
 }
 
-} // namespace
+}  // namespace
diff --git a/libs/androidfw/tests/TestHelpers.cpp b/libs/androidfw/tests/TestHelpers.cpp
index 702ee5c..2c834b1 100644
--- a/libs/androidfw/tests/TestHelpers.cpp
+++ b/libs/androidfw/tests/TestHelpers.cpp
@@ -19,6 +19,7 @@
 #include <unistd.h>
 
 #include "android-base/logging.h"
+#include "ziparchive/zip_archive.h"
 
 namespace android {
 
@@ -31,8 +32,41 @@
   return sTestDataPath;
 }
 
-::testing::AssertionResult IsStringEqual(const ResTable& table,
-                                         uint32_t resource_id,
+::testing::AssertionResult ReadFileFromZipToString(const std::string& zip_path,
+                                                   const std::string& file,
+                                                   std::string* out_contents) {
+  out_contents->clear();
+  ::ZipArchiveHandle handle;
+  int32_t result = OpenArchive(zip_path.c_str(), &handle);
+  if (result != 0) {
+    return ::testing::AssertionFailure() << "Failed to open zip '" << zip_path
+                                         << "': " << ::ErrorCodeString(result);
+  }
+
+  ::ZipString name(file.c_str());
+  ::ZipEntry entry;
+  result = ::FindEntry(handle, name, &entry);
+  if (result != 0) {
+    ::CloseArchive(handle);
+    return ::testing::AssertionFailure() << "Could not find file '" << file << "' in zip '"
+                                         << zip_path << "' : " << ::ErrorCodeString(result);
+  }
+
+  out_contents->resize(entry.uncompressed_length);
+  result = ::ExtractToMemory(
+      handle, &entry, const_cast<uint8_t*>(reinterpret_cast<const uint8_t*>(out_contents->data())),
+      out_contents->size());
+  if (result != 0) {
+    ::CloseArchive(handle);
+    return ::testing::AssertionFailure() << "Failed to extract file '" << file << "' from zip '"
+                                         << zip_path << "': " << ::ErrorCodeString(result);
+  }
+
+  ::CloseArchive(handle);
+  return ::testing::AssertionSuccess();
+}
+
+::testing::AssertionResult IsStringEqual(const ResTable& table, uint32_t resource_id,
                                          const char* expected_str) {
   Res_value val;
   ssize_t block = table.getResource(resource_id, &val, MAY_NOT_BE_BAG);
@@ -46,8 +80,7 @@
 
   const ResStringPool* pool = table.getTableStringBlock(block);
   if (pool == NULL) {
-    return ::testing::AssertionFailure()
-           << "table has no string pool for block " << block;
+    return ::testing::AssertionFailure() << "table has no string pool for block " << block;
   }
 
   const String8 actual_str = pool->string8ObjectAt(val.data);
diff --git a/libs/androidfw/tests/TestHelpers.h b/libs/androidfw/tests/TestHelpers.h
index c1e349f..d9cee22 100644
--- a/libs/androidfw/tests/TestHelpers.h
+++ b/libs/androidfw/tests/TestHelpers.h
@@ -25,13 +25,11 @@
 #include "utils/String16.h"
 #include "utils/String8.h"
 
-static inline ::std::ostream& operator<<(::std::ostream& out,
-                                         const android::String8& str) {
+static inline ::std::ostream& operator<<(::std::ostream& out, const android::String8& str) {
   return out << str.string();
 }
 
-static inline ::std::ostream& operator<<(::std::ostream& out,
-                                         const android::String16& str) {
+static inline ::std::ostream& operator<<(::std::ostream& out, const android::String16& str) {
   return out << android::String8(str).string();
 }
 
@@ -43,18 +41,19 @@
 
 const std::string& GetTestDataPath();
 
-static inline bool operator==(const ResTable_config& a,
-                              const ResTable_config& b) {
+::testing::AssertionResult ReadFileFromZipToString(const std::string& zip_path,
+                                                   const std::string& file,
+                                                   std::string* out_contents);
+
+static inline bool operator==(const ResTable_config& a, const ResTable_config& b) {
   return a.compare(b) == 0;
 }
 
-static inline ::std::ostream& operator<<(::std::ostream& out,
-                                         const ResTable_config& c) {
+static inline ::std::ostream& operator<<(::std::ostream& out, const ResTable_config& c) {
   return out << c.toString().string();
 }
 
-::testing::AssertionResult IsStringEqual(const ResTable& table,
-                                         uint32_t resource_id,
+::testing::AssertionResult IsStringEqual(const ResTable& table, uint32_t resource_id,
                                          const char* expected_str);
 
 }  // namespace android
diff --git a/libs/androidfw/tests/Theme_test.cpp b/libs/androidfw/tests/Theme_test.cpp
index 4d07130..3774657 100644
--- a/libs/androidfw/tests/Theme_test.cpp
+++ b/libs/androidfw/tests/Theme_test.cpp
@@ -14,55 +14,59 @@
  * limitations under the License.
  */
 
-#include <androidfw/ResourceTypes.h>
+#include "androidfw/ResourceTypes.h"
 
-#include <utils/String8.h>
-#include <utils/String16.h>
+#include "utils/String16.h"
+#include "utils/String8.h"
+
 #include "TestHelpers.h"
-#include "data/system/R.h"
 #include "data/app/R.h"
+#include "data/system/R.h"
 
-#include <gtest/gtest.h>
+namespace app = com::android::app;
 
-using namespace android;
-
-namespace {
-
-#include "data/system/system_arsc.h"
-#include "data/app/app_arsc.h"
-
-enum { MAY_NOT_BE_BAG = false };
+namespace android {
 
 /**
  * TODO(adamlesinski): Enable when fixed.
  */
 TEST(ThemeTest, DISABLED_shouldCopyThemeFromDifferentResTable) {
-    ResTable table;
-    ASSERT_EQ(NO_ERROR, table.add(system_arsc, system_arsc_len));
-    ASSERT_EQ(NO_ERROR, table.add(app_arsc, app_arsc_len));
+  ResTable table;
 
-    ResTable::Theme theme1(table);
-    ASSERT_EQ(NO_ERROR, theme1.applyStyle(app::R::style::Theme_One));
-    Res_value val;
-    ASSERT_GE(theme1.getAttribute(android::R::attr::background, &val), 0);
-    ASSERT_EQ(Res_value::TYPE_INT_COLOR_RGB8, val.dataType);
-    ASSERT_EQ(uint32_t(0xffff0000), val.data);
-    ASSERT_GE(theme1.getAttribute(app::R::attr::number, &val), 0);
-    ASSERT_EQ(Res_value::TYPE_INT_DEC, val.dataType);
-    ASSERT_EQ(uint32_t(1), val.data);
+  std::string system_contents;
+  ASSERT_TRUE(ReadFileFromZipToString("/system/system.apk", "resources.arsc",
+                                      &system_contents));
+  ASSERT_EQ(NO_ERROR,
+            table.add(system_contents.data(), system_contents.size()));
 
-    ResTable table2;
-    ASSERT_EQ(NO_ERROR, table2.add(system_arsc, system_arsc_len));
-    ASSERT_EQ(NO_ERROR, table2.add(app_arsc, app_arsc_len));
+  std::string app_contents;
+  ASSERT_TRUE(ReadFileFromZipToString("/basic/basic.apk", "resources.arsc",
+                                      &app_contents));
+  ASSERT_EQ(NO_ERROR, table.add(app_contents.data(), app_contents.size()));
 
-    ResTable::Theme theme2(table2);
-    ASSERT_EQ(NO_ERROR, theme2.setTo(theme1));
-    ASSERT_GE(theme2.getAttribute(android::R::attr::background, &val), 0);
-    ASSERT_EQ(Res_value::TYPE_INT_COLOR_RGB8, val.dataType);
-    ASSERT_EQ(uint32_t(0xffff0000), val.data);
-    ASSERT_GE(theme2.getAttribute(app::R::attr::number, &val), 0);
-    ASSERT_EQ(Res_value::TYPE_INT_DEC, val.dataType);
-    ASSERT_EQ(uint32_t(1), val.data);
+  ResTable::Theme theme1(table);
+  ASSERT_EQ(NO_ERROR, theme1.applyStyle(app::R::style::Theme_One));
+  Res_value val;
+  ASSERT_GE(theme1.getAttribute(android::R::attr::background, &val), 0);
+  ASSERT_EQ(Res_value::TYPE_INT_COLOR_RGB8, val.dataType);
+  ASSERT_EQ(uint32_t(0xffff0000), val.data);
+  ASSERT_GE(theme1.getAttribute(app::R::attr::number, &val), 0);
+  ASSERT_EQ(Res_value::TYPE_INT_DEC, val.dataType);
+  ASSERT_EQ(uint32_t(1), val.data);
+
+  ResTable table2;
+  ASSERT_EQ(NO_ERROR,
+            table2.add(system_contents.data(), system_contents.size()));
+  ASSERT_EQ(NO_ERROR, table2.add(app_contents.data(), app_contents.size()));
+
+  ResTable::Theme theme2(table2);
+  ASSERT_EQ(NO_ERROR, theme2.setTo(theme1));
+  ASSERT_GE(theme2.getAttribute(android::R::attr::background, &val), 0);
+  ASSERT_EQ(Res_value::TYPE_INT_COLOR_RGB8, val.dataType);
+  ASSERT_EQ(uint32_t(0xffff0000), val.data);
+  ASSERT_GE(theme2.getAttribute(app::R::attr::number, &val), 0);
+  ASSERT_EQ(Res_value::TYPE_INT_DEC, val.dataType);
+  ASSERT_EQ(uint32_t(1), val.data);
 }
 
-}
+}  // namespace android
diff --git a/libs/androidfw/tests/data/app/R.h b/libs/androidfw/tests/data/app/R.h
index 23e68e3..5be2eee 100644
--- a/libs/androidfw/tests/data/app/R.h
+++ b/libs/androidfw/tests/data/app/R.h
@@ -14,25 +14,31 @@
  * limitations under the License.
  */
 
-#ifndef __APP_R_H
-#define __APP_R_H
+#ifndef TEST_DATA_APP_R_H_
+#define TEST_DATA_APP_R_H_
 
+#include <cstdint>
+
+namespace com {
+namespace android {
 namespace app {
-namespace R {
 
-namespace attr {
-    enum {
-        number         = 0x7f010000,   // default
+struct R {
+  struct attr {
+    enum : uint32_t {
+      number = 0x7f010000,  // default
     };
-}
+  };
 
-namespace style {
-    enum {
-        Theme_One      = 0x7f020000,   // default
+  struct style {
+    enum : uint32_t {
+      Theme_One = 0x7f020000,  // default
     };
-}
+  };
+};
 
-} // namespace R
-} // namespace app
+}  // namespace app
+}  // namespace android
+}  // namespace com
 
-#endif // __APP_R_H
+#endif  // TEST_DATA_APP_R_H_
diff --git a/libs/androidfw/tests/data/app/app.apk b/libs/androidfw/tests/data/app/app.apk
new file mode 100644
index 0000000..ccb0824
--- /dev/null
+++ b/libs/androidfw/tests/data/app/app.apk
Binary files differ
diff --git a/libs/androidfw/tests/data/app/app_arsc.h b/libs/androidfw/tests/data/app/app_arsc.h
deleted file mode 100644
index d5d9a3b..0000000
--- a/libs/androidfw/tests/data/app/app_arsc.h
+++ /dev/null
@@ -1,62 +0,0 @@
-unsigned char app_arsc[] = {
-  0x02, 0x00, 0x0c, 0x00, 0xc4, 0x02, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
-  0x01, 0x00, 0x1c, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x20, 0x01, 0x9c, 0x02, 0x00, 0x00,
-  0x7f, 0x00, 0x00, 0x00, 0x63, 0x00, 0x6f, 0x00, 0x6d, 0x00, 0x2e, 0x00,
-  0x61, 0x00, 0x6e, 0x00, 0x64, 0x00, 0x72, 0x00, 0x6f, 0x00, 0x69, 0x00,
-  0x64, 0x00, 0x2e, 0x00, 0x61, 0x00, 0x70, 0x00, 0x70, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x01, 0x00, 0x00,
-  0x02, 0x00, 0x00, 0x00, 0x60, 0x01, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x1c, 0x00, 0x40, 0x00, 0x00, 0x00,
-  0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x24, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x0c, 0x00, 0x00, 0x00, 0x04, 0x00, 0x61, 0x00, 0x74, 0x00, 0x74, 0x00,
-  0x72, 0x00, 0x00, 0x00, 0x05, 0x00, 0x73, 0x00, 0x74, 0x00, 0x79, 0x00,
-  0x6c, 0x00, 0x65, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x1c, 0x00,
-  0x4c, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x24, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x06, 0x00, 0x6e, 0x00,
-  0x75, 0x00, 0x6d, 0x00, 0x62, 0x00, 0x65, 0x00, 0x72, 0x00, 0x00, 0x00,
-  0x09, 0x00, 0x54, 0x00, 0x68, 0x00, 0x65, 0x00, 0x6d, 0x00, 0x65, 0x00,
-  0x2e, 0x00, 0x4f, 0x00, 0x6e, 0x00, 0x65, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x02, 0x02, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
-  0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x02, 0x44, 0x00,
-  0x64, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
-  0x48, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x01, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x01, 0x08, 0x00, 0x00, 0x10, 0x04, 0x00, 0x00, 0x00,
-  0x02, 0x02, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
-  0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x02, 0x44, 0x00,
-  0x64, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
-  0x48, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x01, 0x00,
-  0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x01, 0x01, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x01, 0x7f, 0x08, 0x00, 0x00, 0x10, 0x01, 0x00, 0x00, 0x00
-};
-unsigned int app_arsc_len = 708;
diff --git a/libs/androidfw/tests/data/app/build b/libs/androidfw/tests/data/app/build
index 62257bc..d418158 100755
--- a/libs/androidfw/tests/data/app/build
+++ b/libs/androidfw/tests/data/app/build
@@ -15,7 +15,6 @@
 # limitations under the License.
 #
 
-aapt package -v -I ../system/bundle.apk -M AndroidManifest.xml -S res -F bundle.apk -f && \
-unzip bundle.apk resources.arsc && \
-mv resources.arsc app.arsc && \
-xxd -i app.arsc > app_arsc.h
+set -e
+
+aapt package -I ../system/system.apk -M AndroidManifest.xml -S res -F app.apk -f
diff --git a/libs/androidfw/tests/data/appaslib/R.h b/libs/androidfw/tests/data/appaslib/R.h
index 3af921a..5a21327 100644
--- a/libs/androidfw/tests/data/appaslib/R.h
+++ b/libs/androidfw/tests/data/appaslib/R.h
@@ -14,39 +14,53 @@
  * limitations under the License.
  */
 
-#ifndef __APPASLIB_R_H
-#define __APPASLIB_R_H
+#ifndef DATA_APPASLIB_R_H_
+#define DATA_APPASLIB_R_H_
 
+#include <cstdint>
+
+namespace com {
+namespace android {
 namespace appaslib {
-namespace R {
-namespace lib {
-namespace integer {
-    enum {
-        number1     = 0x02020000,   // default
-    };
-}
 
-namespace array {
-    enum {
-        integerArray1 = 0x02030000,   // default
+namespace lib {
+
+struct R {
+  struct integer {
+    enum : uint32_t {
+      number1 = 0x02020000,  // default
     };
-}
-} // namespace lib
+  };
+
+  struct array {
+    enum : uint32_t {
+      integerArray1 = 0x02030000,  // default
+    };
+  };
+};
+
+}  // namespace lib
 
 namespace app {
-namespace integer {
-    enum {
-        number1     = 0x7f020000,     // default
-    };
-}
 
-namespace array {
-    enum {
-        integerArray1 = 0x7f030000,   // default
+struct R {
+  struct integer {
+    enum : uint32_t {
+      number1 = 0x7f020000,  // default
     };
-}
-} // namespace app
-} // namespace R
-} // namespace appaslib
+  };
 
-#endif // __APPASLIB_R_H
+  struct array {
+    enum : uint32_t {
+      integerArray1 = 0x7f030000,  // default
+    };
+  };
+};
+
+}  // namespace app
+
+}  // namespace appaslib
+}  // namespace android
+}  // namespace com
+
+#endif  // DATA_APPASLIB_R_H_
diff --git a/libs/androidfw/tests/data/appaslib/appaslib.apk b/libs/androidfw/tests/data/appaslib/appaslib.apk
new file mode 100644
index 0000000..6ebd823
--- /dev/null
+++ b/libs/androidfw/tests/data/appaslib/appaslib.apk
Binary files differ
diff --git a/libs/androidfw/tests/data/appaslib/appaslib_arsc.h b/libs/androidfw/tests/data/appaslib/appaslib_arsc.h
deleted file mode 100644
index be176ab..0000000
--- a/libs/androidfw/tests/data/appaslib/appaslib_arsc.h
+++ /dev/null
@@ -1,68 +0,0 @@
-unsigned char appaslib_arsc[] = {
-  0x02, 0x00, 0x0c, 0x00, 0x04, 0x03, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
-  0x01, 0x00, 0x1c, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x20, 0x01, 0xdc, 0x02, 0x00, 0x00,
-  0x7f, 0x00, 0x00, 0x00, 0x63, 0x00, 0x6f, 0x00, 0x6d, 0x00, 0x2e, 0x00,
-  0x61, 0x00, 0x6e, 0x00, 0x64, 0x00, 0x72, 0x00, 0x6f, 0x00, 0x69, 0x00,
-  0x64, 0x00, 0x2e, 0x00, 0x74, 0x00, 0x65, 0x00, 0x73, 0x00, 0x74, 0x00,
-  0x2e, 0x00, 0x62, 0x00, 0x61, 0x00, 0x73, 0x00, 0x69, 0x00, 0x63, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x01, 0x00, 0x00,
-  0x03, 0x00, 0x00, 0x00, 0x74, 0x01, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x1c, 0x00, 0x54, 0x00, 0x00, 0x00,
-  0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x28, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x0c, 0x00, 0x00, 0x00, 0x1e, 0x00, 0x00, 0x00, 0x04, 0x00, 0x61, 0x00,
-  0x74, 0x00, 0x74, 0x00, 0x72, 0x00, 0x00, 0x00, 0x07, 0x00, 0x69, 0x00,
-  0x6e, 0x00, 0x74, 0x00, 0x65, 0x00, 0x67, 0x00, 0x65, 0x00, 0x72, 0x00,
-  0x00, 0x00, 0x05, 0x00, 0x61, 0x00, 0x72, 0x00, 0x72, 0x00, 0x61, 0x00,
-  0x79, 0x00, 0x00, 0x00, 0x01, 0x00, 0x1c, 0x00, 0x54, 0x00, 0x00, 0x00,
-  0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x24, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x12, 0x00, 0x00, 0x00, 0x07, 0x00, 0x6e, 0x00, 0x75, 0x00, 0x6d, 0x00,
-  0x62, 0x00, 0x65, 0x00, 0x72, 0x00, 0x31, 0x00, 0x00, 0x00, 0x0d, 0x00,
-  0x69, 0x00, 0x6e, 0x00, 0x74, 0x00, 0x65, 0x00, 0x67, 0x00, 0x65, 0x00,
-  0x72, 0x00, 0x41, 0x00, 0x72, 0x00, 0x72, 0x00, 0x61, 0x00, 0x79, 0x00,
-  0x31, 0x00, 0x00, 0x00, 0x02, 0x02, 0x10, 0x00, 0x10, 0x00, 0x00, 0x00,
-  0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x02, 0x10, 0x00,
-  0x14, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x01, 0x02, 0x48, 0x00, 0x5c, 0x00, 0x00, 0x00,
-  0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x4c, 0x00, 0x00, 0x00,
-  0x34, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x01, 0x00, 0x00, 0x03, 0x7f,
-  0x02, 0x02, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
-  0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x02, 0x48, 0x00,
-  0x80, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
-  0x4c, 0x00, 0x00, 0x00, 0x34, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x10, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x08, 0x00, 0x00, 0x10,
-  0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x02, 0x08, 0x00, 0x00, 0x10,
-  0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x02, 0x08, 0x00, 0x00, 0x10,
-  0x03, 0x00, 0x00, 0x00
-};
-unsigned int appaslib_arsc_len = 772;
diff --git a/libs/androidfw/tests/data/appaslib/appaslib_lib.apk b/libs/androidfw/tests/data/appaslib/appaslib_lib.apk
new file mode 100644
index 0000000..ee1521c
--- /dev/null
+++ b/libs/androidfw/tests/data/appaslib/appaslib_lib.apk
Binary files differ
diff --git a/libs/androidfw/tests/data/appaslib/appaslib_lib_arsc.h b/libs/androidfw/tests/data/appaslib/appaslib_lib_arsc.h
deleted file mode 100644
index 099285a..0000000
--- a/libs/androidfw/tests/data/appaslib/appaslib_lib_arsc.h
+++ /dev/null
@@ -1,68 +0,0 @@
-unsigned char appaslib_lib_arsc[] = {
-  0x02, 0x00, 0x0c, 0x00, 0x04, 0x03, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
-  0x01, 0x00, 0x1c, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x20, 0x01, 0xdc, 0x02, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x63, 0x00, 0x6f, 0x00, 0x6d, 0x00, 0x2e, 0x00,
-  0x61, 0x00, 0x6e, 0x00, 0x64, 0x00, 0x72, 0x00, 0x6f, 0x00, 0x69, 0x00,
-  0x64, 0x00, 0x2e, 0x00, 0x74, 0x00, 0x65, 0x00, 0x73, 0x00, 0x74, 0x00,
-  0x2e, 0x00, 0x62, 0x00, 0x61, 0x00, 0x73, 0x00, 0x69, 0x00, 0x63, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x01, 0x00, 0x00,
-  0x03, 0x00, 0x00, 0x00, 0x74, 0x01, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x1c, 0x00, 0x54, 0x00, 0x00, 0x00,
-  0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x28, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x0c, 0x00, 0x00, 0x00, 0x1e, 0x00, 0x00, 0x00, 0x04, 0x00, 0x61, 0x00,
-  0x74, 0x00, 0x74, 0x00, 0x72, 0x00, 0x00, 0x00, 0x07, 0x00, 0x69, 0x00,
-  0x6e, 0x00, 0x74, 0x00, 0x65, 0x00, 0x67, 0x00, 0x65, 0x00, 0x72, 0x00,
-  0x00, 0x00, 0x05, 0x00, 0x61, 0x00, 0x72, 0x00, 0x72, 0x00, 0x61, 0x00,
-  0x79, 0x00, 0x00, 0x00, 0x01, 0x00, 0x1c, 0x00, 0x54, 0x00, 0x00, 0x00,
-  0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x24, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x12, 0x00, 0x00, 0x00, 0x07, 0x00, 0x6e, 0x00, 0x75, 0x00, 0x6d, 0x00,
-  0x62, 0x00, 0x65, 0x00, 0x72, 0x00, 0x31, 0x00, 0x00, 0x00, 0x0d, 0x00,
-  0x69, 0x00, 0x6e, 0x00, 0x74, 0x00, 0x65, 0x00, 0x67, 0x00, 0x65, 0x00,
-  0x72, 0x00, 0x41, 0x00, 0x72, 0x00, 0x72, 0x00, 0x61, 0x00, 0x79, 0x00,
-  0x31, 0x00, 0x00, 0x00, 0x02, 0x02, 0x10, 0x00, 0x10, 0x00, 0x00, 0x00,
-  0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x02, 0x10, 0x00,
-  0x14, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x01, 0x02, 0x48, 0x00, 0x5c, 0x00, 0x00, 0x00,
-  0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x4c, 0x00, 0x00, 0x00,
-  0x34, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x07, 0x00, 0x00, 0x03, 0x00,
-  0x02, 0x02, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
-  0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x02, 0x48, 0x00,
-  0x80, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
-  0x4c, 0x00, 0x00, 0x00, 0x34, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x10, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x08, 0x00, 0x00, 0x10,
-  0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x02, 0x08, 0x00, 0x00, 0x10,
-  0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x02, 0x08, 0x00, 0x00, 0x10,
-  0x03, 0x00, 0x00, 0x00
-};
-unsigned int appaslib_lib_arsc_len = 772;
diff --git a/libs/androidfw/tests/data/appaslib/build b/libs/androidfw/tests/data/appaslib/build
index e4bd88b..baaf700 100755
--- a/libs/androidfw/tests/data/appaslib/build
+++ b/libs/androidfw/tests/data/appaslib/build
@@ -15,14 +15,9 @@
 # limitations under the License.
 #
 
+set -e
+
 PATH_TO_FRAMEWORK_RES=$(gettop)/prebuilts/sdk/current/android.jar
 
-aapt package -M AndroidManifest.xml -S res -I $PATH_TO_FRAMEWORK_RES -F bundle.apk -f && \
-unzip bundle.apk resources.arsc && \
-mv resources.arsc appaslib.arsc && \
-xxd -i appaslib.arsc > appaslib_arsc.h && \
-aapt package -M AndroidManifest.xml -S res -I $PATH_TO_FRAMEWORK_RES -F bundle.apk -f --shared-lib && \
-unzip bundle.apk resources.arsc && \
-mv resources.arsc appaslib_lib.arsc && \
-xxd -i appaslib_lib.arsc > appaslib_lib_arsc.h \
-
+aapt package -M AndroidManifest.xml -S res -I $PATH_TO_FRAMEWORK_RES -F appaslib.apk -f
+aapt package -M AndroidManifest.xml -S res -I $PATH_TO_FRAMEWORK_RES -F appaslib_lib.apk -f --shared-lib
diff --git a/libs/androidfw/tests/data/basic/AndroidManifest.xml b/libs/androidfw/tests/data/basic/AndroidManifest.xml
index a56ac18..b117882 100644
--- a/libs/androidfw/tests/data/basic/AndroidManifest.xml
+++ b/libs/androidfw/tests/data/basic/AndroidManifest.xml
@@ -15,7 +15,6 @@
 -->
 
 <manifest xmlns:android="http://schemas.android.com/apk/res/android"
-    package="com.android.test.basic">
-    <application>
-    </application>
+    package="com.android.basic">
+    <application />
 </manifest>
diff --git a/libs/androidfw/tests/data/basic/R.h b/libs/androidfw/tests/data/basic/R.h
index 6694dd0..9352b5c 100644
--- a/libs/androidfw/tests/data/basic/R.h
+++ b/libs/androidfw/tests/data/basic/R.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2014 The Android Open Source Project
+ * 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.
@@ -14,59 +14,67 @@
  * limitations under the License.
  */
 
-#ifndef __BASE_R_H
-#define __BASE_R_H
+#ifndef TESTS_DATA_BASIC_R_H_
+#define TESTS_DATA_BASIC_R_H_
 
-namespace base {
-namespace R {
+#include <cstdint>
 
-namespace attr {
-    enum {
-        attr1       = 0x7f010000, // default
-        attr2       = 0x7f010001, // default
+namespace com {
+namespace android {
+namespace basic {
+
+struct R {
+  struct attr {
+    enum : uint32_t {
+      attr1 = 0x7f010000,
+      attr2 = 0x7f010001,
     };
-}
+  };
 
-namespace layout {
-    enum {
-        main        = 0x7f020000,  // default, fr-sw600dp-v13
+  struct layout {
+    enum : uint32_t {
+      main = 0x7f020000,
     };
-}
+  };
 
-namespace string {
-    enum {
-        test1       = 0x7f030000,   // default
-        test2       = 0x7f030001,   // default
-        density     = 0x7f030002,   // default
+  struct string {
+    enum : uint32_t {
+      test1 = 0x7f030000,
+      test2 = 0x7f030001,
+      density = 0x7f030002,
 
-        test3       = 0x7f080000,   // default (in feature)
-        test4       = 0x7f080001,   // default (in feature)
+      // From feature
+      test3 = 0x7f080000,
+      test4 = 0x7f080001,
     };
-}
+  };
 
-namespace integer {
-    enum {
-        number1     = 0x7f040000,   // default, sv, vs
-        number2     = 0x7f040001,   // default
+  struct integer {
+    enum : uint32_t {
+      number1 = 0x7f040000,
+      number2 = 0x7f040001,
 
-        test3       = 0x7f090000,   // default (in feature)
+      // From feature
+      number3 = 0x7f090000,
     };
-}
+  };
 
-namespace style {
-    enum {
-        Theme1      = 0x7f050000,   // default
-        Theme2      = 0x7f050001,   // default
+  struct style {
+    enum : uint32_t {
+      Theme1 = 0x7f050000,
+      Theme2 = 0x7f050001,
     };
-}
+  };
 
-namespace array {
-    enum {
-        integerArray1 = 0x7f060000,   // default
+  struct array {
+    enum : uint32_t {
+      integerArray1 = 0x7f060000,
     };
-}
+  };
+};
 
-} // namespace R
-} // namespace base
+}  // namespace basic
+}  // namespace android
+}  // namespace com
 
-#endif // __BASE_R_H
+#endif /* TESTS_DATA_BASIC_R_H_ */
diff --git a/libs/androidfw/tests/data/basic/basic.apk b/libs/androidfw/tests/data/basic/basic.apk
new file mode 100644
index 0000000..2d71f5b
--- /dev/null
+++ b/libs/androidfw/tests/data/basic/basic.apk
Binary files differ
diff --git a/libs/androidfw/tests/data/basic/basic_arsc.h b/libs/androidfw/tests/data/basic/basic_arsc.h
deleted file mode 100644
index e497401..0000000
--- a/libs/androidfw/tests/data/basic/basic_arsc.h
+++ /dev/null
@@ -1,175 +0,0 @@
-unsigned char basic_arsc[] = {
-  0x02, 0x00, 0x0c, 0x00, 0x0c, 0x08, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
-  0x01, 0x00, 0x1c, 0x00, 0xbc, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x2c, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x2a, 0x00, 0x00, 0x00,
-  0x72, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x13, 0x00, 0x72, 0x00,
-  0x65, 0x00, 0x73, 0x00, 0x2f, 0x00, 0x6c, 0x00, 0x61, 0x00, 0x79, 0x00,
-  0x6f, 0x00, 0x75, 0x00, 0x74, 0x00, 0x2f, 0x00, 0x6d, 0x00, 0x61, 0x00,
-  0x69, 0x00, 0x6e, 0x00, 0x2e, 0x00, 0x78, 0x00, 0x6d, 0x00, 0x6c, 0x00,
-  0x00, 0x00, 0x22, 0x00, 0x72, 0x00, 0x65, 0x00, 0x73, 0x00, 0x2f, 0x00,
-  0x6c, 0x00, 0x61, 0x00, 0x79, 0x00, 0x6f, 0x00, 0x75, 0x00, 0x74, 0x00,
-  0x2d, 0x00, 0x66, 0x00, 0x72, 0x00, 0x2d, 0x00, 0x73, 0x00, 0x77, 0x00,
-  0x36, 0x00, 0x30, 0x00, 0x30, 0x00, 0x64, 0x00, 0x70, 0x00, 0x2d, 0x00,
-  0x76, 0x00, 0x31, 0x00, 0x33, 0x00, 0x2f, 0x00, 0x6d, 0x00, 0x61, 0x00,
-  0x69, 0x00, 0x6e, 0x00, 0x2e, 0x00, 0x78, 0x00, 0x6d, 0x00, 0x6c, 0x00,
-  0x00, 0x00, 0x05, 0x00, 0x74, 0x00, 0x65, 0x00, 0x73, 0x00, 0x74, 0x00,
-  0x31, 0x00, 0x00, 0x00, 0x05, 0x00, 0x74, 0x00, 0x65, 0x00, 0x73, 0x00,
-  0x74, 0x00, 0x32, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x20, 0x01,
-  0x44, 0x07, 0x00, 0x00, 0x7f, 0x00, 0x00, 0x00, 0x63, 0x00, 0x6f, 0x00,
-  0x6d, 0x00, 0x2e, 0x00, 0x61, 0x00, 0x6e, 0x00, 0x64, 0x00, 0x72, 0x00,
-  0x6f, 0x00, 0x69, 0x00, 0x64, 0x00, 0x2e, 0x00, 0x74, 0x00, 0x65, 0x00,
-  0x73, 0x00, 0x74, 0x00, 0x2e, 0x00, 0x62, 0x00, 0x61, 0x00, 0x73, 0x00,
-  0x69, 0x00, 0x63, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x20, 0x01, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0xb0, 0x01, 0x00, 0x00,
-  0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x1c, 0x00,
-  0x90, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x34, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x00,
-  0x2c, 0x00, 0x00, 0x00, 0x3e, 0x00, 0x00, 0x00, 0x4c, 0x00, 0x00, 0x00,
-  0x04, 0x00, 0x61, 0x00, 0x74, 0x00, 0x74, 0x00, 0x72, 0x00, 0x00, 0x00,
-  0x06, 0x00, 0x6c, 0x00, 0x61, 0x00, 0x79, 0x00, 0x6f, 0x00, 0x75, 0x00,
-  0x74, 0x00, 0x00, 0x00, 0x06, 0x00, 0x73, 0x00, 0x74, 0x00, 0x72, 0x00,
-  0x69, 0x00, 0x6e, 0x00, 0x67, 0x00, 0x00, 0x00, 0x07, 0x00, 0x69, 0x00,
-  0x6e, 0x00, 0x74, 0x00, 0x65, 0x00, 0x67, 0x00, 0x65, 0x00, 0x72, 0x00,
-  0x00, 0x00, 0x05, 0x00, 0x73, 0x00, 0x74, 0x00, 0x79, 0x00, 0x6c, 0x00,
-  0x65, 0x00, 0x00, 0x00, 0x05, 0x00, 0x61, 0x00, 0x72, 0x00, 0x72, 0x00,
-  0x61, 0x00, 0x79, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x1c, 0x00,
-  0xec, 0x00, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x44, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x0e, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x00,
-  0x28, 0x00, 0x00, 0x00, 0x36, 0x00, 0x00, 0x00, 0x44, 0x00, 0x00, 0x00,
-  0x56, 0x00, 0x00, 0x00, 0x68, 0x00, 0x00, 0x00, 0x78, 0x00, 0x00, 0x00,
-  0x88, 0x00, 0x00, 0x00, 0x05, 0x00, 0x61, 0x00, 0x74, 0x00, 0x74, 0x00,
-  0x72, 0x00, 0x31, 0x00, 0x00, 0x00, 0x05, 0x00, 0x61, 0x00, 0x74, 0x00,
-  0x74, 0x00, 0x72, 0x00, 0x32, 0x00, 0x00, 0x00, 0x04, 0x00, 0x6d, 0x00,
-  0x61, 0x00, 0x69, 0x00, 0x6e, 0x00, 0x00, 0x00, 0x05, 0x00, 0x74, 0x00,
-  0x65, 0x00, 0x73, 0x00, 0x74, 0x00, 0x31, 0x00, 0x00, 0x00, 0x05, 0x00,
-  0x74, 0x00, 0x65, 0x00, 0x73, 0x00, 0x74, 0x00, 0x32, 0x00, 0x00, 0x00,
-  0x07, 0x00, 0x6e, 0x00, 0x75, 0x00, 0x6d, 0x00, 0x62, 0x00, 0x65, 0x00,
-  0x72, 0x00, 0x31, 0x00, 0x00, 0x00, 0x07, 0x00, 0x6e, 0x00, 0x75, 0x00,
-  0x6d, 0x00, 0x62, 0x00, 0x65, 0x00, 0x72, 0x00, 0x32, 0x00, 0x00, 0x00,
-  0x06, 0x00, 0x54, 0x00, 0x68, 0x00, 0x65, 0x00, 0x6d, 0x00, 0x65, 0x00,
-  0x31, 0x00, 0x00, 0x00, 0x06, 0x00, 0x54, 0x00, 0x68, 0x00, 0x65, 0x00,
-  0x6d, 0x00, 0x65, 0x00, 0x32, 0x00, 0x00, 0x00, 0x0d, 0x00, 0x69, 0x00,
-  0x6e, 0x00, 0x74, 0x00, 0x65, 0x00, 0x67, 0x00, 0x65, 0x00, 0x72, 0x00,
-  0x41, 0x00, 0x72, 0x00, 0x72, 0x00, 0x61, 0x00, 0x79, 0x00, 0x31, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x02, 0x02, 0x10, 0x00, 0x18, 0x00, 0x00, 0x00,
-  0x01, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x01, 0x02, 0x4c, 0x00, 0x8c, 0x00, 0x00, 0x00,
-  0x01, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x54, 0x00, 0x00, 0x00,
-  0x38, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x1c, 0x00, 0x00, 0x00, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01,
-  0x08, 0x00, 0x00, 0x10, 0x05, 0x00, 0x00, 0x00, 0x10, 0x00, 0x01, 0x00,
-  0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x01, 0x08, 0x00, 0x00, 0x10, 0x05, 0x00, 0x00, 0x00,
-  0x02, 0x02, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
-  0x01, 0x00, 0x00, 0x00, 0x04, 0x24, 0x00, 0x00, 0x01, 0x02, 0x4c, 0x00,
-  0x60, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
-  0x50, 0x00, 0x00, 0x00, 0x38, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
-  0x08, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x01, 0x02, 0x4c, 0x00,
-  0x60, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
-  0x50, 0x00, 0x00, 0x00, 0x38, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x66, 0x72, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x00, 0x00, 0x58, 0x02,
-  0x00, 0x00, 0x00, 0x00, 0x4c, 0x61, 0x74, 0x6e, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
-  0x08, 0x00, 0x00, 0x03, 0x01, 0x00, 0x00, 0x00, 0x02, 0x02, 0x10, 0x00,
-  0x1c, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x01, 0x02, 0x4c, 0x00, 0x78, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
-  0x03, 0x00, 0x00, 0x00, 0x58, 0x00, 0x00, 0x00, 0x38, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
-  0xff, 0xff, 0xff, 0xff, 0x08, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
-  0x08, 0x00, 0x00, 0x03, 0x02, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
-  0x04, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x03, 0x03, 0x00, 0x00, 0x00,
-  0x02, 0x02, 0x10, 0x00, 0x18, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
-  0x02, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x01, 0x02, 0x4c, 0x00, 0x74, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
-  0x02, 0x00, 0x00, 0x00, 0x54, 0x00, 0x00, 0x00, 0x38, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
-  0x08, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x10,
-  0xc8, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00,
-  0x08, 0x00, 0x00, 0x01, 0x00, 0x00, 0x06, 0x7f, 0x01, 0x02, 0x4c, 0x00,
-  0x64, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
-  0x54, 0x00, 0x00, 0x00, 0x38, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x76, 0x73, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0x08, 0x00, 0x00, 0x00,
-  0x05, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x10, 0x58, 0x02, 0x00, 0x00,
-  0x01, 0x02, 0x4c, 0x00, 0x64, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
-  0x02, 0x00, 0x00, 0x00, 0x54, 0x00, 0x00, 0x00, 0x38, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x73, 0x76, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x4c, 0x61, 0x74, 0x6e,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff,
-  0x08, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x10,
-  0x90, 0x01, 0x00, 0x00, 0x02, 0x02, 0x10, 0x00, 0x18, 0x00, 0x00, 0x00,
-  0x05, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x01, 0x02, 0x4c, 0x00, 0x98, 0x00, 0x00, 0x00,
-  0x05, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x54, 0x00, 0x00, 0x00,
-  0x38, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x28, 0x00, 0x00, 0x00, 0x10, 0x00, 0x01, 0x00, 0x07, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x7f,
-  0x08, 0x00, 0x00, 0x10, 0x64, 0x00, 0x00, 0x00, 0x01, 0x00, 0x01, 0x7f,
-  0x08, 0x00, 0x00, 0x01, 0x00, 0x00, 0x04, 0x7f, 0x10, 0x00, 0x01, 0x00,
-  0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x7f, 0x01, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x01, 0x7f, 0x08, 0x00, 0x00, 0x10, 0x2c, 0x01, 0x00, 0x00,
-  0x02, 0x02, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00,
-  0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x02, 0x4c, 0x00,
-  0x84, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
-  0x50, 0x00, 0x00, 0x00, 0x38, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x01, 0x00, 0x09, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02,
-  0x08, 0x00, 0x00, 0x10, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x02,
-  0x08, 0x00, 0x00, 0x10, 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x02,
-  0x08, 0x00, 0x00, 0x10, 0x03, 0x00, 0x00, 0x00
-};
-unsigned int basic_arsc_len = 2060;
diff --git a/libs/androidfw/tests/data/basic/basic_de_fr.apk b/libs/androidfw/tests/data/basic/basic_de_fr.apk
new file mode 100644
index 0000000..69a2f30
--- /dev/null
+++ b/libs/androidfw/tests/data/basic/basic_de_fr.apk
Binary files differ
diff --git a/libs/androidfw/tests/data/basic/basic_hdpi-v4.apk b/libs/androidfw/tests/data/basic/basic_hdpi-v4.apk
new file mode 100644
index 0000000..011808b
--- /dev/null
+++ b/libs/androidfw/tests/data/basic/basic_hdpi-v4.apk
Binary files differ
diff --git a/libs/androidfw/tests/data/basic/basic_xhdpi-v4.apk b/libs/androidfw/tests/data/basic/basic_xhdpi-v4.apk
new file mode 100644
index 0000000..6d4353c
--- /dev/null
+++ b/libs/androidfw/tests/data/basic/basic_xhdpi-v4.apk
Binary files differ
diff --git a/libs/androidfw/tests/data/basic/basic_xxhdpi-v4.apk b/libs/androidfw/tests/data/basic/basic_xxhdpi-v4.apk
new file mode 100644
index 0000000..e3bda88
--- /dev/null
+++ b/libs/androidfw/tests/data/basic/basic_xxhdpi-v4.apk
Binary files differ
diff --git a/libs/androidfw/tests/data/basic/build b/libs/androidfw/tests/data/basic/build
index fd289fa..68b911a 100755
--- a/libs/androidfw/tests/data/basic/build
+++ b/libs/androidfw/tests/data/basic/build
@@ -15,25 +15,8 @@
 # limitations under the License.
 #
 
+set -e
+
 PATH_TO_FRAMEWORK_RES=$(gettop)/prebuilts/sdk/current/android.jar
 
-aapt package -M AndroidManifest.xml -S res -I $PATH_TO_FRAMEWORK_RES --split hdpi --split xhdpi --split xxhdpi --split fr,de -F bundle.apk -f && \
-unzip bundle.apk resources.arsc && \
-mv resources.arsc basic.arsc && \
-xxd -i basic.arsc > basic_arsc.h && \
-\
-unzip bundle_de_fr.apk resources.arsc && \
-mv resources.arsc split_de_fr.arsc && \
-xxd -i split_de_fr.arsc > split_de_fr_arsc.h && \
-\
-unzip bundle_hdpi-v4.apk resources.arsc && \
-mv resources.arsc split_hdpi_v4.arsc && \
-xxd -i split_hdpi_v4.arsc > split_hdpi_v4_arsc.h && \
-\
-unzip bundle_xhdpi-v4.apk resources.arsc && \
-mv resources.arsc split_xhdpi_v4.arsc && \
-xxd -i split_xhdpi_v4.arsc > split_xhdpi_v4_arsc.h && \
-\
-unzip bundle_xxhdpi-v4.apk resources.arsc && \
-mv resources.arsc split_xxhdpi_v4.arsc && \
-xxd -i split_xxhdpi_v4.arsc > split_xxhdpi_v4_arsc.h \
+aapt package -M AndroidManifest.xml -S res -I $PATH_TO_FRAMEWORK_RES --split hdpi --split xhdpi --split xxhdpi --split fr,de -F basic.apk -f
diff --git a/libs/androidfw/tests/data/basic/res/values/values.xml b/libs/androidfw/tests/data/basic/res/values/values.xml
index a010cca..75e0435 100644
--- a/libs/androidfw/tests/data/basic/res/values/values.xml
+++ b/libs/androidfw/tests/data/basic/res/values/values.xml
@@ -25,12 +25,12 @@
     <integer name="number2">@array/integerArray1</integer>
 
     <style name="Theme1">
-        <item name="com.android.test.basic:attr1">100</item>
-        <item name="com.android.test.basic:attr2">@integer/number1</item>
+        <item name="com.android.basic:attr1">100</item>
+        <item name="com.android.basic:attr2">@integer/number1</item>
     </style>
 
-    <style name="Theme2" parent="@com.android.test.basic:style/Theme1">
-        <item name="com.android.test.basic:attr1">300</item>
+    <style name="Theme2" parent="@com.android.basic:style/Theme1">
+        <item name="com.android.basic:attr1">300</item>
     </style>
 
     <integer-array name="integerArray1">
diff --git a/libs/androidfw/tests/data/basic/split_de_fr_arsc.h b/libs/androidfw/tests/data/basic/split_de_fr_arsc.h
deleted file mode 100644
index a2aa598..0000000
--- a/libs/androidfw/tests/data/basic/split_de_fr_arsc.h
+++ /dev/null
@@ -1,88 +0,0 @@
-unsigned char split_de_fr_arsc[] = {
-  0x02, 0x00, 0x0c, 0x00, 0xf4, 0x03, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
-  0x01, 0x00, 0x1c, 0x00, 0x7c, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x2c, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x16, 0x00, 0x00, 0x00,
-  0x2c, 0x00, 0x00, 0x00, 0x3e, 0x00, 0x00, 0x00, 0x09, 0x00, 0x76, 0x00,
-  0x65, 0x00, 0x72, 0x00, 0x73, 0x00, 0x75, 0x00, 0x63, 0x00, 0x68, 0x00,
-  0x20, 0x00, 0x31, 0x00, 0x00, 0x00, 0x09, 0x00, 0x76, 0x00, 0x65, 0x00,
-  0x72, 0x00, 0x73, 0x00, 0x75, 0x00, 0x63, 0x00, 0x68, 0x00, 0x20, 0x00,
-  0x32, 0x00, 0x00, 0x00, 0x07, 0x00, 0x65, 0x00, 0x73, 0x00, 0x73, 0x00,
-  0x61, 0x00, 0x69, 0x00, 0x20, 0x00, 0x31, 0x00, 0x00, 0x00, 0x07, 0x00,
-  0x65, 0x00, 0x73, 0x00, 0x73, 0x00, 0x61, 0x00, 0x69, 0x00, 0x20, 0x00,
-  0x32, 0x00, 0x00, 0x00, 0x00, 0x02, 0x20, 0x01, 0x6c, 0x03, 0x00, 0x00,
-  0x7f, 0x00, 0x00, 0x00, 0x63, 0x00, 0x6f, 0x00, 0x6d, 0x00, 0x2e, 0x00,
-  0x61, 0x00, 0x6e, 0x00, 0x64, 0x00, 0x72, 0x00, 0x6f, 0x00, 0x69, 0x00,
-  0x64, 0x00, 0x2e, 0x00, 0x74, 0x00, 0x65, 0x00, 0x73, 0x00, 0x74, 0x00,
-  0x2e, 0x00, 0x62, 0x00, 0x61, 0x00, 0x73, 0x00, 0x69, 0x00, 0x63, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x01, 0x00, 0x00,
-  0x06, 0x00, 0x00, 0x00, 0xb0, 0x01, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x1c, 0x00, 0x90, 0x00, 0x00, 0x00,
-  0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x34, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x0c, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x2c, 0x00, 0x00, 0x00,
-  0x3e, 0x00, 0x00, 0x00, 0x4c, 0x00, 0x00, 0x00, 0x04, 0x00, 0x61, 0x00,
-  0x74, 0x00, 0x74, 0x00, 0x72, 0x00, 0x00, 0x00, 0x06, 0x00, 0x6c, 0x00,
-  0x61, 0x00, 0x79, 0x00, 0x6f, 0x00, 0x75, 0x00, 0x74, 0x00, 0x00, 0x00,
-  0x06, 0x00, 0x73, 0x00, 0x74, 0x00, 0x72, 0x00, 0x69, 0x00, 0x6e, 0x00,
-  0x67, 0x00, 0x00, 0x00, 0x07, 0x00, 0x69, 0x00, 0x6e, 0x00, 0x74, 0x00,
-  0x65, 0x00, 0x67, 0x00, 0x65, 0x00, 0x72, 0x00, 0x00, 0x00, 0x05, 0x00,
-  0x73, 0x00, 0x74, 0x00, 0x79, 0x00, 0x6c, 0x00, 0x65, 0x00, 0x00, 0x00,
-  0x05, 0x00, 0x61, 0x00, 0x72, 0x00, 0x72, 0x00, 0x61, 0x00, 0x79, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x1c, 0x00, 0x40, 0x00, 0x00, 0x00,
-  0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x24, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x0e, 0x00, 0x00, 0x00, 0x05, 0x00, 0x74, 0x00, 0x65, 0x00, 0x73, 0x00,
-  0x74, 0x00, 0x31, 0x00, 0x00, 0x00, 0x05, 0x00, 0x74, 0x00, 0x65, 0x00,
-  0x73, 0x00, 0x74, 0x00, 0x32, 0x00, 0x00, 0x00, 0x02, 0x02, 0x10, 0x00,
-  0x18, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x02, 0x10, 0x00,
-  0x14, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x02, 0x02, 0x10, 0x00, 0x1c, 0x00, 0x00, 0x00,
-  0x03, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
-  0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x02, 0x4c, 0x00,
-  0x78, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
-  0x58, 0x00, 0x00, 0x00, 0x38, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x64, 0x65, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x4c, 0x61, 0x74, 0x6e, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff,
-  0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x03,
-  0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
-  0x08, 0x00, 0x00, 0x03, 0x01, 0x00, 0x00, 0x00, 0x01, 0x02, 0x4c, 0x00,
-  0x78, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
-  0x58, 0x00, 0x00, 0x00, 0x38, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x66, 0x72, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x4c, 0x61, 0x74, 0x6e, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff,
-  0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x03,
-  0x02, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
-  0x08, 0x00, 0x00, 0x03, 0x03, 0x00, 0x00, 0x00, 0x02, 0x02, 0x10, 0x00,
-  0x18, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x02, 0x10, 0x00,
-  0x18, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x02, 0x10, 0x00,
-  0x14, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00
-};
-unsigned int split_de_fr_arsc_len = 1012;
diff --git a/libs/androidfw/tests/data/basic/split_hdpi_v4_arsc.h b/libs/androidfw/tests/data/basic/split_hdpi_v4_arsc.h
deleted file mode 100644
index 0cc3915..0000000
--- a/libs/androidfw/tests/data/basic/split_hdpi_v4_arsc.h
+++ /dev/null
@@ -1,69 +0,0 @@
-unsigned char split_hdpi_v4_arsc[] = {
-  0x02, 0x00, 0x0c, 0x00, 0x10, 0x03, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
-  0x01, 0x00, 0x1c, 0x00, 0x2c, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x68, 0x00,
-  0x64, 0x00, 0x70, 0x00, 0x69, 0x00, 0x00, 0x00, 0x00, 0x02, 0x20, 0x01,
-  0xd8, 0x02, 0x00, 0x00, 0x7f, 0x00, 0x00, 0x00, 0x63, 0x00, 0x6f, 0x00,
-  0x6d, 0x00, 0x2e, 0x00, 0x61, 0x00, 0x6e, 0x00, 0x64, 0x00, 0x72, 0x00,
-  0x6f, 0x00, 0x69, 0x00, 0x64, 0x00, 0x2e, 0x00, 0x74, 0x00, 0x65, 0x00,
-  0x73, 0x00, 0x74, 0x00, 0x2e, 0x00, 0x62, 0x00, 0x61, 0x00, 0x73, 0x00,
-  0x69, 0x00, 0x63, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x20, 0x01, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0xb0, 0x01, 0x00, 0x00,
-  0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x1c, 0x00,
-  0x90, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x34, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x00,
-  0x2c, 0x00, 0x00, 0x00, 0x3e, 0x00, 0x00, 0x00, 0x4c, 0x00, 0x00, 0x00,
-  0x04, 0x00, 0x61, 0x00, 0x74, 0x00, 0x74, 0x00, 0x72, 0x00, 0x00, 0x00,
-  0x06, 0x00, 0x6c, 0x00, 0x61, 0x00, 0x79, 0x00, 0x6f, 0x00, 0x75, 0x00,
-  0x74, 0x00, 0x00, 0x00, 0x06, 0x00, 0x73, 0x00, 0x74, 0x00, 0x72, 0x00,
-  0x69, 0x00, 0x6e, 0x00, 0x67, 0x00, 0x00, 0x00, 0x07, 0x00, 0x69, 0x00,
-  0x6e, 0x00, 0x74, 0x00, 0x65, 0x00, 0x67, 0x00, 0x65, 0x00, 0x72, 0x00,
-  0x00, 0x00, 0x05, 0x00, 0x73, 0x00, 0x74, 0x00, 0x79, 0x00, 0x6c, 0x00,
-  0x65, 0x00, 0x00, 0x00, 0x05, 0x00, 0x61, 0x00, 0x72, 0x00, 0x72, 0x00,
-  0x61, 0x00, 0x79, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x1c, 0x00,
-  0x34, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x07, 0x00, 0x64, 0x00, 0x65, 0x00, 0x6e, 0x00,
-  0x73, 0x00, 0x69, 0x00, 0x74, 0x00, 0x79, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x02, 0x02, 0x10, 0x00, 0x18, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
-  0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x02, 0x02, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
-  0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x02, 0x10, 0x00,
-  0x1c, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x01, 0x02, 0x4c, 0x00, 0x68, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
-  0x03, 0x00, 0x00, 0x00, 0x58, 0x00, 0x00, 0x00, 0x38, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
-  0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x08, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x02, 0x02, 0x10, 0x00,
-  0x18, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x02, 0x10, 0x00,
-  0x18, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x02, 0x10, 0x00,
-  0x14, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00
-};
-unsigned int split_hdpi_v4_arsc_len = 784;
diff --git a/libs/androidfw/tests/data/basic/split_xhdpi_v4_arsc.h b/libs/androidfw/tests/data/basic/split_xhdpi_v4_arsc.h
deleted file mode 100644
index d44ba96..0000000
--- a/libs/androidfw/tests/data/basic/split_xhdpi_v4_arsc.h
+++ /dev/null
@@ -1,69 +0,0 @@
-unsigned char split_xhdpi_v4_arsc[] = {
-  0x02, 0x00, 0x0c, 0x00, 0x14, 0x03, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
-  0x01, 0x00, 0x1c, 0x00, 0x30, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x78, 0x00,
-  0x68, 0x00, 0x64, 0x00, 0x70, 0x00, 0x69, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x02, 0x20, 0x01, 0xd8, 0x02, 0x00, 0x00, 0x7f, 0x00, 0x00, 0x00,
-  0x63, 0x00, 0x6f, 0x00, 0x6d, 0x00, 0x2e, 0x00, 0x61, 0x00, 0x6e, 0x00,
-  0x64, 0x00, 0x72, 0x00, 0x6f, 0x00, 0x69, 0x00, 0x64, 0x00, 0x2e, 0x00,
-  0x74, 0x00, 0x65, 0x00, 0x73, 0x00, 0x74, 0x00, 0x2e, 0x00, 0x62, 0x00,
-  0x61, 0x00, 0x73, 0x00, 0x69, 0x00, 0x63, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x20, 0x01, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00,
-  0xb0, 0x01, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x01, 0x00, 0x1c, 0x00, 0x90, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x34, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00,
-  0x1c, 0x00, 0x00, 0x00, 0x2c, 0x00, 0x00, 0x00, 0x3e, 0x00, 0x00, 0x00,
-  0x4c, 0x00, 0x00, 0x00, 0x04, 0x00, 0x61, 0x00, 0x74, 0x00, 0x74, 0x00,
-  0x72, 0x00, 0x00, 0x00, 0x06, 0x00, 0x6c, 0x00, 0x61, 0x00, 0x79, 0x00,
-  0x6f, 0x00, 0x75, 0x00, 0x74, 0x00, 0x00, 0x00, 0x06, 0x00, 0x73, 0x00,
-  0x74, 0x00, 0x72, 0x00, 0x69, 0x00, 0x6e, 0x00, 0x67, 0x00, 0x00, 0x00,
-  0x07, 0x00, 0x69, 0x00, 0x6e, 0x00, 0x74, 0x00, 0x65, 0x00, 0x67, 0x00,
-  0x65, 0x00, 0x72, 0x00, 0x00, 0x00, 0x05, 0x00, 0x73, 0x00, 0x74, 0x00,
-  0x79, 0x00, 0x6c, 0x00, 0x65, 0x00, 0x00, 0x00, 0x05, 0x00, 0x61, 0x00,
-  0x72, 0x00, 0x72, 0x00, 0x61, 0x00, 0x79, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x01, 0x00, 0x1c, 0x00, 0x34, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x00, 0x64, 0x00,
-  0x65, 0x00, 0x6e, 0x00, 0x73, 0x00, 0x69, 0x00, 0x74, 0x00, 0x79, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x02, 0x02, 0x10, 0x00, 0x18, 0x00, 0x00, 0x00,
-  0x01, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x02, 0x02, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00,
-  0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x02, 0x02, 0x10, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
-  0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x01, 0x02, 0x4c, 0x00, 0x68, 0x00, 0x00, 0x00,
-  0x03, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x58, 0x00, 0x00, 0x00,
-  0x38, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x40, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff,
-  0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00,
-  0x02, 0x02, 0x10, 0x00, 0x18, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
-  0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x02, 0x02, 0x10, 0x00, 0x18, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
-  0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x02, 0x02, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00,
-  0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
-};
-unsigned int split_xhdpi_v4_arsc_len = 788;
diff --git a/libs/androidfw/tests/data/basic/split_xxhdpi_v4_arsc.h b/libs/androidfw/tests/data/basic/split_xxhdpi_v4_arsc.h
deleted file mode 100644
index 2f3f682..0000000
--- a/libs/androidfw/tests/data/basic/split_xxhdpi_v4_arsc.h
+++ /dev/null
@@ -1,69 +0,0 @@
-unsigned char split_xxhdpi_v4_arsc[] = {
-  0x02, 0x00, 0x0c, 0x00, 0x14, 0x03, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
-  0x01, 0x00, 0x1c, 0x00, 0x30, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x00, 0x78, 0x00,
-  0x78, 0x00, 0x68, 0x00, 0x64, 0x00, 0x70, 0x00, 0x69, 0x00, 0x00, 0x00,
-  0x00, 0x02, 0x20, 0x01, 0xd8, 0x02, 0x00, 0x00, 0x7f, 0x00, 0x00, 0x00,
-  0x63, 0x00, 0x6f, 0x00, 0x6d, 0x00, 0x2e, 0x00, 0x61, 0x00, 0x6e, 0x00,
-  0x64, 0x00, 0x72, 0x00, 0x6f, 0x00, 0x69, 0x00, 0x64, 0x00, 0x2e, 0x00,
-  0x74, 0x00, 0x65, 0x00, 0x73, 0x00, 0x74, 0x00, 0x2e, 0x00, 0x62, 0x00,
-  0x61, 0x00, 0x73, 0x00, 0x69, 0x00, 0x63, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x20, 0x01, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00,
-  0xb0, 0x01, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x01, 0x00, 0x1c, 0x00, 0x90, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x34, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00,
-  0x1c, 0x00, 0x00, 0x00, 0x2c, 0x00, 0x00, 0x00, 0x3e, 0x00, 0x00, 0x00,
-  0x4c, 0x00, 0x00, 0x00, 0x04, 0x00, 0x61, 0x00, 0x74, 0x00, 0x74, 0x00,
-  0x72, 0x00, 0x00, 0x00, 0x06, 0x00, 0x6c, 0x00, 0x61, 0x00, 0x79, 0x00,
-  0x6f, 0x00, 0x75, 0x00, 0x74, 0x00, 0x00, 0x00, 0x06, 0x00, 0x73, 0x00,
-  0x74, 0x00, 0x72, 0x00, 0x69, 0x00, 0x6e, 0x00, 0x67, 0x00, 0x00, 0x00,
-  0x07, 0x00, 0x69, 0x00, 0x6e, 0x00, 0x74, 0x00, 0x65, 0x00, 0x67, 0x00,
-  0x65, 0x00, 0x72, 0x00, 0x00, 0x00, 0x05, 0x00, 0x73, 0x00, 0x74, 0x00,
-  0x79, 0x00, 0x6c, 0x00, 0x65, 0x00, 0x00, 0x00, 0x05, 0x00, 0x61, 0x00,
-  0x72, 0x00, 0x72, 0x00, 0x61, 0x00, 0x79, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x01, 0x00, 0x1c, 0x00, 0x34, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x00, 0x64, 0x00,
-  0x65, 0x00, 0x6e, 0x00, 0x73, 0x00, 0x69, 0x00, 0x74, 0x00, 0x79, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x02, 0x02, 0x10, 0x00, 0x18, 0x00, 0x00, 0x00,
-  0x01, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x02, 0x02, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00,
-  0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x02, 0x02, 0x10, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
-  0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x01, 0x02, 0x4c, 0x00, 0x68, 0x00, 0x00, 0x00,
-  0x03, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x58, 0x00, 0x00, 0x00,
-  0x38, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0xe0, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff,
-  0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00,
-  0x02, 0x02, 0x10, 0x00, 0x18, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
-  0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x02, 0x02, 0x10, 0x00, 0x18, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
-  0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x02, 0x02, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00,
-  0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
-};
-unsigned int split_xxhdpi_v4_arsc_len = 788;
diff --git a/libs/androidfw/tests/data/feature/AndroidManifest.xml b/libs/androidfw/tests/data/feature/AndroidManifest.xml
index c2343b7..c972372 100644
--- a/libs/androidfw/tests/data/feature/AndroidManifest.xml
+++ b/libs/androidfw/tests/data/feature/AndroidManifest.xml
@@ -15,5 +15,5 @@
 -->
 
 <manifest xmlns:android="http://schemas.android.com/apk/res/android"
-    package="com.android.test.basic">
+    package="com.android.basic">
 </manifest>
diff --git a/libs/androidfw/tests/data/feature/build b/libs/androidfw/tests/data/feature/build
index 0f3307f..3316e41 100755
--- a/libs/androidfw/tests/data/feature/build
+++ b/libs/androidfw/tests/data/feature/build
@@ -15,7 +15,6 @@
 # limitations under the License.
 #
 
-aapt package -M AndroidManifest.xml -S res --feature-of ../basic/bundle.apk -F bundle.apk -f && \
-unzip bundle.apk resources.arsc && \
-mv resources.arsc feature.arsc && \
-xxd -i feature.arsc > feature_arsc.h
+set -e
+
+aapt package -M AndroidManifest.xml -S res --feature-of ../basic/basic.apk -F feature.apk -f
diff --git a/libs/androidfw/tests/data/feature/feature.apk b/libs/androidfw/tests/data/feature/feature.apk
new file mode 100644
index 0000000..1e65c27
--- /dev/null
+++ b/libs/androidfw/tests/data/feature/feature.apk
Binary files differ
diff --git a/libs/androidfw/tests/data/feature/feature_arsc.h b/libs/androidfw/tests/data/feature/feature_arsc.h
deleted file mode 100644
index cd29910..0000000
--- a/libs/androidfw/tests/data/feature/feature_arsc.h
+++ /dev/null
@@ -1,73 +0,0 @@
-unsigned char feature_arsc[] = {
-  0x02, 0x00, 0x0c, 0x00, 0x44, 0x03, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
-  0x01, 0x00, 0x1c, 0x00, 0x40, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x24, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0e, 0x00, 0x00, 0x00,
-  0x05, 0x00, 0x74, 0x00, 0x65, 0x00, 0x73, 0x00, 0x74, 0x00, 0x33, 0x00,
-  0x00, 0x00, 0x05, 0x00, 0x74, 0x00, 0x65, 0x00, 0x73, 0x00, 0x74, 0x00,
-  0x34, 0x00, 0x00, 0x00, 0x00, 0x02, 0x20, 0x01, 0xf8, 0x02, 0x00, 0x00,
-  0x7f, 0x00, 0x00, 0x00, 0x63, 0x00, 0x6f, 0x00, 0x6d, 0x00, 0x2e, 0x00,
-  0x61, 0x00, 0x6e, 0x00, 0x64, 0x00, 0x72, 0x00, 0x6f, 0x00, 0x69, 0x00,
-  0x64, 0x00, 0x2e, 0x00, 0x74, 0x00, 0x65, 0x00, 0x73, 0x00, 0x74, 0x00,
-  0x2e, 0x00, 0x62, 0x00, 0x61, 0x00, 0x73, 0x00, 0x69, 0x00, 0x63, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x01, 0x00, 0x00,
-  0x09, 0x00, 0x00, 0x00, 0xa0, 0x01, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x1c, 0x00, 0x80, 0x00, 0x00, 0x00,
-  0x09, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x12, 0x00, 0x00, 0x00,
-  0x1e, 0x00, 0x00, 0x00, 0x2e, 0x00, 0x00, 0x00, 0x07, 0x00, 0x3c, 0x00,
-  0x65, 0x00, 0x6d, 0x00, 0x70, 0x00, 0x74, 0x00, 0x79, 0x00, 0x3e, 0x00,
-  0x00, 0x00, 0x04, 0x00, 0x61, 0x00, 0x74, 0x00, 0x74, 0x00, 0x72, 0x00,
-  0x00, 0x00, 0x06, 0x00, 0x73, 0x00, 0x74, 0x00, 0x72, 0x00, 0x69, 0x00,
-  0x6e, 0x00, 0x67, 0x00, 0x00, 0x00, 0x07, 0x00, 0x69, 0x00, 0x6e, 0x00,
-  0x74, 0x00, 0x65, 0x00, 0x67, 0x00, 0x65, 0x00, 0x72, 0x00, 0x00, 0x00,
-  0x01, 0x00, 0x1c, 0x00, 0x58, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x28, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0e, 0x00, 0x00, 0x00,
-  0x1c, 0x00, 0x00, 0x00, 0x05, 0x00, 0x74, 0x00, 0x65, 0x00, 0x73, 0x00,
-  0x74, 0x00, 0x33, 0x00, 0x00, 0x00, 0x05, 0x00, 0x74, 0x00, 0x65, 0x00,
-  0x73, 0x00, 0x74, 0x00, 0x34, 0x00, 0x00, 0x00, 0x07, 0x00, 0x6e, 0x00,
-  0x75, 0x00, 0x6d, 0x00, 0x62, 0x00, 0x65, 0x00, 0x72, 0x00, 0x33, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x02, 0x02, 0x10, 0x00, 0x10, 0x00, 0x00, 0x00,
-  0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x02, 0x10, 0x00,
-  0x18, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x02, 0x44, 0x00,
-  0x6c, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
-  0x4c, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
-  0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x03,
-  0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
-  0x08, 0x00, 0x00, 0x03, 0x01, 0x00, 0x00, 0x00, 0x02, 0x02, 0x10, 0x00,
-  0x14, 0x00, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x01, 0x02, 0x44, 0x00, 0x58, 0x00, 0x00, 0x00,
-  0x09, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x48, 0x00, 0x00, 0x00,
-  0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
-  0x08, 0x00, 0x00, 0x10, 0xc8, 0x00, 0x00, 0x00
-};
-unsigned int feature_arsc_len = 836;
diff --git a/libs/androidfw/tests/data/lib/AndroidManifest.xml b/libs/androidfw/tests/data/lib/AndroidManifest.xml
index a56ac18..02f5d3e 100644
--- a/libs/androidfw/tests/data/lib/AndroidManifest.xml
+++ b/libs/androidfw/tests/data/lib/AndroidManifest.xml
@@ -15,7 +15,6 @@
 -->
 
 <manifest xmlns:android="http://schemas.android.com/apk/res/android"
-    package="com.android.test.basic">
-    <application>
-    </application>
+    package="com.android.lib">
+    <application />
 </manifest>
diff --git a/libs/androidfw/tests/data/lib/R.h b/libs/androidfw/tests/data/lib/R.h
index 6013973..bb22d22 100644
--- a/libs/androidfw/tests/data/lib/R.h
+++ b/libs/androidfw/tests/data/lib/R.h
@@ -14,26 +14,32 @@
  * limitations under the License.
  */
 
-#ifndef __LIB_R_H
-#define __LIB_R_H
+#ifndef TEST_DATA_LIB_R_H_
+#define TEST_DATA_LIB_R_H_
 
+#include <cstdint>
+
+namespace com {
+namespace android {
 namespace lib {
-namespace R {
 
-namespace attr {
-    enum {
-        attr1       = 0x02010000, // default
-        attr2       = 0x02010001, // default
+struct R {
+  struct attr {
+    enum : uint32_t {
+      attr1 = 0x02010000,  // default
+      attr2 = 0x02010001,  // default
     };
-}
+  };
 
-namespace style {
-    enum {
-        Theme        = 0x02020000,  // default
+  struct style {
+    enum : uint32_t {
+      Theme = 0x02020000,  // default
     };
-}
+  };
+};
 
-} // namespace R
-} // namespace lib
+}  // namespace lib
+}  // namespace android
+}  // namespace com
 
-#endif // __LIB_R_H
+#endif  // TEST_DATA_R_H_
diff --git a/libs/androidfw/tests/data/lib/build b/libs/androidfw/tests/data/lib/build
index 4102903..5c3d02c 100755
--- a/libs/androidfw/tests/data/lib/build
+++ b/libs/androidfw/tests/data/lib/build
@@ -15,7 +15,6 @@
 # limitations under the License.
 #
 
-aapt package -M AndroidManifest.xml -S res -F bundle.apk -f --shared-lib && \
-unzip bundle.apk resources.arsc && \
-mv resources.arsc lib.arsc && \
-xxd -i lib.arsc > lib_arsc.h
+set -e
+
+aapt package -M AndroidManifest.xml -S res -F lib.apk -f --shared-lib
diff --git a/libs/androidfw/tests/data/lib/lib.apk b/libs/androidfw/tests/data/lib/lib.apk
new file mode 100644
index 0000000..44c27c7
--- /dev/null
+++ b/libs/androidfw/tests/data/lib/lib.apk
Binary files differ
diff --git a/libs/androidfw/tests/data/lib/lib_arsc.h b/libs/androidfw/tests/data/lib/lib_arsc.h
deleted file mode 100644
index 62bed65..0000000
--- a/libs/androidfw/tests/data/lib/lib_arsc.h
+++ /dev/null
@@ -1,68 +0,0 @@
-unsigned char lib_arsc[] = {
-  0x02, 0x00, 0x0c, 0x00, 0x0c, 0x03, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
-  0x01, 0x00, 0x1c, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x20, 0x01, 0xe4, 0x02, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x63, 0x00, 0x6f, 0x00, 0x6d, 0x00, 0x2e, 0x00,
-  0x61, 0x00, 0x6e, 0x00, 0x64, 0x00, 0x72, 0x00, 0x6f, 0x00, 0x69, 0x00,
-  0x64, 0x00, 0x2e, 0x00, 0x74, 0x00, 0x65, 0x00, 0x73, 0x00, 0x74, 0x00,
-  0x2e, 0x00, 0x62, 0x00, 0x61, 0x00, 0x73, 0x00, 0x69, 0x00, 0x63, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x01, 0x00, 0x00,
-  0x02, 0x00, 0x00, 0x00, 0x60, 0x01, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x1c, 0x00, 0x40, 0x00, 0x00, 0x00,
-  0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x24, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x0c, 0x00, 0x00, 0x00, 0x04, 0x00, 0x61, 0x00, 0x74, 0x00, 0x74, 0x00,
-  0x72, 0x00, 0x00, 0x00, 0x05, 0x00, 0x73, 0x00, 0x74, 0x00, 0x79, 0x00,
-  0x6c, 0x00, 0x65, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x1c, 0x00,
-  0x54, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x28, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x0e, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x00,
-  0x05, 0x00, 0x61, 0x00, 0x74, 0x00, 0x74, 0x00, 0x72, 0x00, 0x31, 0x00,
-  0x00, 0x00, 0x05, 0x00, 0x61, 0x00, 0x74, 0x00, 0x74, 0x00, 0x72, 0x00,
-  0x32, 0x00, 0x00, 0x00, 0x05, 0x00, 0x54, 0x00, 0x68, 0x00, 0x65, 0x00,
-  0x6d, 0x00, 0x65, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x02, 0x10, 0x00,
-  0x18, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x02, 0x4c, 0x00,
-  0x8c, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
-  0x54, 0x00, 0x00, 0x00, 0x38, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x10, 0x00, 0x01, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x01, 0x08, 0x00, 0x00, 0x10, 0x04, 0x00, 0x00, 0x00,
-  0x10, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x08, 0x00, 0x00, 0x10,
-  0x04, 0x00, 0x00, 0x00, 0x02, 0x02, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00,
-  0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x01, 0x02, 0x4c, 0x00, 0x78, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
-  0x01, 0x00, 0x00, 0x00, 0x50, 0x00, 0x00, 0x00, 0x38, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x01, 0x00,
-  0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x01, 0x00, 0x08, 0x00, 0x00, 0x10, 0xbc, 0x02, 0x00, 0x00,
-  0x01, 0x00, 0x01, 0x00, 0x08, 0x00, 0x00, 0x08, 0x00, 0x00, 0x01, 0x00
-};
-unsigned int lib_arsc_len = 780;
diff --git a/libs/androidfw/tests/data/lib/res/values/values.xml b/libs/androidfw/tests/data/lib/res/values/values.xml
index ec8117a7..51e3a40 100644
--- a/libs/androidfw/tests/data/lib/res/values/values.xml
+++ b/libs/androidfw/tests/data/lib/res/values/values.xml
@@ -19,7 +19,7 @@
     <attr name="attr2" format="integer" />
 
     <style name="Theme">
-        <item name="com.android.test.basic:attr1">700</item>
-        <item name="com.android.test.basic:attr2">?com.android.test.basic:attr1</item>
+        <item name="com.android.lib:attr1">700</item>
+        <item name="com.android.lib:attr2">?com.android.lib:attr1</item>
     </style>
 </resources>
diff --git a/libs/androidfw/tests/data/overlay/build b/libs/androidfw/tests/data/overlay/build
index f737677..112f373 100755
--- a/libs/androidfw/tests/data/overlay/build
+++ b/libs/androidfw/tests/data/overlay/build
@@ -15,7 +15,6 @@
 # limitations under the License.
 #
 
-aapt package -M AndroidManifest.xml -S res -F bundle.apk -f && \
-unzip bundle.apk resources.arsc && \
-mv resources.arsc overlay.arsc && \
-xxd -i overlay.arsc > overlay_arsc.h
+set -e
+
+aapt package -M AndroidManifest.xml -S res -F overlay.apk -f
diff --git a/libs/androidfw/tests/data/overlay/overlay.apk b/libs/androidfw/tests/data/overlay/overlay.apk
new file mode 100644
index 0000000..e0e0543
--- /dev/null
+++ b/libs/androidfw/tests/data/overlay/overlay.apk
Binary files differ
diff --git a/libs/androidfw/tests/data/overlay/overlay_arsc.h b/libs/androidfw/tests/data/overlay/overlay_arsc.h
deleted file mode 100644
index 5bd98b2..0000000
--- a/libs/androidfw/tests/data/overlay/overlay_arsc.h
+++ /dev/null
@@ -1,69 +0,0 @@
-unsigned char overlay_arsc[] = {
-  0x02, 0x00, 0x0c, 0x00, 0x10, 0x03, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
-  0x01, 0x00, 0x1c, 0x00, 0x40, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0d, 0x00, 0x74, 0x00,
-  0x65, 0x00, 0x73, 0x00, 0x74, 0x00, 0x32, 0x00, 0x2d, 0x00, 0x6f, 0x00,
-  0x76, 0x00, 0x65, 0x00, 0x72, 0x00, 0x6c, 0x00, 0x61, 0x00, 0x79, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x20, 0x01, 0xc4, 0x02, 0x00, 0x00,
-  0x7f, 0x00, 0x00, 0x00, 0x63, 0x00, 0x6f, 0x00, 0x6d, 0x00, 0x2e, 0x00,
-  0x61, 0x00, 0x6e, 0x00, 0x64, 0x00, 0x72, 0x00, 0x6f, 0x00, 0x69, 0x00,
-  0x64, 0x00, 0x2e, 0x00, 0x74, 0x00, 0x65, 0x00, 0x73, 0x00, 0x74, 0x00,
-  0x2e, 0x00, 0x62, 0x00, 0x61, 0x00, 0x73, 0x00, 0x69, 0x00, 0x63, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x01, 0x00, 0x00,
-  0x03, 0x00, 0x00, 0x00, 0x74, 0x01, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x1c, 0x00, 0x54, 0x00, 0x00, 0x00,
-  0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x28, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x0c, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x04, 0x00, 0x61, 0x00,
-  0x74, 0x00, 0x74, 0x00, 0x72, 0x00, 0x00, 0x00, 0x06, 0x00, 0x73, 0x00,
-  0x74, 0x00, 0x72, 0x00, 0x69, 0x00, 0x6e, 0x00, 0x67, 0x00, 0x00, 0x00,
-  0x05, 0x00, 0x61, 0x00, 0x72, 0x00, 0x72, 0x00, 0x61, 0x00, 0x79, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x1c, 0x00, 0x50, 0x00, 0x00, 0x00,
-  0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x24, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x0e, 0x00, 0x00, 0x00, 0x05, 0x00, 0x74, 0x00, 0x65, 0x00, 0x73, 0x00,
-  0x74, 0x00, 0x32, 0x00, 0x00, 0x00, 0x0d, 0x00, 0x69, 0x00, 0x6e, 0x00,
-  0x74, 0x00, 0x65, 0x00, 0x67, 0x00, 0x65, 0x00, 0x72, 0x00, 0x41, 0x00,
-  0x72, 0x00, 0x72, 0x00, 0x61, 0x00, 0x79, 0x00, 0x31, 0x00, 0x00, 0x00,
-  0x02, 0x02, 0x10, 0x00, 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x02, 0x02, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00,
-  0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x01, 0x02, 0x44, 0x00, 0x58, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
-  0x01, 0x00, 0x00, 0x00, 0x48, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x03,
-  0x00, 0x00, 0x00, 0x00, 0x02, 0x02, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00,
-  0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x01, 0x02, 0x44, 0x00, 0x70, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
-  0x01, 0x00, 0x00, 0x00, 0x48, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x10, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x08, 0x00, 0x00, 0x10,
-  0x0a, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x02, 0x08, 0x00, 0x00, 0x10,
-  0x0b, 0x00, 0x00, 0x00
-};
-unsigned int overlay_arsc_len = 784;
diff --git a/libs/androidfw/tests/data/styles/R.h b/libs/androidfw/tests/data/styles/R.h
index 6dc6ede..4127aa0 100644
--- a/libs/androidfw/tests/data/styles/R.h
+++ b/libs/androidfw/tests/data/styles/R.h
@@ -1,3 +1,22 @@
+/*
+ * Copyright (C) 2016 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef TEST_DATA_STYLES_R_H_
+#define TEST_DATA_STYLES_R_H_
+
 #include <cstdint>
 
 namespace com {
@@ -17,9 +36,9 @@
   };
 
   struct string {
-      enum : uint32_t {
-          string_one = 0x7f030000u,
-      };
+    enum : uint32_t {
+      string_one = 0x7f030000u,
+    };
   };
 
   struct style {
@@ -33,3 +52,5 @@
 }  // namespace app
 }  // namespace android
 }  // namespace com
+
+#endif  // TEST_DATA_STYLES_R_H_
diff --git a/libs/androidfw/tests/data/styles/build b/libs/androidfw/tests/data/styles/build
new file mode 100755
index 0000000..81f78b1
--- /dev/null
+++ b/libs/androidfw/tests/data/styles/build
@@ -0,0 +1,5 @@
+#!/bin/bash
+
+set -e
+
+aapt package -F styles.apk -M AndroidManifest.xml -S res -f
diff --git a/libs/androidfw/tests/data/styles/build.sh b/libs/androidfw/tests/data/styles/build.sh
deleted file mode 100755
index e763421..0000000
--- a/libs/androidfw/tests/data/styles/build.sh
+++ /dev/null
@@ -1,7 +0,0 @@
-#!/bin/bash
-
-set -e
-
-aapt package -F package.apk -M AndroidManifest.xml -S res
-unzip -j package.apk resources.arsc res/layout/layout.xml
-rm package.apk
diff --git a/libs/androidfw/tests/data/styles/layout.xml b/libs/androidfw/tests/data/styles/layout.xml
deleted file mode 100644
index 4997e71..0000000
--- a/libs/androidfw/tests/data/styles/layout.xml
+++ /dev/null
Binary files differ
diff --git a/libs/androidfw/tests/data/styles/resources.arsc b/libs/androidfw/tests/data/styles/resources.arsc
deleted file mode 100644
index 8f65c9a..0000000
--- a/libs/androidfw/tests/data/styles/resources.arsc
+++ /dev/null
Binary files differ
diff --git a/libs/androidfw/tests/data/styles/styles.apk b/libs/androidfw/tests/data/styles/styles.apk
new file mode 100644
index 0000000..6064c48
--- /dev/null
+++ b/libs/androidfw/tests/data/styles/styles.apk
Binary files differ
diff --git a/libs/androidfw/tests/data/system/R.h b/libs/androidfw/tests/data/system/R.h
index 6a31fb8..becb388 100644
--- a/libs/androidfw/tests/data/system/R.h
+++ b/libs/androidfw/tests/data/system/R.h
@@ -14,32 +14,34 @@
  * limitations under the License.
  */
 
-#ifndef __ANDROID_R_H
-#define __ANDROID_R_H
+#ifndef TEST_DATA_SYSTEM_R_H_
+#define TEST_DATA_SYSTEM_R_H_
+
+#include <cstdint>
 
 namespace android {
-namespace R {
 
-namespace attr {
-    enum {
-        background  = 0x01010000, // default
-        foreground  = 0x01010001, // default
+struct R {
+  struct attr {
+    enum : uint32_t {
+      background = 0x01010000,  // default
+      foreground = 0x01010001,  // default
     };
-}
+  };
 
-namespace style {
-    enum {
-        Theme_One      = 0x01020000,   // default
+  struct style {
+    enum : uint32_t {
+      Theme_One = 0x01020000,  // default
     };
-}
+  };
 
-namespace integer {
-    enum {
-        number = 0x01030000, // sv
+  struct integer {
+    enum : uint32_t {
+      number = 0x01030000,  // sv
     };
-}
+  };
+};
 
-} // namespace R
-} // namespace android
+}  // namespace android
 
-#endif // __ANDROID_R_H
+#endif  // TEST_DATA_SYSTEM_R_H_
diff --git a/libs/androidfw/tests/data/system/build b/libs/androidfw/tests/data/system/build
index 1a70e84..bfbdf4c 100755
--- a/libs/androidfw/tests/data/system/build
+++ b/libs/androidfw/tests/data/system/build
@@ -15,7 +15,6 @@
 # limitations under the License.
 #
 
-aapt package -x -M AndroidManifest.xml -S res -F bundle.apk -f && \
-unzip bundle.apk resources.arsc && \
-mv resources.arsc system.arsc && \
-xxd -i system.arsc > system_arsc.h
+set -e
+
+aapt package -x -M AndroidManifest.xml -S res -F system.apk -f
diff --git a/libs/androidfw/tests/data/system/system.apk b/libs/androidfw/tests/data/system/system.apk
new file mode 100644
index 0000000..1299016
--- /dev/null
+++ b/libs/androidfw/tests/data/system/system.apk
Binary files differ
diff --git a/libs/androidfw/tests/data/system/system_arsc.h b/libs/androidfw/tests/data/system/system_arsc.h
deleted file mode 100644
index b0dab6b..0000000
--- a/libs/androidfw/tests/data/system/system_arsc.h
+++ /dev/null
@@ -1,88 +0,0 @@
-unsigned char system_arsc[] = {
-  0x02, 0x00, 0x0c, 0x00, 0xf8, 0x03, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
-  0x01, 0x00, 0x1c, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x20, 0x01, 0xd0, 0x03, 0x00, 0x00,
-  0x01, 0x00, 0x00, 0x00, 0x61, 0x00, 0x6e, 0x00, 0x64, 0x00, 0x72, 0x00,
-  0x6f, 0x00, 0x69, 0x00, 0x64, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x01, 0x00, 0x00,
-  0x04, 0x00, 0x00, 0x00, 0x98, 0x01, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x1c, 0x00, 0x78, 0x00, 0x00, 0x00,
-  0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x2c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x0c, 0x00, 0x00, 0x00, 0x1a, 0x00, 0x00, 0x00, 0x2c, 0x00, 0x00, 0x00,
-  0x04, 0x00, 0x61, 0x00, 0x74, 0x00, 0x74, 0x00, 0x72, 0x00, 0x00, 0x00,
-  0x05, 0x00, 0x73, 0x00, 0x74, 0x00, 0x79, 0x00, 0x6c, 0x00, 0x65, 0x00,
-  0x00, 0x00, 0x07, 0x00, 0x69, 0x00, 0x6e, 0x00, 0x74, 0x00, 0x65, 0x00,
-  0x67, 0x00, 0x65, 0x00, 0x72, 0x00, 0x00, 0x00, 0x0d, 0x00, 0x5e, 0x00,
-  0x61, 0x00, 0x74, 0x00, 0x74, 0x00, 0x72, 0x00, 0x2d, 0x00, 0x70, 0x00,
-  0x72, 0x00, 0x69, 0x00, 0x76, 0x00, 0x61, 0x00, 0x74, 0x00, 0x65, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x1c, 0x00, 0x84, 0x00, 0x00, 0x00,
-  0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x2c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x18, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x46, 0x00, 0x00, 0x00,
-  0x0a, 0x00, 0x62, 0x00, 0x61, 0x00, 0x63, 0x00, 0x6b, 0x00, 0x67, 0x00,
-  0x72, 0x00, 0x6f, 0x00, 0x75, 0x00, 0x6e, 0x00, 0x64, 0x00, 0x00, 0x00,
-  0x0a, 0x00, 0x66, 0x00, 0x6f, 0x00, 0x72, 0x00, 0x65, 0x00, 0x67, 0x00,
-  0x72, 0x00, 0x6f, 0x00, 0x75, 0x00, 0x6e, 0x00, 0x64, 0x00, 0x00, 0x00,
-  0x09, 0x00, 0x54, 0x00, 0x68, 0x00, 0x65, 0x00, 0x6d, 0x00, 0x65, 0x00,
-  0x2e, 0x00, 0x4f, 0x00, 0x6e, 0x00, 0x65, 0x00, 0x00, 0x00, 0x06, 0x00,
-  0x6e, 0x00, 0x75, 0x00, 0x6d, 0x00, 0x62, 0x00, 0x65, 0x00, 0x72, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x02, 0x02, 0x10, 0x00, 0x18, 0x00, 0x00, 0x00,
-  0x01, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40,
-  0x00, 0x00, 0x00, 0x40, 0x01, 0x02, 0x4c, 0x00, 0x8c, 0x00, 0x00, 0x00,
-  0x01, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x54, 0x00, 0x00, 0x00,
-  0x38, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x1c, 0x00, 0x00, 0x00, 0x10, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01,
-  0x08, 0x00, 0x00, 0x10, 0x11, 0x00, 0x00, 0x00, 0x10, 0x00, 0x03, 0x00,
-  0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x01, 0x08, 0x00, 0x00, 0x10, 0x11, 0x00, 0x00, 0x00,
-  0x02, 0x02, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
-  0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x01, 0x02, 0x4c, 0x00,
-  0x78, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
-  0x50, 0x00, 0x00, 0x00, 0x38, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x03, 0x00, 0x02, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01,
-  0x08, 0x00, 0x00, 0x1d, 0x00, 0x00, 0xff, 0xff, 0x01, 0x00, 0x01, 0x01,
-  0x08, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, 0xff, 0x02, 0x02, 0x10, 0x00,
-  0x14, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x40, 0x01, 0x02, 0x4c, 0x00, 0x60, 0x00, 0x00, 0x00,
-  0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x50, 0x00, 0x00, 0x00,
-  0x38, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x73, 0x76, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-  0x08, 0x00, 0x02, 0x00, 0x03, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x10,
-  0x01, 0x00, 0x00, 0x00, 0x02, 0x02, 0x10, 0x00, 0x10, 0x00, 0x00, 0x00,
-  0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
-};
-unsigned int system_arsc_len = 1016;