diff --git a/packages/android_alarm_manager/CHANGELOG.md b/packages/android_alarm_manager/CHANGELOG.md index 22c3d822ec04..aff0e4a30982 100644 --- a/packages/android_alarm_manager/CHANGELOG.md +++ b/packages/android_alarm_manager/CHANGELOG.md @@ -1,3 +1,7 @@ +## 0.4.5+14 + +* Keep handling deprecated Android v1 classes for backward compatibility. + ## 0.4.5+13 * Android Code Inspection and Clean up. diff --git a/packages/android_alarm_manager/android/src/main/java/io/flutter/plugins/androidalarmmanager/AlarmService.java b/packages/android_alarm_manager/android/src/main/java/io/flutter/plugins/androidalarmmanager/AlarmService.java index 107d76738fe3..3287789f6c3d 100644 --- a/packages/android_alarm_manager/android/src/main/java/io/flutter/plugins/androidalarmmanager/AlarmService.java +++ b/packages/android_alarm_manager/android/src/main/java/io/flutter/plugins/androidalarmmanager/AlarmService.java @@ -13,7 +13,6 @@ import android.util.Log; import androidx.core.app.AlarmManagerCompat; import androidx.core.app.JobIntentService; -import io.flutter.plugin.common.PluginRegistry.PluginRegistrantCallback; import java.util.Collections; import java.util.HashMap; import java.util.HashSet; @@ -91,15 +90,18 @@ public static void setCallbackDispatcher(Context context, long callbackHandle) { } /** - * Sets the {@link PluginRegistrantCallback} used to register the plugins used by an application - * with the newly spawned background isolate. + * Sets the {@link io.flutter.plugin.common.PluginRegistry.PluginRegistrantCallback} used to + * register the plugins used by an application with the newly spawned background isolate. * *

This should be invoked in {@link Application.onCreate} with {@link * GeneratedPluginRegistrant} in applications using the V1 embedding API in order to use other * plugins in the background isolate. For applications using the V2 embedding API, it is not - * necessary to set a {@link PluginRegistrantCallback} as plugins are registered automatically. + * necessary to set a {@link io.flutter.plugin.common.PluginRegistry.PluginRegistrantCallback} as + * plugins are registered automatically. */ - public static void setPluginRegistrant(PluginRegistrantCallback callback) { + @SuppressWarnings("deprecation") + public static void setPluginRegistrant( + io.flutter.plugin.common.PluginRegistry.PluginRegistrantCallback callback) { // Indirectly set in FlutterBackgroundExecutor for backwards compatibility. FlutterBackgroundExecutor.setPluginRegistrant(callback); } diff --git a/packages/android_alarm_manager/android/src/main/java/io/flutter/plugins/androidalarmmanager/AndroidAlarmManagerPlugin.java b/packages/android_alarm_manager/android/src/main/java/io/flutter/plugins/androidalarmmanager/AndroidAlarmManagerPlugin.java index 5a135f95e631..557913a626d5 100644 --- a/packages/android_alarm_manager/android/src/main/java/io/flutter/plugins/androidalarmmanager/AndroidAlarmManagerPlugin.java +++ b/packages/android_alarm_manager/android/src/main/java/io/flutter/plugins/androidalarmmanager/AndroidAlarmManagerPlugin.java @@ -6,6 +6,7 @@ import android.content.Context; import android.util.Log; +import io.flutter.embedding.engine.FlutterEngine; import io.flutter.embedding.engine.plugins.FlutterPlugin; import io.flutter.plugin.common.BinaryMessenger; import io.flutter.plugin.common.JSONMethodCodec; @@ -13,8 +14,6 @@ import io.flutter.plugin.common.MethodChannel; import io.flutter.plugin.common.MethodChannel.MethodCallHandler; import io.flutter.plugin.common.MethodChannel.Result; -import io.flutter.plugin.common.PluginRegistry.Registrar; -import io.flutter.view.FlutterNativeView; import org.json.JSONArray; import org.json.JSONException; @@ -28,8 +27,8 @@ *

  • The Dart side of this plugin sends the Android side a "AlarmService.start" message, along * with a Dart callback handle for a Dart callback that should be immediately invoked by a * background Dart isolate. - *
  • The Android side of this plugin spins up a background {@link FlutterNativeView}, which - * includes a background Dart isolate. + *
  • The Android side of this plugin spins up a background {@link FlutterEngine}, which includes + * a background Dart isolate. *
  • The Android side of this plugin instructs the new background Dart isolate to execute the * callback that was received in the "AlarmService.start" message. *
  • The Dart side of this plugin, running within the new background isolate, executes the @@ -49,12 +48,13 @@ public class AndroidAlarmManagerPlugin implements FlutterPlugin, MethodCallHandl /** * Registers this plugin with an associated Flutter execution context, represented by the given - * {@link Registrar}. + * {@link io.flutter.plugin.common.PluginRegistry.Registrar}. * *

    Once this method is executed, an instance of {@code AndroidAlarmManagerPlugin} will be * connected to, and running against, the associated Flutter execution context. */ - public static void registerWith(Registrar registrar) { + @SuppressWarnings("deprecation") + public static void registerWith(io.flutter.plugin.common.PluginRegistry.Registrar registrar) { if (instance == null) { instance = new AndroidAlarmManagerPlugin(); } diff --git a/packages/android_alarm_manager/android/src/main/java/io/flutter/plugins/androidalarmmanager/FlutterBackgroundExecutor.java b/packages/android_alarm_manager/android/src/main/java/io/flutter/plugins/androidalarmmanager/FlutterBackgroundExecutor.java index 8d5290842e14..86010ff3f089 100644 --- a/packages/android_alarm_manager/android/src/main/java/io/flutter/plugins/androidalarmmanager/FlutterBackgroundExecutor.java +++ b/packages/android_alarm_manager/android/src/main/java/io/flutter/plugins/androidalarmmanager/FlutterBackgroundExecutor.java @@ -19,9 +19,7 @@ import io.flutter.plugin.common.MethodChannel; import io.flutter.plugin.common.MethodChannel.MethodCallHandler; import io.flutter.plugin.common.MethodChannel.Result; -import io.flutter.plugin.common.PluginRegistry.PluginRegistrantCallback; import io.flutter.view.FlutterCallbackInformation; -import io.flutter.view.FlutterMain; import java.util.concurrent.CountDownLatch; import java.util.concurrent.atomic.AtomicBoolean; @@ -32,7 +30,10 @@ public class FlutterBackgroundExecutor implements MethodCallHandler { private static final String TAG = "FlutterBackgroundExecutor"; private static final String CALLBACK_HANDLE_KEY = "callback_handle"; - private static PluginRegistrantCallback pluginRegistrantCallback; + + @SuppressWarnings("deprecation") + private static io.flutter.plugin.common.PluginRegistry.PluginRegistrantCallback + pluginRegistrantCallback; /** * The {@link MethodChannel} that connects the Android side of this plugin with the background @@ -45,14 +46,16 @@ public class FlutterBackgroundExecutor implements MethodCallHandler { private AtomicBoolean isCallbackDispatcherReady = new AtomicBoolean(false); /** - * Sets the {@code PluginRegistrantCallback} used to register plugins with the newly spawned - * isolate. + * Sets the {@code io.flutter.plugin.common.PluginRegistry.PluginRegistrantCallback} used to + * register plugins with the newly spawned isolate. * *

    Note: this is only necessary for applications using the V1 engine embedding API as plugins * are automatically registered via reflection in the V2 engine embedding API. If not set, alarm * callbacks will not be able to utilize functionality from other plugins. */ - public static void setPluginRegistrant(PluginRegistrantCallback callback) { + @SuppressWarnings("deprecation") + public static void setPluginRegistrant( + io.flutter.plugin.common.PluginRegistry.PluginRegistrantCallback callback) { pluginRegistrantCallback = callback; } @@ -101,7 +104,7 @@ public void onMethodCall(MethodCall call, Result result) { *

    The isolate is configured as follows: * *