|
| 1 | +diff --git a/submodules/base/tools/aapt2/cmd/Link.cpp b/submodules/base/tools/aapt2/cmd/Link.cpp |
| 2 | +index 642a5618..f1348ce7 100644 |
| 3 | +--- a/submodules/base/tools/aapt2/cmd/Link.cpp |
| 4 | ++++ b/submodules/base/tools/aapt2/cmd/Link.cpp |
| 5 | +@@ -2483,10 +2483,11 @@ int LinkCommand::Action(const std::vector<std::string>& args) { |
| 6 | + if (package_id_int > std::numeric_limits<uint8_t>::max() |
| 7 | + || package_id_int == kFrameworkPackageId |
| 8 | + || (!options_.allow_reserved_package_id && package_id_int < kAppPackageId)) { |
| 9 | +- context.GetDiagnostics()->Error( |
| 10 | ++ context.GetDiagnostics()->Warn( |
| 11 | + android::DiagMessage() << StringPrintf( |
| 12 | +- "invalid package ID 0x%02x. Must be in the range 0x7f-0xff.", package_id_int)); |
| 13 | +- return 1; |
| 14 | ++ "invalid package ID 0x%02x. Must be in the range 0x7f-0xff. Ignoring...", package_id_int)); |
| 15 | ++ // Apktool |
| 16 | ++ // return 1; |
| 17 | + } |
| 18 | + context.SetPackageId(static_cast<uint8_t>(package_id_int)); |
| 19 | + } |
| 20 | +@@ -2589,6 +2590,23 @@ int LinkCommand::Action(const std::vector<std::string>& args) { |
| 21 | + ".mpg", ".mpeg", ".mp4", ".m4a", ".m4v", ".3gp", ".3gpp", ".3g2", ".3gpp2", ".wma", ".wmv", |
| 22 | + ".webm", ".mkv"}); |
| 23 | + |
| 24 | ++ // Populate no compress extensions specified in the extensions file. |
| 25 | ++ if (options_.extensions_to_not_compress_path) { |
| 26 | ++ std::ifstream extensionsFile(options_.extensions_to_not_compress_path.value()); |
| 27 | ++ |
| 28 | ++ if (extensionsFile.fail()) { |
| 29 | ++ context.GetDiagnostics()->Error( |
| 30 | ++ android::DiagMessage() << "could not open extensions file " |
| 31 | ++ << options_.extensions_to_not_compress_path.value() |
| 32 | ++ << " for reading"); |
| 33 | ++ return 1; |
| 34 | ++ } |
| 35 | ++ |
| 36 | ++ for (std::string line; getline(extensionsFile, line);) { |
| 37 | ++ options_.extensions_to_not_compress.insert(line); |
| 38 | ++ } |
| 39 | ++ } |
| 40 | ++ |
| 41 | + // Turn off auto versioning for static-libs. |
| 42 | + if (context.GetPackageType() == PackageType::kStaticLib) { |
| 43 | + options_.no_auto_version = true; |
| 44 | +diff --git a/submodules/base/tools/aapt2/cmd/Link.h b/submodules/base/tools/aapt2/cmd/Link.h |
| 45 | +index 2f178537..7d3111d5 100644 |
| 46 | +--- a/submodules/base/tools/aapt2/cmd/Link.h |
| 47 | ++++ b/submodules/base/tools/aapt2/cmd/Link.h |
| 48 | +@@ -78,6 +78,7 @@ struct LinkOptions { |
| 49 | + bool use_sparse_encoding = false; |
| 50 | + std::unordered_set<std::string> extensions_to_not_compress; |
| 51 | + std::optional<std::regex> regex_to_not_compress; |
| 52 | ++ std::optional<std::string> extensions_to_not_compress_path; |
| 53 | + FeatureFlagValues feature_flag_values; |
| 54 | + |
| 55 | + // Static lib options. |
| 56 | +@@ -291,6 +292,8 @@ class LinkCommand : public Command { |
| 57 | + &options_.manifest_fixer_options.rename_overlay_category); |
| 58 | + AddOptionalFlagList("-0", "File suffix not to compress.", |
| 59 | + &options_.extensions_to_not_compress); |
| 60 | ++ AddOptionalFlag("-e", "File containing list of extensions not to compress.", |
| 61 | ++ &options_.extensions_to_not_compress_path); |
| 62 | + AddOptionalSwitch("--no-compress", "Do not compress any resources.", |
| 63 | + &options_.do_not_compress_anything); |
| 64 | + AddOptionalSwitch("--keep-raw-values", "Preserve raw attribute values in xml files.", |
0 commit comments