14
14
import io .flutter .embedding .engine .FlutterEngine ;
15
15
import io .flutter .embedding .engine .dart .DartExecutor ;
16
16
import io .flutter .embedding .engine .dart .DartExecutor .DartCallback ;
17
- import io .flutter .embedding .engine .plugins .shim .ShimPluginRegistry ;
18
17
import io .flutter .plugin .common .BinaryMessenger ;
19
18
import io .flutter .plugin .common .JSONMethodCodec ;
20
19
import io .flutter .plugin .common .MethodCall ;
21
20
import io .flutter .plugin .common .MethodChannel ;
22
21
import io .flutter .plugin .common .MethodChannel .MethodCallHandler ;
23
22
import io .flutter .plugin .common .MethodChannel .Result ;
24
- import io .flutter .plugin .common .PluginRegistry .PluginRegistrantCallback ;
25
23
import io .flutter .view .FlutterCallbackInformation ;
26
24
import java .util .concurrent .CountDownLatch ;
27
25
import java .util .concurrent .atomic .AtomicBoolean ;
35
33
public class FlutterBackgroundExecutor implements MethodCallHandler {
36
34
private static final String TAG = "FlutterBackgroundExecutor" ;
37
35
private static final String CALLBACK_HANDLE_KEY = "callback_handle" ;
38
- private static PluginRegistrantCallback pluginRegistrantCallback ;
39
36
40
37
/**
41
38
* The {@link MethodChannel} that connects the Android side of this plugin with the background
@@ -47,18 +44,6 @@ public class FlutterBackgroundExecutor implements MethodCallHandler {
47
44
48
45
private final AtomicBoolean isCallbackDispatcherReady = new AtomicBoolean (false );
49
46
50
- /**
51
- * Sets the {@code PluginRegistrantCallback} used to register plugins with the newly spawned
52
- * isolate.
53
- *
54
- * <p>Note: this is only necessary for applications using the V1 engine embedding API as plugins
55
- * are automatically registered via reflection in the V2 engine embedding API. If not set, alarm
56
- * callbacks will not be able to utilize functionality from other plugins.
57
- */
58
- public static void setPluginRegistrant (PluginRegistrantCallback callback ) {
59
- pluginRegistrantCallback = callback ;
60
- }
61
-
62
47
/**
63
48
* Sets the Dart callback handle for the Dart method that is responsible for initializing the
64
49
* background Dart isolate, preparing it to receive Dart callback tasks requests.
@@ -116,8 +101,6 @@ public void onMethodCall(MethodCall call, Result result) {
116
101
* <ul>
117
102
* <li>The given callback must correspond to a registered Dart callback. If the handle does not
118
103
* resolve to a Dart callback then this method does nothing.
119
- * <li>A static {@link #pluginRegistrantCallback} must exist, otherwise a {@link
120
- * PluginRegistrantException} will be thrown.
121
104
* </ul>
122
105
*/
123
106
public void startBackgroundIsolate (Context context ) {
@@ -144,8 +127,6 @@ public void startBackgroundIsolate(Context context) {
144
127
* <ul>
145
128
* <li>The given {@code callbackHandle} must correspond to a registered Dart callback. If the
146
129
* handle does not resolve to a Dart callback then this method does nothing.
147
- * <li>A static {@link #pluginRegistrantCallback} must exist, otherwise a {@link
148
- * PluginRegistrantException} will be thrown.
149
130
* </ul>
150
131
*/
151
132
public void startBackgroundIsolate (Context context , long callbackHandle ) {
@@ -176,12 +157,6 @@ public void startBackgroundIsolate(Context context, long callbackHandle) {
176
157
DartCallback dartCallback = new DartCallback (assets , appBundlePath , flutterCallback );
177
158
178
159
executor .executeDartCallback (dartCallback );
179
-
180
- // The pluginRegistrantCallback should only be set in the V1 embedding as
181
- // plugin registration is done via reflection in the V2 embedding.
182
- if (pluginRegistrantCallback != null ) {
183
- pluginRegistrantCallback .registerWith (new ShimPluginRegistry (backgroundFlutterEngine ));
184
- }
185
160
}
186
161
}
187
162
0 commit comments