[build] Add ability to define manifest package in GN

The build system will verify that the manifest packages match if you
specify it in both GN and the manifest.

Bug: 891996
Change-Id: I39c3f158d01908b971a3ef47cb90af73019284a0
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1667687
Commit-Queue: Tibor Goldschwendt <[email protected]>
Auto-Submit: Tibor Goldschwendt <[email protected]>
Reviewed-by: Andrew Grieve <[email protected]>
Cr-Commit-Position: refs/heads/master@{#671814}
diff --git a/docs/android_dynamic_feature_modules.md b/docs/android_dynamic_feature_modules.md
index 89481fee2..4096ef3 100644
--- a/docs/android_dynamic_feature_modules.md
+++ b/docs/android_dynamic_feature_modules.md
@@ -51,8 +51,7 @@
 ```xml
 <manifest xmlns:android="http://schemas.android.com/apk/res/android"
     xmlns:dist="http://schemas.android.com/apk/distribution"
-    featureSplit="foo"
-    package="{{manifest_package}}">
+    featureSplit="foo">
 
     <!-- dist:onDemand="true" makes this a separately installed module.
          dist:onDemand="false" would always install the module alongside the
@@ -98,17 +97,6 @@
 import("//chrome/android/features/dynamic_feature_modules.gni")
 
 template("foo_module_tmpl") {
-  _manifest = "$target_gen_dir/$target_name/AndroidManifest.xml"
-  _manifest_target = "${target_name}__manifest"
-  jinja_template(_manifest_target) {
-    input = "//chrome/android/features/foo/java/AndroidManifest.xml"
-    output = _manifest
-    variables = [
-      "target_sdk_version=$android_sdk_version",
-      "manifest_package=${invoker.manifest_package}",
-    ]
-  }
-
   android_app_bundle_module(target_name) {
     forward_variables_from(invoker,
                            [
@@ -118,8 +106,9 @@
                              "version_code",
                              "version_name",
                            ])
-    android_manifest = _manifest
-    android_manifest_dep = ":${_manifest_target}"
+    android_manifest = "//chrome/android/features/foo/java/AndroidManifest.xml"
+    min_sdk_version = 21
+    target_sdk_version = android_sdk_version
     proguard_enabled = !is_java_debug
     aapt_locale_whitelist = locales
     package_name = "foo"