Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Next Next commit
use the state
  • Loading branch information
Gray Mackall committed Nov 19, 2024
commit 1e675e77eeebe581762cf7621343d46e1f728408
Original file line number Diff line number Diff line change
Expand Up @@ -634,6 +634,11 @@ protected void onCreate(@Nullable Bundle savedInstanceState) {

super.onCreate(savedInstanceState);

if (savedInstanceState != null &&
savedInstanceState.getBoolean(FlutterActivityAndFragmentDelegate.ON_BACK_CALLBACK_ENABLED_KEY)) {
setFrameworkHandlesBack(true);
}

delegate = new FlutterActivityAndFragmentDelegate(this);
delegate.onAttach(this);
delegate.onRestoreInstanceState(savedInstanceState);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@
private static final String TAG = "FlutterActivityAndFragmentDelegate";
private static final String FRAMEWORK_RESTORATION_BUNDLE_KEY = "framework";
private static final String PLUGINS_RESTORATION_BUNDLE_KEY = "plugins";
private static final String ON_BACK_CALLBACK_ENABLED_KEY = "enableOnBackInvokedCallbackState";
static final String ON_BACK_CALLBACK_ENABLED_KEY = "enableOnBackInvokedCallbackState";
private static final int FLUTTER_SPLASH_VIEW_FALLBACK_ID = 486947586;

/** Factory to obtain a FlutterActivityAndFragmentDelegate instance. */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1071,6 +1071,10 @@ public void onAttach(@NonNull Context context) {
@Override
public void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
if (savedInstanceState != null &&
savedInstanceState.getBoolean(FlutterActivityAndFragmentDelegate.ON_BACK_CALLBACK_ENABLED_KEY)) {
onBackPressedCallback.setEnabled(true);
}
delegate.onRestoreInstanceState(savedInstanceState);
}

Expand Down