Skip to content

Commit

Permalink
Reland: Display Features support (#29585)
Browse files Browse the repository at this point in the history
  • Loading branch information
andreidiaconu authored Nov 20, 2021
1 parent cf20dd0 commit 93f3991
Show file tree
Hide file tree
Showing 29 changed files with 890 additions and 88 deletions.
2 changes: 1 addition & 1 deletion DEPS
Original file line number Diff line number Diff line change
Expand Up @@ -570,7 +570,7 @@ deps = {
'packages': [
{
'package': 'flutter/android/embedding_bundle',
'version': 'last_updated:2021-10-28T23:34:47-0700'
'version': 'last_updated:2021-11-03T10:29:50-0700'
}
],
'condition': 'download_android_deps',
Expand Down
1 change: 1 addition & 0 deletions ci/licenses_golden/licenses_flutter
Original file line number Diff line number Diff line change
Expand Up @@ -837,6 +837,7 @@ FILE: ../../../flutter/shell/platform/android/io/flutter/embedding/android/Rende
FILE: ../../../flutter/shell/platform/android/io/flutter/embedding/android/SplashScreen.java
FILE: ../../../flutter/shell/platform/android/io/flutter/embedding/android/SplashScreenProvider.java
FILE: ../../../flutter/shell/platform/android/io/flutter/embedding/android/TransparencyMode.java
FILE: ../../../flutter/shell/platform/android/io/flutter/embedding/android/WindowInfoRepositoryCallbackAdapterWrapper.java
FILE: ../../../flutter/shell/platform/android/io/flutter/embedding/engine/FlutterEngine.java
FILE: ../../../flutter/shell/platform/android/io/flutter/embedding/engine/FlutterEngineCache.java
FILE: ../../../flutter/shell/platform/android/io/flutter/embedding/engine/FlutterEngineConnectionRegistry.java
Expand Down
35 changes: 28 additions & 7 deletions lib/ui/fixtures/ui_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -339,7 +339,7 @@ void hooksTests() {
window.onMetricsChanged!();
_callHook(
'_updateWindowMetrics',
17,
20,
0, // window Id
0.1234, // device pixel ratio
0.0, // width
Expand All @@ -355,8 +355,11 @@ void hooksTests() {
0.0, // system gesture inset top
0.0, // system gesture inset right
0.0, // system gesture inset bottom
0.0, // system gesture inset left,
0.0, // system gesture inset left
22.0, // physicalTouchSlop
<double>[], // display features bounds
<int>[], // display features types
<int>[], // display features states
);

expectIdentical(originalZone, callbackZone);
Expand Down Expand Up @@ -403,7 +406,7 @@ void hooksTests() {
test('Window padding/insets/viewPadding/systemGestureInsets', () {
_callHook(
'_updateWindowMetrics',
17,
20,
0, // window Id
1.0, // devicePixelRatio
800.0, // width
Expand All @@ -421,6 +424,9 @@ void hooksTests() {
0.0, // systemGestureInsetBottom
0.0, // systemGestureInsetLeft
22.0, // physicalTouchSlop
<double>[], // display features bounds
<int>[], // display features types
<int>[], // display features states
);

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

_callHook(
'_updateWindowMetrics',
17,
20,
0, // window Id
1.0, // devicePixelRatio
800.0, // width
Expand All @@ -448,6 +454,9 @@ void hooksTests() {
44.0, // systemGestureInsetBottom
0.0, // systemGestureInsetLeft
22.0, // physicalTouchSlop
<double>[], // display features bounds
<int>[], // display features types
<int>[], // display features states
);

expectEquals(window.viewInsets.bottom, 400.0);
Expand All @@ -459,7 +468,7 @@ void hooksTests() {
test('Window physical touch slop', () {
_callHook(
'_updateWindowMetrics',
17,
20,
0, // window Id
1.0, // devicePixelRatio
800.0, // width
Expand All @@ -477,14 +486,17 @@ void hooksTests() {
0.0, // systemGestureInsetBottom
0.0, // systemGestureInsetLeft
11.0, // physicalTouchSlop
<double>[], // display features bounds
<int>[], // display features types
<int>[], // display features states
);

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

_callHook(
'_updateWindowMetrics',
17,
20,
0, // window Id
1.0, // devicePixelRatio
800.0, // width
Expand All @@ -502,14 +514,17 @@ void hooksTests() {
44.0, // systemGestureInsetBottom
0.0, // systemGestureInsetLeft
-1.0, // physicalTouchSlop
<double>[], // display features bounds
<int>[], // display features types
<int>[], // display features states
);

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

_callHook(
'_updateWindowMetrics',
17,
20,
0, // window Id
1.0, // devicePixelRatio
800.0, // width
Expand All @@ -527,6 +542,9 @@ void hooksTests() {
44.0, // systemGestureInsetBottom
0.0, // systemGestureInsetLeft
22.0, // physicalTouchSlop
<double>[], // display features bounds
<int>[], // display features types
<int>[], // display features states
);

expectEquals(window.viewConfiguration.gestureSettings,
Expand Down Expand Up @@ -752,4 +770,7 @@ void _callHook(
Object? arg15,
Object? arg16,
Object? arg17,
Object? arg18,
Object? arg19,
Object? arg20,
]) native 'CallHook';
6 changes: 6 additions & 0 deletions lib/ui/hooks.dart
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@ void _updateWindowMetrics(
double systemGestureInsetBottom,
double systemGestureInsetLeft,
double physicalTouchSlop,
List<double> displayFeaturesBounds,
List<int> displayFeaturesType,
List<int> displayFeaturesState,
) {
PlatformDispatcher.instance._updateWindowMetrics(
id,
Expand All @@ -45,6 +48,9 @@ void _updateWindowMetrics(
systemGestureInsetBottom,
systemGestureInsetLeft,
physicalTouchSlop,
displayFeaturesBounds,
displayFeaturesType,
displayFeaturesState,
);
}

Expand Down
Loading

0 comments on commit 93f3991

Please sign in to comment.