Skip to content

Commit

Permalink
Revert "Do not pause rendering when android activity loses focus (#4848
Browse files Browse the repository at this point in the history
…)" (#4985)

This reverts commit c83d1ef.
  • Loading branch information
jonahwilliams committed Apr 12, 2018
1 parent 8a8f965 commit 8a6e64a
Show file tree
Hide file tree
Showing 7 changed files with 7 additions and 41 deletions.
12 changes: 4 additions & 8 deletions lib/ui/window.dart
Original file line number Diff line number Diff line change
Expand Up @@ -47,14 +47,10 @@ 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.
///
/// 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.
/// 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.
inactive,

/// The application is not currently visible to the user, not responding to
Expand Down
6 changes: 0 additions & 6 deletions shell/platform/android/io/flutter/app/FlutterActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -99,12 +99,6 @@ 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,11 +218,6 @@ 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,11 +54,6 @@ 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,13 +98,6 @@ public void onBackPressed() {
}
}

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


@Override
protected void onPause() {
super.onPause();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -128,14 +128,7 @@ private void attach(FlutterNativeView view) {

// Called by native to send us a platform message.
private void handlePlatformMessage(final String channel, byte[] message, final int replyId) {
// The platform may not be attached immediately in certain cases where a new bundle is run -
// the native view is created in a separate thread. This mostly happens when the app restarts in dev
// mode when switching into split-screen mode. Preventing app restarts on layout and density
// changes will prevent this, and afterwards this can be changed back to an assert.
if (!isAttached()) {
Log.d(TAG, "PlatformView is not attached");
return;
}
assertAttached();
BinaryMessageHandler handler = mMessageHandlers.get(channel);
if (handler != null) {
try {
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.inactive");
mFlutterLifecycleChannel.send("AppLifecycleState.paused");
}

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

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

public void onMemoryPressure() {
Expand Down

0 comments on commit 8a6e64a

Please sign in to comment.