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

Add a Display API to dart:ui that reports the physical size, DPR, and refresh rate of the main display #41685

Merged
merged 24 commits into from
May 6, 2023

Conversation

dnfield
Copy link
Contributor

@dnfield dnfield commented May 3, 2023

Fixes flutter/flutter#123307 - for Android, iOS, and Web, for the main display only (flutter/flutter#125938 tracks supporting multiple displays, flutter/flutter#125939 for desktop).

Desktop will need to be implemented for this, but given priority for a couple of our customers targetting foldable devices on Android I'm inclined to get this in before desktop can be finished.

The main concern for this right now is that on some Android foldable devices, setting a preferred orientation will cause letterboxing and the MediaQuery will never get the full screen size when unfolded. This causes apps to think the screen is smaller than it is, as they've mainly been using MediaQueryData.size to figure this out. Android's recommendation is to not set a preferred orientation, and if you must to use the new method introduced in ViewUtil.java to calculate the maximal window size.

@flutter-dashboard flutter-dashboard bot added embedder Related to the embedder API platform-android platform-ios platform-web Code specifically for the web engine labels May 3, 2023
@dnfield dnfield changed the title Displays Add a Display API to dart:ui that reports the physical size, DPR, and refresh rate of the main display May 3, 2023
@dnfield dnfield marked this pull request as draft May 3, 2023 04:15
@dnfield
Copy link
Contributor Author

dnfield commented May 3, 2023

I'm going to try to add some tests for this tomorrow.

@dnfield dnfield marked this pull request as ready for review May 3, 2023 18:42
@dnfield
Copy link
Contributor Author

dnfield commented May 3, 2023

This now has test coverage for VM Dart and Android.

@cyanglaz or @jmagman - I think this gets some coverage from scenario_app on iOS, but I can't think of a good way to unit test the changes to the iOS embedding more particularly. Open to suggestions.

@cyanglaz
Copy link
Contributor

cyanglaz commented May 3, 2023

This now has test coverage for VM Dart and Android.

@cyanglaz or @jmagman - I think this gets some coverage from scenario_app on iOS, but I can't think of a good way to unit test the changes to the iOS embedding more particularly. Open to suggestions.

You can prob test if updateDisplays is called during setViewController and setupShell. Similar to how you did it for android.

@dnfield
Copy link
Contributor Author

dnfield commented May 3, 2023

This now has test coverage for VM Dart and Android.
@cyanglaz or @jmagman - I think this gets some coverage from scenario_app on iOS, but I can't think of a good way to unit test the changes to the iOS embedding more particularly. Open to suggestions.

You can prob test if updateDisplays is called during setViewController and setupShell. Similar to how you did it for android.

How can I do that on the object itself though? Ther'es some weird ObjC way to spy on a method of a real class right? I can't remember.

engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request May 7, 2023
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request May 7, 2023
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request May 7, 2023
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request May 7, 2023
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request May 7, 2023
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request May 8, 2023
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request May 8, 2023
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request May 8, 2023
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request May 8, 2023
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request May 8, 2023
goderbauer added a commit that referenced this pull request May 8, 2023
The engine roll is currently failing (https://cirrus-ci.com/task/5475027185827840?logs=main#L172) because of a doc issue introduced by #41685. This fixes the doc issue.
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request May 8, 2023
auto-submit bot pushed a commit that referenced this pull request May 8, 2023
The engine roll is currently failing (https://cirrus-ci.com/task/5475027185827840?logs=main#L172) because of a doc issue introduced by #41685. This fixes the doc issue.
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request May 8, 2023
auto-submit bot pushed a commit to flutter/flutter that referenced this pull request May 8, 2023
…126262)

flutter/engine@23f730e...c42dd23

2023-05-08 goderbauer@google.com Fix doc to fix engine roll (flutter/engine#41812)
2023-05-08 49699333+dependabot[bot]@users.noreply.github.com Bump github/codeql-action from 2.3.2 to 2.3.3 (flutter/engine#41811)
2023-05-08 skia-flutter-autoroll@skia.org Roll Skia from 802eb7f66fc5 to 5f7e572995b1 (1 revision) (flutter/engine#41809)
2023-05-08 skia-flutter-autoroll@skia.org Roll Skia from f9bef8f7bdb5 to 802eb7f66fc5 (1 revision) (flutter/engine#41807)
2023-05-08 skia-flutter-autoroll@skia.org Roll Skia from 148ebc0596b7 to f9bef8f7bdb5 (1 revision) (flutter/engine#41806)
2023-05-08 skia-flutter-autoroll@skia.org Roll Fuchsia Mac SDK from VD0zJZ-ezOAfA9O1s... to KZrdNPIOcs5m2MqV_... (flutter/engine#41805)
2023-05-07 skia-flutter-autoroll@skia.org Roll Skia from 642ba306e140 to 148ebc0596b7 (1 revision) (flutter/engine#41804)
2023-05-07 skia-flutter-autoroll@skia.org Roll Skia from 8a93b289c2ed to 642ba306e140 (1 revision) (flutter/engine#41802)
2023-05-07 skia-flutter-autoroll@skia.org Roll ICU from d8daa943f64c to a2961dc659b4 (2 revisions) (flutter/engine#41801)
2023-05-07 skia-flutter-autoroll@skia.org Roll Fuchsia Mac SDK from k4NzlntuagXZIlCJg... to VD0zJZ-ezOAfA9O1s... (flutter/engine#41800)
2023-05-07 skia-flutter-autoroll@skia.org Roll Fuchsia Mac SDK from FFOWihz4lzOeDHmNj... to k4NzlntuagXZIlCJg... (flutter/engine#41799)
2023-05-06 skia-flutter-autoroll@skia.org Roll Dart SDK from d04e8b571819 to ab64c4a56e2c (1 revision) (flutter/engine#41798)
2023-05-06 dnfield@google.com Add a `Display` API to dart:ui that reports the physical size, DPR, and refresh rate of the main display (flutter/engine#41685)

Also rolling transitive DEPS:
  fuchsia/sdk/core/mac-amd64 from FFOWihz4lzOe to KZrdNPIOcs5m

If this roll has caused a breakage, revert this CL and stop the roller
using the controls here:
https://autoroll.skia.org/r/flutter-engine-flutter-autoroll
Please CC jimgraham@google.com,rmistry@google.com,zra@google.com on the revert to ensure that a human
is aware of the problem.

To file a bug in Flutter: https://github.com/flutter/flutter/issues/new/choose

To report a problem with the AutoRoller itself, please file a bug:
https://bugs.chromium.org/p/skia/issues/entry?template=Autoroller+Bug

Documentation for the AutoRoller is here:
https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
autosubmit Merge PR when tree becomes green via auto submit App embedder Related to the embedder API platform-android platform-ios platform-web Code specifically for the web engine
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support getting the maximum window size (or the size of the display)
5 participants