From 4c67a475a334e4f65238d439a3339195e03c03be Mon Sep 17 00:00:00 2001 From: Adam Lesinski Date: Thu, 10 Nov 2016 16:43:59 -0800 Subject: [PATCH] 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 --- libs/androidfw/AttributeResolution.cpp | 202 ++++--- .../{ => include/androidfw}/AttributeFinder.h | 0 libs/androidfw/tests/Android.mk | 9 +- libs/androidfw/tests/AppAsLib_test.cpp | 56 +- libs/androidfw/tests/Asset_test.cpp | 28 +- libs/androidfw/tests/AttributeFinder_test.cpp | 27 +- .../tests/AttributeResolution_test.cpp | 21 +- libs/androidfw/tests/ByteBucketArray_test.cpp | 50 +- libs/androidfw/tests/Config_test.cpp | 214 +++---- libs/androidfw/tests/Idmap_test.cpp | 144 ++--- libs/androidfw/tests/ResTable_test.cpp | 544 ++++++++++-------- libs/androidfw/tests/Split_test.cpp | 329 ++++++----- libs/androidfw/tests/TestHelpers.cpp | 41 +- libs/androidfw/tests/TestHelpers.h | 19 +- libs/androidfw/tests/Theme_test.cpp | 78 +-- libs/androidfw/tests/data/app/R.h | 34 +- libs/androidfw/tests/data/app/app.apk | Bin 0 -> 1138 bytes libs/androidfw/tests/data/app/app_arsc.h | 62 -- libs/androidfw/tests/data/app/build | 7 +- libs/androidfw/tests/data/appaslib/R.h | 68 ++- .../tests/data/appaslib/appaslib.apk | Bin 0 -> 1308 bytes .../tests/data/appaslib/appaslib_arsc.h | 68 --- .../tests/data/appaslib/appaslib_lib.apk | Bin 0 -> 1308 bytes .../tests/data/appaslib/appaslib_lib_arsc.h | 68 --- libs/androidfw/tests/data/appaslib/build | 13 +- .../tests/data/basic/AndroidManifest.xml | 5 +- libs/androidfw/tests/data/basic/R.h | 88 +-- libs/androidfw/tests/data/basic/basic.apk | Bin 0 -> 2959 bytes libs/androidfw/tests/data/basic/basic_arsc.h | 175 ------ .../tests/data/basic/basic_de_fr.apk | Bin 0 -> 1516 bytes .../tests/data/basic/basic_hdpi-v4.apk | Bin 0 -> 1298 bytes .../tests/data/basic/basic_xhdpi-v4.apk | Bin 0 -> 1304 bytes .../tests/data/basic/basic_xxhdpi-v4.apk | Bin 0 -> 1302 bytes libs/androidfw/tests/data/basic/build | 23 +- .../tests/data/basic/res/values/values.xml | 8 +- .../tests/data/basic/split_de_fr_arsc.h | 88 --- .../tests/data/basic/split_hdpi_v4_arsc.h | 69 --- .../tests/data/basic/split_xhdpi_v4_arsc.h | 69 --- .../tests/data/basic/split_xxhdpi_v4_arsc.h | 69 --- .../tests/data/feature/AndroidManifest.xml | 2 +- libs/androidfw/tests/data/feature/build | 7 +- libs/androidfw/tests/data/feature/feature.apk | Bin 0 -> 1294 bytes .../tests/data/feature/feature_arsc.h | 73 --- .../tests/data/lib/AndroidManifest.xml | 5 +- libs/androidfw/tests/data/lib/R.h | 36 +- libs/androidfw/tests/data/lib/build | 7 +- libs/androidfw/tests/data/lib/lib.apk | Bin 0 -> 1221 bytes libs/androidfw/tests/data/lib/lib_arsc.h | 68 --- .../tests/data/lib/res/values/values.xml | 4 +- libs/androidfw/tests/data/overlay/build | 7 +- libs/androidfw/tests/data/overlay/overlay.apk | Bin 0 -> 1254 bytes .../tests/data/overlay/overlay_arsc.h | 69 --- libs/androidfw/tests/data/styles/R.h | 27 +- libs/androidfw/tests/data/styles/build | 5 + libs/androidfw/tests/data/styles/build.sh | 7 - libs/androidfw/tests/data/styles/layout.xml | Bin 380 -> 0 bytes .../styles/{resources.arsc => styles.apk} | Bin 1544 -> 2274 bytes libs/androidfw/tests/data/system/R.h | 40 +- libs/androidfw/tests/data/system/build | 7 +- libs/androidfw/tests/data/system/system.apk | Bin 0 -> 1417 bytes .../androidfw/tests/data/system/system_arsc.h | 88 --- 61 files changed, 1185 insertions(+), 1943 deletions(-) rename libs/androidfw/{ => include/androidfw}/AttributeFinder.h (100%) create mode 100644 libs/androidfw/tests/data/app/app.apk delete mode 100644 libs/androidfw/tests/data/app/app_arsc.h create mode 100644 libs/androidfw/tests/data/appaslib/appaslib.apk delete mode 100644 libs/androidfw/tests/data/appaslib/appaslib_arsc.h create mode 100644 libs/androidfw/tests/data/appaslib/appaslib_lib.apk delete mode 100644 libs/androidfw/tests/data/appaslib/appaslib_lib_arsc.h create mode 100644 libs/androidfw/tests/data/basic/basic.apk delete mode 100644 libs/androidfw/tests/data/basic/basic_arsc.h create mode 100644 libs/androidfw/tests/data/basic/basic_de_fr.apk create mode 100644 libs/androidfw/tests/data/basic/basic_hdpi-v4.apk create mode 100644 libs/androidfw/tests/data/basic/basic_xhdpi-v4.apk create mode 100644 libs/androidfw/tests/data/basic/basic_xxhdpi-v4.apk delete mode 100644 libs/androidfw/tests/data/basic/split_de_fr_arsc.h delete mode 100644 libs/androidfw/tests/data/basic/split_hdpi_v4_arsc.h delete mode 100644 libs/androidfw/tests/data/basic/split_xhdpi_v4_arsc.h delete mode 100644 libs/androidfw/tests/data/basic/split_xxhdpi_v4_arsc.h create mode 100644 libs/androidfw/tests/data/feature/feature.apk delete mode 100644 libs/androidfw/tests/data/feature/feature_arsc.h create mode 100644 libs/androidfw/tests/data/lib/lib.apk delete mode 100644 libs/androidfw/tests/data/lib/lib_arsc.h create mode 100644 libs/androidfw/tests/data/overlay/overlay.apk delete mode 100644 libs/androidfw/tests/data/overlay/overlay_arsc.h create mode 100755 libs/androidfw/tests/data/styles/build delete mode 100755 libs/androidfw/tests/data/styles/build.sh delete mode 100644 libs/androidfw/tests/data/styles/layout.xml rename libs/androidfw/tests/data/styles/{resources.arsc => styles.apk} (58%) create mode 100644 libs/androidfw/tests/data/system/system.apk delete mode 100644 libs/androidfw/tests/data/system/system_arsc.h diff --git a/libs/androidfw/AttributeResolution.cpp b/libs/androidfw/AttributeResolution.cpp index d71fc39802aab..f5aef05e88425 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 #include -#include + +#include "androidfw/AttributeFinder.h" +#include "androidfw/ResourceTypes.h" constexpr bool kDebugStyles = false; namespace android { -class XmlAttributeFinder : public BackTrackingAttributeFinder { +class XmlAttributeFinder + : public BackTrackingAttributeFinder { 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 { + : public BackTrackingAttributeFinder { 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 @@ class BagAttributeFinder } }; -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 @@ bool ResolveAttrs(ResTable::Theme* theme, uint32_t def_style_attr, uint32_t def_ 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 @@ bool ResolveAttrs(ResTable::Theme* theme, uint32_t def_style_attr, uint32_t def_ 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 @@ bool ResolveAttrs(ResTable::Theme* theme, uint32_t def_style_attr, uint32_t def_ 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 @@ bool ResolveAttrs(ResTable::Theme* theme, uint32_t def_style_attr, uint32_t def_ 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 @@ bool ResolveAttrs(ResTable::Theme* theme, uint32_t def_style_attr, uint32_t def_ } 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(res.getTableCookie(block)) : static_cast(-1); + block != -1 ? static_cast(res.getTableCookie(block)) + : static_cast(-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 @@ bool ResolveAttrs(ResTable::Theme* theme, uint32_t def_style_attr, uint32_t def_ res.unlock(); - if (out_indices != NULL) { + if (out_indices != nullptr) { out_indices[0] = indices_idx; } return true; @@ -197,8 +218,8 @@ void ApplyStyle(ResTable::Theme* theme, ResXMLParser* xml_parser, uint32_t def_s 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 @@ void ApplyStyle(ResTable::Theme* theme, ResXMLParser* xml_parser, uint32_t def_s 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 @@ void ApplyStyle(ResTable::Theme* theme, ResXMLParser* xml_parser, uint32_t def_s // 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 @@ void ApplyStyle(ResTable::Theme* theme, ResXMLParser* xml_parser, uint32_t def_s 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 @@ void ApplyStyle(ResTable::Theme* theme, ResXMLParser* xml_parser, uint32_t def_s // 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 @@ void ApplyStyle(ResTable::Theme* theme, ResXMLParser* xml_parser, uint32_t def_s 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 @@ void ApplyStyle(ResTable::Theme* theme, ResXMLParser* xml_parser, uint32_t def_s } 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(res.getTableCookie(block)) - : static_cast(-1); + out_values[STYLE_ASSET_COOKIE] = + block != kXmlBlock ? static_cast(res.getTableCookie(block)) + : static_cast(-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 @@ void ApplyStyle(ResTable::Theme* theme, ResXMLParser* xml_parser, uint32_t def_s 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 @@ bool RetrieveAttributes(const ResTable* res, ResXMLParser* xml_parser, uint32_t* 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 @@ bool RetrieveAttributes(const ResTable* res, ResXMLParser* xml_parser, uint32_t* // 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(res->getTableCookie(block)) - : static_cast(-1); + out_values[STYLE_ASSET_COOKIE] = + block != kXmlBlock ? static_cast(res->getTableCookie(block)) + : static_cast(-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 @@ bool RetrieveAttributes(const ResTable* res, ResXMLParser* xml_parser, uint32_t* 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 d18cb8f472c70..d91a1338c8487 100644 --- a/libs/androidfw/tests/Android.mk +++ b/libs/androidfw/tests/Android.mk @@ -24,6 +24,7 @@ testFiles := \ 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 @@ include $(CLEAR_VARS) 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 @@ LOCAL_SHARED_LIBRARIES := \ 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 8489acf6246f7..ddaa46d274cdb 100644 --- a/libs/androidfw/tests/AppAsLib_test.cpp +++ b/libs/androidfw/tests/AppAsLib_test.cpp @@ -14,55 +14,69 @@ * limitations under the License. */ -#include +#include "androidfw/ResourceTypes.h" +#include "TestHelpers.h" #include "data/appaslib/R.h" -#include +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 45c8cef92918a..5018218066cb0 100644 --- a/libs/androidfw/tests/Asset_test.cpp +++ b/libs/androidfw/tests/Asset_test.cpp @@ -14,24 +14,26 @@ * limitations under the License. */ -#include +#include "androidfw/Asset.h" -#include +#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 d9ed48ebe9532..7264b812737c2 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 -#include +#include "android-base/macros.h" +#include "gtest/gtest.h" -using android::BackTrackingAttributeFinder; +namespace android { -class MockAttributeFinder : public BackTrackingAttributeFinder { +class MockAttributeFinder + : public BackTrackingAttributeFinder { 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 @@ class MockAttributeFinder : public BackTrackingAttributeFinder +#include "androidfw/ByteBucketArray.h" -#include +#include "gtest/gtest.h" -using android::ByteBucketArray; +namespace android { TEST(ByteBucketArrayTest, TestSparseInsertion) { - ByteBucketArray 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 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 738947a462009..778c7bfb2053f 100644 --- a/libs/androidfw/tests/Config_test.cpp +++ b/libs/androidfw/tests/Config_test.cpp @@ -14,168 +14,172 @@ * limitations under the License. */ -#include -#include -#include -#include +#include "androidfw/ResourceTypes.h" + +#include "utils/Log.h" +#include "utils/String8.h" +#include "utils/Vector.h" #include "TestHelpers.h" -#include +#include "gtest/gtest.h" namespace android { static ResTable_config selectBest(const ResTable_config& target, - const Vector& 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& 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 configs; + Vector 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 configs; - configs.add(buildDensityConfig(ResTable_config::DENSITY_HIGH)); + Vector 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(¬RoundConfig, 0, sizeof(notRoundConfig)); - notRoundConfig.screenLayout2 = ResTable_config::SCREENROUND_NO; + ResTable_config notRoundConfig; + memset(¬RoundConfig, 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 f50c17890b1e6..0928b1b976c3e 100644 --- a/libs/androidfw/tests/Idmap_test.cpp +++ b/libs/androidfw/tests/Idmap_test.cpp @@ -14,102 +14,102 @@ * limitations under the License. */ -#include +#include "androidfw/ResourceTypes.h" + +#include "utils/String16.h" +#include "utils/String8.h" -#include -#include #include "TestHelpers.h" #include "data/basic/R.h" -#include +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 9e53dd279195a..b151f3f96496c 100644 --- a/libs/androidfw/tests/ResTable_test.cpp +++ b/libs/androidfw/tests/ResTable_test.cpp @@ -14,352 +14,386 @@ * limitations under the License. */ -#include +#include "androidfw/ResourceTypes.h" #include #include #include -#include -#include +#include "utils/String16.h" +#include "utils/String8.h" + #include "TestHelpers.h" #include "data/basic/R.h" #include "data/lib/R.h" -#include +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(¶m, 0, sizeof(param)); - param.density = 320; - table.setParameters(¶m); + 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(¶m, 0, sizeof(param)); + param.density = 320; + table.setParameters(¶m); - 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(¶m, 0, sizeof(param)); - param.language[0] = 's'; - param.language[1] = 'v'; - param.country[0] = 'S'; - param.country[1] = 'E'; - table.setParameters(¶m); + 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(¶m, 0, sizeof(param)); + param.language[0] = 's'; + param.language[1] = 'v'; + param.country[0] = 'S'; + param.country[1] = 'E'; + table.setParameters(¶m); + + 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::length(str); + size_t len = std::char_traits::length(str); - // Gtest can't print UTF-16 strings, so we have to convert to UTF-8 :( - std::wstring_convert, 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, 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(-42), true, false); - testU16StringToInt(u" -42", static_cast(-42), true, false); - testU16StringToInt(u"042", 42U, true, false); - testU16StringToInt(u"-042", static_cast(-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(-42), true, false); + testU16StringToInt(u" -42", static_cast(-42), true, false); + testU16StringToInt(u"042", 42U, true, false); + testU16StringToInt(u"-042", static_cast(-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(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(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(¶m, 0, sizeof(param)); - param.language[0] = 'v'; - param.language[1] = 's'; - sharedTable.setParameters(¶m); + 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(¶m, 0, sizeof(param)); + param.language[0] = 'v'; + param.language[1] = 's'; + sharedTable.setParameters(¶m); - // 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(¶m, 0, sizeof(param)); - param.language[0] = 's'; - param.language[1] = 'v'; - param.country[0] = 'S'; - param.country[1] = 'E'; - table.setParameters(¶m); + // 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(¶m, 0, sizeof(param)); + param.language[0] = 's'; + param.language[1] = 'v'; + param.country[0] = 'S'; + param.country[1] = 'E'; + table.setParameters(¶m); - // 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 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 locales; - table.getLocales(&locales); + Vector 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 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 b69d68572e6ae..1f207e2e63732 100644 --- a/libs/androidfw/tests/Split_test.cpp +++ b/libs/androidfw/tests/Split_test.cpp @@ -14,233 +14,254 @@ * limitations under the License. */ -#include +#include "androidfw/ResourceTypes.h" + +#include "utils/String16.h" +#include "utils/String8.h" -#include -#include #include "TestHelpers.h" #include "data/basic/R.h" -#include +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(0), specFlags); + EXPECT_EQ(static_cast(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 702ee5c9d4ad9..2c834b14127a3 100644 --- a/libs/androidfw/tests/TestHelpers.cpp +++ b/libs/androidfw/tests/TestHelpers.cpp @@ -19,6 +19,7 @@ #include #include "android-base/logging.h" +#include "ziparchive/zip_archive.h" namespace android { @@ -31,8 +32,41 @@ const std::string& GetTestDataPath() { 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(reinterpret_cast(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 std::string& GetTestDataPath() { 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 c1e349fb824f6..d9cee22a15935 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 @@ void SetTestDataPath(const std::string& path); 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 4d07130acb393..37746576f79c1 100644 --- a/libs/androidfw/tests/Theme_test.cpp +++ b/libs/androidfw/tests/Theme_test.cpp @@ -14,55 +14,59 @@ * limitations under the License. */ -#include +#include "androidfw/ResourceTypes.h" + +#include "utils/String16.h" +#include "utils/String8.h" -#include -#include #include "TestHelpers.h" -#include "data/system/R.h" #include "data/app/R.h" +#include "data/system/R.h" -#include +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 23e68e3e80dc0..5be2eee11bfa0 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 + +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 0000000000000000000000000000000000000000..ccb08242a656e387a1e2c914dd99e2119c746edf GIT binary patch literal 1138 zcmWIWW@Zs#U}E54U}%`nxO0!V(>ewQh7v{w24NuWn3qzNpPAyDn3tKBT3n)6k(-m+ z=PlG^Am9?;vw!aWR&M_XOlEpI`OXjdbz7MD9w^!@E5G1(M5u7tE~}R>eU2L~F-nN| z#PF*o`>ut5>*fN{yhE`P0x$P1R!|l^+$B8KD&2d9Ugy#`o=B zMD(xU@8fEs^lYc;Khlu@RrzWzC;R_(lgw6?|4ZN5^Jnj=p2!ZhL%~l~7b@3Yz7Shl zI&Zb_U+(3Rh3B6q%igZKzvkM4CI%j`4AAckj0`eBhzj6*CI!YdKojbL(#Z_@47m(?42cYR3@HpnKwc)0 z2Js7kaQFiSU|<1*f*}D)gM17MI|m>Q5{Cg57z0T205J z!Ky&|eSj=n`UQY;Y{2j?1%`YQP!GrqPKFSM3?Mrfi1ir!fwB;@n3x0@M1b;;I0Z65 zY$hL|T?nxNAlm{YK_(CYn-0+ovIhtlf!Rrb1;~Ke5Aq9C4sJh8j2iYs%w}SQ(2VsU z`$6mgZ$>6@X51MZs00WU7`8QnXe`+sW&lVUR6?L 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 3af921a7ba65f..5a2132733795f 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 + +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 0000000000000000000000000000000000000000..6ebd8237a2d8a1e26f3dbb996c44fe2c9ec5cd37 GIT binary patch literal 1308 zcmWIWW@Zs#U}E54U}%`n__5rLOM#Jrp@WHmL70Jo!7(qTC_gjBH!&|WEw#8ruOc^R z>V%DchaCi5jvGE;nZ>}^=;GNrL0K^)sI9H5WF==ygXbfcZ7(%{a@aNZKT@9X;O$eL zo|QK)-}&_{?fPc%RV%NziM;U0Z``tU{*F~O?;F%7G>L!Uvpb+}vGkqH7l$Q+vo;#( zPMNS&*mhNd?$zMwQ(yBviz}Y8^U*B3XJrRt#p_mTS~}0({rUYqF~M1aqQT$TOD-{< z=?PxQd8)^+);8F1aaxDc;_yShtGvH`w9j4_csADe@=yPV>gVDax4+-}f9}c;vm&E>Z(U;tr0pioh2aeir0a%!<&Vo`B269W%e1{mTDj0`eBhzj6*CI!YPz$mE) zN+&bqGvqSpF(fkNF{CgQ0eP7~T92WGA(f#RNa`^p0p*H;qRFU+4HF(Hc>)8Ip#(?+ zg9HpfVHW~qfy7}z1I7T-JU}c5#4Ny&DFMPFAe$W+LV4g&O9zG=NQ4zATLgrO43$70 z%uJXaKp_Sd5CH{3K$;zBLMbpdlE5Yy0!4VyOm&2t2$E%D5?~Mj(xCVT0T5pVL<2EQ zjFHKQApuD&0LZogVsZg6V}k*Z28CQb%uY~PA=}vkATV%DchaCi5jvGE;nZ>}^=;GNrL0K^)sI9H5WF==ygXbfcZ7(%{a@aNZKT@9X;O$eL zo|QK)-}&_{?fPc%RV%NziM;U0Z``tU{*F~O?;F%7G>L!Uvpb+}vGkqH7l$Q+vo;#( zPMNS&*mhNd?$zMwQ(yBviz}Y8^U*B3XJrRt#p_mTS~}0({rUYqF~M1aqQT$TOD-{< z=?PxQd8)^+);8F1aaxDc;_yShtGvH`w9j4_csADe@=yPV>gVDax4+-}f9}c;vm&M4CI%j`3^2qQ7#U=M5Ea1rObU!ofKdVh z$qe}nxeR&?i41uRDGWtGUM7&%V<=%rWhe%cdJIWGxniJbGDO2LBSFa%7?=ztKpGk( z;IIn;ih;yoKm*1A(mX&c2gEGEkSPJeA|RU`7(#jAP)i4f97u!}C|d-Ci42uM9w 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 a56ac18e900b2..b117882802d70 100644 --- a/libs/androidfw/tests/data/basic/AndroidManifest.xml +++ b/libs/androidfw/tests/data/basic/AndroidManifest.xml @@ -15,7 +15,6 @@ --> - - + package="com.android.basic"> + diff --git a/libs/androidfw/tests/data/basic/R.h b/libs/androidfw/tests/data/basic/R.h index 6694dd0c36e17..9352b5c6629e9 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 -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 0000000000000000000000000000000000000000..2d71f5b5cb4c148c8592538e10bb1eccccc89251 GIT binary patch literal 2959 zcmds3dq|sC6hHaQqbq7d)!MoWS&?a7rlEhajB$hcQ z+aGB`>Rdsoj=9;otxfA>8*7eZtWH-(TSI-f zH~-+*1=`NO%bvJuVNmy4deQ#Vx|E~?)kFOQ&)?A)Hl|)G?JI1GkNxI3um8QN*Eb)^ z9v;2?*X-2XT;8rL_TtkgPP{#sKmSYV-IH{zVExbj&FYEoedVW8 z&sQZ}=+4+>yqk30;464{`1tgru8gi2|B>EXIli&47Dnne4Qx4+ZFcWVO}>6(ETQ-O zjUm_jM|RHMxj8U7)UAD`d1}wosvqi&V_Js(^U{x0m?J#*`(X)J5Y?Q?zJhv|tLd!2K) z@AHnCiP2Ld3HST_8(w(WS~&kx#l4Fo+n*e~I65?O*8N0XwxpKH5Bz6eLJeKuZD5Dh znOSdYZ)|qyZ4SM&H8(5E(xh+6&dF>r)!4bTW}DxbW-=O$7OyFbrq}g*#%UjKeyk~sBN2~7Xs7>+sw7p5Ra%w)t#nk^@E`$|Z#&~t(XVK^$ z=GZ{4#%71v>dY`XoMwTd#ToPzDQGKwfl&#TXon*5X>d8dy)JV-J zWF|F0t06mOP#ffWcy3$PQ%^S7^@z|)xs-)J3pGJ+p=`=oHjWDMIim|6M2p%^XdpqS zDAEwQA)0}v0SHXMVL_HgAhJNOgvANjEH3!}{^)R+YHaTljO&Bj5Nu z=a*VImYT|u*9tGI*n4uF=VQY5zBjZ}j)&G1w6qx`-!c5(4v|7I&^yp1dpYF1(Cpd; zu9sGf7Ff%1K?+=atqKCq1#Qw8nq!Rd@L_!HqfEgFd`6kA400s+fJ2OrF$&_U@on5f zGKvx9qw?~}W&@%;zF1T2iEF~i#DuaHyf^M6Y3?ZGNcN`1`UMbU;F!Ee2FtoKsIy(_ z1-9`#k4%h*KSYu}(q3RZoSV-bqjoZ=^Zkd8@~GXM(*k|DoGngFtdXSsOF8+pR?FdR zSz`jYhv)EOCsIv0ue?DxcMoimJ<^({Ar{{ud}c%n1IF3AeEbY z5oXbEM-VUHH9m{L97bS$LuQNgu5tcn5RWO?`vT+Sd<=nQ#t#-{_9-h-2#HZEKQ`e4 z($Uop9+!D~h6f0LVezs+00S^AK6+MqZ><)OpG^T`K;JHj7kWfV0YpbUpTplmive;_ Y2mq43jLJ$>;>S{n`w@%qb>gS$AA)zKBme*a literal 0 HcmV?d00001 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 e497401bdddb7..0000000000000 --- 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 0000000000000000000000000000000000000000..69a2f304db83fe783bf67498e1e944fae6a984c4 GIT binary patch literal 1516 zcmds1Ye|HP}jy)Wa~PDIe=UqARGWPY$m~OG36O-mNK*GP`j$E&a0{U=hDN@&(_T~rqyee z$_trFYh`QY{Tq?#y3;$G+v~kxA6Gk zsn-ibF_S@WzF@0^Zx9e`vTK)C0{=T2#ef{$j4%f`^QP<$HxRc*{9{N0Q5{_i) zruG*cD$e@wbYRTCq4YpP(QNz3ysM$b_dcaHb~Mz!U)v_(BFm%ex3_SJU2n6T>IwI2-$3(wVU8b%y)#E9FXd!qX+ z10Y?8kYE<=PQhpv)doQ{@({vSkXhg$2F{?Bqe`+{a?q|vrT8G~8aM@J5I_Vc7@-1G zuqPn87ttWh6!9~FWhrkZLOH;zI4f3Ii>?vuPz7qtw}A=Iu;c$s7?&aewKtfO~Lk~bEr3dNA%u29|loq z@ro<b05FX4TmS$7 literal 0 HcmV?d00001 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 0000000000000000000000000000000000000000..011808bb108ef0cb81b4b9b2b6fc4964156daa61 GIT binary patch literal 1298 zcmWIWW@Zs#U}E54U}%`nXl=2BU5Jr^A%Ka2L70Jo!7(qTC_gjBH!&|WEw#8ruOc_6 zbfTf(VFv-%|F>EsIs{xqM5cs@_&GObEL^f+iSsee1jatm=n#=Pjlu;Seuo1y9=xp( zJk}Chd-lxz{q<>YBRbD1pUm_Z_lvrI-sszW6Qg6?U?Gp z*DIcH726Z@VD~)F-`S$y(|+&U-t&F)&iZ?wSOdU82n;Q75LPaGohrc0zyQL0K%t`4 z;{4L0M4CI%j`3^0rt7#U<3big!_fC2>=14y$lWH6*K6fk6h#F!KqZvZ2u z9>`2)$Y;o9&|^qs$OFn30eP7~T8|+KC{he$Cxg@vW1s*GJT{>JHUMc*ID!BuEGGbI zkT?vOz!*T92Z&{W7!=-iKiD1@rra71F7zO4rO( znu(qUqnWA@&muFdOtj%^wwLkM}GNncDc)wnzwNm@VoL3X)s+Z`MEM%8m5V4u} zcBExt^LNpEVtN-j>?ai$N#El9U6)W(GJ%&VvJfMmqATJY0>oFt&MT&v!WF&KjBU1qwfNVgIZ2;1sumk~6 zcuoM)AaNKlfiZwI4-m@$u?`U10kIDdvjD@Z1PF_OY&M1*Ag>Y_mZd-u5Wg5KlL-vt zbReG{7_NChkyIcr6|935tfCUAFBK@y3e;T$gdj6O0OTH!{V?}|#1udT6tDwhEEQ-X zD85RddYG657$ku5AU(jSh69ke2viJa9!L!2A7DZQW4K}hXw%5JK`At literal 0 HcmV?d00001 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 0000000000000000000000000000000000000000..e3bda88659fb500ee79687d7c180b8757c2bcb63 GIT binary patch literal 1302 zcmWIWW@Zs#U}E54U}%`n==JWJzYrq>LkJTCgD?XFgJWJwQGRBMZ(?3%T555LUPW$B z=|o$Plku8ZSANejmI2PQIXKg#xS zBqzB08-MxXypyhF-3BOE<3cdc|e6yz0QS6k586>9Tp?Z@tHU^^w~VS00AHnfp(-tG!Wr%g#d2 z7o|5|ZxyTBd7!*n?d|)}JGbAiey4x${j-0Sr_}?%K?n>ja1a)9nEnxAW?%qeKA=!h zYH@yPQF3arUSd&kG7|$2SOyrz42%pi3nLmI6gU{9>?7CNPZC zfqZsgxaI*xQh~fwuntzRib|lqRG>U7PDTGywF2={*1d literal 0 HcmV?d00001 diff --git a/libs/androidfw/tests/data/basic/build b/libs/androidfw/tests/data/basic/build index fd289fad62b1f..68b911a3bc15d 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 a010cca182eef..75e0435e06fab 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 @@ @array/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 a2aa598e5c90b..0000000000000 --- 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 0cc39154a5ec4..0000000000000 --- 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 d44ba9630aba9..0000000000000 --- 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 2f3f682fb6e4f..0000000000000 --- 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 c2343b75e16e4..c972372508be3 100644 --- a/libs/androidfw/tests/data/feature/AndroidManifest.xml +++ b/libs/androidfw/tests/data/feature/AndroidManifest.xml @@ -15,5 +15,5 @@ --> + package="com.android.basic"> diff --git a/libs/androidfw/tests/data/feature/build b/libs/androidfw/tests/data/feature/build index 0f3307f518ec5..3316e41cd2928 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 0000000000000000000000000000000000000000..1e65c2732ebf08b1170977628d6d81ea01b03fb6 GIT binary patch literal 1294 zcmWIWW@Zs#U}E54U}%`nxbK<8^>qvk3>AzF48lO#F)yVkKQqNQF)uSMwYWsDA~z?s z&r+x=BT;CP9H~-eGV%>km&v^sD-UIps?7hf`!DoFt&MT&v!WRUt{3>1I?$_4b_8Xye}5- r8bLIcq6lUHNE%dnp=WQfIM{&uKqhKt5AbGX1IaT1VJ(oZW&!a4%NwwF literal 0 HcmV?d00001 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 cd299102e8f6e..0000000000000 --- 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 a56ac18e900b2..02f5d3efabea8 100644 --- a/libs/androidfw/tests/data/lib/AndroidManifest.xml +++ b/libs/androidfw/tests/data/lib/AndroidManifest.xml @@ -15,7 +15,6 @@ --> - - + package="com.android.lib"> + diff --git a/libs/androidfw/tests/data/lib/R.h b/libs/androidfw/tests/data/lib/R.h index 6013973072cc4..bb22d22f90e1d 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 + +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 41029031028c9..5c3d02c850bf6 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 0000000000000000000000000000000000000000..44c27c79ae7cfb54aca904e92a5997edc239acfa GIT binary patch literal 1221 zcmWIWW@Zs#U}E54U}%`n=y`lg;YkJthBJ%|48lO#F)yVkKQqNQF)uSMwYWsDA~z?s z-E>N%7Xr{yxz4+s~zU%iKeD}_I zViF{r_d@!!(_Low0@m^m4F0MARBuI@yILK%EgIm3!na zkL@+ieGh%#{Q12uC#py8QFKg6Qs_A8n)H}5~O zl5&dupytCQ`lZtG{30(~g}L|jE;H>&tJYlcbD!ZI{V!K*32K04AOtApKykqe zH^UHxX9VVjFk}GD%Y~ZB#3aBV0Tc(tEwZ~9nS2;}ki+5A#2SW(1WA0(*cQkjsE< zAYx<)@MdHZXU1J-0G$B@3JlvCK{S>U1ZDt88dT_@XFaeu*nnR^CTd0u@MdKL$uj|A LEs!<>g&YF_4>778 literal 0 HcmV?d00001 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 62bed655f9143..0000000000000 --- 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 ec8117a78c566..51e3a407c5389 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 @@ diff --git a/libs/androidfw/tests/data/overlay/build b/libs/androidfw/tests/data/overlay/build index f73767749274f..112f373ead30f 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 0000000000000000000000000000000000000000..e0e054343601fccafab1a5b8a1ae6d1ae35346ce GIT binary patch literal 1254 zcmWIWW@Zs#U}E54U}%`nc-+I1{~7}W!yQHj24NuWn3qzNpPAyDn3tKBT3n)6k(-m+ z=bhK=AmEbivq3ji_`i}^T-8+8oQe6)1xdpHCp=`Zbm^Ot{6z2MV&fAM-&cefU%eVE zo3Tb--BMTdpmMDC+dIo2FwZ%l{)6d$)*s1RZsK!84_xXlTV=WQnwQ1YqABLGg<)OQ z|7N_K8P^n-#UKA6?AyM-;nTtvJ^x{p`?2$F|1+I0dBvu;Hvj)@xBA<>i1pii8-uI1 zya{5jPXEHK=J$W%J5NCq#{E+~6B_1~eOV^ALc{TYgo1ug~?%w`Kn`1b~A9=wom&bluxrsKCs?0K$Agp`z5{{L-T2)MCBFqT*yG z1|F~sFpL-&8Dtn7z%-D60tFZYNb@q3Fr+dR14$zWU50#yG9a&rA%`K6p%S8sNrCYS z69Yp%ke3XU&t=d9%H=Vn09EBPWCCeDxCwd;NkF+`plC9Z4a0}201QxIfHRZ;X<(3m z0VsS!fGm(W3~0a@K$-`LWq_Ck7&0Y5SOjFVfy2897*2T%=|Da!P_76FVPOt3GXN+K zvjfOvPyrE80E%%|c&HlzdAwk=KrxvPjz34Zd4@n)CME#}0U!-Z4Ii-2e#hKVsU z`7k6PiGl350Ag|hFuQ^QkOl`0%uWyo+0F_eA0|erodQ6UVP-?ajtOYL02jngFq<35 z4)A7V5@*I;r~s7!fda#}Mi7mqh=CaZk_MGZ=-Cl04mN-t=pNL}8Q{&z29jq2!df65 I%mU&80Kvk*B>(^b literal 0 HcmV?d00001 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 5bd98b28409d2..0000000000000 --- 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 6dc6edec64abf..4127aa0e2eccd 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 namespace com { @@ -17,9 +36,9 @@ struct R { }; struct string { - enum : uint32_t { - string_one = 0x7f030000u, - }; + enum : uint32_t { + string_one = 0x7f030000u, + }; }; struct style { @@ -33,3 +52,5 @@ struct R { } // 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 0000000000000..81f78b1b7b7fb --- /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 e763421626cf9..0000000000000 --- 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 4997e71dce6dc9f14b04be74902b562d35a2e115..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 380 zcmZ9Iy-EX75Ju14o5-4K3lR%@E0e}T@(k9t5_H8Ny1`Ab5ln62v-w7PX4wnD89wID znLoIhnvVpDbAEs$RqU!fjHha@uGN?NR>!Q^>TlffNXO0>%ns<5Ct0gQmTz>pkjC7G zB@4ahUefYnNAHytuRJ){u{O@FcGecd{IfAO_FS6p+|s!*Y{ISmE$>6NPc@CNO!}-8 yso~7LQomZn9J&1FfJbd=exgTDSoHZt!(0u`Y-EPQs;M{fcw;j1vMc@L<@O(ZqCiOi diff --git a/libs/androidfw/tests/data/styles/resources.arsc b/libs/androidfw/tests/data/styles/styles.apk similarity index 58% rename from libs/androidfw/tests/data/styles/resources.arsc rename to libs/androidfw/tests/data/styles/styles.apk index 8f65c9ad15070276f2c014d09248de5c92aa56ec..6064c482d6a6f271556bc9a0dd0035eefbe14790 100644 GIT binary patch delta 744 zcmeC+c_dgL;LXe;!obA9!NAZkpK<3Nai?_*3=AcV3=G0R+A%MsC_gjBH!&|WEw#8r zuOc@mwa;6q$w0s*zGwg3`>ovm517pKbn=}a^6R!R@jXzqSyq0*?}$+0vRzg$U-}$3 zT4IzC@rmJAP4-<2|JKa~qIrj6B?MmXTdbfgc(_Y=YQ0su_X@qvrEff+>TpK=bGYoY zIiTvCYs`u0U%%hS)kNvpPSby+A^)rL)m%>Y|LZ21tt$VQzO(1g-cvo19cqVypQ&kQZb7Hu^CI3b>xH=1yCBt4V;nT5I7(gSuwZwTe4foJu;m7b;%7btwOH z|A#lv1kKKzJ$vTPO!M!lPh^-`-u-0G+i@g$x!lRlno0Jb!tWWStJ_tkdLF&U#U@*N z{8S9ri7VTgj;%U-Y+CxVMQID`gFd};TYGvA|Gk>?}*zvMxv-l;O_M{0WdQop) zPgL!{cXe&S()oM;GeW!$^d&fIW8S0(bFeWmfG{7(>#4>0r9~Xcsl|GUMa9V*IM{$` zfssj^8Fy*`8^xf&u&oiq!jd-74L}cWgaP+~OrQ%;!af|FzF=m6)dG_wy1Nl(+yF)* b#1}A61bDLoeaFDS41@=OG!HOUGcW)E)$J0H delta 9 QcmaDP*uk@zg^7a=01z$$PXGV_ diff --git a/libs/androidfw/tests/data/system/R.h b/libs/androidfw/tests/data/system/R.h index 6a31fb8ff0882..becb38830fb35 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 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 1a70e84114b0f..bfbdf4ca770b9 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 0000000000000000000000000000000000000000..1299016a0f836d9ae4406f7643a7412a44a23f3d GIT binary patch literal 1417 zcmd^9T}V@L6hHTFE{(Mo4vJ~Dq==%eB8ok(h!C&RpxFmwtGN#w=@$3y%9IQh!-vF| zgbIR)S|J6!MM2OAe2G#ih#u5chz}v8FMU04cnvoCHW9M=>=lssu`TGC&_e&bWk=OgJZR5K*H*R1LX56_eA+SW_gGOvIIpC)?f@8j@^%KKsFf*LmVw@Zr4K zlg}+!!+md8R~_gvWxXGBdoS&-n;OY9sp{wBbwd_wO*r3wa<1##rpXHf^N!oM-fwko zmz&?nH;=rotsiz@9p00>=3dBeyc-<3Tz`LCpr$ie{9d^DCv4UQgbsP=eYST^+D**6!o%|7=Pr@xY4n+VNo6E!^E`QeL+ zh}i~6jw@+Zj>Z*FL{_3ASv3#FC4p-3Ev1qzx`YX2;J65-C`K}+DGB-ikqb*OW9%!s zq4YVEXp~HygnifbE zSPLxfkVq8m#C7;?hzt<u0J<0ax5RhRPPl|RabA#sf3AHE6!z(uAxl2) z(SaE5Pmj_1<1;fbKlFd;kL&C6>r&wQ>xqg*fef9BMlU=`c`v768(4WSN(UT&NR{Y- zbMbDt2G_Jh8u!F63F2DQ^6%baITt8 literal 0 HcmV?d00001 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 b0dab6b357e9d..0000000000000 --- 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;