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

feat: Support async updates from the updater library. #13

Merged
merged 2 commits into from
Apr 25, 2023
Merged
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion DEPS
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ vars = {
'skia_revision': '7e1844439eaa3eb24d00c6314ddc81ca532fdd1b',

'updater_git': 'https://github.com/shorebirdtech/updater.git',
'updater_rev': 'bc19f5df79005d65073debdc736f17ca6d827f89',
'updater_rev': '4ab78869b8e75f10450d6156c92d9ab7dc401516',

# WARNING: DO NOT EDIT canvaskit_cipd_instance MANUALLY
# See `lib/web_ui/README.md` for how to roll CanvasKit to a new version.
Expand Down
2 changes: 1 addition & 1 deletion shell/common/shell.cc
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ std::unique_ptr<Shell> Shell::Create(
// non-android targets (e.g. flutter_tester) will fail to link.
#if FML_OS_ANDROID
if (!vm) {
shorebird_report_failed_launch();
shorebird_report_launch_failure();
}
#endif
FML_CHECK(vm) << "Must be able to initialize the VM.";
Expand Down
23 changes: 12 additions & 11 deletions shell/platform/android/flutter_main.cc
Original file line number Diff line number Diff line change
Expand Up @@ -120,34 +120,35 @@ void ConfigureShorebird(std::string android_cache_path,
app_parameters.original_libapp_paths = c_paths.data();
app_parameters.original_libapp_paths_size = c_paths.size();

app_parameters.vm_path = "libflutter.so"; // Unused.

// shorebird_init copies from app_parameters and shorebirdYaml.
shorebird_init(&app_parameters, shorebirdYaml.c_str());
}

FML_LOG(INFO) << "Starting Shorebird update";
shorebird_update();

char* c_active_path = shorebird_active_path();
char* c_active_path = shorebird_next_boot_patch_path();
if (c_active_path != NULL) {
std::string active_path = c_active_path;
shorebird_free_string(c_active_path);
FML_LOG(INFO) << "Shorebird updater: active path: " << active_path;

settings.application_library_path.clear();
settings.application_library_path.emplace_back(active_path);

char* c_patch_number = shorebird_active_patch_number();
char* c_patch_number = shorebird_next_boot_patch_number();
if (c_patch_number != NULL) {
std::string patch_number = c_patch_number;
shorebird_free_string(c_patch_number);
FML_LOG(INFO) << "Shorebird updater: active patch number: "
<< patch_number;
}

settings.application_library_path.clear();
settings.application_library_path.emplace_back(active_path);
// Once start_update_thread is called, the next_boot_patch* functions may
// change their return values if the shorebird_report_launch_failed
// function is called.
shorebird_report_launch_start();
} else {
FML_LOG(INFO) << "Shorebird updater: no active patch.";
}

FML_LOG(INFO) << "Starting Shorebird update";
shorebird_start_update_thread();
}

void FlutterMain::Init(JNIEnv* env,
Expand Down