Refactor policy parsing
This change removes the ability for an overlayable resource to be
defined in multiple policy blocks within the same overlayable. This
change also changes aapt2 to use a bit mask to keep track of the parsed
policies.
Bug: 110869880
Bug: 120298168
Test: aapt2_tests
Change-Id: Ie26cd913f94a16c0b312f222bccfa48f62feceaa
diff --git a/tools/aapt2/Resources.proto b/tools/aapt2/Resources.proto
index bf9fe49..81a2c2e 100644
--- a/tools/aapt2/Resources.proto
+++ b/tools/aapt2/Resources.proto
@@ -136,12 +136,11 @@
// Represents a declaration that a resource is overayable at runtime.
message Overlayable {
enum Policy {
- NONE = 0;
- PUBLIC = 1;
- SYSTEM = 2;
- VENDOR = 3;
- PRODUCT = 4;
- PRODUCT_SERVICES = 5;
+ PUBLIC = 0;
+ SYSTEM = 1;
+ VENDOR = 2;
+ PRODUCT = 3;
+ PRODUCT_SERVICES = 4;
}
// Where this declaration was defined in source.
@@ -150,8 +149,8 @@
// Any comment associated with the declaration.
string comment = 2;
- // The policy of the overlayable declaration
- Policy policy = 3;
+ // The policy defined in the overlayable declaration.
+ repeated Policy policy = 3;
}
// An entry ID in the range [0x0000, 0xffff].
@@ -181,7 +180,7 @@
AllowNew allow_new = 4;
// Whether this resource can be overlaid by a runtime resource overlay (RRO).
- repeated Overlayable overlayable = 5;
+ Overlayable overlayable = 5;
// The set of values defined for this entry, each corresponding to a different
// configuration/variant.