Do not update system UI overlays when the SDK version condition is not met (flutter/engine#29643)
This commit is contained in:
committed by
GitHub
parent
e79b6bb25d
commit
0a5dbbe522
@@ -238,11 +238,7 @@ public class PlatformPlugin {
|
||||
}
|
||||
|
||||
private void setSystemChromeEnabledSystemUIMode(PlatformChannel.SystemUiMode systemUiMode) {
|
||||
int enabledOverlays =
|
||||
DEFAULT_SYSTEM_UI
|
||||
| View.SYSTEM_UI_FLAG_FULLSCREEN
|
||||
| View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
|
||||
| View.SYSTEM_UI_FLAG_HIDE_NAVIGATION;
|
||||
int enabledOverlays;
|
||||
|
||||
if (systemUiMode == PlatformChannel.SystemUiMode.LEAN_BACK
|
||||
&& Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
|
||||
@@ -301,6 +297,9 @@ public class PlatformPlugin {
|
||||
View.SYSTEM_UI_FLAG_LAYOUT_STABLE
|
||||
| View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
|
||||
| View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN;
|
||||
} else {
|
||||
// When none of the conditions are matched, return without updating the system UI overlays.
|
||||
return;
|
||||
}
|
||||
|
||||
mEnabledOverlays = enabledOverlays;
|
||||
|
||||
@@ -367,6 +367,26 @@ public class PlatformPluginTest {
|
||||
}
|
||||
}
|
||||
|
||||
@Config(sdk = 28)
|
||||
@Test
|
||||
public void doNotEnableEdgeToEdgeOnOlderSdk() {
|
||||
View fakeDecorView = mock(View.class);
|
||||
Window fakeWindow = mock(Window.class);
|
||||
when(fakeWindow.getDecorView()).thenReturn(fakeDecorView);
|
||||
Activity fakeActivity = mock(Activity.class);
|
||||
when(fakeActivity.getWindow()).thenReturn(fakeWindow);
|
||||
PlatformChannel fakePlatformChannel = mock(PlatformChannel.class);
|
||||
PlatformPlugin platformPlugin = new PlatformPlugin(fakeActivity, fakePlatformChannel);
|
||||
|
||||
platformPlugin.mPlatformMessageHandler.showSystemUiMode(
|
||||
PlatformChannel.SystemUiMode.EDGE_TO_EDGE);
|
||||
verify(fakeDecorView, never())
|
||||
.setSystemUiVisibility(
|
||||
View.SYSTEM_UI_FLAG_LAYOUT_STABLE
|
||||
| View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
|
||||
| View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void popSystemNavigatorFlutterActivity() {
|
||||
Activity mockActivity = mock(Activity.class);
|
||||
|
||||
Reference in New Issue
Block a user