Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,12 @@
import android.os.Bundle;
import android.os.Handler;
import android.os.Looper;
import android.view.Window;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.core.view.WindowCompat;
import androidx.core.view.WindowInsetsCompat;
import androidx.core.view.WindowInsetsControllerCompat;
import io.flutter.FlutterInjector;
import io.flutter.embedding.engine.FlutterShellArgs;
import io.flutter.embedding.engine.loader.FlutterLoader;
Expand All @@ -25,6 +29,7 @@ public abstract class TestActivity extends TestableFlutterActivity {
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
hideSystemBars(getWindow());
testFlutterLoaderCallbackWhenInitializedTwice();
}

Expand Down Expand Up @@ -104,4 +109,13 @@ protected void testFlutterLoaderCallbackWhenInitializedTwice() {
}
});
}

private static void hideSystemBars(Window window) {
final WindowInsetsControllerCompat insetController =
WindowCompat.getInsetsController(window, window.getDecorView());
assert insetController != null;
insetController.setSystemBarsBehavior(
WindowInsetsControllerCompat.BEHAVIOR_SHOW_TRANSIENT_BARS_BY_SWIPE);
insetController.hide(WindowInsetsCompat.Type.systemBars());
}
}
28 changes: 11 additions & 17 deletions testing/scenario_app/bin/run_android_tests.dart
Original file line number Diff line number Diff line change
Expand Up @@ -298,23 +298,17 @@ Future<void> _run({
});

await step('Configuring emulator...', () async {
final List<List<String>> adbShellCommands = <List<String>> [
// Try to close all OS popups in the emulator, like "System UI stopped working".
<String>['am', 'broadcast', '-a', 'android.intent.action.CLOSE_SYSTEM_DIALOGS'],

// Don't show "this is how you exit fullscreen mode".
<String>['settings', 'put', 'secure', 'immersive_mode_confirmations', 'confirmed'],

// Hide all system bars.
<String>['settings', 'put', 'global', 'policy_control', 'immersive.full=*'],
];

// Run all the commands.
for (final List<String> command in adbShellCommands) {
final int exitCode = await pm.runAndForward(<String>[adb.path, 'shell', ...command]);
if (exitCode != 0) {
panic(<String>['could not run command: ${command.join(' ')}']);
}
final int exitCode = await pm.runAndForward(<String>[
adb.path,
'shell',
'settings',
'put',
'secure',
'immersive_mode_confirmations',
'confirmed',
]);
if (exitCode != 0) {
panic(<String>['could not configure emulator']);
}
});

Expand Down