From 615aad1916b30986b7a9060c9760db2111b4c38d Mon Sep 17 00:00:00 2001 From: Xiao Yu Date: Thu, 5 Nov 2020 22:41:13 -0800 Subject: [PATCH 1/2] move deprecation from the PluginRegistry outer interface to inner, v1-specific fields --- .../flutter/plugin/common/PluginRegistry.java | 26 ++++++++++++++----- 1 file changed, 19 insertions(+), 7 deletions(-) diff --git a/shell/platform/android/io/flutter/plugin/common/PluginRegistry.java b/shell/platform/android/io/flutter/plugin/common/PluginRegistry.java index 5724ce7ab2f3b..c8f4eabf32986 100644 --- a/shell/platform/android/io/flutter/plugin/common/PluginRegistry.java +++ b/shell/platform/android/io/flutter/plugin/common/PluginRegistry.java @@ -16,25 +16,26 @@ import io.flutter.view.TextureRegistry; /** - * Registry used by plugins to set up interaction with Android APIs. + * Container class for Android API listeners used by {@link ActivityPluginBinding}. * - *

Flutter applications by default include an auto-generated and auto-updated plugin registrant - * class (GeneratedPluginRegistrant) that makes use of a {@link PluginRegistry} to register + *

This class also contains deprecated v1 embedding APIs used for plugin registration. + * + *

In v1 Android applications, an auto-generated and auto-updated plugin registrant + * class (GeneratedPluginRegistrant) makes use of a {@link PluginRegistry} to register * contributions from each plugin mentioned in the application's pubspec file. The generated * registrant class is, again by default, called from the application's main {@link Activity}, which * defaults to an instance of {@link io.flutter.app.FlutterActivity}, itself a {@link * PluginRegistry}. - * - * @deprecated See https://flutter.dev/go/android-project-migration for migration details. */ -@Deprecated public interface PluginRegistry { /** * Returns a {@link Registrar} for receiving the registrations pertaining to the specified plugin. * * @param pluginKey a unique String identifying the plugin; typically the fully qualified name of * the plugin's main class. + * @deprecated See https://flutter.dev/go/android-project-migration for migration details. */ + @Deprecated Registrar registrarFor(String pluginKey); /** @@ -43,7 +44,9 @@ public interface PluginRegistry { * @param pluginKey a unique String identifying the plugin; typically the fully qualified name of * the plugin's main class. * @return true if this registry has handed out a registrar for the specified plugin. + * @deprecated See https://flutter.dev/go/android-project-migration for migration details. */ + @Deprecated boolean hasPlugin(String pluginKey); /** @@ -56,15 +59,18 @@ public interface PluginRegistry { * @param pluginKey a unique String identifying the plugin; typically the fully qualified name of * the plugin's main class. * @return the published value, possibly null. + * @deprecated See https://flutter.dev/go/android-project-migration for migration details. */ + @Deprecated T valuePublishedByPlugin(String pluginKey); /** * Receiver of registrations from a single plugin. * - *

This registrar is for Flutter's v1 embedding. For instructions on migrating a plugin from + * @deprecated This registrar is for Flutter's v1 embedding. For instructions on migrating a plugin from * Flutter's v1 Android embedding to v2, visit http://flutter.dev/go/android-plugin-migration */ + @Deprecated interface Registrar { /** * Returns the {@link Activity} that forms the plugin's operating context. @@ -336,7 +342,10 @@ interface UserLeaveHintListener { * Delegate interface for handling an {@link Activity}'s onDestroy method being called. A plugin * that implements this interface can adopt the FlutterNativeView by retaining a reference and * returning true. + * + * @deprecated See https://flutter.dev/go/android-project-migration for migration details. */ + @Deprecated interface ViewDestroyListener { boolean onViewDestroy(FlutterNativeView view); } @@ -346,7 +355,10 @@ interface ViewDestroyListener { * *

For example, an Application may use this callback interface to provide a background service * with a callback for calling its GeneratedPluginRegistrant.registerWith method. + * + * @deprecated See https://flutter.dev/go/android-project-migration for migration details. */ + @Deprecated interface PluginRegistrantCallback { void registerWith(PluginRegistry registry); } From 5fd9ffea5ae608445c23e7c2f4ffc7b9c34fe837 Mon Sep 17 00:00:00 2001 From: Xiao Yu Date: Fri, 6 Nov 2020 13:14:16 -0800 Subject: [PATCH 2/2] autoformat --- .../io/flutter/plugin/common/PluginRegistry.java | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/shell/platform/android/io/flutter/plugin/common/PluginRegistry.java b/shell/platform/android/io/flutter/plugin/common/PluginRegistry.java index c8f4eabf32986..5585da0c866b5 100644 --- a/shell/platform/android/io/flutter/plugin/common/PluginRegistry.java +++ b/shell/platform/android/io/flutter/plugin/common/PluginRegistry.java @@ -20,12 +20,11 @@ * *

This class also contains deprecated v1 embedding APIs used for plugin registration. * - *

In v1 Android applications, an auto-generated and auto-updated plugin registrant - * class (GeneratedPluginRegistrant) makes use of a {@link PluginRegistry} to register - * contributions from each plugin mentioned in the application's pubspec file. The generated - * registrant class is, again by default, called from the application's main {@link Activity}, which - * defaults to an instance of {@link io.flutter.app.FlutterActivity}, itself a {@link - * PluginRegistry}. + *

In v1 Android applications, an auto-generated and auto-updated plugin registrant class + * (GeneratedPluginRegistrant) makes use of a {@link PluginRegistry} to register contributions from + * each plugin mentioned in the application's pubspec file. The generated registrant class is, again + * by default, called from the application's main {@link Activity}, which defaults to an instance of + * {@link io.flutter.app.FlutterActivity}, itself a {@link PluginRegistry}. */ public interface PluginRegistry { /** @@ -67,8 +66,9 @@ public interface PluginRegistry { /** * Receiver of registrations from a single plugin. * - * @deprecated This registrar is for Flutter's v1 embedding. For instructions on migrating a plugin from - * Flutter's v1 Android embedding to v2, visit http://flutter.dev/go/android-plugin-migration + * @deprecated This registrar is for Flutter's v1 embedding. For instructions on migrating a + * plugin from Flutter's v1 Android embedding to v2, visit + * http://flutter.dev/go/android-plugin-migration */ @Deprecated interface Registrar {