RRO: Added partition policies for overlays
<overlayable> tags can now have policy elements that indicate which
partition the overlay apk must reside on in order to be allowed to
overlay a resource. This change only adds parsing of <policy> and
encoding of policy in the proto ResourceTable. A later change will add
the encoding of policy and overlayable in the binary APK.
<overlayable>
<policy type="system|vendor|product|product_services|public" >
<item type="string" name="oof" />
</policy>
</overlayable>
Bug: 110869880
Test: make aapt2_tests
Change-Id: I8d4ed7b0e01f981149c6e3190af1681073b79b03
diff --git a/tools/aapt2/test/Builders.cpp b/tools/aapt2/test/Builders.cpp
index f33ae31..03b59e0 100644
--- a/tools/aapt2/test/Builders.cpp
+++ b/tools/aapt2/test/Builders.cpp
@@ -135,6 +135,15 @@
return *this;
}
+ResourceTableBuilder& ResourceTableBuilder::AddOverlayable(const StringPiece& name,
+ const Maybe<Overlayable::Policy> p) {
+ ResourceName res_name = ParseNameOrDie(name);
+ Overlayable overlayable;
+ overlayable.policy = p;
+ CHECK(table_->AddOverlayable(res_name, overlayable, GetDiagnostics()));
+ return *this;
+}
+
StringPool* ResourceTableBuilder::string_pool() {
return &table_->string_pool;
}