Skip to content

Commit

Permalink
fix(android_alarm_manager_plus): Remove references to v1 embedding (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
johnmccutchan committed May 1, 2024
1 parent 51879f3 commit 0bb6a1f
Showing 1 changed file with 0 additions and 25 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,12 @@
import io.flutter.embedding.engine.FlutterEngine;
import io.flutter.embedding.engine.dart.DartExecutor;
import io.flutter.embedding.engine.dart.DartExecutor.DartCallback;
import io.flutter.embedding.engine.plugins.shim.ShimPluginRegistry;
import io.flutter.plugin.common.BinaryMessenger;
import io.flutter.plugin.common.JSONMethodCodec;
import io.flutter.plugin.common.MethodCall;
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 java.util.concurrent.CountDownLatch;
import java.util.concurrent.atomic.AtomicBoolean;
Expand All @@ -35,7 +33,6 @@
public class FlutterBackgroundExecutor implements MethodCallHandler {
private static final String TAG = "FlutterBackgroundExecutor";
private static final String CALLBACK_HANDLE_KEY = "callback_handle";
private static PluginRegistrantCallback pluginRegistrantCallback;

/**
* The {@link MethodChannel} that connects the Android side of this plugin with the background
Expand All @@ -47,18 +44,6 @@ public class FlutterBackgroundExecutor implements MethodCallHandler {

private final AtomicBoolean isCallbackDispatcherReady = new AtomicBoolean(false);

/**
* Sets the {@code PluginRegistrantCallback} used to register plugins with the newly spawned
* isolate.
*
* <p>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) {
pluginRegistrantCallback = callback;
}

/**
* Sets the Dart callback handle for the Dart method that is responsible for initializing the
* background Dart isolate, preparing it to receive Dart callback tasks requests.
Expand Down Expand Up @@ -116,8 +101,6 @@ public void onMethodCall(MethodCall call, Result result) {
* <ul>
* <li>The given callback must correspond to a registered Dart callback. If the handle does not
* resolve to a Dart callback then this method does nothing.
* <li>A static {@link #pluginRegistrantCallback} must exist, otherwise a {@link
* PluginRegistrantException} will be thrown.
* </ul>
*/
public void startBackgroundIsolate(Context context) {
Expand All @@ -144,8 +127,6 @@ public void startBackgroundIsolate(Context context) {
* <ul>
* <li>The given {@code callbackHandle} must correspond to a registered Dart callback. If the
* handle does not resolve to a Dart callback then this method does nothing.
* <li>A static {@link #pluginRegistrantCallback} must exist, otherwise a {@link
* PluginRegistrantException} will be thrown.
* </ul>
*/
public void startBackgroundIsolate(Context context, long callbackHandle) {
Expand Down Expand Up @@ -176,12 +157,6 @@ public void startBackgroundIsolate(Context context, long callbackHandle) {
DartCallback dartCallback = new DartCallback(assets, appBundlePath, flutterCallback);

executor.executeDartCallback(dartCallback);

// The pluginRegistrantCallback should only be set in the V1 embedding as
// plugin registration is done via reflection in the V2 embedding.
if (pluginRegistrantCallback != null) {
pluginRegistrantCallback.registerWith(new ShimPluginRegistry(backgroundFlutterEngine));
}
}
}

Expand Down

0 comments on commit 0bb6a1f

Please sign in to comment.