From 09733f0b66058f497f4fbd006c22d665277e94ff Mon Sep 17 00:00:00 2001 From: torne Date: Wed, 1 Mar 2017 04:01:39 -0800 Subject: [PATCH] android_webview: support building a stub WebView. Allwo building a WebView APK which doesn't contain any code or assets, and no resources other than the icon. This APK has a special manifest tag which will direct the system to provide the missing files from another "donor" package at runtime that has compatible code (this will be Monochrome). To enable this to work, a new APK variable is defined called "generate_buildconfig_java" so that the BuildConfig.java file can be omitted from this APK (leaving the generated classes.dex containing nothing but the AAPT-generated R class for the single icon resource). The runtime doesn't like having multiple APKs in the classpath which define the same classes, so we need to omit this BuildConfig to avoid clashing with Monochrome's. BUG=664456 Review-Url: https://codereview.chromium.org/2634563002 Cr-Original-Commit-Position: refs/heads/master@{#453911} Cr-Mirrored-From: https://chromium.googlesource.com/chromium/src Cr-Mirrored-Commit: cbafd406aff624f7191f76d64e3c0fcb66b60653 --- config/android/rules.gni | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/config/android/rules.gni b/config/android/rules.gni index 1bfb32179..c265b5690 100644 --- a/config/android/rules.gni +++ b/config/android/rules.gni @@ -1464,6 +1464,9 @@ if (enable_java_templates) { # testonly: Marks this target as "test-only". # write_asset_list: Adds an extra file to the assets, which contains a list of # all other asset files. + # generate_buildconfig_java: If defined and false, skip generating the + # BuildConfig java class describing the build configuration. The default + # is true for non-test APKs. # requires_sdk_api_level_23: If defined and true, the apk is intended for # installation only on Android M or later. In these releases the system # linker does relocation unpacking, so we can enable it unconditionally. @@ -1675,6 +1678,10 @@ if (enable_java_templates) { defined(invoker.create_density_splits) && invoker.create_density_splits _create_language_splits = defined(invoker.language_splits) && invoker.language_splits != [] + _generate_buildconfig_java = !defined(invoker.apk_under_test) + if (defined(invoker.generate_buildconfig_java)) { + _generate_buildconfig_java = invoker.generate_buildconfig_java + } # Help GN understand that _create_abi_split is not unused (bug in GN). assert(_create_abi_split || true) @@ -1835,7 +1842,7 @@ if (enable_java_templates) { _srcjar_deps += [ ":${_template_name}__native_libraries_java" ] } - if (!defined(invoker.apk_under_test)) { + if (_generate_buildconfig_java) { java_cpp_template("${_template_name}__build_config_java") { package_name = "org/chromium/base" sources = [