summaryrefslogtreecommitdiffstats
path: root/build
diff options
context:
space:
mode:
authoragrieve <agrieve@chromium.org>2015-09-22 14:27:00 -0700
committerCommit bot <commit-bot@chromium.org>2015-09-22 21:36:54 +0000
commit74be507bf420d21eed1a354dc15b4784a6aba4ff (patch)
tree868d46980c223285529976c15167d85974b6f68b /build
parent3fa3fc4efcf0c10eaba541636c76d5bd7cc3bd73 (diff)
downloadchromium_src-74be507bf420d21eed1a354dc15b4784a6aba4ff.zip
chromium_src-74be507bf420d21eed1a354dc15b4784a6aba4ff.tar.gz
chromium_src-74be507bf420d21eed1a354dc15b4784a6aba4ff.tar.bz2
GN: Make _incremental apk targets work when no <application> exists
BUG=534849 Review URL: https://codereview.chromium.org/1352043007 Cr-Commit-Position: refs/heads/master@{#350236}
Diffstat (limited to 'build')
-rwxr-xr-xbuild/android/incremental_install/generate_android_manifest.py16
1 files changed, 7 insertions, 9 deletions
diff --git a/build/android/incremental_install/generate_android_manifest.py b/build/android/incremental_install/generate_android_manifest.py
index b9061ed..17eabd4 100755
--- a/build/android/incremental_install/generate_android_manifest.py
+++ b/build/android/incremental_install/generate_android_manifest.py
@@ -22,6 +22,7 @@ ElementTree.register_namespace('android', _ANDROID_NAMESPACE)
_INCREMENTAL_APP_NAME = 'org.chromium.incrementalinstall.BootstrapApplication'
_META_DATA_NAME = 'incremental-install-real-app'
+_DEFAULT_APPLICATION_CLASS = 'android.app.Application'
def _AddNamespace(name):
@@ -44,13 +45,11 @@ def _ParseArgs():
return parser.parse_args()
-def _ProcessManifest(main_manifest, main_manifest_path,
- disable_isolated_processes):
+def _ProcessManifest(main_manifest, disable_isolated_processes):
"""Returns a transformed AndroidManifest.xml for use with _incremental apks.
Args:
main_manifest: Manifest contents to transform.
- main_manifest_path: Path to main_manifest (used for error messages).
disable_isolated_processes: Whether to set all isolatedProcess attributes to
false
@@ -64,11 +63,10 @@ def _ProcessManifest(main_manifest, main_manifest_path,
doc = ElementTree.fromstring(main_manifest)
app_node = doc.find('application')
if app_node is None:
- raise Exception('Could not find <application> in %s' % main_manifest_path)
- real_app_class = app_node.get(_AddNamespace('name'))
- if real_app_class is None:
- raise Exception('Could not find android:name in <application> in %s' %
- main_manifest_path)
+ app_node = ElementTree.SubElement(doc, 'application')
+
+ real_app_class = app_node.get(_AddNamespace('name'),
+ _DEFAULT_APPLICATION_CLASS)
app_node.set(_AddNamespace('name'), _INCREMENTAL_APP_NAME)
meta_data_node = ElementTree.SubElement(app_node, 'meta-data')
@@ -81,7 +79,7 @@ def main():
options = _ParseArgs()
with open(options.src_manifest) as f:
main_manifest_data = f.read()
- new_manifest_data = _ProcessManifest(main_manifest_data, options.src_manifest,
+ new_manifest_data = _ProcessManifest(main_manifest_data,
options.disable_isolated_processes)
with open(options.out_manifest, 'w') as f:
f.write(new_manifest_data)