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

Commit fbb3436

Browse files
Remove some unused code from the Android host (#5619)
These functions were made obsolete by the engine refactoring (6baff4c)
1 parent 36f3f95 commit fbb3436

File tree

4 files changed

+0
-163
lines changed

4 files changed

+0
-163
lines changed

shell/platform/android/android_shell_holder.cc

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -181,21 +181,4 @@ fml::WeakPtr<PlatformViewAndroid> AndroidShellHolder::GetPlatformView() {
181181
return platform_view_;
182182
}
183183

184-
void AndroidShellHolder::UpdateAssetManager(
185-
fml::RefPtr<blink::AssetManager> asset_manager) {
186-
if (!IsValid() || !asset_manager) {
187-
return;
188-
}
189-
190-
shell_->GetTaskRunners().GetUITaskRunner()->PostTask(
191-
[engine = shell_->GetEngine(),
192-
asset_manager = std::move(asset_manager)]() {
193-
if (engine) {
194-
if (!engine->UpdateAssetManager(std::move(asset_manager))) {
195-
FXL_DLOG(ERROR) << "Could not update asset asset manager.";
196-
}
197-
}
198-
});
199-
}
200-
201184
} // namespace shell

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

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -81,25 +81,10 @@ public void runFromBundle(String bundlePath, String snapshotOverride, String ent
8181
applicationIsRunning = true;
8282
}
8383

84-
public void runFromSource(final String assetsDirectory, final String main, final String packages) {
85-
assertAttached();
86-
if (applicationIsRunning)
87-
throw new AssertionError("This Flutter engine instance is already running an application");
88-
89-
nativeRunBundleAndSource(mNativePlatformView, assetsDirectory, main, packages);
90-
91-
applicationIsRunning = true;
92-
}
93-
9484
public boolean isApplicationRunning() {
9585
return applicationIsRunning;
9686
}
9787

98-
public void setAssetBundlePathOnUI(final String assetsDirectory) {
99-
assertAttached();
100-
nativeSetAssetBundlePathOnUI(mNativePlatformView, assetsDirectory);
101-
}
102-
10388
public static String getObservatoryUri() {
10489
return nativeGetObservatoryUri();
10590
}
@@ -216,14 +201,6 @@ private static native void nativeRunBundleAndSnapshot(long nativePlatformViewAnd
216201
boolean reuseRuntimeController,
217202
AssetManager manager);
218203

219-
private static native void nativeRunBundleAndSource(long nativePlatformViewAndroid,
220-
String bundlePath,
221-
String main,
222-
String packages);
223-
224-
private static native void nativeSetAssetBundlePathOnUI(long nativePlatformViewAndroid,
225-
String bundlePath);
226-
227204
private static native String nativeGetObservatoryUri();
228205

229206
// Send an empty platform message to Dart.

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

Lines changed: 0 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -646,55 +646,6 @@ public void runFromBundle(String bundlePath, String snapshotOverride, String ent
646646
postRun();
647647
}
648648

649-
private void runFromSource(final String assetsDirectory, final String main, final String packages) {
650-
Runnable runnable = new Runnable() {
651-
public void run() {
652-
assertAttached();
653-
preRun();
654-
mNativeView.runFromSource(assetsDirectory, main, packages);
655-
postRun();
656-
synchronized (this) {
657-
notify();
658-
}
659-
}
660-
};
661-
662-
try {
663-
synchronized (runnable) {
664-
// Post to the Android UI thread and wait for the response.
665-
post(runnable);
666-
runnable.wait();
667-
}
668-
} catch (InterruptedException e) {
669-
Log.e(TAG, "Thread got interrupted waiting for " +
670-
"RunFromSourceRunnable to finish", e);
671-
}
672-
}
673-
674-
private void setAssetBundlePath(final String assetsDirectory) {
675-
Runnable runnable = new Runnable() {
676-
public void run() {
677-
assertAttached();
678-
mNativeView.setAssetBundlePathOnUI(assetsDirectory);
679-
synchronized (this) {
680-
notify();
681-
}
682-
}
683-
};
684-
685-
try {
686-
synchronized (runnable) {
687-
// Post to the Android UI thread and wait for the response.
688-
post(runnable);
689-
runnable.wait();
690-
}
691-
} catch (InterruptedException e) {
692-
Log.e(TAG, "Thread got interrupted waiting for " +
693-
"setAssetBundlePath to finish", e);
694-
}
695-
}
696-
697-
698649
/**
699650
* Return the most recent frame as a bitmap.
700651
*

shell/platform/android/platform_view_android_jni.cc

Lines changed: 0 additions & 74 deletions
Original file line numberDiff line numberDiff line change
@@ -254,69 +254,6 @@ static void RunBundleAndSnapshot(
254254
ANDROID_SHELL_HOLDER->Launch(std::move(config));
255255
}
256256

257-
static void RunBundleAndSource(JNIEnv* env,
258-
jobject jcaller,
259-
jlong shell_holder,
260-
jstring jBundlePath,
261-
jstring main,
262-
jstring packages) {
263-
auto asset_manager = fml::MakeRefCounted<blink::AssetManager>();
264-
265-
const auto bundlepath = fml::jni::JavaStringToString(env, jBundlePath);
266-
267-
if (bundlepath.size() > 0) {
268-
auto directory =
269-
fml::OpenFile(bundlepath.c_str(), fml::OpenPermission::kRead, true);
270-
asset_manager->PushBack(
271-
std::make_unique<blink::DirectoryAssetBundle>(std::move(directory)));
272-
}
273-
274-
auto main_file_path = fml::jni::JavaStringToString(env, main);
275-
auto packages_file_path = fml::jni::JavaStringToString(env, packages);
276-
277-
auto config =
278-
IsolateConfiguration::CreateForSource(main_file_path, packages_file_path);
279-
280-
if (!config) {
281-
return;
282-
}
283-
284-
RunConfiguration run_configuration(std::move(config),
285-
std::move(asset_manager));
286-
287-
ANDROID_SHELL_HOLDER->Launch(std::move(run_configuration));
288-
}
289-
290-
void SetAssetBundlePathOnUI(JNIEnv* env,
291-
jobject jcaller,
292-
jlong shell_holder,
293-
jstring jBundlePath) {
294-
const auto bundlepath = fml::jni::JavaStringToString(env, jBundlePath);
295-
296-
if (bundlepath.size() == 0) {
297-
return;
298-
}
299-
300-
auto directory =
301-
fml::OpenFile(bundlepath.c_str(), fml::OpenPermission::kRead, true);
302-
303-
if (!directory.is_valid()) {
304-
return;
305-
}
306-
307-
std::unique_ptr<blink::AssetResolver> directory_asset_bundle =
308-
std::make_unique<blink::DirectoryAssetBundle>(std::move(directory));
309-
310-
if (!directory_asset_bundle->IsValid()) {
311-
return;
312-
}
313-
314-
auto asset_manager = fml::MakeRefCounted<blink::AssetManager>();
315-
asset_manager->PushBack(std::move(directory_asset_bundle));
316-
317-
ANDROID_SHELL_HOLDER->UpdateAssetManager(std::move(asset_manager));
318-
}
319-
320257
static void SetViewportMetrics(JNIEnv* env,
321258
jobject jcaller,
322259
jlong shell_holder,
@@ -578,17 +515,6 @@ bool PlatformViewAndroid::Register(JNIEnv* env) {
578515
"String;ZLandroid/content/res/AssetManager;)V",
579516
.fnPtr = reinterpret_cast<void*>(&shell::RunBundleAndSnapshot),
580517
},
581-
{
582-
.name = "nativeRunBundleAndSource",
583-
.signature =
584-
"(JLjava/lang/String;Ljava/lang/String;Ljava/lang/String;)V",
585-
.fnPtr = reinterpret_cast<void*>(&shell::RunBundleAndSource),
586-
},
587-
{
588-
.name = "nativeSetAssetBundlePathOnUI",
589-
.signature = "(JLjava/lang/String;)V",
590-
.fnPtr = reinterpret_cast<void*>(&shell::SetAssetBundlePathOnUI),
591-
},
592518
{
593519
.name = "nativeDetach",
594520
.signature = "(J)V",

0 commit comments

Comments
 (0)