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

Fix another instance of platform view breakage on Android 14 #52980

Merged
merged 1 commit into from
May 22, 2024
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@

import android.annotation.TargetApi;
import android.app.Activity;
import android.content.ComponentCallbacks2;
import android.content.Context;
import android.content.Intent;
import android.net.Uri;
Expand Down Expand Up @@ -645,6 +646,12 @@ void onStop() {
// See https://github.com/flutter/flutter/issues/93276
previousVisibility = flutterView.getVisibility();
flutterView.setVisibility(View.GONE);
if (flutterEngine != null) {
// When an Activity is stopped it won't have its onTrimMemory callback invoked. Normally,
// this isn't a problem but because of a bug in some builds of Android 14 we must act as
// if the onTrimMemory callback has been called.
flutterEngine.getRenderer().onTrimMemory(ComponentCallbacks2.TRIM_MEMORY_BACKGROUND);
}
}

/**
Expand Down