mirror of
https://github.com/flutter/flutter.git
synced 2026-02-20 02:29:02 +08:00
Comment rationale for code
This commit is contained in:
parent
c55766fed0
commit
5cc8367e5a
@ -81,6 +81,9 @@ Future<void> runFlutterDriverAndroidTests() async {
|
||||
);
|
||||
|
||||
// A simulated cutout overlay is necessary to test display_cutout_rotation.
|
||||
// Using adb to enable a cutout overlay once the test app is running breaks
|
||||
// the connection with FlutterDriver; therefore, this setting must be set
|
||||
// before `flutter drive` is executed.
|
||||
await runCommand(
|
||||
'adb',
|
||||
<String>[
|
||||
|
||||
@ -48,6 +48,11 @@ class MainActivity : FlutterActivity() {
|
||||
windowInsetsController.hide(WindowInsetsCompat.Type.systemBars())
|
||||
actionBar?.hide()
|
||||
|
||||
// The default behavior on SDK level 34 and below is for display cutouts to be consumed
|
||||
// before the insets would reach the engine. In order to receive the display cutouts in the
|
||||
// engine, the test app must request that it be allowed to draw its content behind cutouts.
|
||||
// See
|
||||
// https://developer.android.com/reference/android/view/WindowManager.LayoutParams#layoutInDisplayCutoutMode
|
||||
if (Build.VERSION.SDK_INT >= 30) {
|
||||
window.attributes.layoutInDisplayCutoutMode =
|
||||
WindowManager.LayoutParams.LAYOUT_IN_DISPLAY_CUTOUT_MODE_ALWAYS
|
||||
|
||||
@ -6,6 +6,11 @@ import 'package:flutter_driver/flutter_driver.dart';
|
||||
import 'package:native_driver/native_driver.dart';
|
||||
import 'package:test/test.dart';
|
||||
|
||||
// These tests require that the device running them have a single cutout at the
|
||||
// top of the display. A simulated cutout setting suffices; however, enabling
|
||||
// one via adb must take place before `flutter drive` starts. Therefore, this
|
||||
// setup is executed in run_flutter_driver_android_tests.dart, rather than in
|
||||
// the below setupAll block.
|
||||
void main() async {
|
||||
late final FlutterDriver flutterDriver;
|
||||
late final NativeDriver nativeDriver;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user