From c9c3e7474749780066ea13175b2bae7fed070dbb Mon Sep 17 00:00:00 2001 From: Gray Mackall <34871572+gmackall@users.noreply.github.com> Date: Thu, 27 Feb 2025 13:47:12 -0800 Subject: [PATCH] Add empty `io.flutter.app.FlutterApplication` to give deprecation notice, and un-break projects that have not migrated (#164233) The removal of the v1 embedding missed that this class was not marked as deprecated, and did not provide a notice in the breaking changes section. V1 apps that needed the functionality of the old `FlutterApplication` were all broken in the previous release, but some V2 apps have been referencing the v1 `FlutterApplication`. For these apps, this is the same as extending the base `android.app.Application`. So we can provide an "empty extension" of that base class, to provide these v2 apps a deprecation notice, and avoid breaking them without warning (in 3.29.1). Arbitrarily chose the `spell_checker` integration test to reference this empty application, let me know if you think I should bring up an entirely new devicelab test instead. ## Pre-launch Checklist - [x] I read the [Contributor Guide] and followed the process outlined there for submitting PRs. - [x] I read the [Tree Hygiene] wiki page, which explains my responsibilities. - [x] I read and followed the [Flutter Style Guide], including [Features we expect every widget to implement]. - [x] I signed the [CLA]. - [ ] I listed at least one issue that this PR fixes in the description above. - [x] I updated/added relevant documentation (doc comments with `///`). - [x] I added new tests to check the change I am making, or this PR is [test-exempt]. - [x] I followed the [breaking change policy] and added [Data Driven Fixes] where supported. - [ ] All existing and new tests are passing. If you need help, consider asking for advice on the #hackers-new channel on [Discord]. [Contributor Guide]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#overview [Tree Hygiene]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md [test-exempt]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#tests [Flutter Style Guide]: https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md [Features we expect every widget to implement]: https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md#features-we-expect-every-widget-to-implement [CLA]: https://cla.developers.google.com/ [flutter/tests]: https://github.com/flutter/tests [breaking change policy]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#handling-breaking-changes [Discord]: https://github.com/flutter/flutter/blob/main/docs/contributing/Chat.md [Data Driven Fixes]: https://github.com/flutter/flutter/blob/main/docs/contributing/Data-driven-Fixes.md --------- Co-authored-by: Gray Mackall --- .../analyze-test-input/ktlint-baseline.xml | 3 +++ .../android/app/src/main/AndroidManifest.xml | 2 +- .../com/example/sc_int_test/MainApplication.kt | 12 ++++++++++++ .../ci/licenses_golden/licenses_flutter | 2 ++ .../flutter/shell/platform/android/BUILD.gn | 1 + .../io/flutter/app/FlutterApplication.java | 18 ++++++++++++++++++ .../src/flutter/tools/javadoc/gen_javadoc.py | 1 + 7 files changed, 38 insertions(+), 1 deletion(-) create mode 100644 dev/integration_tests/spell_check/android/app/src/main/kotlin/com/example/sc_int_test/MainApplication.kt create mode 100644 engine/src/flutter/shell/platform/android/io/flutter/app/FlutterApplication.java diff --git a/dev/bots/test/analyze-test-input/ktlint-baseline.xml b/dev/bots/test/analyze-test-input/ktlint-baseline.xml index c5918d1ce2..2ec64693b6 100644 --- a/dev/bots/test/analyze-test-input/ktlint-baseline.xml +++ b/dev/bots/test/analyze-test-input/ktlint-baseline.xml @@ -18,6 +18,9 @@ + + + diff --git a/dev/integration_tests/spell_check/android/app/src/main/AndroidManifest.xml b/dev/integration_tests/spell_check/android/app/src/main/AndroidManifest.xml index dd94c3a426..c159ad36a5 100644 --- a/dev/integration_tests/spell_check/android/app/src/main/AndroidManifest.xml +++ b/dev/integration_tests/spell_check/android/app/src/main/AndroidManifest.xml @@ -5,7 +5,7 @@ found in the LICENSE file. --> For more information on the removal of Flutter's v1 Android embedding, see: + * https://docs.flutter.dev/release/breaking-changes/v1-android-embedding. + */ +@Deprecated +public class FlutterApplication extends Application {} diff --git a/engine/src/flutter/tools/javadoc/gen_javadoc.py b/engine/src/flutter/tools/javadoc/gen_javadoc.py index 270af576b2..88d58ef44d 100755 --- a/engine/src/flutter/tools/javadoc/gen_javadoc.py +++ b/engine/src/flutter/tools/javadoc/gen_javadoc.py @@ -66,6 +66,7 @@ def main(): classpath.append(args.build_config_path) packages = [ + 'io.flutter.app', 'io.flutter.embedding.android', 'io.flutter.embedding.engine', 'io.flutter.embedding.engine.dart',