Repository: flutter
Issue: [Engine/Android] Inconsistent system navigation bar between SystemUiMode.manual and others due to inconsistent usage of SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
Labels: in triage

### Steps to reproduce

Switching between different SystemUiMode, for example
```dart
// Step 1: show all the bars
SystemChrome.setEnabledSystemUIMode(SystemUiMode.edgeToEdge)
// Step 2: show only navigation bar
SystemChrome.setEnabledSystemUIMode(SystemUiMode.manual,
          overlays: [SystemUiOverlay.bottom]);
// Step 3: bring back all the bars
SystemChrome.setEnabledSystemUIMode(SystemUiMode.edgeToEdge)
```

The problem is caused by this line in engine code:
https://github.com/flutter/flutter/blob/586a59211df425b8a1f9b6be1b02662bf88ddc0b/engine/src/flutter/shell/platform/android/io/flutter/plugin/platform/PlatformPlugin.java#L377

I think it should not remove `SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION` flag when showing navigaiton bar as all the other modes have this flag. If we remove it, it will resize the whole app! Check the code for non-manual modes:
https://github.com/flutter/flutter/blob/586a59211df425b8a1f9b6be1b02662bf88ddc0b/engine/src/flutter/shell/platform/android/io/flutter/plugin/platform/PlatformPlugin.java#L266

### Expected results

Should not change the layout in the whole process.

### Actual results

The layout is changed. When going from step1 to step2, the app height is getting smaller, and from step2 to step3, the app height is getting bigger again, and a flashing black area under navigation bar is spotted.

### Code sample

<details open><summary>Code sample</summary>

```dart
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';

class SystemBarPage extends StatelessWidget {
  const SystemBarPage({super.key});

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      body: Center(
        child: Column(
          mainAxisAlignment: MainAxisAlignment.center,
          children: <Widget>[
            ElevatedButton(
              onPressed: () {
                SystemChrome.setEnabledSystemUIMode(SystemUiMode.edgeToEdge);
              },
              child: const Text('Edge to Edge'),
            ),
            ElevatedButton(
              onPressed: () {
                SystemChrome.setEnabledSystemUIMode(SystemUiMode.manual,
                    overlays: [SystemUiOverlay.top, SystemUiOverlay.bottom]);
              },
              child: const Text('Top and Bottom'),
            ),
            ElevatedButton(
              onPressed: () {
                SystemChrome.setEnabledSystemUIMode(SystemUiMode.manual,
                    overlays: [SystemUiOverlay.bottom]);
              },
              child: const Text('Only Bottom'),
            ),
          ],
        ),
      ),
    );
  }
}

```

</details>


### Screenshots or Video

_No response_

### Logs

_No response_

### Flutter Doctor output

<details open><summary>Doctor output</summary>

```console
[√] Flutter (Channel stable, 3.27.1, on Microsoft Windows [版本 10.0.22631.4602], locale zh-CN)
    • Flutter version 3.27.1 on channel stable at G:\flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 17025dd882 (6 weeks ago), 2024-12-17 03:23:09 +0900
    • Engine revision cb4b5fff73
    • Dart version 3.6.0
    • DevTools version 2.40.2

[√] Windows Version (Installed version of Windows is version 10 or higher)

[√] Android toolchain - develop for Android devices (Android SDK version 35.0.0)
    • Android SDK at E:\Android\SDK
    • Platform android-35, build-tools 35.0.0
    • ANDROID_HOME = E:\Android\SDK
    • Java binary at: C:\Program Files\Android\Android Studio\jbr\bin\java
    • Java version OpenJDK Runtime Environment (build 17.0.10+0--11609105)
    • All Android licenses accepted.

[√] Chrome - develop for the web
    • Chrome at C:\Program Files\Google\Chrome\Application\chrome.exe

[√] Visual Studio - develop Windows apps (Visual Studio Community 2022 17.10.3)
    • Visual Studio at D:\Program Files\Microsoft Visual Studio\2022\Community
    • Visual Studio Community 2022 version 17.10.35013.160
    • Windows 10 SDK version 10.0.22621.0

[√] Android Studio (version 2024.1)
    • Android Studio at C:\Program Files\Android\Android Studio
    • Flutter plugin can be installed from:
       https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
       https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build 17.0.10+0--11609105)

[√] IntelliJ IDEA Ultimate Edition (version 2023.1)
    • IntelliJ at D:\Program Files\JetBrains\IntelliJ IDEA 2023.1.2
    • Flutter plugin can be installed from:
       https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
       https://plugins.jetbrains.com/plugin/6351-dart

[√] VS Code (version 1.96.4)
    • VS Code at C:\Users\lai\AppData\Local\Programs\Microsoft VS Code
    • Flutter extension version 3.102.0

[√] Connected device (4 available)
    • Redmi Note 8 (mobile) • 43ab0033 • android-arm64  • Android 11 (API 30)
    • Windows (desktop)     • windows  • windows-x64    • Microsoft Windows [版本 10.0.22631.4602]
    • Chrome (web)          • chrome   • web-javascript • Google Chrome 131.0.6778.267
    • Edge (web)            • edge     • web-javascript • Microsoft Edge 128.0.2739.42

[√] Network resources
    • All expected network resources are available.

• No issues found!
```

</details>