Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 742888f0 authored by Adam Lesinski's avatar Adam Lesinski
Browse files

AAPT2: binary parser should be more lenient with files

Some APKs have file references that reference files that don't exist.

For now, just be lenient and ignore the files themselves.

Keep the actual reference until such a time as general resource
stripping is implemented.

Bug: 37749644
Test: manual
Change-Id: I773685acf41212405b71b064d64045fb4556dcfc
parent 0ddca920
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -213,10 +213,10 @@ class OptimizeCommand {

            if (file_ref->file == nullptr) {
              ResourceNameRef name(pkg->name, type->type, entry->name);
              context_->GetDiagnostics()->Error(DiagMessage(file_ref->GetSource())
              context_->GetDiagnostics()->Warn(DiagMessage(file_ref->GetSource())
                                                << "file for resource " << name << " with config '"
                                                << config_value->config << "' not found");
              return false;
              continue;
            }

            const StringPiece entry_name = entry->name;
+1 −2
Original line number Diff line number Diff line
@@ -439,11 +439,10 @@ std::unique_ptr<Item> BinaryResourceParser::ParseValue(const ResourceNameRef& na
    if (file_ref != nullptr) {
      file_ref->file = files_->FindFile(*file_ref->path);
      if (file_ref->file == nullptr) {
        context_->GetDiagnostics()->Error(DiagMessage() << "resource " << name << " for config '"
        context_->GetDiagnostics()->Warn(DiagMessage() << "resource " << name << " for config '"
                                                        << config << "' is a file reference to '"
                                                        << *file_ref->path
                                                        << "' but no such path exists");
        return {};
      }
    }
  }