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

Commit 8868cdf

Browse files
committed
Removed "onStarted" events + hooks
1 parent 2449c41 commit 8868cdf

File tree

9 files changed

+11
-61
lines changed

9 files changed

+11
-61
lines changed

shell/platform/android/BUILD.gn

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,6 @@ java_library("flutter_shell_java") {
133133
"io/flutter/util/Preconditions.java",
134134
"io/flutter/view/AccessibilityBridge.java",
135135
"io/flutter/view/FlutterCallbackInformation.java",
136-
"io/flutter/view/FlutterIsolateStartedEvent.java",
137136
"io/flutter/view/FlutterMain.java",
138137
"io/flutter/view/FlutterNativeView.java",
139138
"io/flutter/view/FlutterRunArguments.java",

shell/platform/android/android_shell_holder.cc

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,8 @@ AndroidShellHolder::AndroidShellHolder(
8282
fxl::RefPtr<fml::TaskRunner> gpu_runner;
8383
fxl::RefPtr<fml::TaskRunner> ui_runner;
8484
fxl::RefPtr<fml::TaskRunner> io_runner;
85+
fxl::RefPtr<fml::TaskRunner> platform_runner =
86+
fml::MessageLoop::GetCurrent().GetTaskRunner();
8587
if (is_background_view) {
8688
auto single_task_runner = thread_host_.ui_thread->GetTaskRunner();
8789
gpu_runner = single_task_runner;
@@ -94,7 +96,7 @@ AndroidShellHolder::AndroidShellHolder(
9496
}
9597
blink::TaskRunners task_runners(
9698
thread_label, // label
97-
fml::MessageLoop::GetCurrent().GetTaskRunner(), // platform
99+
platform_runner, // platform
98100
gpu_runner, // gpu
99101
ui_runner, // ui
100102
io_runner // io
@@ -158,19 +160,15 @@ void AndroidShellHolder::Launch(RunConfiguration config) {
158160

159161
shell_->GetTaskRunners().GetUITaskRunner()->PostTask(
160162
fxl::MakeCopyable([engine = shell_->GetEngine(), //
161-
config = std::move(config), //
162-
view = platform_view_.get() //
163+
config = std::move(config) //
163164
]() mutable {
164-
bool success = false;
165-
FXL_LOG(INFO) << "Attempting to launch engine configuration...";
165+
FML_LOG(INFO) << "Attempting to launch engine configuration...";
166166
if (!engine || !engine->Run(std::move(config))) {
167-
FXL_LOG(ERROR) << "Could not launch engine in configuration.";
167+
FML_LOG(ERROR) << "Could not launch engine in configuration.";
168168
} else {
169-
FXL_LOG(INFO) << "Isolate for engine configuration successfully "
169+
FML_LOG(INFO) << "Isolate for engine configuration successfully "
170170
"started and run.";
171-
success = true;
172171
}
173-
view->InvokeOnStartedCallback(success);
174172
}));
175173
}
176174

shell/platform/android/io/flutter/view/FlutterIsolateStartedEvent.java

Lines changed: 0 additions & 13 deletions
This file was deleted.

shell/platform/android/io/flutter/view/FlutterNativeView.java

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ public class FlutterNativeView implements BinaryMessenger {
2727
private FlutterView mFlutterView;
2828
private final Context mContext;
2929
private boolean applicationIsRunning;
30-
private FlutterIsolateStartedEvent startedEvent;
3130

3231
public FlutterNativeView(Context context) {
3332
this(context, false);
@@ -83,7 +82,7 @@ public void runFromBundle(FlutterRunArguments args) {
8382
throw new AssertionError("An entrypoint must be specified");
8483
}
8584
runFromBundleInternal(args.bundlePath, args.entrypoint,
86-
args.libraryPath, args.onStartedEvent);
85+
args.libraryPath, null);
8786
}
8887

8988
/**
@@ -97,12 +96,11 @@ public void runFromBundle(String bundlePath, String snapshotOverride, String ent
9796
}
9897

9998
private void runFromBundleInternal(String bundlePath, String entrypoint,
100-
String libraryPath, FlutterIsolateStartedEvent event) {
99+
String libraryPath, String snapshotOverride) {
101100
assertAttached();
102101
if (applicationIsRunning)
103102
throw new AssertionError(
104103
"This Flutter engine instance is already running an application");
105-
startedEvent = event;
106104
nativeRunBundleAndSnapshotFromLibrary(mNativePlatformView, bundlePath,
107105
entrypoint, libraryPath, mContext.getResources().getAssets());
108106

@@ -224,11 +222,6 @@ private void onFirstFrame() {
224222
mFlutterView.onFirstFrame();
225223
}
226224

227-
private void onStarted(boolean success) {
228-
if (startedEvent == null) return;
229-
startedEvent.onStarted(success);
230-
}
231-
232225
private static native long nativeAttach(FlutterNativeView view, boolean isBackgroundView);
233226
private static native void nativeDestroy(long nativePlatformViewAndroid);
234227
private static native void nativeDetach(long nativePlatformViewAndroid);

shell/platform/android/io/flutter/view/FlutterRunArguments.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,5 +12,5 @@ public class FlutterRunArguments {
1212
public String bundlePath;
1313
public String entrypoint;
1414
public String libraryPath;
15-
public FlutterIsolateStartedEvent onStartedEvent;
15+
public String snapshotOverride;
1616
}

shell/platform/android/platform_view_android.cc

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -138,16 +138,6 @@ void PlatformViewAndroid::InvokePlatformMessageEmptyResponseCallback(
138138
message_response->CompleteEmpty();
139139
}
140140

141-
void PlatformViewAndroid::InvokeOnStartedCallback(bool success) {
142-
JNIEnv* env = fml::jni::AttachCurrentThread();
143-
fml::jni::ScopedJavaLocalRef<jobject> view = java_object_.get(env);
144-
if (view.is_null()) {
145-
// The Java object died.
146-
return;
147-
}
148-
FlutterViewOnStarted(fml::jni::AttachCurrentThread(), view.obj(), success);
149-
}
150-
151141
// |shell::PlatformView|
152142
void PlatformViewAndroid::HandlePlatformMessage(
153143
fxl::RefPtr<blink::PlatformMessage> message) {

shell/platform/android/platform_view_android.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,8 +63,6 @@ class PlatformViewAndroid final : public PlatformView {
6363
void InvokePlatformMessageEmptyResponseCallback(JNIEnv* env,
6464
jint response_id);
6565

66-
void InvokeOnStartedCallback(bool success);
67-
6866
void DispatchSemanticsAction(JNIEnv* env,
6967
jint id,
7068
jint action,

shell/platform/android/platform_view_android_jni.cc

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -111,12 +111,6 @@ void FlutterViewOnFirstFrame(JNIEnv* env, jobject obj) {
111111
FXL_CHECK(CheckException(env));
112112
}
113113

114-
static jmethodID g_on_started_method = nullptr;
115-
void FlutterViewOnStarted(JNIEnv* env, jobject obj, jboolean success) {
116-
env->CallVoidMethod(obj, g_on_started_method, success);
117-
FXL_CHECK(CheckException(env));
118-
}
119-
120114
static jmethodID g_attach_to_gl_context_method = nullptr;
121115
void SurfaceTextureAttachToGLContext(JNIEnv* env, jobject obj, jint textureId) {
122116
env->CallVoidMethod(obj, g_attach_to_gl_context_method, textureId);
@@ -292,7 +286,7 @@ static void RunBundleAndSnapshotFromLibrary(
292286
ANDROID_SHELL_HOLDER->Launch(std::move(config));
293287
}
294288

295-
static jobject LookupCallbackInformation(JNIEnv* env, jlong handle) {
289+
static jobject LookupCallbackInformation(JNIEnv* env, /* unused */ jobject, jlong handle) {
296290
auto cbInfo = blink::DartCallbackCache::GetCallbackInformation(handle);
297291
if (cbInfo == nullptr) {
298292
return nullptr;
@@ -738,13 +732,6 @@ bool PlatformViewAndroid::Register(JNIEnv* env) {
738732
return false;
739733
}
740734

741-
g_on_started_method =
742-
env->GetMethodID(g_flutter_native_view_class->obj(), "onStarted", "(Z)V");
743-
744-
if (g_on_started_method == nullptr) {
745-
return false;
746-
}
747-
748735
g_attach_to_gl_context_method = env->GetMethodID(
749736
g_surface_texture_class->obj(), "attachToGLContext", "(I)V");
750737

shell/platform/android/platform_view_android_jni.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,6 @@ void FlutterViewUpdateCustomAccessibilityActions(JNIEnv* env,
3434

3535
void FlutterViewOnFirstFrame(JNIEnv* env, jobject obj);
3636

37-
void FlutterViewOnStarted(JNIEnv* env, jobject obj, jboolean success);
38-
3937
void SurfaceTextureAttachToGLContext(JNIEnv* env, jobject obj, jint textureId);
4038

4139
void SurfaceTextureUpdateTexImage(JNIEnv* env, jobject obj);

0 commit comments

Comments
 (0)