From 91adede1e925cc8d54eb819fb14316d274216ebf Mon Sep 17 00:00:00 2001 From: Alexander Frick Date: Fri, 28 Apr 2023 07:28:37 -0500 Subject: [PATCH] update android deps --- src/chrome/android/BUILD.gn | 461 +++-------- src/chrome/android/chrome_public_apk_tmpl.gni | 759 ++++++++++++++++++ .../strings/android_chrome_strings.grd | 90 ++- 3 files changed, 914 insertions(+), 396 deletions(-) create mode 100644 src/chrome/android/chrome_public_apk_tmpl.gni diff --git a/src/chrome/android/BUILD.gn b/src/chrome/android/BUILD.gn index eb48e7b4..30d3a951 100644 --- a/src/chrome/android/BUILD.gn +++ b/src/chrome/android/BUILD.gn @@ -21,11 +21,11 @@ import("//chrome/android/features/vr/public_vr_java_sources.gni") import("//chrome/android/feed/feed_java_sources.gni") import("//chrome/android/modules/chrome_bundle_tmpl.gni") import("//chrome/android/modules/chrome_feature_module_tmpl.gni") -import("//chrome/android/monochrome_android_manifest_jinja_variables.gni") import("//chrome/browser/commerce/price_tracking/android/java_sources.gni") import("//chrome/browser/commerce/subscriptions/android/java_sources.gni") import( "//chrome/browser/commerce/subscriptions/test/android/test_java_sources.gni") +import("//chrome/browser/page_info/buildflags.gni") import("//chrome/browser/password_manager/buildflags.gni") import("//chrome/browser/share/android/java_sources.gni") import("//chrome/chrome_paks.gni") @@ -48,142 +48,25 @@ if (android_64bit_target_cpu && skip_secondary_abi_for_cq) { } if (current_toolchain == default_toolchain) { - _default_package = "org.chromium.thorium" - if (use_stable_package_name_for_trichrome) { - _default_package += ".stable" - # CHANGED BY ALEX313031 FOR THORIUM - } else if (android_channel != "default" && android_channel != "stable") { - # android-binary-size trybot may checks if an internal Chrome variant's - # AndroidManifest is as expected by ensuring the differences between its - # AndroidManifest and its upstream target's .AndroidManifest.expected file - # are as expected. Upstream targets having a "org.chromium.chrome" package - # name will cause the comparison to output many unnecessary differences. - # See https://source.chromium.org/chromium/chromium/src/+/main:chrome/android/java/README.md - _default_package += "." + android_channel + # 32-bit library will have browser code in it. 64-bit is webview-only. + if (android_64bit_target_cpu && !skip_secondary_abi_for_cq) { + _monochrome_browser_toolchain = android_secondary_abi_toolchain + } else { + _monochrome_browser_toolchain = current_toolchain } - declare_args() { - # Android package name to use when compiling the public chrome targets - # (chrome_public_apk, monochrome_public_apk, etc. as well as the - # *_bundle variants). This is particularly useful when using - # monochrome_public_apk for WebView development, as the OS only accepts - # WebView providers which declare one of a handful of package names. See - # https://chromium.googlesource.com/chromium/src/+/HEAD/android_webview/docs/build-instructions.md#Changing-package-name - # for details. - chrome_public_manifest_package = _default_package - } - chrome_public_test_manifest_package = "org.chromium.thorium.tests" - - chrome_public_jinja_variables = - default_chrome_public_jinja_variables + - [ "manifest_package=$chrome_public_manifest_package" ] - chrome_public_android_manifest = - "$target_gen_dir/chrome_public_apk/AndroidManifest.xml" - trichrome_library_android_manifest = - "$target_gen_dir/trichrome_library_apk/AndroidManifest.xml" - trichrome_library_64_32_android_manifest = - "$target_gen_dir/trichrome_library_64_32_apk/AndroidManifest.xml" - trichrome_library_64_android_manifest = - "$target_gen_dir/trichrome_library_64_apk/AndroidManifest.xml" - trichrome_library_32_android_manifest = - "$target_gen_dir/trichrome_library_32_apk/AndroidManifest.xml" - app_hooks_impl = "java/src/org/chromium/chrome/browser/AppHooksImpl.java" # Exclude it from JNI registration if VR is not enabled. - chrome_jni_sources_exclusions = [] + chrome_jni_file_exclusions = [] if (!enable_vr) { - chrome_jni_sources_exclusions += [ "//chrome/android/features/vr/java/src/org/chromium/chrome/browser/vr/VrModuleProvider.java" ] - } - - jinja_template("chrome_public_android_manifest") { - input = "java/AndroidManifest.xml" - output = chrome_public_android_manifest - variables = chrome_public_jinja_variables - variables += [ - "min_sdk_version=$default_min_sdk_version", - "target_sdk_version=$android_sdk_version", - ] + chrome_jni_file_exclusions += [ "//chrome/android/features/vr/java/src/org/chromium/chrome/browser/vr/VrModuleProvider.java" ] } jinja_template("chrome_public_android_feature_vr_manifest") { input = "features/vr/java/AndroidManifest.xml" output = feature_module_vr_android_manifest_path - variables = chrome_public_jinja_variables - variables += [ - "min_sdk_version=$default_min_sdk_version", - "target_sdk_version=$android_sdk_version", - ] - } - - _use_stable_package_name_for_trichrome = - use_stable_package_name_for_trichrome && android_channel == "beta" - _use_high_package_name_for_64bit_only_trichrome = is_high_end_android - - jinja_template("trichrome_library_android_manifest") { - input = "java/AndroidManifest_trichrome_library.xml" - output = trichrome_library_android_manifest - if (_use_stable_package_name_for_trichrome) { - _version_code = trichrome_beta_version_code - } else { - _version_code = trichrome_version_code - } - variables = trichrome_jinja_variables + [ - "trichrome_version=$_version_code", - "manifest_package=$trichrome_library_package", - ] - } - - if (android_64bit_target_cpu) { - jinja_template("trichrome_library_64_32_android_manifest") { - input = "java/AndroidManifest_trichrome_library.xml" - output = trichrome_library_64_32_android_manifest - if (_use_stable_package_name_for_trichrome) { - _version_code = trichrome_64_32_beta_version_code - } else { - _version_code = trichrome_64_32_version_code - } - variables = trichrome_jinja_variables + [ - "trichrome_version=$_version_code", - "manifest_package=$trichrome_library_package", - "use32bitAbi=", - ] - } - jinja_template("trichrome_library_64_android_manifest") { - input = "java/AndroidManifest_trichrome_library.xml" - output = trichrome_library_64_android_manifest - if (_use_high_package_name_for_64bit_only_trichrome) { - if (_use_stable_package_name_for_trichrome) { - _version_code = trichrome_64_high_beta_version_code - } else { - _version_code = trichrome_64_high_version_code - } - } else { - if (_use_stable_package_name_for_trichrome) { - _version_code = trichrome_64_beta_version_code - } else { - _version_code = trichrome_64_version_code - } - } - variables = trichrome_jinja_variables + [ - "trichrome_version=$_version_code", - "manifest_package=$trichrome_library_package", - "use32bitAbi=", - ] - } - jinja_template("trichrome_library_32_android_manifest") { - input = "java/AndroidManifest_trichrome_library.xml" - output = trichrome_library_32_android_manifest - if (_use_stable_package_name_for_trichrome) { - _version_code = trichrome_32_beta_version_code - } else { - _version_code = trichrome_32_version_code - } - variables = trichrome_jinja_variables + [ - "trichrome_version=$_version_code", - "manifest_package=$trichrome_library_package", - ] - } + variables = default_chrome_public_jinja_variables } generate_ui_locale_resources("ui_locale_string_resources") { @@ -243,6 +126,7 @@ if (current_toolchain == default_toolchain) { "//chrome/browser/lens:java_resources", "//chrome/browser/password_check/android:java_resources", "//chrome/browser/password_manager/android:java_resources", + "//chrome/browser/quick_delete:java_resources", "//chrome/browser/search_resumption:java_resources", "//chrome/browser/signin/services/android:java_resources", "//chrome/browser/tab:java_resources", @@ -343,7 +227,6 @@ if (current_toolchain == default_toolchain) { deps = [ ":base_module_java", ":chrome_app_java_resources", - ":chrome_public_android_manifest", ":chrome_public_apk_template_resources", ":update_proto_java", ":usage_stats_proto_java", @@ -439,6 +322,7 @@ if (current_toolchain == default_toolchain) { "//chrome/browser/privacy_guide/android:java", "//chrome/browser/privacy_sandbox/android:java", "//chrome/browser/profiles/android:java", + "//chrome/browser/quick_delete:java", "//chrome/browser/safe_browsing/android:java", "//chrome/browser/safety_check/android:java", "//chrome/browser/search_engines/android:java", @@ -620,6 +504,7 @@ if (current_toolchain == default_toolchain) { "//components/webauthn/android:java", "//components/webrtc/android:java", "//components/webxr/android:ar_java_interfaces", + "//components/zoom/android:java", "//content/public/android:content_java", "//content/public/common:common_java", "//device/gamepad:java", @@ -646,13 +531,13 @@ if (current_toolchain == default_toolchain) { "//services/shape_detection/public/mojom:mojom_java", "//skia/public/mojom:mojom_java", "//third_party/android_deps:chromium_play_services_availability_java", - "//third_party/android_deps:com_google_android_play_core_java", "//third_party/android_deps:com_google_code_findbugs_jsr305_java", "//third_party/android_deps:com_google_guava_listenablefuture_java", "//third_party/android_deps:dagger_java", "//third_party/android_deps:guava_android_java", "//third_party/android_deps:javax_inject_javax_inject_java", "//third_party/android_deps:material_design_java", + "//third_party/android_deps:playcore_java", "//third_party/android_deps:protobuf_lite_runtime_java", "//third_party/android_media:android_media_java", "//third_party/android_swipe_refresh:android_swipe_refresh_java", @@ -793,6 +678,10 @@ if (current_toolchain == default_toolchain) { deps += [ "//chrome/browser/supervised_user:website_parent_approval_java" ] } + + if (page_info_use_internal_android_resources) { + deps += [ "//clank/components/page_info:java_resources" ] + } } # Template for strict mode detection enabling/disabling so that proguard strips out @@ -904,6 +793,7 @@ if (current_toolchain == default_toolchain) { ] deps = [ + "//chrome/browser/page_info:page_info_buildflags", "//chrome/browser/password_manager:password_manager_buildflags", "//device/vr/buildflags", ] @@ -936,7 +826,6 @@ if (current_toolchain == default_toolchain) { ":chrome_app_java_resources", ":chrome_java", ":chrome_jni_headers", - ":chrome_public_android_manifest", ":delegate_public_impl_java", "$google_play_services_package:google_play_services_base_java", "$google_play_services_package:google_play_services_basement_java", @@ -1053,6 +942,7 @@ if (current_toolchain == default_toolchain) { "//chrome/browser/tabmodel/internal:java", "//chrome/browser/tabpersistence:junit", "//chrome/browser/thumbnail:java", + "//chrome/browser/touch_to_fill/common/android:junit", "//chrome/browser/touch_to_fill/payments/android/internal:junit", "//chrome/browser/ui/android/appmenu:java", "//chrome/browser/ui/android/appmenu/internal:junit", @@ -1323,6 +1213,11 @@ if (current_toolchain == default_toolchain) { annotation_processor_deps = [ "//base/android/jni_generator:jni_processor" ] } + android_resources("chrome_unit_test_java_resources") { + testonly = true + sources = [ "//chrome/android/javatests/res/layout/bottombar_stub.xml" ] + } + android_library("chrome_unit_test_java") { testonly = true resources_package = "org.chromium.chrome.test" @@ -1346,6 +1241,7 @@ if (current_toolchain == default_toolchain) { "javatests/src/org/chromium/chrome/browser/crash/LogcatExtractionRunnableTest.java", "javatests/src/org/chromium/chrome/browser/crash/MinidumpUploadServiceTest.java", "javatests/src/org/chromium/chrome/browser/crypto/CipherFactoryTest.java", + "javatests/src/org/chromium/chrome/browser/customtabs/CustomTabBottomBarViewUnitTest.java", "javatests/src/org/chromium/chrome/browser/customtabs/CustomTabLaunchCauseMetricsTest.java", "javatests/src/org/chromium/chrome/browser/download/DownloadForegroundServiceManagerTest.java", "javatests/src/org/chromium/chrome/browser/download/DownloadForegroundServiceTest.java", @@ -1360,6 +1256,8 @@ if (current_toolchain == default_toolchain) { "javatests/src/org/chromium/chrome/browser/notifications/NotificationPlatformBridgeUnitTest.java", "javatests/src/org/chromium/chrome/browser/ntp/IncognitoDescriptionViewRenderTest.java", "javatests/src/org/chromium/chrome/browser/ntp/TitleUtilTest.java", + "javatests/src/org/chromium/chrome/browser/payments/CurrencyFormatterTest.java", + "javatests/src/org/chromium/chrome/browser/share/ShareUrlTest.java", "javatests/src/org/chromium/chrome/browser/status_indicator/StatusIndicatorViewBinderTest.java", "javatests/src/org/chromium/chrome/browser/tab/WebContentsStateBridgeTest.java", "javatests/src/org/chromium/chrome/browser/tab/state/FilePersistedTabDataStorageTest.java", @@ -1373,6 +1271,8 @@ if (current_toolchain == default_toolchain) { "javatests/src/org/chromium/chrome/browser/webapps/WebappLaunchCauseMetricsTest.java", ] deps = [ + ":chrome_app_java_resources", + ":chrome_unit_test_java_resources", ":chrome_unit_test_util_java", "//base:base_java", "//base:base_java_test_support", @@ -1381,6 +1281,7 @@ if (current_toolchain == default_toolchain) { "//chrome/browser/android/browserservices/intents:java", "//chrome/browser/android/browserservices/verification:java", "//chrome/browser/android/crypto:java", + "//chrome/browser/commerce/android:java", "//chrome/browser/commerce/subscriptions/android:subscriptions_java", "//chrome/browser/contextmenu:java", "//chrome/browser/download/android:download_java_tests", @@ -1414,6 +1315,7 @@ if (current_toolchain == default_toolchain) { "//components/browser_ui/widget/android:java", "//components/commerce/core/android:core_java", "//components/crash/android:java", + "//components/dom_distiller/core/android:dom_distiller_core_java", "//components/embedder_support/android:context_menu_java", "//components/embedder_support/android:util_java", "//components/external_intents/android:java", @@ -1442,6 +1344,7 @@ if (current_toolchain == default_toolchain) { "//third_party/android_deps:espresso_java", "//third_party/android_deps:guava_android_java", "//third_party/android_sdk:android_test_base_java", + "//third_party/android_sdk:android_test_mock_java", "//third_party/android_support_test_runner:rules_java", "//third_party/android_support_test_runner:runner_java", "//third_party/androidx:androidx_annotation_annotation_java", @@ -1455,6 +1358,7 @@ if (current_toolchain == default_toolchain) { "//third_party/mockito:mockito_java", "//ui/android:ui_full_java", "//ui/android:ui_java_test_support", + "//url:android_test_helper_java", "//url:gurl_java", "//url:gurl_junit_test_support", "//url:origin_java", @@ -2102,8 +2006,14 @@ if (current_toolchain == default_toolchain) { generate_jni_registration("chrome_jni_registration") { targets = [ ":chrome_public_base_module_java" ] + if (enable_vr) { + targets += [ "//chrome/android/features/vr:java" ] + } manual_jni_registration = true - sources_exclusions = chrome_jni_sources_exclusions + file_exclusions = chrome_jni_file_exclusions + if (allow_jni_multiplexing) { + enable_jni_multiplexing = true + } } # The test apks do not use chromium linker, but using manual JNI registration @@ -2111,8 +2021,28 @@ if (current_toolchain == default_toolchain) { generate_jni_registration("chrome_jni_for_test_registration") { testonly = true targets = [ ":chrome_public_base_module_java_for_test" ] + if (enable_vr) { + targets += [ "//chrome/android/features/vr:java" ] + } manual_jni_registration = true - sources_exclusions = chrome_jni_sources_exclusions + file_exclusions = chrome_jni_file_exclusions + if (allow_jni_multiplexing) { + enable_jni_multiplexing = true + } + } + + if (allow_jni_multiplexing) { + generate_jni_registration("monochrome_jni_registration") { + targets = [ + ":monochrome_java", + ":chrome_all_java", + ] + if (enable_vr) { + targets += [ "//chrome/android/features/vr:java" ] + } + file_exclusions = chrome_jni_file_exclusions + enable_jni_multiplexing = true + } } # This template instantiates targets responsible for generating pak @@ -2145,9 +2075,9 @@ if (current_toolchain == default_toolchain) { if (enable_resource_allowlist_generation) { if (_is_trichrome || _is_monochrome) { - _lib = "libmonochrome_pak_allowlist_inputs" + _lib = "libmonochrome_inputs" } else { - _lib = "libchrome_pak_allowlist_inputs" + _lib = "libchrome_inputs" } _resource_allowlist_target = "${_variant}_resource_allowlist" _resource_allowlist_file = @@ -2155,17 +2085,11 @@ if (current_toolchain == default_toolchain) { _lib_path = "/lib.unstripped/" + _lib + shlib_extension generate_resource_allowlist(_resource_allowlist_target) { - _fat_lib_toolchain = "" + _fat_lib_toolchain = current_toolchain if (_is_monochrome || _is_trichrome) { - # Always use the 32-bit library's allowlist since the 64-bit one is - # webview-only. # TODO(agrieve): For 64-bit primary, using libmonochrome_64 would be # more efficient. - if (android_64bit_target_cpu && !skip_secondary_abi_for_cq) { - _fat_lib_toolchain = android_secondary_abi_toolchain - } else { - _fat_lib_toolchain = current_toolchain - } + _fat_lib_toolchain = _monochrome_browser_toolchain } deps = [ ":${_lib}($_fat_lib_toolchain)" ] @@ -2479,9 +2403,6 @@ if (current_toolchain == default_toolchain) { deps += [ ":chrome_apk_pak_assets" ] } - android_manifest = chrome_public_android_manifest - android_manifest_dep = ":chrome_public_android_manifest" - shared_libraries = [ ":libchrome" ] version_name = chrome_version_name @@ -2494,13 +2415,6 @@ if (current_toolchain == default_toolchain) { enable_multidex = is_java_debug } - chrome_public_apk_or_module_tmpl("chrome_modern_public_base_bundle_module") { - target_type = "android_app_bundle_module" - is_base_module = true - add_view_trace_events = true - bundle_target = ":chrome_modern_public_bundle" - } - android_library("monochrome_java") { deps = [ ":base_module_java", @@ -2603,7 +2517,7 @@ if (current_toolchain == default_toolchain) { "//components/media_router/browser/android:cast_options_provider_java", "//components/minidump_uploader:minidump_uploader_java", "//components/module_installer/android:module_installer_java", - "//third_party/android_deps:com_google_android_play_core_java", + "//third_party/android_deps:playcore_java", "//third_party/androidx:androidx_annotation_annotation_java", "//third_party/androidx:androidx_collection_collection_java", "//ui/android:ui_no_recycler_view_java", @@ -2663,56 +2577,9 @@ if (current_toolchain == default_toolchain) { # include_32_bit_webview: When compiling a 64-bit browser configuration, if # true, a 32-bit WebView library will also be built and included. template("monochrome_public_apk_or_module_tmpl") { - _android_manifest = - "$target_gen_dir/manifest/${target_name}/AndroidManifest.xml" - _split_android_manifest = - "$target_gen_dir/manifest/${target_name}/AndroidManifest_split.xml" _is_trichrome = defined(invoker.is_trichrome) && invoker.is_trichrome _is_bundle = invoker.target_type == "android_app_bundle_module" - # Generate the manifest here in the template, to avoid a growing collection - # of manually-instantiated manifests. - split_manifest_template("${target_name}__android_manifest") { - definitions_in_split = _is_bundle - includes = [ "java/AndroidManifest.xml" ] - split_input = "java/AndroidManifest_split.xml" - split_output = _split_android_manifest - variables = chrome_public_jinja_variables + - [ "include_arcore_manifest_flag=$enable_arcore" ] - if (_is_trichrome) { - input = "java/AndroidManifest_trichrome_chrome.xml" - variables += trichrome_jinja_variables - - _is_64_bit_browser = - android_64bit_target_cpu && invoker.is_64_bit_browser - _include_32_bit_webview = !defined(invoker.include_32_bit_webview) || - invoker.include_32_bit_webview - _include_64_bit_webview = android_64bit_target_cpu && - (!defined(invoker.include_64_bit_webview) || - invoker.include_64_bit_webview) - _version_code = TRICHROME_VERSION_MAP["${android_64bit_target_cpu}_${_is_64_bit_browser}_${_include_64_bit_webview}_${_include_32_bit_webview}"] - variables += [ "trichrome_version=$_version_code" ] - } else { - _arch = "" - if (android_64bit_target_cpu && invoker.is_64_bit_browser) { - _arch = "_64" - } - input = "java/AndroidManifest_monochrome.xml" - includes += [ "//android_webview/nonembedded/java/AndroidManifest.xml" ] - variables += monochrome_android_manifest_jinja_variables + [ - "target_sdk_version=$android_sdk_version", - "webview_library=libmonochrome${_arch}.so", - ] - } - - # 32-bit is the common case, so remove the ABI variable in the 64-case. - if (android_64bit_target_cpu && invoker.is_64_bit_browser) { - variables -= [ use_32bit_abi_jinja_variable ] - } - - output = _android_manifest - } - monochrome_public_common_apk_or_module_tmpl(target_name) { forward_variables_from(invoker, [ @@ -2730,8 +2597,6 @@ if (current_toolchain == default_toolchain) { "target_type", "use_chromium_linker", ]) - android_manifest = _android_manifest - android_manifest_dep = ":${target_name}__android_manifest" if (!_is_trichrome) { # Resource allowlist used when generating R.java files and causes @@ -2792,8 +2657,6 @@ if (current_toolchain == default_toolchain) { trichrome_library_apk_tmpl("trichrome_library_apk") { apk_name = "TrichromeLibrary" - android_manifest = trichrome_library_android_manifest - android_manifest_dep = ":trichrome_library_android_manifest" if (android_64bit_target_cpu) { is_64_bit_browser = false @@ -2831,8 +2694,6 @@ if (current_toolchain == default_toolchain) { trichrome_library_apk_tmpl("trichrome_library_64_apk") { apk_name = "TrichromeLibrary64" - android_manifest = trichrome_library_64_android_manifest - android_manifest_dep = ":trichrome_library_64_android_manifest" is_64_bit_browser = true include_32_bit_webview = false if (enable_libs_and_assets_verification) { @@ -2844,8 +2705,6 @@ if (current_toolchain == default_toolchain) { if (!skip_secondary_abi_for_cq) { trichrome_library_apk_tmpl("trichrome_library_32_apk") { apk_name = "TrichromeLibrary32" - android_manifest = trichrome_library_32_android_manifest - android_manifest_dep = ":trichrome_library_32_android_manifest" is_64_bit_browser = false include_64_bit_webview = false if (enable_libs_and_assets_verification) { @@ -2856,8 +2715,6 @@ if (current_toolchain == default_toolchain) { trichrome_library_apk_tmpl("trichrome_library_64_32_apk") { apk_name = "TrichromeLibrary6432" - android_manifest = trichrome_library_64_32_android_manifest - android_manifest_dep = ":trichrome_library_64_32_android_manifest" is_64_bit_browser = true include_32_bit_webview = true if (enable_libs_and_assets_verification) { @@ -2868,95 +2725,12 @@ if (current_toolchain == default_toolchain) { } } - chrome_public_unit_test_apk_manifest = - "$root_gen_dir/chrome_public_unit_test_apk_manifest/AndroidManifest.xml" - chrome_public_test_apk_manifest = - "$root_gen_dir/chrome_public_test_apk_manifest/AndroidManifest.xml" - chrome_public_test_vr_apk_manifest = - "$root_gen_dir/chrome_public_test_vr_apk_manifest/AndroidManifest.xml" - monochrome_public_test_ar_apk_manifest = - "$root_gen_dir/monochrome_public_test_ar_apk_manifest/AndroidManifest.xml" - - jinja_template("chrome_public_unit_test_apk_manifest") { - input = "javatests/AndroidManifest.xml" - includes = [ "java/AndroidManifest.xml" ] - output = chrome_public_unit_test_apk_manifest - variables = default_chrome_public_jinja_variables - variables += [ - "manifest_package=$chrome_public_test_manifest_package", - "min_sdk_version=$default_min_sdk_version", - "target_sdk_version=$android_sdk_version", - ] - } - - jinja_template("chrome_public_test_apk_manifest") { - input = "javatests/AndroidManifest.xml" - includes = [ "java/AndroidManifest.xml" ] - output = chrome_public_test_apk_manifest - variables = default_chrome_public_jinja_variables - variables += [ - "manifest_package=$chrome_public_test_manifest_package", - "min_sdk_version=$default_min_sdk_version", - "target_sdk_version=$android_sdk_version", - ] - } - - jinja_template("chrome_public_test_vr_apk_manifest") { - input = "javatests/AndroidManifest.xml" - includes = [ "java/AndroidManifest.xml" ] - output = chrome_public_test_vr_apk_manifest - variables = chrome_public_jinja_variables - variables += [ - "min_sdk_version=$default_min_sdk_version", - "target_sdk_version=$android_sdk_version", - ] - } - - template("monochrome_public_test_ar_apk_manifest_tmpl") { - jinja_template(target_name) { - forward_variables_from(invoker, "*") - input = "javatests/AndroidManifest_monochrome.xml" - includes = [ - "java/AndroidManifest.xml", - "java/AndroidManifest_monochrome.xml", - "javatests/AndroidManifest.xml", - "//android_webview/nonembedded/java/AndroidManifest.xml", - ] - variables = - chrome_public_jinja_variables + - monochrome_android_manifest_jinja_variables + - [ - "target_sdk_version=$android_sdk_version", - "test_manifest_package=$chrome_public_test_manifest_package", - "webview_library=$webview_library_name", - "include_arcore_manifest_flag=$enable_arcore", - ] - } - } - - monochrome_public_test_ar_apk_manifest_tmpl( - "monochrome_public_test_ar_apk_manifest") { - output = monochrome_public_test_ar_apk_manifest - webview_library_name = "libmonochrome.so" - } - - if (android_64bit_target_cpu && skip_secondary_abi_for_cq) { - monochrome_public_test_ar_64_apk_manifest = "$root_gen_dir/monochrome_public_test_ar_64_apk_manifest/AndroidManifest.xml" - monochrome_public_test_ar_apk_manifest_tmpl( - "monochrome_public_test_ar_64_apk_manifest") { - output = monochrome_public_test_ar_64_apk_manifest - webview_library_name = "libmonochrome_64.so" - } - } - # As compared to chrome_public_test_apk, this target contains only unit tests # that require on device capabilities. These tests are smaller, more tightly # scoped, and do not leave lingering state after execution. # TODO(crbug.com/1238057): Set clear rules for what tests can be added here. chrome_test_apk_tmpl("chrome_public_unit_test_apk") { apk_name = "ChromePublicUnitTest" - android_manifest = chrome_public_unit_test_apk_manifest - android_manifest_dep = ":chrome_public_unit_test_apk_manifest" shared_libraries = [ ":libchromefortest" ] deps = [ ":chrome_unit_test_java", @@ -2991,6 +2765,7 @@ if (current_toolchain == default_toolchain) { "//components/external_intents/android:unit_device_javatests", "//components/infobars/android:unit_device_javatests", "//components/installedapp/android:unit_device_javatests", + "//components/messages/android:unit_device_javatests", "//components/messages/android/internal:unit_device_javatests", "//components/payments/content/android:unit_device_javatests", "//components/signin/public/android:unit_device_javatests", @@ -3019,8 +2794,6 @@ if (current_toolchain == default_toolchain) { #enable_lint = true apk_name = "ChromePublicTest" - android_manifest = chrome_public_test_apk_manifest - android_manifest_dep = ":chrome_public_test_apk_manifest" shared_libraries = [ ":libchromefortest" ] deps = [ ":chrome_test_apk_template_resources", @@ -3066,9 +2839,8 @@ if (current_toolchain == default_toolchain) { if (enable_vr) { chrome_test_apk_tmpl("chrome_public_test_vr_apk") { apk_name = "ChromePublicTestVr" - android_manifest = chrome_public_test_vr_apk_manifest - android_manifest_dep = ":chrome_public_test_vr_apk_manifest" shared_libraries = [ ":libchromefortest" ] + manifest_package = chrome_public_manifest_package deps = [ ":chrome_test_vr_java", @@ -3090,18 +2862,9 @@ if (current_toolchain == default_toolchain) { min_sdk_version = 24 target_sdk_version = android_sdk_version - android_manifest = monochrome_public_test_ar_apk_manifest - android_manifest_dep = ":monochrome_public_test_ar_apk_manifest" if (android_64bit_target_cpu) { - if (skip_secondary_abi_for_cq) { - android_manifest = monochrome_public_test_ar_64_apk_manifest - android_manifest_dep = ":monochrome_public_test_ar_64_apk_manifest" - is_64_bit_browser = true - include_32_bit_webview = false - } else { - is_64_bit_browser = false - include_64_bit_webview = true - } + is_64_bit_browser = skip_secondary_abi_for_cq + include_32_bit_webview = !skip_secondary_abi_for_cq } # This is where we would add the shared_libraries entry for @@ -3247,18 +3010,6 @@ if (current_toolchain == default_toolchain) { "--disable-fre", ] - instrumentation_test_runner("chrome_modern_public_bundle_smoke_test") { - apk_under_test = ":chrome_modern_public_bundle_apks" - android_test_apk = ":chrome_bundle_smoke_test_apk" - never_incremental = true - modules = [ "test_dummy" ] - if (!is_java_debug) { - proguard_mapping_path = - "$root_build_dir/apks/ChromeModernPublic.aab.mapping" - } - extra_args = _bundle_smoke_test_extra_args - } - instrumentation_test_runner("monochrome_public_bundle_smoke_test") { if (android_64bit_target_cpu && skip_secondary_abi_for_cq) { apk_under_test = "//chrome/android:monochrome_64_public_bundle_apks" @@ -3306,12 +3057,21 @@ if (current_toolchain == default_toolchain) { never_incremental = true modules = [ "test_dummy" ] extra_args = _bundle_smoke_test_extra_args - if (android_64bit_target_cpu && skip_secondary_abi_for_cq) { - apk_under_test = "//chrome/android:trichrome_chrome_64_bundle_apks" - additional_apks = [ "//chrome/android:trichrome_library_64_apk" ] - if (!is_java_debug) { - proguard_mapping_path = - "$root_build_dir/apks/TrichromeChrome64.aab.mapping" + if (android_64bit_target_cpu) { + if (skip_secondary_abi_for_cq) { + apk_under_test = "//chrome/android:trichrome_chrome_64_bundle_apks" + additional_apks = [ "//chrome/android:trichrome_library_64_apk" ] + if (!is_java_debug) { + proguard_mapping_path = + "$root_build_dir/apks/TrichromeChrome64.aab.mapping" + } + } else { + apk_under_test = "//chrome/android:trichrome_chrome_64_32_bundle_apks" + additional_apks = [ "//chrome/android:trichrome_library_64_32_apk" ] + if (!is_java_debug) { + proguard_mapping_path = + "$root_build_dir/apks/TrichromeChrome6432.aab.mapping" + } } } else { apk_under_test = "//chrome/android:trichrome_chrome_bundle_apks" @@ -3364,33 +3124,6 @@ if (current_toolchain == default_toolchain) { ] } - chrome_bundle("chrome_modern_public_bundle") { - base_module_target = ":chrome_modern_public_base_bundle_module" - bundle_name = "ChromeModernPublic" - compress_shared_libraries = true - if (android_64bit_target_cpu) { - is_64_bit_browser = true - } - add_view_trace_events = true - manifest_package = chrome_public_manifest_package - min_sdk_version = default_min_sdk_version - module_descs = chrome_modern_module_descs - } - - if (is_official_build) { - # Used for binary size monitoring. - create_app_bundle_minimal_apks("chrome_modern_public_minimal_apks") { - deps = [ ":chrome_modern_public_bundle" ] - bundle_path = "$root_build_dir/apks/ChromeModernPublic.aab" - } - - android_resource_sizes_test( - "resource_sizes_chrome_modern_public_minimal_apks") { - file_path = "$root_build_dir/apks/ChromeModernPublic.minimal.apks" - data_deps = [ ":chrome_modern_public_minimal_apks" ] - } - } - template("monochrome_or_trichrome_public_bundle_tmpl") { _base_module_target_name = "${invoker.target_name}__base_bundle_module" _is_trichrome = defined(invoker.is_trichrome) && invoker.is_trichrome @@ -3982,6 +3715,9 @@ template("libchrome_impl") { chrome_common_shared_library(target_name) { sources = [ "../browser/android/chrome_entry_point.cc" ] deps = [ ":chrome_jni_registration($default_toolchain)" ] + if (allow_jni_multiplexing) { + enable_jni_multiplexing = true + } if (defined(invoker.deps)) { deps += invoker.deps } @@ -3990,13 +3726,12 @@ template("libchrome_impl") { deps += [ "//chrome/browser/android/vr:module_factory" ] } - module_descs = chrome_modern_module_descs forward_variables_from(invoker, "*", [ "deps" ]) } } if (enable_resource_allowlist_generation) { - libchrome_impl("libchrome_pak_allowlist_inputs") { + libchrome_impl("libchrome_inputs") { collect_inputs_only = true } } @@ -4007,7 +3742,7 @@ libchrome_impl("libchrome") { if (enable_resource_allowlist_generation) { # Make sure allowlist_inputs is built first so when concurrent_links == 1 # it comes before the actual (very slow) link step. - deps = [ ":libchrome_pak_allowlist_inputs" ] + deps = [ ":libchrome_inputs" ] } } @@ -4039,6 +3774,9 @@ chrome_common_shared_library("libchromefortest") { if (enable_vr) { deps += [ "//chrome/browser/android/vr:test_support" ] } + if (allow_jni_multiplexing) { + enable_jni_multiplexing = true + } # Make this a partitioned library, since some partitioned code is linked in # (otherwise, the library will warn at build time that it contains multiple @@ -4061,11 +3799,18 @@ template("libmonochrome_apk_or_bundle_tmpl") { deps += invoker.deps } + defines = [] if (webview_includes_weblayer) { - defines = [ "WEBVIEW_INCLUDES_WEBLAYER" ] + defines += [ "WEBVIEW_INCLUDES_WEBLAYER" ] deps += [ "//weblayer:weblayer_lib" ] } + if (allow_jni_multiplexing) { + defines += [ "JNI_REGISTRATION_REQUIRED" ] + deps += [ ":monochrome_jni_registration($default_toolchain)" ] + enable_jni_multiplexing = true + } + if (enable_vr) { deps += [ "//chrome/browser/android/vr:module_factory" ] } @@ -4082,7 +3827,7 @@ if (!android_64bit_target_cpu || current_toolchain == android_secondary_abi_toolchain)) { # Avoiding a real link for this step allows the actual libmonochrome to # run at the same time as R8. - libmonochrome_apk_or_bundle_tmpl("libmonochrome_pak_allowlist_inputs") { + libmonochrome_apk_or_bundle_tmpl("libmonochrome_inputs") { collect_inputs_only = true } @@ -4092,7 +3837,7 @@ if (!android_64bit_target_cpu || if (enable_resource_allowlist_generation) { # Make sure allowlist_inputs is built first so when concurrent_links == 1 # it comes before the actual (very slow) link step. - deps = [ ":libmonochrome_pak_allowlist_inputs" ] + deps = [ ":libmonochrome_inputs" ] } } diff --git a/src/chrome/android/chrome_public_apk_tmpl.gni b/src/chrome/android/chrome_public_apk_tmpl.gni new file mode 100644 index 00000000..cdce768a --- /dev/null +++ b/src/chrome/android/chrome_public_apk_tmpl.gni @@ -0,0 +1,759 @@ +# Copyright 2015 The Chromium Authors +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +import("//android_webview/variables.gni") +import("//base/android/linker/config.gni") +import("//base/android/resource_exclusions.gni") +import("//build/config/android/rules.gni") +import("//build/config/compiler/compiler.gni") +import("//build/config/locales.gni") +import("//chrome/android/features/dev_ui/dev_ui_module.gni") +import("//chrome/android/modules/chrome_bundle_tmpl.gni") +import("//chrome/android/trichrome.gni") +import("//chrome/common/features.gni") +import("//chrome/version.gni") +import("//components/crash/android/silent_java_assert_reporting.gni") +import("//components/optimization_guide/features.gni") +import("//device/vr/buildflags/buildflags.gni") +import("//weblayer/variables.gni") +import("channel.gni") + +declare_args() { + # Android package name to use when compiling the public chrome targets + # (chrome_public_apk, monochrome_public_apk, etc. as well as the + # *_bundle variants). This is particularly useful when using + # monochrome_public_apk for WebView development, as the OS only accepts + # WebView providers which declare one of a handful of package names. See + # https://chromium.googlesource.com/chromium/src/+/HEAD/android_webview/docs/build-instructions.md#Changing-package-name + # for details. + chrome_public_manifest_package = "org.chromium.thorium" + if (use_stable_package_name_for_trichrome) { + chrome_public_manifest_package += ".stable" + # CHANGED BY ALEX313031 FOR THORIUM + } else if (android_channel != "default" && android_channel != "stable") { + chrome_public_manifest_package += "." + android_channel + } +} + +chrome_public_test_manifest_package = "org.chromium.thorium.tests" + +default_chrome_public_jinja_variables = [ + "channel=$android_channel", + "enable_cardboard=$enable_cardboard", + "enable_vr=$enable_vr", + "enable_arcore=$enable_arcore", + "zygote_preload_class=org.chromium.content_public.app.ZygotePreload", +] + +monochrome_android_manifest_jinja_variables = + [ "sandboxed_service_exported=true" ] + +# Generates an AndroidManifest.xml along with an optional second manifest +# dependent on the original. +# +# Variables: +# input: The base manifest template with the main application definition. +# output: Output path for |input|. +# split_input: Path to an alternate manifest that will be built if +# definitions_in_split is true. +# split_output: Output path for |split_input|. +# variables: Variables to pass to the jinja templates. +# definitions_in_split: If true will pass definitions_in_split=true in the +# variables passed to |input| and generate |split_output|. +template("split_manifest_template") { + _definitions_in_split = + defined(invoker.definitions_in_split) && invoker.definitions_in_split + jinja_template(target_name) { + forward_variables_from(invoker, + [ + "includes", + "input", + "output", + "variables", + ]) + if (_definitions_in_split) { + variables += [ "definitions_in_split=true" ] + } + } + + if (_definitions_in_split) { + jinja_template("${target_name}__split") { + forward_variables_from(invoker, + [ + "includes", + "variables", + ]) + if (!defined(includes)) { + includes = [] + } + includes += [ invoker.input ] + input = invoker.split_input + output = invoker.split_output + _rebased_input = rebase_path(invoker.input, "//") + variables += [ "base_manifest=${_rebased_input}" ] + } + } else { + not_needed(invoker, + [ + "split_input", + "split_output", + ]) + } +} + +# A template used to declare any target that will implement a full Chromium +# or Chrome application, either as an APK, or an app bundle module. +# +# Variables: +# target_type: Either 'android_apk' or 'android_app_bundle_module'. +# apk_name: For APK target types, the final APK name without a suffix. +# shared_libraries: List of native shared libraries targets to include in +# the final target (e.g. [ ":libchrome" ]). +# is_monochrome: Indicates that this target contains chrome and webview +# packaged together and can only run on Android N+. +# is_trichrome: Indicates this target relies on a trichrome static library +# target and can only run on Android P+. +# png_to_webp: Optional. If true, convert image resources to webp format. +# requires Android K+, since these were not supported by Android properly +# before 4.3.0. +# +# Plus all other variables accepted by android_apk() or +# android_app_bundle_module(), depending on the target type. +# +template("chrome_common_apk_or_module_tmpl") { + forward_variables_from(invoker, TESTONLY_AND_VISIBILITY) + + _target_type = invoker.target_type + assert(_target_type == "android_apk" || + _target_type == "android_app_bundle_module" || + _target_type == "instrumentation_test_apk") + + _is_monochrome = defined(invoker.is_monochrome) && invoker.is_monochrome + _is_trichrome = defined(invoker.is_trichrome) && invoker.is_trichrome + _is_bundle = _target_type == "android_app_bundle_module" + _is_test = _target_type == "instrumentation_test_apk" + assert(!(_is_test && _is_monochrome), "Unsupported configuration") + assert(!(_is_test && _is_trichrome), "Unsupported configuration") + + if (_is_test) { + testonly = true + } + + _is_64_bit_browser = + android_64bit_target_cpu && + (!defined(invoker.is_64_bit_browser) || invoker.is_64_bit_browser) + if (_is_trichrome || _is_monochrome) { + _include_64_bit_webview = + android_64bit_target_cpu && (!defined(invoker.include_64_bit_webview) || + invoker.include_64_bit_webview) + _include_32_bit_webview = !defined(invoker.include_32_bit_webview) || + invoker.include_32_bit_webview + _include_primary_abi = !android_64bit_target_cpu || _is_64_bit_browser || + _include_64_bit_webview + _include_secondary_abi = android_64bit_target_cpu && + (!_is_64_bit_browser || _include_32_bit_webview) + if (_include_secondary_abi) { + _secondary_out_dir = + get_label_info("X($android_secondary_abi_toolchain)", "root_out_dir") + not_needed([ "_secondary_out_dir" ]) + } + } + + assert(!(_is_monochrome && _is_trichrome), + "Cannot be both trichrome and monochrome!") + assert(_is_trichrome == defined(invoker.static_library_provider), + "If trichrome library is used, static_library_provider must be set " + + "so that a dep can be added on the library APK.") + + if (_is_trichrome) { + _version_code = TRICHROME_VERSION_MAP["${android_64bit_target_cpu}_${_is_64_bit_browser}_${_include_64_bit_webview}_${_include_32_bit_webview}"] + } else if (_is_monochrome) { + _version_code = MONOCHROME_VERSION_MAP["${android_64bit_target_cpu}_${_is_64_bit_browser}_${_include_64_bit_webview}_${_include_32_bit_webview}"] + } else { + _version_code = chrome_version_code + } + + if (defined(invoker.manifest_package)) { + _manifest_package = invoker.manifest_package + } else if (_is_test) { + _manifest_package = chrome_public_test_manifest_package + } else { + _manifest_package = chrome_public_manifest_package + } + + _android_manifest = "$target_gen_dir/$target_name/AndroidManifest.xml" + _split_android_manifest = + "$target_gen_dir/$target_name/AndroidManifest_split.xml" + _android_manifest_target_name = "${target_name}__android_manifest" + split_manifest_template(_android_manifest_target_name) { + definitions_in_split = _is_bundle + split_input = "//chrome/android/java/AndroidManifest_split.xml" + split_output = _split_android_manifest + includes = [] + output = _android_manifest + variables = default_chrome_public_jinja_variables + + [ "manifest_package=$_manifest_package" ] + if (_is_trichrome) { + input = "//chrome/android/java/AndroidManifest_trichrome_chrome.xml" + includes = [ "//chrome/android/java/AndroidManifest.xml" ] + variables += + trichrome_jinja_variables + [ "trichrome_version=$_version_code" ] + } else if (_is_monochrome) { + input = "//chrome/android/java/AndroidManifest_monochrome.xml" + includes = [ + "//android_webview/nonembedded/java/AndroidManifest.xml", + "//chrome/android/java/AndroidManifest.xml", + ] + variables += monochrome_android_manifest_jinja_variables + if (_is_64_bit_browser) { + variables += [ "webview_library=libmonochrome_64.so" ] + } else { + variables += [ "webview_library=libmonochrome.so" ] + } + } else { + input = "//chrome/android/java/AndroidManifest.xml" + } + if (_is_monochrome || _is_trichrome) { + _force_32_bit = _include_32_bit_webview && _include_64_bit_webview && + !_is_64_bit_browser + variables += [ "force_32_bit=$_force_32_bit" ] + } + if (_is_test) { + includes += [ input ] + input = "//chrome/android/javatests/AndroidManifest.xml" + } + if (defined(invoker.jinja_input)) { + includes += [ input ] + input = invoker.jinja_input + } + if (defined(invoker.jinja_extra_variables)) { + variables += invoker.jinja_extra_variables + } + if (defined(invoker.jinja_extra_includes)) { + includes += invoker.jinja_extra_includes + } + } + target(_target_type, target_name) { + android_manifest = _android_manifest + android_manifest_dep = ":$_android_manifest_target_name" + manifest_package = _manifest_package + + if (defined(invoker.min_sdk_version)) { + min_sdk_version = invoker.min_sdk_version + } else if (_is_trichrome) { + min_sdk_version = 29 + } + if (defined(invoker.version_name)) { + version_name = invoker.version_name + } else { + version_name = chrome_version_name + } + if (defined(invoker.version_code)) { + # Override for the actual versionCode, but not for trichrome_version. + version_code = invoker.version_code + } else { + version_code = _version_code + } + if (defined(invoker.expected_android_manifest)) { + expected_android_manifest_version_code_offset = chrome_version_code + expected_android_manifest_library_version_offset = chrome_version_code + } + + if (_target_type == "android_apk") { + command_line_flags_file = "chrome-command-line" + } + + if (_is_bundle) { + is_base_module = true + + # Sets ISOLATED_SPLITS_ENABLED in BuildConfig.java. + isolated_splits_enabled = true + } + + product_config_java_packages = [ "org.chromium.thorium.browser" ] + + if (_is_monochrome) { + alternative_android_sdk_dep = webview_framework_dep + app_as_shared_lib = true + + # Resource allowlist used when generating R.java files and causes + # only the webview subset of resources to be marked as non-final. + # Strings in this target will also be kept in the base apk rather than placed in the language splits. + shared_resources_allowlist_target = + "//android_webview:system_webview_no_weblayer_apk" + + # Ensure the localized resources for all locales are used, even when + # a smaller set is specified through aapt_locale_allowlist. + shared_resources_allowlist_locales = platform_pak_locales + + product_config_java_packages += [ webview_product_config_java_package ] + + if (webview_includes_weblayer) { + product_config_java_packages += [ weblayer_product_config_java_package ] + } + } + + if (enable_silent_java_assert_reporting) { + custom_assertion_handler = crash_reporting_assertion_handler + } + + if (allow_jni_multiplexing) { + enable_jni_multiplexing = true + } + + # Include resource strings files only for supported locales. + aapt_locale_allowlist = platform_pak_locales + + resource_exclusion_regex = common_resource_exclusion_regex + resource_exclusion_exceptions = common_resource_exclusion_exceptions + + # Exceptions (rationale in https://crbug.com/691733): + resource_exclusion_exceptions += [ + "*ic_file_download_white*", # Bottom edge seems misaligned. + "*ic_lock.*", # Bottom edge seems misaligned. + ] + + # Most of these, with the exception of resource_exclusion_exceptions, + # are currently duplicated in system_webview_apk_tmpl.gni. + + # Used only by alert dialog on tiny screens. + _material_package = "com_google_android_material.*" + resource_exclusion_regex += "|${_material_package}values-small" + + # Used only by date picker (which chrome doesn't use). + resource_exclusion_regex += "|${_material_package}-(w480dp-port|w360dp-port|h480dp-land|h360dp-land)" + + # Material design layouts that cause views to be kept that we don't use. + # Instead of manually filtering, unused resource removal would be better: + # https://crbug.com/636448 + resource_exclusion_regex += "|${_material_package}/xml.*badge_" + + if (!is_java_debug) { + # TODO(crbug.com/993340): Update test goldens with webp versions of images. + if (!_is_test) { + png_to_webp = true + } + + proguard_enabled = true + proguard_configs = [ "//chrome/android/proguard/main.flags" ] + if (_is_monochrome) { + proguard_configs += + [ "//android_webview/nonembedded/java/proguard.flags" ] + } + if (_is_test) { + proguard_configs += [ "//chrome/android/proguard/apk_for_test.flags" ] + } + if (defined(invoker.proguard_configs)) { + proguard_configs += invoker.proguard_configs + } + + # We only optimize resources for bundles since APKs are not shipped. + # Resources only live in the base module atm as such we only need to set + # these on the base module + if (_is_bundle) { + # Removes metadata needed for Resources.getIdentifier("resource_name"). + strip_resource_names = true + + # Shortens resource file names in apk eg: res/drawable/button.xml -> res/a.xml + short_resource_paths = true + + # Removes unused resources from the apk. Only enabled on official builds + # since it adds a slow step and serializes the build graph causing fewer + # expensive tasks (eg: proguarding, resource optimization) to be run in + # parallel by adding dependencies between them (adds around 10-20 + # seconds on my machine). + strip_unused_resources = is_official_build + + # Resources config for blocklisting resource names from obfuscation + resources_config_paths = [ "//chrome/android/aapt2.config" ] + if (_is_monochrome || _is_trichrome) { + resources_config_paths += [ "//android_webview/aapt2.config" ] + } + if (defined(invoker.resources_config_paths)) { + resources_config_paths += invoker.resources_config_paths + } + } + } + + deps = [ + "//chrome/android:chrome_base_module_resources", + "//chrome/android:chrome_public_non_pak_assets", + ] + + # TODO(agrieve): Make unconditional when moving to trampoline. + if (_is_monochrome || _is_trichrome) { + deps += [ "//components/crash/android:handler_java" ] + } + if (_is_monochrome) { + deps += [ "//chrome/android:base_monochrome_module_java" ] + } else { + deps += [ "//chrome/android:base_module_java" ] + } + if (defined(invoker.deps)) { + deps += invoker.deps + } + + if (!_is_trichrome) { + # These go in trichrome library. + deps += [ + "//gin:v8_snapshot_assets", + "//third_party/icu:icu_assets", + ] + + # TODO(agrieve): This is excluded from trichrome in preparation for + # "synchronized proguarding", which we've since abandoned. Enable for + # trichrome, or just remove the version check altogether. + build_config_include_product_version_resource = true + deps += [ "//chrome/android:product_version_resources" ] + } + + if (_is_bundle) { + # Required to support macro resources. + # See https://crbug.com/1278419 + deps += [ ":${target_name}__all_dfm_resources" ] + } else { + # For bundles, this exists in the "chrome" split. + deps += [ "//chrome/android:chrome_all_java" ] + + if (dfmify_dev_ui) { + # For bundles, Dev UI is a feature in a DFM. + deps += [ "//chrome/android/features/dev_ui:java" ] + } + if (enable_vr) { + # For bundles, VR is a feature in a DFM. + deps += [ "//chrome/android/features/vr:java" ] + } + } + + if (_is_monochrome) { + deps += [ + "//android_webview/glue:glue_java", + "//android_webview/nonembedded:monochrome_devui_launcher_icon_resources", + "//android_webview/nonembedded:nonembedded_java", + ] + + # For bundles, this lives in chrome split. + if (!_is_bundle) { + deps += [ "//chrome/android:monochrome_java" ] + } + + if (_include_primary_abi) { + deps += [ "//android_webview:monochrome_webview_primary_abi_assets" ] + } + if (_include_secondary_abi) { + deps += [ "//android_webview:monochrome_webview_secondary_abi_assets" ] + } + } + + if (_is_bundle && _is_monochrome) { + deps += [ "//chrome/android:monochrome_bundle_module_pak_assets" ] + } else if (_is_bundle && _is_trichrome) { + deps += [ "//chrome/android:trichrome_chrome_bundle_module_pak_assets" ] + } else if (_is_bundle) { + deps += [ "//chrome/android:chrome_bundle_module_pak_assets" ] + } else if (_is_monochrome) { + deps += [ "//chrome/android:monochrome_apk_pak_assets" ] + } else { + assert(!_is_trichrome) + deps += [ "//chrome/android:chrome_apk_pak_assets" ] + } + + if (defined(invoker.add_upstream_only_deps) && + invoker.add_upstream_only_deps) { + if (_is_monochrome) { + deps += upstream_only_webview_deps + } else if (!_is_trichrome) { + deps += [ + "//chrome/android:chrome_public_apk_base_module_resources", + "//chrome/android:chrome_public_base_module_java", + "//chrome/android:chrome_public_non_pak_assets", + "//components/browser_ui/styles/android:chrome_public_apk_resources", + ] + } + if (_is_bundle) { + deps += [ + # deps in delegate_public_impl_java are put into the Chrome module, but the language deps + # are needed by the base module. + "//components/language/android:ulp_delegate_public_java", + ] + } else { + deps += [ "//chrome/android:delegate_public_impl_java" ] + } + if (_is_test) { + deps += [ "//chrome/android:chrome_public_base_module_java_for_test" ] + } + } + + # https://crbug.com/1415351 + assert_no_deps = [ + "//third_party/androidx:androidx_window_extensions_core_core_java", + "//third_party/androidx:androidx_window_sidecar_sidecar_java", + "//third_party/androidx:androidx_window_window_java_java", + ] + if (defined(invoker.assert_no_deps)) { + assert_no_deps += invoker.assert_no_deps + } + + # Unwind tables are included in the stack_unwinder DFM on Android, so they + # aren't needed for bundle builds. However, we keep them for non-bundle + # builds, such as test and development apks (e.g. chrome_public_apk), to + # allow tests and developers to use them directly. + if (!defined(invoker.shared_libraries) && !_is_bundle && + add_unwind_tables_in_chrome_32bit_apk && + (target_cpu == "arm" || + (target_cpu == "arm64" && !_is_64_bit_browser))) { + if (_is_test) { + deps += [ "//chrome/android:libchromefortest_unwind_table_assets" ] + } else if (_is_monochrome || _is_trichrome) { + deps += [ "//chrome/android:libmonochrome_unwind_table_assets" ] + } else { + deps += [ "//chrome/android:libchrome_unwind_table_assets" ] + } + } + + data_deps = [] + if (defined(invoker.data_deps)) { + data_deps += invoker.data_deps + } + + # Prefer to add this data_dep on the final target instead of java targets + # like chrome_all_java so that all other targets can build in parallel with + # lint. + if (!disable_android_lint) { + data_deps += [ "//chrome/android:android_lint" ] + } + + shared_libraries = [] + loadable_modules = [] + if (android_64bit_target_cpu) { + secondary_abi_shared_libraries = [] + secondary_abi_loadable_modules = [] + } + if (defined(invoker.loadable_modules)) { + loadable_modules = invoker.loadable_modules + } + if (defined(invoker.secondary_abi_loadable_modules)) { + secondary_abi_loadable_modules = invoker.secondary_abi_loadable_modules + } + + if (_is_64_bit_browser && build_hwasan_splits) { + _hwasan_toolchain = "//build/toolchain/android:android_clang_arm64_hwasan" + } + + if (defined(invoker.shared_libraries)) { + shared_libraries += invoker.shared_libraries + } else if (_is_test) { + shared_libraries += [ "//chrome/android:libchromefortest" ] + } else if (_is_monochrome) { + if (android_64bit_target_cpu) { + # Build //android_webview:monochrome with the opposite bitness that + # Chrome runs in. + if (_is_64_bit_browser) { + shared_libraries += [ "//chrome/android:libmonochrome_64" ] + if (_include_32_bit_webview) { + secondary_abi_shared_libraries += [ "//android_webview:monochrome_64($android_secondary_abi_toolchain)" ] + } + if (build_hwasan_splits) { + shared_libraries += + [ "//chrome/android:libmonochrome_64($_hwasan_toolchain)" ] + } + } else { + if (_include_64_bit_webview) { + shared_libraries += [ "//android_webview:monochrome" ] + } + secondary_abi_shared_libraries += [ + "//chrome/android:libmonochrome($android_secondary_abi_toolchain)", + ] + } + } else { + shared_libraries += [ "//chrome/android:libmonochrome" ] + } + } else if (!_is_trichrome) { + shared_libraries += [ "//chrome/android:libchrome" ] + } + + if (enable_arcore) { + # The arcore manifest needs to be merged into the base module because + # the Play Store verifies the com.google.ar.core.min_apk_version + # meta-data tag is in the base manifest. + deps += [ + "//third_party/arcore-android-sdk-client:arcore_base_manifest_java", + ] + + # For Trichrome, the primary abi arcore library is added to + # TrichromeLibrary.apk, so it's not needed here. + if (!_is_trichrome) { + _arcore_target = "//third_party/arcore-android-sdk-client:com_google_ar_core_J__unpack_aar" + deps += [ _arcore_target ] + _libarcore_dir = get_label_info(_arcore_target, "target_out_dir") + + "/com_google_ar_core_java/jni" + + if (android_64bit_target_cpu) { + if (_is_64_bit_browser) { + loadable_modules += + [ "$_libarcore_dir/arm64-v8a/libarcore_sdk_c.so" ] + } else { + secondary_abi_loadable_modules += + [ "$_libarcore_dir/armeabi-v7a/libarcore_sdk_c.so" ] + } + } else { + loadable_modules += + [ "$_libarcore_dir/armeabi-v7a/libarcore_sdk_c.so" ] + } + } + } + library_always_compress = [] + if (defined(invoker.library_always_compress)) { + library_always_compress = invoker.library_always_compress + } + + # TODO(agrieve): Use Crashpad trampoline in chrome_public_apk. + if (!_is_monochrome && !_is_trichrome) { + deps += + [ "//components/crash/core/app:chrome_crashpad_handler_named_as_so" ] + loadable_modules += [ "$root_out_dir/libchrome_crashpad_handler.so" ] + library_always_compress += [ "libchrome_crashpad_handler.so" ] + } else if (!_is_trichrome) { + # Crashpad trampoline lives in TrichromeLibrary.apk. + # https://chromium.googlesource.com/chromium/src/+/main/docs/android_native_libraries.md#Crashpad-Packaging + if (_include_primary_abi) { + deps += [ + "//third_party/crashpad/crashpad/handler:crashpad_handler_trampoline", + ] + loadable_modules += + [ "$root_out_dir/libcrashpad_handler_trampoline.so" ] + } + if (_include_secondary_abi) { + deps += [ "//third_party/crashpad/crashpad/handler:crashpad_handler_trampoline($android_secondary_abi_toolchain)" ] + secondary_abi_loadable_modules += + [ "$_secondary_out_dir/libcrashpad_handler_trampoline.so" ] + } + } + + # The Chromium Linker depends on ASharedMemory_create() introduced in O. + use_chromium_linker = chromium_linker_supported && _is_trichrome + + if (use_chromium_linker) { + if (android_64bit_target_cpu && !_is_64_bit_browser) { + deps += [ "//base/android/linker:chromium_android_linker($android_secondary_abi_toolchain)" ] + secondary_abi_loadable_modules += + [ "$_secondary_out_dir/libchromium_android_linker$shlib_extension" ] + } else { + deps += [ "//base/android/linker:chromium_android_linker" ] + loadable_modules += + [ "$root_out_dir/libchromium_android_linker$shlib_extension" ] + } + if (_is_64_bit_browser && build_hwasan_splits) { + deps += [ + "//base/android/linker:chromium_android_linker($_hwasan_toolchain)", + ] + _hwasan_outdir = get_label_info(":($_hwasan_toolchain)", "root_out_dir") + loadable_modules += + [ "$_hwasan_outdir/libchromium_android_linker$shlib_extension" ] + } + } + + if (build_with_internal_optimization_guide) { + if (android_64bit_target_cpu && !_is_64_bit_browser) { + _secondary_optimization_guide = "//components/optimization_guide/internal:optimization_guide_internal($android_secondary_abi_toolchain)" + deps += [ _secondary_optimization_guide ] + secondary_abi_loadable_modules += + [ "$_secondary_out_dir/liboptimization_guide_internal.so" ] + } else { + deps += [ "//components/optimization_guide/internal:optimization_guide_internal" ] + loadable_modules += + [ "$root_out_dir/liboptimization_guide_internal.so" ] + } + } + + if (_is_trichrome) { + if (android_64bit_target_cpu && !_is_64_bit_browser) { + static_library_provider_use_secondary_abi = true + } + + # Include placeholder libraries to make Chrome multiarch in the same way + # as Monochrome, even though Chrome only runs with one of the two + # bitnesses. This allows the "32-bit" and "64-bit" versions of Chrome to + # depend on their respective versions of the shared library APK even + # though they're functionally the same. + if (_include_primary_abi && loadable_modules == []) { + native_lib_placeholders = [ "libdummy.so" ] + } + if (_include_secondary_abi && secondary_abi_loadable_modules == []) { + secondary_native_lib_placeholders = [ "libdummy.so" ] + } + + # http://crbug.com/1042107. + if (is_component_build) { + if (_is_64_bit_browser) { + main_component_library = "libmonochrome_64.cr.so" + } else { + main_component_library = "libmonochrome.cr.so" + } + } + } + + if (_is_test) { + bundles_supported = true + deps += [ "//third_party/androidx:androidx_test_runner_java" ] + + # For EmbeddedTestServer. + additional_apks = [ "//net/android:net_test_support_apk" ] + if (defined(invoker.additional_apks)) { + additional_apks += invoker.additional_apks + } + } + + forward_variables_from(invoker, + "*", + TESTONLY_AND_VISIBILITY + [ + "additional_apks", + "assert_no_deps", + "data_deps", + "deps", + "loadable_modules", + "manifest_package", + "proguard_configs", + "resources_config_paths", + "secondary_abi_loadable_modules", + "secondary_abi_shared_libraries", + "shared_libraries", + "version_code", + "version_name", + ]) + } +} + +# For creating chrome targets without internal customizations. +template("chrome_public_apk_or_module_tmpl") { + chrome_common_apk_or_module_tmpl(target_name) { + add_upstream_only_deps = true + forward_variables_from(invoker, TESTONLY_AND_VISIBILITY) + forward_variables_from(invoker, "*", TESTONLY_AND_VISIBILITY) + } +} + +template("chrome_public_test_apk_tmpl") { + chrome_common_apk_or_module_tmpl(target_name) { + add_upstream_only_deps = true + target_type = "instrumentation_test_apk" + forward_variables_from(invoker, TESTONLY_AND_VISIBILITY) + forward_variables_from(invoker, "*", TESTONLY_AND_VISIBILITY) + } +} + +# TODO(https://crbug.com/1427610): Remove. +template("monochrome_public_common_apk_or_module_tmpl") { + chrome_common_apk_or_module_tmpl(target_name) { + forward_variables_from(invoker, "*") + if (!defined(is_monochrome)) { + is_trichrome = true + } + } +} +template("chrome_public_common_apk_or_module_tmpl") { + chrome_common_apk_or_module_tmpl(target_name) { + forward_variables_from(invoker, "*") + } +} diff --git a/src/chrome/browser/ui/android/strings/android_chrome_strings.grd b/src/chrome/browser/ui/android/strings/android_chrome_strings.grd index 29a87000..28d5e42e 100644 --- a/src/chrome/browser/ui/android/strings/android_chrome_strings.grd +++ b/src/chrome/browser/ui/android/strings/android_chrome_strings.grd @@ -321,11 +321,11 @@ CHAR_LIMIT guidelines: Shows prompts to sign in to Thorium - - Autocomplete searches and URLs + + Improve search suggestions - - Sends some cookies and searches from the address bar and search box to your default search engine + + When you type in the address bar or search box, Thorium sends what you type to your default search engine to get better suggestions. This is off in Incognito. Lock Incognito tabs when you leave Thorium @@ -1347,6 +1347,9 @@ Your Google account may have other forms of browsing history like searches and a Time range + + Last 15 minutes + Last hour @@ -3048,17 +3051,32 @@ To change this setting, <resetlink>reset sync

Turn on sync? - - Turn on sync + + Pick up where you left off - - Sync + + Browse across devices - - Back up your stuff and use it on any device + + Save time and type less - - Sync your data on all devices + + Get better suggestions + + + Sync your tabs and history + + + To continue browsing on another device, sync your tabs and history + + + To quickly get back to sites you’ve visited, sync your tabs and history + + + To see better suggestions in your address bar, sync your tabs and history + + + To get back to the sites you’ve visited on other devices, sync your tabs and history Sync your passwords, history & more on all devices @@ -3072,15 +3090,6 @@ To change this setting, <resetlink>reset sync

You can always choose what to sync in <LINK1>settings</LINK1>. Google may personalize Search and other services based on your history. - - Bookmarks - - - Autofill - - - History and more - Yes, I'm in @@ -3395,7 +3404,7 @@ To change this setting, <resetlink>reset sync

%1$s5 tabs as a new background tab group. - See content you follow here + Explore content to follow @@ -3603,6 +3612,9 @@ To change this setting, <resetlink>reset sync

History + + Delete last 15 minutes + Downloads @@ -3612,12 +3624,6 @@ To change this setting, <resetlink>reset sync

Edit Bookmark - - Add to reading list - - - Delete from reading list - Find in page @@ -4032,7 +4038,16 @@ To change this setting, <resetlink>reset sync

- Manage account + Manage account + + + Signed in as %1$sPeter Parker. %2$speter.parker@gmail.com. Button. Opens settings. + + + Signed in as %sBruce Wayne. Button. Opens settings. + + + Signed out. Button. Opens dialog to sign in and turn on sync. Home @@ -4170,7 +4185,7 @@ To change this setting, <resetlink>reset sync

- + Remove suggestion from history? @@ -5241,10 +5256,6 @@ To change this setting, <resetlink>reset sync

- - Copied - - Text Copied @@ -5558,9 +5569,6 @@ To change this setting, <resetlink>reset sync

- - Signing in to %1$srp.example with %2$sidp.com - Sign in to %1$srp.example with %2$sidp.com @@ -5592,7 +5600,10 @@ To change this setting, <resetlink>reset sync

Sign in bottom sheet is closed. - + + Signing you in… + + Verifying… @@ -5626,6 +5637,9 @@ To change this setting, <resetlink>reset sync

Upgrade navigations to HTTPS and warn you before loading sites that don’t support it + + Upgrade navigations to HTTPS and warn you before loading sites that don’t support it. You can’t change this setting because you have Advanced Protection enabled. +