Aapt main dex proguard rules - always keep application
Aapt with -D option was not keeping the application and instrumentation
subclasses, which were instead handled by mainDexClasses.rules. Instead,
include them in the aapt -D output.
Change-Id: Ia3b89fc2edd45d379c4d06f0bf674716646fcb3d
diff --git a/tools/aapt2/java/ProguardRules.cpp b/tools/aapt2/java/ProguardRules.cpp
index 9061660..902ec4c 100644
--- a/tools/aapt2/java/ProguardRules.cpp
+++ b/tools/aapt2/java/ProguardRules.cpp
@@ -170,16 +170,10 @@
}
}
} else if (node->name == "activity" || node->name == "service" ||
- node->name == "receiver" || node->name == "provider" ||
- node->name == "instrumentation") {
+ node->name == "receiver" || node->name == "provider") {
getName = true;
- }
- if (getName) {
- xml::Attribute* attr = node->findAttribute(xml::kSchemaAndroid, "name");
- getName = attr != nullptr;
-
- if (getName && mMainDexOnly) {
+ if (mMainDexOnly) {
xml::Attribute* componentProcess = node->findAttribute(xml::kSchemaAndroid,
"process");
@@ -187,6 +181,13 @@
: mDefaultProcess;
getName = !process.empty() && process[0] != ':';
}
+ } else if (node-> name == "instrumentation") {
+ getName = true;
+ }
+
+ if (getName) {
+ xml::Attribute* attr = node->findAttribute(xml::kSchemaAndroid, "name");
+ getName = attr != nullptr;
if (getName) {
Maybe<std::string> result = util::getFullyQualifiedClassName(mPackage,