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 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
12 changes: 8 additions & 4 deletions lib/ui/window.dart
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,14 @@ enum AppLifecycleState {
/// in the foreground inactive state. Apps transition to this state when in
/// a phone call, responding to a TouchID request, when entering the app
/// switcher or the control center, or when the UIViewController hosting the
/// Flutter app is transitioning. Apps in this state should assume that they
/// may be [paused] at any time.
///
/// On Android, this state is currently unused.
/// Flutter app is transitioning.
///
/// On Android, this corresponds to an app or the Flutter host view running
/// in the foreground inactive state. Apps transition to this state when
/// another activity is focused, such as a split-screen app, a phone call,
/// a picture-in-picture app, a system dialog, or another window.
///
/// Apps in this state should assume that they may be [paused] at any time.
inactive,

/// The application is not currently visible to the user, not responding to
Expand Down
6 changes: 6 additions & 0 deletions shell/platform/android/io/flutter/app/FlutterActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,12 @@ public void onBackPressed() {
super.onBackPressed();
}
}

@Override
protected void onStop() {
eventDelegate.onStop();
super.onStop();
}

@Override
protected void onPause() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,11 @@ public void onResume() {
}
}

@Override
public void onStop() {
flutterView.onStop();
}

@Override
public void onPostResume() {
if (flutterView != null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,11 @@ public interface FlutterActivityEvents
*/
void onDestroy();

/**
* @see android.app.Activity#onStop()
*/
void onStop();

/**
* Invoked when the activity has detected the user's press of the back key.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,12 @@ public void onBackPressed() {
}
}

@Override
protected void onStop() {
eventDelegate.onStop();
super.onStop();
}

@Override
protected void onPause() {
super.onPause();
Expand Down
4 changes: 2 additions & 2 deletions shell/platform/android/io/flutter/view/FlutterView.java
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,7 @@ public void addActivityLifecycleListener(ActivityLifecycleListener listener) {
}

public void onPause() {
mFlutterLifecycleChannel.send("AppLifecycleState.paused");
mFlutterLifecycleChannel.send("AppLifecycleState.inactive");
}

public void onPostResume() {
Expand All @@ -278,7 +278,7 @@ public void onPostResume() {
}

public void onStop() {
mFlutterLifecycleChannel.send("AppLifecycleState.suspending");
mFlutterLifecycleChannel.send("AppLifecycleState.paused");
}

public void onMemoryPressure() {
Expand Down