blob: b4cf4f8d7f54c1984e0fbe8db30ef37818cf4174 [file] [log] [blame]
Adam Lesinski2ae4a872015-11-02 16:10:55 -08001/*
2 * Copyright (C) 2015 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
Adam Lesinski2ae4a872015-11-02 16:10:55 -080017#include "link/ManifestFixer.h"
Adam Lesinskice5e56e2016-10-21 17:56:45 -070018
19#include <unordered_set>
20
21#include "android-base/logging.h"
22
Adam Lesinskicacb28f2016-10-19 12:18:14 -070023#include "ResourceUtils.h"
Adam Lesinski2ae4a872015-11-02 16:10:55 -080024#include "util/Util.h"
Adam Lesinskicc5609d2016-04-05 12:41:07 -070025#include "xml/XmlActionExecutor.h"
Adam Lesinski467f1712015-11-16 17:35:44 -080026#include "xml/XmlDom.h"
Adam Lesinski2ae4a872015-11-02 16:10:55 -080027
Adam Lesinskid5083f62017-01-16 15:07:21 -080028using android::StringPiece;
29
Adam Lesinski2ae4a872015-11-02 16:10:55 -080030namespace aapt {
31
Adam Lesinskicc5609d2016-04-05 12:41:07 -070032/**
Adam Lesinskicacb28f2016-10-19 12:18:14 -070033 * This is how PackageManager builds class names from AndroidManifest.xml
34 * entries.
Adam Lesinskicc5609d2016-04-05 12:41:07 -070035 */
Adam Lesinskice5e56e2016-10-21 17:56:45 -070036static bool NameIsJavaClassName(xml::Element* el, xml::Attribute* attr,
Adam Lesinskicc5609d2016-04-05 12:41:07 -070037 SourcePathDiagnostics* diag) {
Adam Lesinskicacb28f2016-10-19 12:18:14 -070038 // We allow unqualified class names (ie: .HelloActivity)
39 // Since we don't know the package name, we can just make a fake one here and
40 // the test will be identical as long as the real package name is valid too.
Adam Lesinskice5e56e2016-10-21 17:56:45 -070041 Maybe<std::string> fully_qualified_class_name =
42 util::GetFullyQualifiedClassName("a", attr->value);
Adam Lesinskicc5609d2016-04-05 12:41:07 -070043
Adam Lesinskice5e56e2016-10-21 17:56:45 -070044 StringPiece qualified_class_name = fully_qualified_class_name
45 ? fully_qualified_class_name.value()
46 : attr->value;
Adam Lesinskid0f116b2016-07-08 15:00:32 -070047
Adam Lesinskice5e56e2016-10-21 17:56:45 -070048 if (!util::IsJavaClassName(qualified_class_name)) {
49 diag->Error(DiagMessage(el->line_number)
Adam Lesinskicacb28f2016-10-19 12:18:14 -070050 << "attribute 'android:name' in <" << el->name
51 << "> tag must be a valid Java class name");
Adam Lesinski52364f72016-01-11 13:10:24 -080052 return false;
Adam Lesinskicacb28f2016-10-19 12:18:14 -070053 }
54 return true;
55}
56
Adam Lesinskice5e56e2016-10-21 17:56:45 -070057static bool OptionalNameIsJavaClassName(xml::Element* el,
Adam Lesinskicacb28f2016-10-19 12:18:14 -070058 SourcePathDiagnostics* diag) {
Adam Lesinskice5e56e2016-10-21 17:56:45 -070059 if (xml::Attribute* attr = el->FindAttribute(xml::kSchemaAndroid, "name")) {
60 return NameIsJavaClassName(el, attr, diag);
Adam Lesinskicacb28f2016-10-19 12:18:14 -070061 }
62 return true;
63}
64
Adam Lesinskice5e56e2016-10-21 17:56:45 -070065static bool RequiredNameIsJavaClassName(xml::Element* el,
Adam Lesinskicacb28f2016-10-19 12:18:14 -070066 SourcePathDiagnostics* diag) {
Adam Lesinskice5e56e2016-10-21 17:56:45 -070067 if (xml::Attribute* attr = el->FindAttribute(xml::kSchemaAndroid, "name")) {
68 return NameIsJavaClassName(el, attr, diag);
Adam Lesinskicacb28f2016-10-19 12:18:14 -070069 }
Adam Lesinskice5e56e2016-10-21 17:56:45 -070070 diag->Error(DiagMessage(el->line_number)
Adam Lesinskicacb28f2016-10-19 12:18:14 -070071 << "<" << el->name << "> is missing attribute 'android:name'");
72 return false;
Adam Lesinski52364f72016-01-11 13:10:24 -080073}
74
Adam Lesinskice5e56e2016-10-21 17:56:45 -070075static bool VerifyManifest(xml::Element* el, SourcePathDiagnostics* diag) {
76 xml::Attribute* attr = el->FindAttribute({}, "package");
Adam Lesinskicacb28f2016-10-19 12:18:14 -070077 if (!attr) {
Adam Lesinskice5e56e2016-10-21 17:56:45 -070078 diag->Error(DiagMessage(el->line_number)
Adam Lesinskicacb28f2016-10-19 12:18:14 -070079 << "<manifest> tag is missing 'package' attribute");
80 return false;
Adam Lesinskice5e56e2016-10-21 17:56:45 -070081 } else if (ResourceUtils::IsReference(attr->value)) {
82 diag->Error(
83 DiagMessage(el->line_number)
Adam Lesinskicacb28f2016-10-19 12:18:14 -070084 << "attribute 'package' in <manifest> tag must not be a reference");
85 return false;
Adam Lesinskice5e56e2016-10-21 17:56:45 -070086 } else if (!util::IsJavaPackageName(attr->value)) {
87 diag->Error(DiagMessage(el->line_number)
Adam Lesinskicacb28f2016-10-19 12:18:14 -070088 << "attribute 'package' in <manifest> tag is not a valid Java "
89 "package name: '"
90 << attr->value << "'");
91 return false;
92 }
93 return true;
Adam Lesinski52364f72016-01-11 13:10:24 -080094}
95
Adam Lesinski6b17d2c2016-08-10 11:37:06 -070096/**
Adam Lesinskicacb28f2016-10-19 12:18:14 -070097 * The coreApp attribute in <manifest> is not a regular AAPT attribute, so type
Adam Lesinskice5e56e2016-10-21 17:56:45 -070098 * checking on it is manual.
Adam Lesinski6b17d2c2016-08-10 11:37:06 -070099 */
Adam Lesinskice5e56e2016-10-21 17:56:45 -0700100static bool FixCoreAppAttribute(xml::Element* el, SourcePathDiagnostics* diag) {
101 if (xml::Attribute* attr = el->FindAttribute("", "coreApp")) {
Adam Lesinskicacb28f2016-10-19 12:18:14 -0700102 std::unique_ptr<BinaryPrimitive> result =
Adam Lesinskice5e56e2016-10-21 17:56:45 -0700103 ResourceUtils::TryParseBool(attr->value);
Adam Lesinskicacb28f2016-10-19 12:18:14 -0700104 if (!result) {
Adam Lesinskice5e56e2016-10-21 17:56:45 -0700105 diag->Error(DiagMessage(el->line_number)
Adam Lesinskicacb28f2016-10-19 12:18:14 -0700106 << "attribute coreApp must be a boolean");
107 return false;
Adam Lesinski6b17d2c2016-08-10 11:37:06 -0700108 }
Adam Lesinskice5e56e2016-10-21 17:56:45 -0700109 attr->compiled_value = std::move(result);
Adam Lesinskicacb28f2016-10-19 12:18:14 -0700110 }
111 return true;
Adam Lesinski6b17d2c2016-08-10 11:37:06 -0700112}
113
Adam Lesinski86d67df2017-01-31 13:47:27 -0800114// Checks that <uses-feature> has android:glEsVersion or android:name, not both (or neither).
115static bool VerifyUsesFeature(xml::Element* el, SourcePathDiagnostics* diag) {
116 bool has_name = false;
117 if (xml::Attribute* attr = el->FindAttribute(xml::kSchemaAndroid, "name")) {
118 if (attr->value.empty()) {
119 diag->Error(DiagMessage(el->line_number)
120 << "android:name in <uses-feature> must not be empty");
121 return false;
122 }
123 has_name = true;
124 }
125
126 bool has_gl_es_version = false;
127 if (xml::Attribute* attr = el->FindAttribute(xml::kSchemaAndroid, "glEsVersion")) {
128 if (has_name) {
129 diag->Error(DiagMessage(el->line_number)
130 << "cannot define both android:name and android:glEsVersion in <uses-feature>");
131 return false;
132 }
133 has_gl_es_version = true;
134 }
135
136 if (!has_name && !has_gl_es_version) {
137 diag->Error(DiagMessage(el->line_number)
138 << "<uses-feature> must have either android:name or android:glEsVersion attribute");
139 return false;
140 }
141 return true;
142}
143
Adam Lesinskice5e56e2016-10-21 17:56:45 -0700144bool ManifestFixer::BuildRules(xml::XmlActionExecutor* executor,
Adam Lesinskicacb28f2016-10-19 12:18:14 -0700145 IDiagnostics* diag) {
146 // First verify some options.
Adam Lesinskice5e56e2016-10-21 17:56:45 -0700147 if (options_.rename_manifest_package) {
148 if (!util::IsJavaPackageName(options_.rename_manifest_package.value())) {
149 diag->Error(DiagMessage() << "invalid manifest package override '"
150 << options_.rename_manifest_package.value()
Adam Lesinskicacb28f2016-10-19 12:18:14 -0700151 << "'");
152 return false;
153 }
154 }
155
Adam Lesinskice5e56e2016-10-21 17:56:45 -0700156 if (options_.rename_instrumentation_target_package) {
157 if (!util::IsJavaPackageName(
158 options_.rename_instrumentation_target_package.value())) {
159 diag->Error(DiagMessage()
Adam Lesinskicacb28f2016-10-19 12:18:14 -0700160 << "invalid instrumentation target package override '"
Adam Lesinskice5e56e2016-10-21 17:56:45 -0700161 << options_.rename_instrumentation_target_package.value()
Adam Lesinskicacb28f2016-10-19 12:18:14 -0700162 << "'");
163 return false;
164 }
165 }
166
Adam Lesinski86d67df2017-01-31 13:47:27 -0800167 // Common <intent-filter> actions.
Adam Lesinskice5e56e2016-10-21 17:56:45 -0700168 xml::XmlNodeAction intent_filter_action;
169 intent_filter_action["action"];
170 intent_filter_action["category"];
171 intent_filter_action["data"];
Adam Lesinskicacb28f2016-10-19 12:18:14 -0700172
Adam Lesinski86d67df2017-01-31 13:47:27 -0800173 // Common <meta-data> actions.
Adam Lesinskice5e56e2016-10-21 17:56:45 -0700174 xml::XmlNodeAction meta_data_action;
Adam Lesinskicacb28f2016-10-19 12:18:14 -0700175
Adam Lesinski86d67df2017-01-31 13:47:27 -0800176 // Common <uses-feature> actions.
177 xml::XmlNodeAction uses_feature_action;
178 uses_feature_action.Action(VerifyUsesFeature);
179
180 // Common component actions.
181 xml::XmlNodeAction component_action;
182 component_action.Action(RequiredNameIsJavaClassName);
183 component_action["intent-filter"] = intent_filter_action;
184 component_action["meta-data"] = meta_data_action;
185
Adam Lesinskicacb28f2016-10-19 12:18:14 -0700186 // Manifest actions.
Adam Lesinskice5e56e2016-10-21 17:56:45 -0700187 xml::XmlNodeAction& manifest_action = (*executor)["manifest"];
188 manifest_action.Action(VerifyManifest);
189 manifest_action.Action(FixCoreAppAttribute);
190 manifest_action.Action([&](xml::Element* el) -> bool {
191 if (options_.version_name_default) {
192 if (el->FindAttribute(xml::kSchemaAndroid, "versionName") == nullptr) {
Adam Lesinskicacb28f2016-10-19 12:18:14 -0700193 el->attributes.push_back(
194 xml::Attribute{xml::kSchemaAndroid, "versionName",
Adam Lesinskice5e56e2016-10-21 17:56:45 -0700195 options_.version_name_default.value()});
Adam Lesinskicacb28f2016-10-19 12:18:14 -0700196 }
Adam Lesinskicc5609d2016-04-05 12:41:07 -0700197 }
198
Adam Lesinskice5e56e2016-10-21 17:56:45 -0700199 if (options_.version_code_default) {
200 if (el->FindAttribute(xml::kSchemaAndroid, "versionCode") == nullptr) {
Adam Lesinskicacb28f2016-10-19 12:18:14 -0700201 el->attributes.push_back(
202 xml::Attribute{xml::kSchemaAndroid, "versionCode",
Adam Lesinskice5e56e2016-10-21 17:56:45 -0700203 options_.version_code_default.value()});
Adam Lesinskicacb28f2016-10-19 12:18:14 -0700204 }
Adam Lesinskicc5609d2016-04-05 12:41:07 -0700205 }
Adam Lesinski2ae4a872015-11-02 16:10:55 -0800206 return true;
Adam Lesinskicacb28f2016-10-19 12:18:14 -0700207 });
208
209 // Meta tags.
Adam Lesinskice5e56e2016-10-21 17:56:45 -0700210 manifest_action["eat-comment"];
Adam Lesinskicacb28f2016-10-19 12:18:14 -0700211
212 // Uses-sdk actions.
Adam Lesinskice5e56e2016-10-21 17:56:45 -0700213 manifest_action["uses-sdk"].Action([&](xml::Element* el) -> bool {
214 if (options_.min_sdk_version_default &&
215 el->FindAttribute(xml::kSchemaAndroid, "minSdkVersion") == nullptr) {
Adam Lesinskicacb28f2016-10-19 12:18:14 -0700216 // There was no minSdkVersion defined and we have a default to assign.
217 el->attributes.push_back(
218 xml::Attribute{xml::kSchemaAndroid, "minSdkVersion",
Adam Lesinskice5e56e2016-10-21 17:56:45 -0700219 options_.min_sdk_version_default.value()});
Adam Lesinskicacb28f2016-10-19 12:18:14 -0700220 }
221
Adam Lesinskice5e56e2016-10-21 17:56:45 -0700222 if (options_.target_sdk_version_default &&
223 el->FindAttribute(xml::kSchemaAndroid, "targetSdkVersion") == nullptr) {
Adam Lesinskicacb28f2016-10-19 12:18:14 -0700224 // There was no targetSdkVersion defined and we have a default to assign.
225 el->attributes.push_back(
226 xml::Attribute{xml::kSchemaAndroid, "targetSdkVersion",
Adam Lesinskice5e56e2016-10-21 17:56:45 -0700227 options_.target_sdk_version_default.value()});
Adam Lesinskicacb28f2016-10-19 12:18:14 -0700228 }
229 return true;
230 });
231
232 // Instrumentation actions.
Adam Lesinski86d67df2017-01-31 13:47:27 -0800233 manifest_action["instrumentation"].Action(RequiredNameIsJavaClassName);
Adam Lesinskice5e56e2016-10-21 17:56:45 -0700234 manifest_action["instrumentation"].Action([&](xml::Element* el) -> bool {
235 if (!options_.rename_instrumentation_target_package) {
Adam Lesinskicacb28f2016-10-19 12:18:14 -0700236 return true;
237 }
238
239 if (xml::Attribute* attr =
Adam Lesinskice5e56e2016-10-21 17:56:45 -0700240 el->FindAttribute(xml::kSchemaAndroid, "targetPackage")) {
241 attr->value = options_.rename_instrumentation_target_package.value();
Adam Lesinskicacb28f2016-10-19 12:18:14 -0700242 }
243 return true;
244 });
Adam Lesinski86d67df2017-01-31 13:47:27 -0800245 manifest_action["instrumentation"]["meta-data"] = meta_data_action;
Adam Lesinskicacb28f2016-10-19 12:18:14 -0700246
Adam Lesinskice5e56e2016-10-21 17:56:45 -0700247 manifest_action["original-package"];
248 manifest_action["protected-broadcast"];
249 manifest_action["uses-permission"];
250 manifest_action["permission"];
251 manifest_action["permission-tree"];
252 manifest_action["permission-group"];
Adam Lesinskice5e56e2016-10-21 17:56:45 -0700253 manifest_action["uses-configuration"];
Adam Lesinskice5e56e2016-10-21 17:56:45 -0700254 manifest_action["supports-screens"];
Adam Lesinski86d67df2017-01-31 13:47:27 -0800255 manifest_action["uses-feature"] = uses_feature_action;
256 manifest_action["feature-group"]["uses-feature"] = uses_feature_action;
Adam Lesinskice5e56e2016-10-21 17:56:45 -0700257 manifest_action["compatible-screens"];
258 manifest_action["compatible-screens"]["screen"];
Adam Lesinskice5e56e2016-10-21 17:56:45 -0700259 manifest_action["supports-gl-texture"];
Adam Lesinski5119e512016-12-05 19:48:20 -0800260 manifest_action["meta-data"] = meta_data_action;
261
Adam Lesinskicacb28f2016-10-19 12:18:14 -0700262 // Application actions.
Adam Lesinskice5e56e2016-10-21 17:56:45 -0700263 xml::XmlNodeAction& application_action = manifest_action["application"];
264 application_action.Action(OptionalNameIsJavaClassName);
Adam Lesinskicacb28f2016-10-19 12:18:14 -0700265
Adam Lesinskice5e56e2016-10-21 17:56:45 -0700266 application_action["uses-library"];
Adam Lesinskice5e56e2016-10-21 17:56:45 -0700267 application_action["meta-data"] = meta_data_action;
Adam Lesinski86d67df2017-01-31 13:47:27 -0800268 application_action["activity"] = component_action;
269 application_action["activity-alias"] = component_action;
270 application_action["service"] = component_action;
271 application_action["receiver"] = component_action;
Adam Lesinskicacb28f2016-10-19 12:18:14 -0700272
273 // Provider actions.
Adam Lesinski86d67df2017-01-31 13:47:27 -0800274 application_action["provider"] = component_action;
Adam Lesinskice5e56e2016-10-21 17:56:45 -0700275 application_action["provider"]["grant-uri-permissions"];
276 application_action["provider"]["path-permissions"];
Adam Lesinskicacb28f2016-10-19 12:18:14 -0700277
278 return true;
Adam Lesinski2ae4a872015-11-02 16:10:55 -0800279}
280
Adam Lesinski52364f72016-01-11 13:10:24 -0800281class FullyQualifiedClassNameVisitor : public xml::Visitor {
Adam Lesinskicacb28f2016-10-19 12:18:14 -0700282 public:
Adam Lesinskice5e56e2016-10-21 17:56:45 -0700283 using xml::Visitor::Visit;
Adam Lesinski52364f72016-01-11 13:10:24 -0800284
Adam Lesinskicacb28f2016-10-19 12:18:14 -0700285 explicit FullyQualifiedClassNameVisitor(const StringPiece& package)
Adam Lesinskice5e56e2016-10-21 17:56:45 -0700286 : package_(package) {}
Adam Lesinski52364f72016-01-11 13:10:24 -0800287
Adam Lesinskice5e56e2016-10-21 17:56:45 -0700288 void Visit(xml::Element* el) override {
Adam Lesinskicacb28f2016-10-19 12:18:14 -0700289 for (xml::Attribute& attr : el->attributes) {
Adam Lesinskice5e56e2016-10-21 17:56:45 -0700290 if (attr.namespace_uri == xml::kSchemaAndroid &&
291 class_attributes_.find(attr.name) != class_attributes_.end()) {
292 if (Maybe<std::string> new_value =
293 util::GetFullyQualifiedClassName(package_, attr.value)) {
294 attr.value = std::move(new_value.value());
Adam Lesinski52364f72016-01-11 13:10:24 -0800295 }
Adam Lesinskicacb28f2016-10-19 12:18:14 -0700296 }
Adam Lesinski52364f72016-01-11 13:10:24 -0800297 }
298
Adam Lesinskicacb28f2016-10-19 12:18:14 -0700299 // Super implementation to iterate over the children.
Adam Lesinskice5e56e2016-10-21 17:56:45 -0700300 xml::Visitor::Visit(el);
Adam Lesinskicacb28f2016-10-19 12:18:14 -0700301 }
302
303 private:
Adam Lesinskice5e56e2016-10-21 17:56:45 -0700304 StringPiece package_;
305 std::unordered_set<StringPiece> class_attributes_ = {"name"};
Adam Lesinski52364f72016-01-11 13:10:24 -0800306};
307
Adam Lesinskice5e56e2016-10-21 17:56:45 -0700308static bool RenameManifestPackage(const StringPiece& package_override,
309 xml::Element* manifest_el) {
310 xml::Attribute* attr = manifest_el->FindAttribute({}, "package");
Adam Lesinski52364f72016-01-11 13:10:24 -0800311
Adam Lesinskicacb28f2016-10-19 12:18:14 -0700312 // We've already verified that the manifest element is present, with a package
313 // name specified.
Adam Lesinskice5e56e2016-10-21 17:56:45 -0700314 CHECK(attr != nullptr);
Adam Lesinski52364f72016-01-11 13:10:24 -0800315
Adam Lesinskice5e56e2016-10-21 17:56:45 -0700316 std::string original_package = std::move(attr->value);
Adam Lesinskid5083f62017-01-16 15:07:21 -0800317 attr->value = package_override.to_string();
Adam Lesinski52364f72016-01-11 13:10:24 -0800318
Adam Lesinskice5e56e2016-10-21 17:56:45 -0700319 FullyQualifiedClassNameVisitor visitor(original_package);
320 manifest_el->Accept(&visitor);
Adam Lesinskicacb28f2016-10-19 12:18:14 -0700321 return true;
Adam Lesinski52364f72016-01-11 13:10:24 -0800322}
323
Adam Lesinskice5e56e2016-10-21 17:56:45 -0700324bool ManifestFixer::Consume(IAaptContext* context, xml::XmlResource* doc) {
325 xml::Element* root = xml::FindRootElement(doc->root.get());
326 if (!root || !root->namespace_uri.empty() || root->name != "manifest") {
327 context->GetDiagnostics()->Error(DiagMessage(doc->file.source)
Adam Lesinskicacb28f2016-10-19 12:18:14 -0700328 << "root tag must be <manifest>");
329 return false;
330 }
Adam Lesinski2ae4a872015-11-02 16:10:55 -0800331
Adam Lesinskice5e56e2016-10-21 17:56:45 -0700332 if ((options_.min_sdk_version_default ||
333 options_.target_sdk_version_default) &&
334 root->FindChild({}, "uses-sdk") == nullptr) {
Adam Lesinskie343eb12016-10-27 16:31:58 -0700335 // Auto insert a <uses-sdk> element. This must be inserted before the
336 // <application> tag. The device runtime PackageParser will make SDK version
337 // decisions while parsing <application>.
Adam Lesinskice5e56e2016-10-21 17:56:45 -0700338 std::unique_ptr<xml::Element> uses_sdk = util::make_unique<xml::Element>();
339 uses_sdk->name = "uses-sdk";
Adam Lesinskie343eb12016-10-27 16:31:58 -0700340 root->InsertChild(0, std::move(uses_sdk));
Adam Lesinskicacb28f2016-10-19 12:18:14 -0700341 }
Adam Lesinski2ae4a872015-11-02 16:10:55 -0800342
Adam Lesinskicacb28f2016-10-19 12:18:14 -0700343 xml::XmlActionExecutor executor;
Adam Lesinskice5e56e2016-10-21 17:56:45 -0700344 if (!BuildRules(&executor, context->GetDiagnostics())) {
Adam Lesinskicacb28f2016-10-19 12:18:14 -0700345 return false;
346 }
Adam Lesinskicc5609d2016-04-05 12:41:07 -0700347
Adam Lesinskice5e56e2016-10-21 17:56:45 -0700348 if (!executor.Execute(xml::XmlActionExecutorPolicy::kWhitelist,
349 context->GetDiagnostics(), doc)) {
Adam Lesinskicacb28f2016-10-19 12:18:14 -0700350 return false;
351 }
Adam Lesinskicc5609d2016-04-05 12:41:07 -0700352
Adam Lesinskice5e56e2016-10-21 17:56:45 -0700353 if (options_.rename_manifest_package) {
Adam Lesinskicacb28f2016-10-19 12:18:14 -0700354 // Rename manifest package outside of the XmlActionExecutor.
Adam Lesinskie343eb12016-10-27 16:31:58 -0700355 // We need to extract the old package name and FullyQualify all class
356 // names.
Adam Lesinskice5e56e2016-10-21 17:56:45 -0700357 if (!RenameManifestPackage(options_.rename_manifest_package.value(),
358 root)) {
Adam Lesinskicacb28f2016-10-19 12:18:14 -0700359 return false;
Adam Lesinskicc5609d2016-04-05 12:41:07 -0700360 }
Adam Lesinskicacb28f2016-10-19 12:18:14 -0700361 }
362 return true;
Adam Lesinski2ae4a872015-11-02 16:10:55 -0800363}
364
Adam Lesinskicacb28f2016-10-19 12:18:14 -0700365} // namespace aapt