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

Commit 3364409

Browse files
Reland Display Features support (Foldable and Cutout) (#29447)
1 parent ca1710a commit 3364409

File tree

29 files changed

+890
-88
lines changed

29 files changed

+890
-88
lines changed

DEPS

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -570,7 +570,7 @@ deps = {
570570
'packages': [
571571
{
572572
'package': 'flutter/android/embedding_bundle',
573-
'version': 'last_updated:2021-10-28T23:34:47-0700'
573+
'version': 'last_updated:2021-11-03T10:29:50-0700'
574574
}
575575
],
576576
'condition': 'download_android_deps',

ci/licenses_golden/licenses_flutter

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -835,6 +835,7 @@ FILE: ../../../flutter/shell/platform/android/io/flutter/embedding/android/Rende
835835
FILE: ../../../flutter/shell/platform/android/io/flutter/embedding/android/SplashScreen.java
836836
FILE: ../../../flutter/shell/platform/android/io/flutter/embedding/android/SplashScreenProvider.java
837837
FILE: ../../../flutter/shell/platform/android/io/flutter/embedding/android/TransparencyMode.java
838+
FILE: ../../../flutter/shell/platform/android/io/flutter/embedding/android/WindowInfoRepositoryCallbackAdapterWrapper.java
838839
FILE: ../../../flutter/shell/platform/android/io/flutter/embedding/engine/FlutterEngine.java
839840
FILE: ../../../flutter/shell/platform/android/io/flutter/embedding/engine/FlutterEngineCache.java
840841
FILE: ../../../flutter/shell/platform/android/io/flutter/embedding/engine/FlutterEngineConnectionRegistry.java

lib/ui/fixtures/ui_test.dart

Lines changed: 28 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -339,7 +339,7 @@ void hooksTests() {
339339
window.onMetricsChanged!();
340340
_callHook(
341341
'_updateWindowMetrics',
342-
17,
342+
20,
343343
0, // window Id
344344
0.1234, // device pixel ratio
345345
0.0, // width
@@ -355,8 +355,11 @@ void hooksTests() {
355355
0.0, // system gesture inset top
356356
0.0, // system gesture inset right
357357
0.0, // system gesture inset bottom
358-
0.0, // system gesture inset left,
358+
0.0, // system gesture inset left
359359
22.0, // physicalTouchSlop
360+
<double>[], // display features bounds
361+
<int>[], // display features types
362+
<int>[], // display features states
360363
);
361364

362365
expectIdentical(originalZone, callbackZone);
@@ -403,7 +406,7 @@ void hooksTests() {
403406
test('Window padding/insets/viewPadding/systemGestureInsets', () {
404407
_callHook(
405408
'_updateWindowMetrics',
406-
17,
409+
20,
407410
0, // window Id
408411
1.0, // devicePixelRatio
409412
800.0, // width
@@ -421,6 +424,9 @@ void hooksTests() {
421424
0.0, // systemGestureInsetBottom
422425
0.0, // systemGestureInsetLeft
423426
22.0, // physicalTouchSlop
427+
<double>[], // display features bounds
428+
<int>[], // display features types
429+
<int>[], // display features states
424430
);
425431

426432
expectEquals(window.viewInsets.bottom, 0.0);
@@ -430,7 +436,7 @@ void hooksTests() {
430436

431437
_callHook(
432438
'_updateWindowMetrics',
433-
17,
439+
20,
434440
0, // window Id
435441
1.0, // devicePixelRatio
436442
800.0, // width
@@ -448,6 +454,9 @@ void hooksTests() {
448454
44.0, // systemGestureInsetBottom
449455
0.0, // systemGestureInsetLeft
450456
22.0, // physicalTouchSlop
457+
<double>[], // display features bounds
458+
<int>[], // display features types
459+
<int>[], // display features states
451460
);
452461

453462
expectEquals(window.viewInsets.bottom, 400.0);
@@ -459,7 +468,7 @@ void hooksTests() {
459468
test('Window physical touch slop', () {
460469
_callHook(
461470
'_updateWindowMetrics',
462-
17,
471+
20,
463472
0, // window Id
464473
1.0, // devicePixelRatio
465474
800.0, // width
@@ -477,14 +486,17 @@ void hooksTests() {
477486
0.0, // systemGestureInsetBottom
478487
0.0, // systemGestureInsetLeft
479488
11.0, // physicalTouchSlop
489+
<double>[], // display features bounds
490+
<int>[], // display features types
491+
<int>[], // display features states
480492
);
481493

482494
expectEquals(window.viewConfiguration.gestureSettings,
483495
GestureSettings(physicalTouchSlop: 11.0));
484496

485497
_callHook(
486498
'_updateWindowMetrics',
487-
17,
499+
20,
488500
0, // window Id
489501
1.0, // devicePixelRatio
490502
800.0, // width
@@ -502,14 +514,17 @@ void hooksTests() {
502514
44.0, // systemGestureInsetBottom
503515
0.0, // systemGestureInsetLeft
504516
-1.0, // physicalTouchSlop
517+
<double>[], // display features bounds
518+
<int>[], // display features types
519+
<int>[], // display features states
505520
);
506521

507522
expectEquals(window.viewConfiguration.gestureSettings,
508523
GestureSettings(physicalTouchSlop: null));
509524

510525
_callHook(
511526
'_updateWindowMetrics',
512-
17,
527+
20,
513528
0, // window Id
514529
1.0, // devicePixelRatio
515530
800.0, // width
@@ -527,6 +542,9 @@ void hooksTests() {
527542
44.0, // systemGestureInsetBottom
528543
0.0, // systemGestureInsetLeft
529544
22.0, // physicalTouchSlop
545+
<double>[], // display features bounds
546+
<int>[], // display features types
547+
<int>[], // display features states
530548
);
531549

532550
expectEquals(window.viewConfiguration.gestureSettings,
@@ -752,4 +770,7 @@ void _callHook(
752770
Object? arg15,
753771
Object? arg16,
754772
Object? arg17,
773+
Object? arg18,
774+
Object? arg19,
775+
Object? arg20,
755776
]) native 'CallHook';

lib/ui/hooks.dart

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,9 @@ void _updateWindowMetrics(
2626
double systemGestureInsetBottom,
2727
double systemGestureInsetLeft,
2828
double physicalTouchSlop,
29+
List<double> displayFeaturesBounds,
30+
List<int> displayFeaturesType,
31+
List<int> displayFeaturesState,
2932
) {
3033
PlatformDispatcher.instance._updateWindowMetrics(
3134
id,
@@ -45,6 +48,9 @@ void _updateWindowMetrics(
4548
systemGestureInsetBottom,
4649
systemGestureInsetLeft,
4750
physicalTouchSlop,
51+
displayFeaturesBounds,
52+
displayFeaturesType,
53+
displayFeaturesState,
4854
);
4955
}
5056

0 commit comments

Comments
 (0)