File tree Expand file tree Collapse file tree 2 files changed +24
-5
lines changed
io/flutter/plugin/platform
test/io/flutter/plugin/platform Expand file tree Collapse file tree 2 files changed +24
-5
lines changed Original file line number Diff line number Diff line change @@ -238,11 +238,7 @@ public void onSystemUiVisibilityChange(int visibility) {
238238 }
239239
240240 private void setSystemChromeEnabledSystemUIMode (PlatformChannel .SystemUiMode systemUiMode ) {
241- int enabledOverlays =
242- DEFAULT_SYSTEM_UI
243- | View .SYSTEM_UI_FLAG_FULLSCREEN
244- | View .SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
245- | View .SYSTEM_UI_FLAG_HIDE_NAVIGATION ;
241+ int enabledOverlays ;
246242
247243 if (systemUiMode == PlatformChannel .SystemUiMode .LEAN_BACK
248244 && Build .VERSION .SDK_INT >= Build .VERSION_CODES .JELLY_BEAN ) {
@@ -301,6 +297,9 @@ private void setSystemChromeEnabledSystemUIMode(PlatformChannel.SystemUiMode sys
301297 View .SYSTEM_UI_FLAG_LAYOUT_STABLE
302298 | View .SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
303299 | View .SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN ;
300+ } else {
301+ // When none of the conditions are matched, return without updating the system UI overlays.
302+ return ;
304303 }
305304
306305 mEnabledOverlays = enabledOverlays ;
Original file line number Diff line number Diff line change @@ -367,6 +367,26 @@ public void setSystemUiMode() {
367367 }
368368 }
369369
370+ @ Config (sdk = 28 )
371+ @ Test
372+ public void doNotEnableEdgeToEdgeOnOlderSdk () {
373+ View fakeDecorView = mock (View .class );
374+ Window fakeWindow = mock (Window .class );
375+ when (fakeWindow .getDecorView ()).thenReturn (fakeDecorView );
376+ Activity fakeActivity = mock (Activity .class );
377+ when (fakeActivity .getWindow ()).thenReturn (fakeWindow );
378+ PlatformChannel fakePlatformChannel = mock (PlatformChannel .class );
379+ PlatformPlugin platformPlugin = new PlatformPlugin (fakeActivity , fakePlatformChannel );
380+
381+ platformPlugin .mPlatformMessageHandler .showSystemUiMode (
382+ PlatformChannel .SystemUiMode .EDGE_TO_EDGE );
383+ verify (fakeDecorView , never ())
384+ .setSystemUiVisibility (
385+ View .SYSTEM_UI_FLAG_LAYOUT_STABLE
386+ | View .SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
387+ | View .SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN );
388+ }
389+
370390 @ Test
371391 public void popSystemNavigatorFlutterActivity () {
372392 Activity mockActivity = mock (Activity .class );
You can’t perform that action at this time.
0 commit comments