summaryrefslogtreecommitdiff
path: root/tools/aapt2/ResourceParser.cpp
diff options
context:
space:
mode:
authorSteven Laver <lavers@google.com>2020-01-23 17:03:21 -0800
committerSteven Laver <lavers@google.com>2020-02-04 23:22:55 +0000
commit71998c3d8b36220df1be12fe6e1ba7eda81cde41 (patch)
tree8b5e07fadfa5561f430abd298094046a496c3fb3 /tools/aapt2/ResourceParser.cpp
parent4307c64762e7fd78e8cdd955296655d51a6094e2 (diff)
parentdb0ac39741da692dddac3ff31aa87634af92e1e8 (diff)
Merge RP1A.200123.001
Change-Id: I16a4437d9876db7a6a2b07231b4584df4564bee4
Diffstat (limited to 'tools/aapt2/ResourceParser.cpp')
-rw-r--r--tools/aapt2/ResourceParser.cpp10
1 files changed, 8 insertions, 2 deletions
diff --git a/tools/aapt2/ResourceParser.cpp b/tools/aapt2/ResourceParser.cpp
index c55765663204..74e2a0987c3f 100644
--- a/tools/aapt2/ResourceParser.cpp
+++ b/tools/aapt2/ResourceParser.cpp
@@ -1641,8 +1641,14 @@ bool ResourceParser::ParseDeclareStyleable(xml::XmlPullParser* parser,
ParsedResource* out_resource) {
out_resource->name.type = ResourceType::kStyleable;
- // Declare-styleable is kPrivate by default, because it technically only exists in R.java.
- out_resource->visibility_level = Visibility::Level::kPublic;
+ if (!options_.preserve_visibility_of_styleables) {
+ // This was added in change Idd21b5de4d20be06c6f8c8eb5a22ccd68afc4927 to mimic aapt1, but no one
+ // knows exactly what for.
+ //
+ // FWIW, styleables only appear in generated R classes. For custom views these should always be
+ // package-private (to be used only by the view class); themes are a different story.
+ out_resource->visibility_level = Visibility::Level::kPublic;
+ }
// Declare-styleable only ends up in default config;
if (out_resource->config != ConfigDescription::DefaultConfig()) {