def METHOD_NAME(
    package_command,
    first_app_aab,
    host_os,
    gradlew_name,
    tool_debug_mode,
    tmp_path,
):
    """Validate that package_app() will launch `gradlew bundleRelease` with the
    appropriate environment & cwd, and that it will use `gradlew.bat` on Windows but
    `gradlew` elsewhere."""
    # Mock out `host_os` so we can validate which name is used for gradlew.
    package_command.tools.host_os = host_os
    # Enable verbose tool logging
    if tool_debug_mode:
        package_command.tools.logger.verbosity = 2
    # Set up a side effect of invoking gradle to create a bundle
    def create_bundle(*args, **kwargs):
        create_file(
            tmp_path
            / "base_path"
            / "build"
            / "first-app"
            / "android"
            / "gradle"
            / "app"
            / "build"
            / "outputs"
            / "bundle"
            / "release"
            / "app-release.aab",
            "Android release",
        )
    package_command.tools.subprocess.run.side_effect = create_bundle
    # Create mock environment with `key`, which we expect to be preserved, and
    # `ANDROID_SDK_ROOT`, which we expect to be overwritten.
    package_command.tools.os.environ = {"ANDROID_SDK_ROOT": "somewhere", "key": "value"}
    package_command.package_app(first_app_aab)
    package_command.tools.android_sdk.verify_emulator.assert_called_once_with()
    package_command.tools.subprocess.run.assert_called_once_with(
        [
            package_command.bundle_path(first_app_aab) / gradlew_name,
            "--console",
            "plain",
        ]
        + (["--debug"] if tool_debug_mode else [])
        + ["bundleRelease"],
        cwd=package_command.bundle_path(first_app_aab),
        env=package_command.tools.android_sdk.env,
        check=True,
    )
    # The release asset has been moved into the dist folder
    assert (tmp_path / "base_path" / "dist" / "First App-0.0.1.aab").exists()