Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(android_alarm_manager_plus): Remove references to v1 embedding #2864

Merged
merged 2 commits into from
May 1, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading