Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Commit 983766f

Browse files
authored
Merge branch 'main' into deprecatedMember
2 parents 3bad670 + 0617178 commit 983766f

File tree

2 files changed

+17
-25
lines changed

2 files changed

+17
-25
lines changed

testing/scenario_app/android/app/src/main/java/dev/flutter/scenarios/TestActivity.java

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,8 @@
99
import android.os.Bundle;
1010
import android.os.Handler;
1111
import android.os.Looper;
12-
import android.view.Window;
1312
import androidx.annotation.NonNull;
1413
import androidx.annotation.Nullable;
15-
import androidx.core.view.WindowCompat;
16-
import androidx.core.view.WindowInsetsCompat;
17-
import androidx.core.view.WindowInsetsControllerCompat;
1814
import io.flutter.FlutterInjector;
1915
import io.flutter.embedding.engine.FlutterShellArgs;
2016
import io.flutter.embedding.engine.loader.FlutterLoader;
@@ -29,7 +25,6 @@ public abstract class TestActivity extends TestableFlutterActivity {
2925
@Override
3026
protected void onCreate(@Nullable Bundle savedInstanceState) {
3127
super.onCreate(savedInstanceState);
32-
hideSystemBars(getWindow());
3328
testFlutterLoaderCallbackWhenInitializedTwice();
3429
}
3530

@@ -109,13 +104,4 @@ protected void testFlutterLoaderCallbackWhenInitializedTwice() {
109104
}
110105
});
111106
}
112-
113-
private static void hideSystemBars(Window window) {
114-
final WindowInsetsControllerCompat insetController =
115-
WindowCompat.getInsetsController(window, window.getDecorView());
116-
assert insetController != null;
117-
insetController.setSystemBarsBehavior(
118-
WindowInsetsControllerCompat.BEHAVIOR_SHOW_TRANSIENT_BARS_BY_SWIPE);
119-
insetController.hide(WindowInsetsCompat.Type.systemBars());
120-
}
121107
}

testing/scenario_app/bin/run_android_tests.dart

Lines changed: 17 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -298,17 +298,23 @@ Future<void> _run({
298298
});
299299

300300
await step('Configuring emulator...', () async {
301-
final int exitCode = await pm.runAndForward(<String>[
302-
adb.path,
303-
'shell',
304-
'settings',
305-
'put',
306-
'secure',
307-
'immersive_mode_confirmations',
308-
'confirmed',
309-
]);
310-
if (exitCode != 0) {
311-
panic(<String>['could not configure emulator']);
301+
final List<List<String>> adbShellCommands = <List<String>> [
302+
// Try to close all OS popups in the emulator, like "System UI stopped working".
303+
<String>['am', 'broadcast', '-a', 'android.intent.action.CLOSE_SYSTEM_DIALOGS'],
304+
305+
// Don't show "this is how you exit fullscreen mode".
306+
<String>['settings', 'put', 'secure', 'immersive_mode_confirmations', 'confirmed'],
307+
308+
// Hide all system bars.
309+
<String>['settings', 'put', 'global', 'policy_control', 'immersive.full=*'],
310+
];
311+
312+
// Run all the commands.
313+
for (final List<String> command in adbShellCommands) {
314+
final int exitCode = await pm.runAndForward(<String>[adb.path, 'shell', ...command]);
315+
if (exitCode != 0) {
316+
panic(<String>['could not run command: ${command.join(' ')}']);
317+
}
312318
}
313319
});
314320

0 commit comments

Comments
 (0)