Set the 'visibility' of 'FlutterView' to the previous one in 'FragmentActivityAndFragment.onStart' (flutter/engine#34601)
This commit is contained in:
@@ -87,6 +87,7 @@ import java.util.List;
|
||||
private boolean isFlutterUiDisplayed;
|
||||
private boolean isFirstFrameRendered;
|
||||
private boolean isAttached;
|
||||
private Integer previousVisibility;
|
||||
|
||||
@NonNull
|
||||
private final FlutterUiDisplayListener flutterUiDisplayListener =
|
||||
@@ -399,7 +400,9 @@ import java.util.List;
|
||||
// screen when unlocked. We can work around this by changing the visibility of FlutterView in
|
||||
// onStart and onStop.
|
||||
// See https://github.com/flutter/flutter/issues/93276
|
||||
flutterView.setVisibility(View.VISIBLE);
|
||||
if (previousVisibility != null) {
|
||||
flutterView.setVisibility(previousVisibility);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -599,6 +602,7 @@ import java.util.List;
|
||||
// screen when unlocked. We can work around this by changing the visibility of FlutterView in
|
||||
// onStart and onStop.
|
||||
// See https://github.com/flutter/flutter/issues/93276
|
||||
previousVisibility = flutterView.getVisibility();
|
||||
flutterView.setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
|
||||
@@ -1038,11 +1038,27 @@ public class FlutterActivityAndFragmentDelegateTest {
|
||||
// Verify that the flutterView is visible.
|
||||
assertEquals(View.VISIBLE, delegate.flutterView.getVisibility());
|
||||
delegate.onStop();
|
||||
// Verify that the flutterView is not visible.
|
||||
// Verify that the flutterView is gone.
|
||||
assertEquals(View.GONE, delegate.flutterView.getVisibility());
|
||||
delegate.onStart();
|
||||
// Verify that the flutterView is visible.
|
||||
assertEquals(View.VISIBLE, delegate.flutterView.getVisibility());
|
||||
|
||||
delegate.flutterView.setVisibility(View.INVISIBLE);
|
||||
delegate.onStop();
|
||||
// Verify that the flutterView is gone.
|
||||
assertEquals(View.GONE, delegate.flutterView.getVisibility());
|
||||
delegate.onStart();
|
||||
// Verify that the flutterView is invisible.
|
||||
assertEquals(View.INVISIBLE, delegate.flutterView.getVisibility());
|
||||
|
||||
delegate.flutterView.setVisibility(View.GONE);
|
||||
delegate.onStop();
|
||||
// Verify that the flutterView is gone.
|
||||
assertEquals(View.GONE, delegate.flutterView.getVisibility());
|
||||
delegate.onStart();
|
||||
// Verify that the flutterView is gone.
|
||||
assertEquals(View.GONE, delegate.flutterView.getVisibility());
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
Reference in New Issue
Block a user