summaryrefslogtreecommitdiff
path: root/tools/aapt2/cmd/Compile.cpp
diff options
context:
space:
mode:
authorIzabela Orlowska <imorlowska@google.com>2018-04-13 11:56:35 +0100
committerIzabela Orlowska <imorlowska@google.com>2018-04-18 14:27:52 +0100
commit1056019c2dcdce86d3ca78e96871363375bdc926 (patch)
tree971d5305f298ad93075efe458cabec673319ace1 /tools/aapt2/cmd/Compile.cpp
parentbf813dbdb2ddac50c59995e1cb610efb12c39179 (diff)
AAPT2: include package name in styleable children
When writing partial R files, also include the package of the styleable child: <declare-styleable name="ds1"> <attr name="font"/> <attr name="android:font"/> <attr name="tools:font"/> <attr name="com.foo.bar:font"/> </declare-styleable> will produce: default int styleable ds1_font default int styleable ds1_android_font default int styleable ds1_tools_font default int styleable ds1_com_foo_bar_font Bug: 73927419 Test: manual, see description Change-Id: Ica493408c7c6d9e7fae2b693c96fbc20a723ce08
Diffstat (limited to 'tools/aapt2/cmd/Compile.cpp')
-rw-r--r--tools/aapt2/cmd/Compile.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/tools/aapt2/cmd/Compile.cpp b/tools/aapt2/cmd/Compile.cpp
index 6fe86107d6c0..a17a0d3e7299 100644
--- a/tools/aapt2/cmd/Compile.cpp
+++ b/tools/aapt2/cmd/Compile.cpp
@@ -30,6 +30,7 @@
#include "Flags.h"
#include "ResourceParser.h"
#include "ResourceTable.h"
+#include "cmd/Util.h"
#include "compile/IdAssigner.h"
#include "compile/InlineXmlFormatParser.h"
#include "compile/Png.h"
@@ -328,6 +329,12 @@ static bool CompileTable(IAaptContext* context, const CompileOptions& options,
// nested under their parent and use its visibility.
r_txt_printer.Print("default int styleable ");
r_txt_printer.Print(entry->name);
+ // If the package name is present, also include it in the mangled name (e.g.
+ // "android")
+ if (!attr.name.value().package.empty()) {
+ r_txt_printer.Print("_");
+ r_txt_printer.Print(MakePackageSafeName(attr.name.value().package));
+ }
r_txt_printer.Print("_");
r_txt_printer.Println(attr.name.value().entry);
}