Add DisplayFeatures and DisplayCutout to viewport metrics#1
Add DisplayFeatures and DisplayCutout to viewport metrics#1andreidiaconu wants to merge 31 commits intomasterfrom
Conversation
tggmbi
left a comment
There was a problem hiding this comment.
at this stage, this should be based on alpha 02 of androidx.window:window
any reason you are using 01?
|
Yes, that is my next ToDo.
…On Wed, 3 Feb 2021 at 22:14, tggmbi ***@***.***> wrote:
at this stage, this should be based on alpha 02 of androidx.window:window
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#1 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAKWJPVTPCPOMETURJPU7ELS5GVCLANCNFSM4WHJZORA>
.
|
|
This is based on alpha1 because at the time alpha2 was not published yet
and I needed to move on. I am changing to alpha2 next.
…On Wed, 3 Feb 2021 at 22:16, tggmbi ***@***.***> wrote:
***@***.**** requested changes on this pull request.
at this stage, this should be based on alpha 02 of androidx.window:window
any reason you are using 01?
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#1 (review)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAKWJPRXLFXOIVGZU3CXAGDS5GVIJANCNFSM4WHJZORA>
.
|
shell/platform/android/io/flutter/embedding/android/FlutterView.java
Outdated
Show resolved
Hide resolved
shell/platform/android/io/flutter/embedding/android/FlutterView.java
Outdated
Show resolved
Hide resolved
shell/platform/android/io/flutter/embedding/android/FlutterView.java
Outdated
Show resolved
Hide resolved
shell/platform/android/io/flutter/embedding/android/FlutterView.java
Outdated
Show resolved
Hide resolved
shell/platform/android/io/flutter/embedding/android/FlutterView.java
Outdated
Show resolved
Hide resolved
shell/platform/android/io/flutter/embedding/engine/renderer/FlutterRenderer.java
Outdated
Show resolved
Hide resolved
shell/platform/android/io/flutter/embedding/engine/renderer/FlutterRenderer.java
Show resolved
Hide resolved
|
This also needs tests! |
|
@GaryQian Thank you for the thorough review. Just wanted to mention that the TODOs and lack of tests were next on my list and not something intended to stay. |
xster
left a comment
There was a problem hiding this comment.
Looks like a great start! Mostly small nit comments. One question around the initialization timing.
shell/platform/android/io/flutter/embedding/android/FlutterView.java
Outdated
Show resolved
Hide resolved
shell/platform/android/io/flutter/embedding/android/FlutterView.java
Outdated
Show resolved
Hide resolved
shell/platform/android/io/flutter/embedding/android/FlutterView.java
Outdated
Show resolved
Hide resolved
shell/platform/android/io/flutter/embedding/engine/renderer/FlutterRenderer.java
Outdated
Show resolved
Hide resolved
| * We do not know this type of display feature yet. This can happen if WindowManager is updated | ||
| * with new types. | ||
| */ | ||
| UNKNOWN(0), |
There was a problem hiding this comment.
Or this could happen when the window is not yet attached when setWindowManagerDisplayFeatures is called via onLayout right?
I wonder if we should delay the sending of the very first viewport metrics until a window is attached. Worth testing whether during initialization, we get a quick succession of { window size XY }, then very quickly after, { window size XY, hinge at rect Z }, causing the Flutter application listening to the mediaquery to rapidly build 2 different layouts (wasting the first one).
There was a problem hiding this comment.
Will test and see. If there is a delay, I don't think it's large enough to warrant both calls.
@xster I would say they are more than nit comments - Documentation can be a lot better. Thank you for taking the time. |
| final DisplayFeatureType type; | ||
|
|
||
| /// Posture of display feature, which is populated only for folds and hinges. | ||
| /// For cutouts, this is [DisplayFeatureState.unknown] |
There was a problem hiding this comment.
To get better doc linking (here and elsewhere):
| /// For cutouts, this is [DisplayFeatureState.unknown] | |
| /// For [DisplayFeatureType.cutout]s, this is [DisplayFeatureState.unknown]. |
There was a problem hiding this comment.
Also seems odd that it is "unknown" for cutouts. Isn't it more like: "This doesn't make sense for cutouts"?
There was a problem hiding this comment.
Also seems odd that it is "unknown" for cutouts. Isn't it more like: "This doesn't make sense for cutouts"?
WindowManager display features and cutouts are very similar in a lot of aspects, but indeed, this property is not used for cutouts yet. This was the simplest way to still have the posture for "fold" and "hinge".
|
@andreidiaconu is this PR ready for another round of reviews? |
|
@xster Yes, with the mention that I've opened an official PR on the engine repo: flutter#24756 Also, tests are still in progress, my apologies for taking longer with them. |
…tter#26117) This appears to have triggered reproducible failures in channels_integration_test_ios: [ +4 ms] 00:01 [32m+0[0m: channel suite step through[0m [+3744 ms] Unsupported value: Sun Mar 11 07:16:42 2018 of type __NSTaggedDate [ ] *** Assertion failure in void WriteValue(CFMutableDataRef, id)(), FlutterStandardCodec.mm:340 [ +2 ms] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Unsupported value for standard codec.' [ ] *** First throw call stack: [ ] (0x19d5bd9d8 0x1b1940b54 0x19d4cc50c 0x19e815238 0x1050031ec 0x104823f80 0x105003aac 0x1050009bc 0x104824e9c 0x105000b4c 0x104d0cc98 0x10501b398 0x104fb3c94 0x104fb72c4 0x19d53e3e0 0x19d53dfe4 0x19d53d4c4 0x19d537850 0x19d536ba0 0x1b429c598 0x19fe282f4 0x19fe2d874 0x1048257fc 0x19d215568) [ ] libc++abi.dylib: terminating with uncaught exception of type NSException [ +65 ms] Process 541 stopped [ ] * thread #1, queue = 'com.apple.main-thread', stop reason = signal SIGABRT [ ] frame #0: 0x00000001c93e584c libsystem_kernel.dylib`__pthread_kill + 8 [ ] libsystem_kernel.dylib`__pthread_kill: [ ] -> 0x1c93e584c <+8>: b.lo 0x1c93e5868 ; <+36> [ ] 0x1c93e5850 <+12>: stp x29, x30, [sp, #-0x10]! [ ] 0x1c93e5854 <+16>: mov x29, sp [ ] 0x1c93e5858 <+20>: bl 0x1c93c2f5c ; cerror_nocancel [ ] Target 0: (Runner) stopped. Example builds: * https://ci.chromium.org/ui/p/flutter/builders/prod/Mac_ios%20channels_integration_test_ios/828/overview * https://ci.chromium.org/ui/p/flutter/builders/prod/Mac_ios%20channels_integration_test_ios/829/overview * https://ci.chromium.org/ui/p/flutter/builders/prod/Mac_ios%20channels_integration_test_ios/830/overview * https://ci.chromium.org/ui/p/flutter/builders/prod/Mac_ios%20channels_integration_test_ios/831/overview Example Log: * https://logs.chromium.org/logs/flutter/buildbucket/cr-buildbucket.appspot.com/8847377106855056784/+/u/run_channels_integration_test_ios/stdout This reverts commit 99021da.
# Conflicts: # lib/ui/fixtures/ui_test.dart # lib/ui/hooks.dart # lib/ui/platform_dispatcher.dart # lib/ui/window/viewport_metrics.cc # lib/ui/window/viewport_metrics.h # lib/ui/window/window.cc # lib/web_ui/lib/src/ui/platform_dispatcher.dart # shell/common/shell_test.cc # shell/platform/android/io/flutter/embedding/engine/FlutterJNI.java # shell/platform/android/io/flutter/embedding/engine/renderer/FlutterRenderer.java # shell/platform/android/io/flutter/view/FlutterView.java # shell/platform/android/platform_view_android_jni_impl.cc # shell/platform/android/test/io/flutter/plugin/platform/PlatformViewsControllerTest.java # shell/platform/fuchsia/flutter/platform_view.cc # testing/scenario_app/android/app/build.gradle
# Conflicts: # shell/platform/android/test/io/flutter/plugin/editing/TextInputPluginTest.java
# Conflicts: # shell/platform/android/test/io/flutter/embedding/engine/renderer/FlutterRendererTest.java
97bdab0 to
89fe749
Compare
# Conflicts: # shell/platform/android/test/io/flutter/embedding/engine/renderer/FlutterRendererTest.java
This PR is opened for early feedback on foldable support