171 Commits

Author SHA1 Message Date
Dan Field
ea5131772d Add a Display API to dart:ui that reports the physical size, DPR, and refresh rate of the main display (flutter/engine#41685)
Fixes https://github.com/flutter/flutter/issues/123307 - for Android, iOS, and Web, for the main display only (https://github.com/flutter/flutter/issues/125938 tracks supporting multiple displays, https://github.com/flutter/flutter/issues/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.
2023-05-06 18:28:22 +00:00
Loïc Sharma
c6f9e5cebd [Shell] Update stale comments after multi-view (flutter/engine#39298) 2023-01-31 23:58:10 +00:00
Chris Bracken
dc3033d922 Clarify semantics action dispatch id parameter (flutter/engine#38356)
Previously the embedder API documented this as an action ID, but it's
actually the semantics node ID. This fixes the docs and renames the
parameter to clarify its purpose.

This callback is registered in the framework render bindings:
9102f2fe0b/packages/flutter/lib/src/rendering/binding.dart (L43)

Handled by `_handleSemanticsAction`:
9102f2fe0b/packages/flutter/lib/src/rendering/binding.dart (L360-L366)

Which invokes `SemanticsOwner.performAction`, where the node is looked up by ID:
9102f2fe0b/packages/flutter/lib/src/semantics/semantics.dart (L3258-L3277)
2022-12-16 13:40:48 -08:00
Dan Field
020577edbb Make NotifyIdle reject close and past deadlines. (flutter/engine#37737)
This patch also eliminates some extraneous tracing that is happening
every frame. It is possible to get the same trace calls by enabling
the API stream if needed.

Also refactors the NotifyIdle callsites to just always work in
TimeDeltas rather than converting back and forth between them and
TimePoints, which I think reads more clearly.
2022-11-18 18:17:53 +00:00
Dan Field
181a1728f1 Always use fml::TaskRunnerAffineWeakPtr for SnapshotDelegate (flutter/engine#36772) 2022-10-14 18:09:29 -07:00
gaaclarke
e41c775200 Removed instances of unnecessary values (flutter/engine#36221) 2022-09-26 21:28:04 +00:00
gaaclarke
42c469183e Started handling messages from background isolates for iOS (flutter/engine#35174) 2022-09-08 00:03:27 +00:00
ColdPaleLight
e9ad8e2454 [Impeller] Implement ui.Picture.toImage() (flutter/engine#35633) 2022-09-01 22:59:41 +00:00
Jonah Williams
1245043020 Support hot reload of asset fonts (flutter/engine#35213) 2022-08-08 18:06:05 +00:00
ColdPaleLight
b1ad898b4e Correct the frame timing in 'Rasterizer::Draw' when pipeline is more available (flutter/engine#32283) 2022-06-03 10:18:06 -07:00
Kaushik Iska
916f9bcab5 Fix layer tree snapshot values (flutter/engine#33753) 2022-06-01 10:18:05 -07:00
hellohuanlin
37048bc2f9 Fixed a few typos in comments (flutter/engine#33062) 2022-05-02 18:59:04 -07:00
ColdPaleLight
e9f78111c6 Clean obsolete 'shared_resource_context' (flutter/engine#32521) 2022-04-14 13:24:05 -07:00
Kaushik Iska
d8e73006e0 Add service protocol method to facilitate getting snapshots (flutter/engine#32628) 2022-04-13 13:39:05 -07:00
ColdPaleLight
31e332ee32 Tuning resource cache max bytes in lightweight engine scenarios (flutter/engine#32156) 2022-03-31 21:11:05 -07:00
Chris Yang
840af99590 Make Get GetVsyncWaiter return weak_ptr to prevent dangling pointer crash (flutter/engine#32121) 2022-03-21 11:05:05 -07:00
ColdPaleLight
05bb17d606 Always update the latest frame target time when the 'Animator::Render' method is called (flutter/engine#31973) 2022-03-21 09:35:02 -07:00
Chinmay Garde
34f3581a3c Switch the renderer to impeller based on the presence of a command line flag. (flutter/engine#31959)
Specifying the `--enable-impeller` flag will switch the renderer to using
Impeller instead of Skia. On platforms where Impeller is not supported, this
flag is ignored.

The notion of the `flutter::SurfaceFrame` has been augmented. Now, in the
absence of a Skia surface to render to, the surface frame will render into a
display list instead.

Impeller variants of the context and surface variants have been added to
`shell/gpu` and `shell/platform`. The variants prepare surface frames that
don’t/can’t specify a Skia surface thus forcing the surface frame to render to a
display list instead. Then, in the submit callback, they forward the display
list ops to the Impeller display list dispatcher.

This scheme has been chosen as it requires the fewest updates to engine
internals which all depend on Skia data structures. Instead of updating all
call-sites to be Skia neutral, the display list interface itself is being made
graphics package agnostic.
2022-03-15 14:12:53 -07:00
ColdPaleLight
043d9d2e39 Add an embedder.h API for scheduling frame (flutter/engine#31304) 2022-02-17 13:24:10 -08:00
ColdPaleLight
b64598bef6 Refactor type of deadline in the method NotifyIdle to fml::TimePoint (flutter/engine#30737) 2022-01-19 17:25:09 -08:00
gaaclarke
1724b4f192 Reland: iOS Background Platform Channels (#29665) (flutter/engine#30697)
* iOS Background Platform Channels (#29665)

* added test that passes before this change, and fails after it

* started supporting backwards compatible usage of setting handlers
2022-01-12 09:57:29 -08:00
Chris Yang
a50ebf3955 Variable Refresh Rate Display (flutter/engine#30223) 2022-01-11 10:55:10 -08:00
eggfly
6b1d2dcdbc Share the io_manager between parent and spawn engine (flutter/engine#29915) 2021-12-01 10:34:01 -08:00
Tong Mu
5183c56533 [Embedder] Send key data through message channel (flutter/engine#29795)
This PR changes how embedder API's SendKeyData sends ui.KeyData to the framework. The packets are now sent over the existing platform messenger, reusing the entirety of its code path and functionalities while keeping the embedder API unchanged
2021-11-18 17:53:28 -08:00
Dan Field
0a6301d5ca Listen for display refresh changes and report them correctly (flutter/engine#29800)
This makes sure the frame timings recorder and vsync waiter implementations get
the correct refresh rate if or when it adjusts at runtime. This should be OK
because we'll only query the refresh rate when the display metrics actually
change, which is much less frequent than every frame. I experimented with an NDK
implementation in the previous patch, but that vastly restricts the API levels
we can support, and currently on API 30 and 31 it just calls Java methods
through JNI anyway.

I've refactored the way Display updates are reported so that AndroidDisplay can
just dynamically get the refresh rate correctly. These values are used by a
service protocol extension and by some Stopwatches on the CompositorContext.

See also #29765

Fixes flutter/flutter#93688
Fixes flutter/flutter#93698
2021-11-18 13:09:26 -08:00
gaaclarke
8c4ccf58e2 Reapply: Android background platform channels (flutter/engine#29346)
* Revert "Revert "Android Background Platform Channels (#29147)""

This reverts commit 7ed91e14ccc1f5ffc4cb13d1d37e27d370c8f7cd.

* Made this PR less of a breaking change by keeping setMessageHandler's signature the same
2021-10-27 10:11:36 -07:00
Dan Field
d5c36f87f5 Revert "Android Background Platform Channels (#29147)" (flutter/engine#29344)
This reverts commit c40f7670e7aff3a42be2cbac0df067009278d639.
2021-10-26 14:52:13 -07:00
gaaclarke
c40f7670e7 Android Background Platform Channels (flutter/engine#29147) 2021-10-21 16:08:02 -07:00
ColdPaleLight
3bd57ac05a Make FlutterEngineGroup support initialRoute (flutter/engine#28884) 2021-09-29 11:02:37 -07:00
eggfly
f1fd54b45a Implementation of two or more threads merging for multiple platform views (flutter/engine#27662)
Implementation of two or more threads merging for both lightweight multiple engines and standalone multiple engines.
2021-08-06 10:31:59 -07:00
Brandon DeRosier
e2c58529b5 Add native Android image decoder supported by API 28+ (flutter/engine#26746) 2021-07-21 13:52:29 -07:00
Jonah Williams
ccae44ffd0 Surface frame number identifier through window (flutter/engine#26785) 2021-06-28 10:16:01 -07:00
Jason Simmons
dcb08fa9ae Capture the layer tree pipeline as a weak pointer in the OnAnimatorDraw task (flutter/engine#26210) 2021-05-19 14:39:05 -07:00
gaaclarke
4d98fd9744 Switch PlatformMessages to hold data in Mappings (flutter/engine#25867) 2021-05-13 10:28:25 -07:00
Kaushik Iska
2fead370b3 Streamline frame timings recording (flutter/engine#25892) 2021-05-07 12:14:01 -07:00
gaaclarke
1734ce7f8a Moved PlatformMessage's to unique_ptrs (flutter/engine#25860) 2021-05-06 20:19:01 -07:00
Dan Field
ce6f1f5fd0 Avoid calling Dart_HintFreed more than once every five seconds (flutter/engine#25827) 2021-05-03 12:19:01 -07:00
Dan Field
b09dbac3d5 Remove flake inducing timeouts (flutter/engine#25847) 2021-04-30 14:51:38 -07:00
Dan Field
22da76000a Refactor GPU access switch (flutter/engine#24356) 2021-04-06 22:16:06 -07:00
Chris Bracken
9b4a0264d5 Correct typos throughout the engine/embedder (flutter/engine#25346)
Used the the `misspell` tool available at
https://github.com/client9/misspell, then applied hand-corrections. It's
possible we could adopt this as a presubmit, but there are still enough
false positives that it may not be worth the effort.
2021-04-01 11:08:19 -07:00
Kaushik Iska
ca7c19d772 Revert "Reland "Remove pipeline in favor of layer tree holder" (#24947)" (flutter/engine#25027) 2021-03-16 16:43:01 -07:00
Kaushik Iska
660e70b250 Reland "Remove pipeline in favor of layer tree holder" (flutter/engine#24947) 2021-03-11 10:56:08 -08:00
Chris Bracken
13cf185e1c Correct setup-related typos (flutter/engine#24846)
Corrects uses of setup as a verb to 'set up', leaves noun/noun-phrase
forms of setup as 'setup'. Also settles on 'teardown' as opposed to
tear-down for consistency across the codebase.

A few other minor comment/wording corrections.
2021-03-08 17:31:10 -08:00
gaaclarke
8d44387269 Started initializing the gpu disable syncswitch based on the app state. (flutter/engine#24503) 2021-02-24 22:24:29 -08:00
Kaushik Iska
628624c014 Revert "Reland "Remove pipeline in favor of layer tree holder (#18901)" (#24387)" (flutter/engine#24456)
This reverts commit 89d58651ecab974f80345f065203178024eb9b84.
2021-02-17 10:44:39 -08:00
Kaushik Iska
89d58651ec Reland "Remove pipeline in favor of layer tree holder (#18901)" (flutter/engine#24387) 2021-02-16 13:27:09 -08:00
David Worsham
3215611f74 Fix use of multiple shells w/ different snapshots (flutter/engine#24152) 2021-02-03 17:42:36 -08:00
Tong Mu
ee1cc9f5ab Hardware keyboard: Web, embedder, and dart:ui (flutter/engine#23466) 2021-01-28 17:19:02 -08:00
Dan Field
e778949043 Reland path vol tracker (flutter/engine#23840)
This time making sure to deref the native object on GC.
2021-01-21 16:03:43 -08:00
Dan Field
cb57183325 revert path volatility tracker (flutter/engine#23822) 2021-01-21 08:34:02 -08:00