summaryrefslogtreecommitdiff
path: root/tools/aapt2/link/ReferenceLinker.cpp
diff options
context:
space:
mode:
authorRyan Mitchell <rtmitchell@google.com>2018-11-06 16:39:36 -0800
committerRyan Mitchell <rtmitchell@google.com>2018-12-04 16:45:26 -0800
commit75e20dda2b1ef3d2593b02f6a366a02656c1c89d (patch)
tree8fbbab15ed762cd27097f38e4db0279d679f14eb /tools/aapt2/link/ReferenceLinker.cpp
parent7208efc83baa70999d2ab264c289b0a38d716ed5 (diff)
Encoding of <overlayable> and <policy>
This change defines two new chunks for encoding overlayable information. RES_TABLE_OVERLAYABLE_POLICY_TYPE contains flags that represent restrictions enforced on overlays that try to overlay a specific set of resource ids. The chunk header is followed by ResTable_ref for each id that belongs to the policy type. A policy chunk will be created for every unique combination of policies that are defined in overlayable declarations. RES_TABLE_OVERLAYABLE_TYPE holds policy blocks. Since <overlayable> does not currently have any attributes, only one overlayable block is encoded in an APK. This change also removes the SPEC_OVERLAYABLE flag because the runtime does not use the flag, and the overlayable chunk encoding renders it obsolete. Bug: 110869880 Bug: 117545186 Test: libandroidfw_tests and aapt2_tests Change-Id: I45ae9bf4176699f14c85e2b7a2e8560185d8a0b8
Diffstat (limited to 'tools/aapt2/link/ReferenceLinker.cpp')
-rw-r--r--tools/aapt2/link/ReferenceLinker.cpp11
1 files changed, 10 insertions, 1 deletions
diff --git a/tools/aapt2/link/ReferenceLinker.cpp b/tools/aapt2/link/ReferenceLinker.cpp
index 3a5d5858254d..1b6626a8dfe9 100644
--- a/tools/aapt2/link/ReferenceLinker.cpp
+++ b/tools/aapt2/link/ReferenceLinker.cpp
@@ -368,7 +368,16 @@ bool ReferenceLinker::Consume(IAaptContext* context, ResourceTable* table) {
// Symbol state information may be lost if there is no value for the resource.
if (entry->visibility.level != Visibility::Level::kUndefined && entry->values.empty()) {
context->GetDiagnostics()->Error(DiagMessage(entry->visibility.source)
- << "no definition for declared symbol '" << name << "'");
+ << "no definition for declared symbol '" << name
+ << "'");
+ error = true;
+ }
+
+ // Ensure that definitions for values declared as overlayable exist
+ if (!entry->overlayable_declarations.empty() && entry->values.empty()) {
+ context->GetDiagnostics()->Error(DiagMessage(entry->overlayable_declarations[0].source)
+ << "no definition for overlayable symbol '"
+ << name << "'");
error = true;
}