Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Commit 8a7bf16

Browse files
committed
fixed the entrypoint test
1 parent a65561d commit 8a7bf16

File tree

1 file changed

+17
-18
lines changed

1 file changed

+17
-18
lines changed

shell/platform/android/io/flutter/embedding/android/FlutterActivityAndFragmentDelegate.java

Lines changed: 17 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -228,6 +228,21 @@ void onAttach(@NonNull Context context) {
228228
return activity;
229229
}
230230

231+
private FlutterEngine createEngineFromGroup(FlutterEngineGroup flutterEngineGroup) {
232+
String appBundlePathOverride = host.getAppBundlePath();
233+
if (appBundlePathOverride == null || appBundlePathOverride.isEmpty()) {
234+
appBundlePathOverride = FlutterInjector.instance().flutterLoader().findAppBundlePath();
235+
}
236+
237+
DartExecutor.DartEntrypoint dartEntrypoint =
238+
new DartExecutor.DartEntrypoint(
239+
appBundlePathOverride, host.getDartEntrypointFunctionName());
240+
flutterEngine =
241+
flutterEngineGroup.createAndRunEngine(
242+
host.getContext(), dartEntrypoint, host.getInitialRoute());
243+
isFlutterEngineFromHost = false;
244+
}
245+
231246
/**
232247
* Obtains a reference to a FlutterEngine to back this delegate and its {@code host}.
233248
*
@@ -285,18 +300,7 @@ void onAttach(@NonNull Context context) {
285300
+ "'");
286301
}
287302

288-
String appBundlePathOverride = host.getAppBundlePath();
289-
if (appBundlePathOverride == null || appBundlePathOverride.isEmpty()) {
290-
appBundlePathOverride = FlutterInjector.instance().flutterLoader().findAppBundlePath();
291-
}
292-
293-
DartExecutor.DartEntrypoint dartEntrypoint =
294-
new DartExecutor.DartEntrypoint(
295-
appBundlePathOverride, host.getDartEntrypointFunctionName());
296-
flutterEngine =
297-
flutterEngineGroup.createAndRunEngine(
298-
host.getContext(), dartEntrypoint, host.getInitialRoute());
299-
isFlutterEngineFromHost = false;
303+
flutterEngine = createEngineFromGroup(flutterEngineGroup);
300304
return;
301305
}
302306

@@ -311,12 +315,7 @@ void onAttach(@NonNull Context context) {
311315
engineGroup == null
312316
? new FlutterEngineGroup(host.getContext(), host.getFlutterShellArgs().toArray())
313317
: engineGroup;
314-
flutterEngine =
315-
group.createAndRunEngine(
316-
new FlutterEngineGroup.Options(host.getContext())
317-
.setAutomaticallyRegisterPlugins(false)
318-
.setWaitForRestorationData(host.shouldRestoreAndSaveState()));
319-
isFlutterEngineFromHost = false;
318+
flutterEngine = createEngineFromGroup(engineGroup);
320319
}
321320

322321
/**

0 commit comments

Comments
 (0)