344 Commits

Author SHA1 Message Date
Chinmay Garde
93a6d340fa Add explicit casts to pointer data members on Android. (flutter/engine#5558)
This accounts for changes made in https://github.com/flutter/engine/pull/5556
2018-06-18 12:08:11 -07:00
Ian Hickson
19d7432403 Remove spurious log messages (flutter/engine#5547)
These are making some of the tests that are sensitive to output flakey.
2018-06-15 14:15:35 -07:00
Stanislav Baranov
6d140f4e43 Fix compile error introduce in #5473. (flutter/engine#5488)
Fix compile error introduced in #5473.
2018-06-07 15:36:35 -07:00
Stanislav Baranov
5afc3daf35 Support running bundles from zip file. (flutter/engine#5473)
Support running bundles from zip file.
2018-06-07 15:09:23 -07:00
Zachary Anderson
e95110f16f Adds dynamic, interpreter configs to tools/gn (flutter/engine#5446)
Adds --dynamic and --interpreter flags to
tools/gn. These flags result in engines with
properties as follows:

--dynamic:
- JIT targeting native code on Android and
  DBC on iOS

--interpreter
- Target DBC even if running on Android.

For example:

gn --android --dynamic --interpreter --runtime-mode release

Will generate an engine:
- Without Dart asserts
- Without Observatory
- With JIT compililation to DBC

into out/android_dynamic_release_dbc
2018-06-05 14:52:52 -07:00
Stanislav Baranov
5c89db5409 Remove unused argument. (flutter/engine#5471) 2018-06-05 13:11:18 -07:00
Chinmay Garde
23fd79d790 Parse --verbose-logging flag from intent and pass to the engine as args. (flutter/engine#5447) 2018-06-01 17:34:45 -07:00
Mehmet Fidanboylu
4d4a42b63c Fix lint errors to prepare for building Android files in Google (flutter/engine#5440) 2018-06-01 10:16:50 -07:00
Chinmay Garde
aa608f192b Create a shell with no GPU configurations unless explicitly specified by the platform. (flutter/engine#5383) 2018-05-25 14:31:01 -07:00
Simon Lightfoot
1987911c7d Add support for physical keyboards on Android (flutter/engine#5324)
* Fixes flutter/flutter#7943
* Fixes flutter/flutter#9347
* Fixes flutter/flutter#11177
2018-05-24 15:21:33 -07:00
Ryan Macnak
8e2bc7b70e Reapply "Don't link the core snapshot in the Android engine." (flutter/engine#5353)
Add back the core snapshot to runtime_unittests and embedder_unittests.
2018-05-23 17:09:51 -07:00
Ryan Macnak
49c1ba1007 Revert "Don't link the core snapshot in the Android engine. (#5348)" (flutter/engine#5352)
This reverts commit d40b0dbcd2c28fbd4eadc91943f3c2c9ee0d7df5.
2018-05-23 16:11:57 -07:00
Michael Goderbauer
3337784f29 Remove assert for unsupported SemanticsEvents (flutter/engine#5349)
Not all platforms are expected to handle all SemanticsEvents. Therefore, it is ok to just drop unsupported events on the floor.
2018-05-23 16:05:15 -07:00
Ryan Macnak
d40b0dbcd2 Don't link the core snapshot in the Android engine. (flutter/engine#5348)
Allows one to use a different core snapshot without a custom engine build by just packaging a different one in the APK.
2018-05-23 15:56:28 -07:00
Yegor
7df1242691 split children into two ordered lists: traversal and hit test (flutter/engine#5091)
* split `children` into two ordered lists: traversal and hit test

* address comments

* reduce node object byte size

* link to DebugSemanticsDumpOrder
2018-05-21 17:44:23 -07:00
Michael Goderbauer
52e89069cb Re-add ACTION_LONG_CLICK for Android a11y (flutter/engine#5330) 2018-05-21 11:29:50 -07:00
Chinmay Garde
1718f9b935 Break the FXL from flutter/assets. (flutter/engine#5316) 2018-05-18 17:04:36 -07:00
Michael Goderbauer
cfbbc59034 Only send a11y events if a11y is turned on (flutter/engine#5281) 2018-05-16 13:12:56 -07:00
Jason Simmons
4f15413841 Support a model where the application creates a FlutterNativeView that is never destroyed (flutter/engine#5256)
This allows applications to start a Flutter engine instance during app startup
and keep it running throughout the app process' lifetime.

FlutterActivity subclasses can override createFlutterNativeView to provide a
preinitialized FlutterNativeView instance and override retainFlutterNativeView
to signal that the FlutterNativeView should be kept alive when the activity
is destroyed.
2018-05-15 12:05:54 -07:00
Jason Simmons
6431f174d4 Detach from JNI before exiting the GPU thread. (flutter/engine#5231)
The GPU thread calls into Java via JNI in order to update external textures.

Fixes https://github.com/flutter/flutter/issues/17329
2018-05-11 11:42:19 -07:00
Jonah Williams
e36f92ec65 Re-land Enables system chrome customization on Android O/N and greater (flutter/engine#5171) 2018-05-07 15:45:59 -07:00
Jonah Williams
92e3517650 add onStart hook which places flutter in an inactive state (flutter/engine#5177) 2018-05-04 14:46:57 -07:00
Jonah Williams
c2349b2245 Revert "Enables system chrome customization on Android O and greater" (flutter/engine#5167)
* Revert "Roll dart sdk to e6d7d67f4b35556805dd083fed15bf3ed41f7e33. (#5165)"

This reverts commit 75b94b4ea5307c723c6003b9d7a786ac3f22bce1.

* Revert "Enables system chrome customization on Android M/O and greater (#5112)"

This reverts commit f4136be0d552a5b7f1f8bfafc3c5da4a70dda190.
2018-05-03 15:38:25 -07:00
Jonah Williams
f4136be0d5 Enables system chrome customization on Android M/O and greater (flutter/engine#5112) 2018-05-03 13:10:44 -07:00
Jonah Williams
8bac5d84be Add Android accessibility bridge support for "longPress" and "tap" semantic events 2018-05-02 17:24:29 -07:00
xster
fa659500dd Increase the GPU thread priority and add error logging (flutter/engine#5117) 2018-04-30 17:18:33 -07:00
Jason Simmons
d47e663efa Re-land "Hold a global reference to the AssetManager Java object backing the APKAssetProvider" (flutter/engine#5132)
Fixes https://github.com/flutter/flutter/issues/16222
2018-04-30 12:29:40 -07:00
Jason Simmons
8c9ef95bea Detach from JNI during shutdown of the UI thread on Android (flutter/engine#5120)
The APKAssetProvider will hold a reference to its Java peer
(see c2b081e229)

After dropping this reference, the UI thread must detach from JNI before exiting.
2018-04-30 10:44:01 -07:00
Yegor
2b58565cee Revert "Hold a global reference to the AssetManager Java object backing the APKAssetProvider (#5078)" (flutter/engine#5116)
This reverts commit c2b081e229eb3c1103d0d06f0c9d7057166ece1d.

It causes engine crashes in some Android Espresso tests.
2018-04-27 13:47:26 -07:00
Jonah Williams
08d8e86ff1 Add tooltip method to Android AccessibilityBridge (flutter/engine#5103) 2018-04-26 15:03:47 -07:00
Ryan Macnak
b8b7e8e829 [fuchsia] Changes for running Dart 2 on flutter_runner. (flutter/engine#5080)
- Remove assumption that we're in Dart 2 mode only if there's a platform kernel.
 - Load core snapshots from the package instead of linking them in.
2018-04-25 13:31:13 -07:00
Jason Simmons
c2b081e229 Hold a global reference to the AssetManager Java object backing the APKAssetProvider (flutter/engine#5078)
Fixes https://github.com/flutter/flutter/issues/16222
2018-04-24 15:50:52 -07:00
Yegor
82678dc356 replace nextNodeId/previousNodeId with hitTestPosition (flutter/engine#5066) 2018-04-23 16:16:17 -07:00
Jason Simmons
4a5f9d7c9f Fix syntax error in AccessibilityBridge (flutter/engine#5059) 2018-04-20 13:54:27 -07:00
Jason Simmons
1fab880e72 Prevent multiple calls to FlutterMain.startInitialization (flutter/engine#5058)
See https://github.com/flutter/flutter/issues/16748
and https://github.com/flutter/flutter/issues/16456
2018-04-20 11:38:10 -07:00
Michael Goderbauer
3034fd831c Add SemanticsFlag.isHidden (flutter/engine#5052) 2018-04-20 10:37:02 -07:00
Jason Simmons
a9d706ed38 Throw an error or return null if FlutterView.getBitmap fails (flutter/engine#5051)
getBitmap had been doing FXL_CHECK assertions to check memory allocation
failures and other errors.  getBitmap will now return null to the caller
instead.
(The VM may throw OutOfMemoryError or other exceptions if JNI APIs fail)

Fixes https://github.com/flutter/flutter/issues/16750
2018-04-19 16:12:22 -07:00
Jonah Williams
656482af41 AccessibilityBridge support for edge triggered semantics (iOS + Android) (flutter/engine#4901)
AccessibilityBridge support for edge triggered semantics (iOS + Android)
2018-04-19 11:14:47 -07:00
Mikkel Nygaard Ravn
c4aaa21eb3 Fix Android platform channels (flutter/engine#5025) 2018-04-17 16:02:10 +02:00
Jonah Williams
605fa93f5e Re-land "do not pause rendering when android view loses focus" (flutter/engine#5004)
* do not pause rendering when android view loses focus
2018-04-13 17:08:00 -07:00
Chinmay Garde
82c5c8feda Re-land "Support multiple shells in a single process. (#4932)" (flutter/engine#4998)
* Re-land "Support multiple shells in a single process. (#4932)"

This reverts commit a9dd1abd80f9c5148c74d606302171fa260365ca.
2018-04-13 13:48:15 -07:00
Jonah Williams
c91c703fb6 Revert "Do not pause rendering when android activity loses focus (#4848)" (flutter/engine#4985)
This reverts commit 03e3c8bc39eecfbc1900792e4b3ba415fef10d0e.
2018-04-12 11:20:24 -07:00
Jonah Williams
03e3c8bc39 Do not pause rendering when android activity loses focus (flutter/engine#4848)
* do not pause rendering when android view loses focus
2018-04-12 11:00:31 -07:00
Vyacheslav Egorov
a9dd1abd80 Revert "Re-land "Support multiple shells in a single process. (#4932)" (#4977)" (flutter/engine#4981)
This reverts commit e27940623b550f50fece0740ea3d6e9cb259fdae.
2018-04-12 18:28:55 +02:00
Chinmay Garde
e27940623b Re-land "Support multiple shells in a single process. (#4932)" (flutter/engine#4977)
This reverts commit a1befb4f3090141d738fc2b801e5454d96047121.
2018-04-11 15:41:23 -07:00
Chinmay Garde
a1befb4f30 Revert "Support multiple shells in a single process. (#4932)" (flutter/engine#4964)
This reverts commit 077d29581c35a08a076c5aeb5186855975756b55.
2018-04-10 15:28:43 -07:00
Chinmay Garde
077d29581c Support multiple shells in a single process. (flutter/engine#4932)
* Support multiple shells in a single process.

The Flutter Engine currently works by initializing a singleton shell
instance. This shell has to be created on the platform thread. The shell
is responsible for creating the 3 main threads used by Flutter (UI, IO,
GPU) as well as initializing the Dart VM. The shell, references to task
runners of the main threads as well as all snapshots used for VM
initialization are stored in singleton objects. The Flutter shell only
creates the threads, rasterizers, contexts, etc. to fully support a
single Flutter application. Current support for multiple Flutter
applications is achieved by making multiple applications share the same
resources (via the platform views mechanism).

This scheme has the following limitations:

* The shell is a singleton and there is no way to tear it down. Once you
  run a Flutter application in a process, all resources managed by it
  will remain referenced till process termination.
* The threads on which the shell performs its operations are all
  singletons. These threads are never torn down and multiple Flutter
  applications (if present) have to compete with one another on these
  threads.
* Resources referenced by the Dart VM are leaked because the VM isn't
  shutdown even when there are no more Flutter views.
* The shell as a target does not compile on Fuchsia. The Fuchsia content
  handler uses specific dependencies of the shell to rebuild all the
  shell dependencies on its own. This leads to differences in frame
  scheduling, VM setup, service protocol endpoint setup, tracing, etc..
  Fuchsia is very much a second class citizen in this world.
* Since threads and message loops are managed by the engine, the engine
  has to know about threading and platform message loop interop on each
  supported platform.

Specific updates in this patch:

* The shell is no longer a singleton and the embedder holds the unique
  reference to the shell.
* Shell setup and teardown is deterministic.
* Threads are no longer managed by the shell. Instead, the shell is
  given a task runner configuration by the embedder.
* Since the shell does not own its threads, the embedder can control
  threads and the message loops operating on these threads. The shell is
  only given references to the task runners that execute tasks on these
  threads.
* The shell only needs task runner references. These references can be
  to the same task runner. So, if the embedder thinks that a particular
  Flutter application would not need all the threads, it can pass
  references to the same task runner. This effectively makes Flutter
  application run in single threaded mode. There are some places in the
  shell that make synchronous calls, these sites have been updated to
  ensure that they don’t deadlock.
* The test runner and the headless Dart code runner are now Flutter
  applications that are effectively single threaded (since they don’t
  have rendering concerns of big-boy Flutter application).
* The embedder has to guarantee that the threads and outlive the shell.
  It is easy for the embedder to make that guarantee because shell
  termination is deterministic.
* The embedder can create as many shell as it wants. Typically it
  creates a shell per Flutter application with its own task runner
  configuration. Most embedders obtain these task runners from threads
  dedicated to the shell. But, it is entirely possible that the embedder
  can obtain these task runners from a thread pool.
* There can only be one Dart VM in the process. The numerous shell
  interact with one another to manage the VM lifecycle. Once the last
  shell goes away, the VM does as well and hence all resources
  associated with the VM are collected.
* The shell as a target can now compile and run on Fuchsia. The current
  content handler has been removed from the Flutter engine source tree
  and a new implementation has been written that uses the new shell
  target.
* Isolate management has been significantly overhauled. There are no
  owning references to Dart isolates within the shell. The VM owns the
  only strong reference to the Dart isolate. The isolate that has window
  bindings is now called the root isolate. Child isolates can now be
  created from the root isolate and their bindings and thread
  configurations are now inherited from the root isolate.
* Terminating the shell terminates its root isolates as well as all the
  isolates spawned by this isolate. This is necessary be shell shutdown
  is deterministic and the embedder is free to collect the threads on
  which the isolates execute their tasks (and listen for mircrotasks
  flushes on).
* Launching the root isolate is now significantly overhauled. The shell
  side (non-owning) reference to an isolate is now a little state
  machine and illegal state transitions should be impossible (barring
  construction issues). This is the only way to manage Dart isolates in
  the shell (the shell does not use the C API is dart_api.h anymore).
* Once an isolate is launched, it must be prepared (and hence move to
  the ready phase) by associating a snapshot with the same. This
  snapshot can either be a precompiled snapshot, kernel snapshot, script
  snapshot or source file. Depending on the kind of data specified as a
  snapshot as well as the capabilities of the VM running in the process,
  isolate preparation can fail preparation with the right message.
* Asset management has been significantly overhauled. All asset
  resolution goes through an abstract asset resolver interface. An asset
  manager implements this interface and manages one or more child asset
  resolvers. These asset resolvers typically resolve assets from
  directories, ZIP files (legacy FLX assets if provided), APK bundles,
  FDIO namespaces, etc…
* Each launch of the shell requires a separate and fully configured
  asset resolver. This is necessary because launching isolates for the
  engine may require resolving snapshots as assets from the asset
  resolver. Asset resolvers can be shared by multiple launch instances
  in multiple shells and need to be thread safe.
* References to the command line object have been removed from the
  shell. Instead, the shell only takes a settings object that may be
  configured from the command line. This makes it easy for embedders and
  platforms that don’t have a command line (Fuchsia) to configure the
  shell. Consequently, there is only one spot where the various switches
  are read from the command line (by the embedder and not the shell) to
  form the settings object.
* All platform now respect the log tag (this was done only by Android
  till now) and each shell instance have its own log tag. This makes
  logs from multiple Flutter application in the same process (mainly
  Fuchsia) more easily decipherable.
* The per shell IO task runner now has a new component that is
  unfortunately named the IOManager. This component manages the IO
  GrContext (used for asynchronous texture uploads) that cooperates with
  the GrContext on the GPU task runner associated with the shell. The
  IOManager is also responsible for flushing tasks that collect Skia
  objects that reference GPU resources during deterministic shell
  shutdown.
* The embedder now has to be careful to only enable Blink on a single
  instance of the shell. Launching the legacy text layout and rendering
  engine multiple times is will trip assertions. The entirety of this
  runtime has been separated out into a separate object and can be
  removed in one go when the migration to libtxt is complete.
* There is a new test target for the various C++ objects that the shell
  uses to interact with the Dart VM (the shell no longer use the C API
  in dart_api.h). This allows engine developers to test VM/Isolate
  initialization and teardown without having the setup a full shell
  instance.
* There is a new test target for the testing a single shell instances
  without having to configure and launch an entire VM and associated
  root isolate.
* Mac, Linux & Windows used to have different target that created the
  flutter_tester referenced by the tool. This has now been converted
  into a single target that compiles on all platforms.
* WeakPointers vended by the fml::WeakPtrFactory(notice the difference
  between the same class in the fxl namespace) add threading checks on
  each use. This is enabled by getting rid of the “re-origination”
  feature of the WeakPtrFactory in the fxl namespace. The side effect of
  this is that all non-thread safe components have to be created, used
  and destroyed on the same thread. Numerous thread safety issues were
  caught by this extra assertion and have now been fixed.
  * Glossary of components that are only safe on a specific thread (and
    have the fml variants of the WeakPtrFactory):
    * Platform Thread: Shell
    * UI Thread: Engine, RuntimeDelegate, DartIsolate, Animator
    * GPU Thread: Rasterizer, Surface
    * IO Thread: IOManager

This patch was reviewed in smaller chunks in the following pull
requests. All comments from the pulls requests has been incorporated
into this patch:

* flutter/assets: https://github.com/flutter/engine/pull/4829
* flutter/common: https://github.com/flutter/engine/pull/4830
* flutter/content_handler: https://github.com/flutter/engine/pull/4831
* flutter/flow: https://github.com/flutter/engine/pull/4832
* flutter/fml: https://github.com/flutter/engine/pull/4833
* flutter/lib/snapshot: https://github.com/flutter/engine/pull/4834
* flutter/lib/ui: https://github.com/flutter/engine/pull/4835
* flutter/runtime: https://github.com/flutter/engine/pull/4836
* flutter/shell: https://github.com/flutter/engine/pull/4837
* flutter/synchronization: https://github.com/flutter/engine/pull/4838
* flutter/testing: https://github.com/flutter/engine/pull/4839
2018-04-10 14:57:02 -07:00
Jason Simmons
92aab4ba64 Provide a texture registry to the compositor context used for screenshots (flutter/engine#4921)
Fixes https://github.com/flutter/flutter/issues/16143
2018-04-02 15:19:04 -07:00
Alan Russian
17f59f4dd6 Add CallSuper annotation to onCreate(). (flutter/engine#4789)
This provides improved code inspection, making it easier for developers to figure out what might be going wrong if they override this and don't call super, like I just did. :-)
2018-03-30 19:03:49 -07:00
Jason Simmons
b035c5b0f6 Allow FirstFrameListeners to remove themselves from the FlutterView's list (flutter/engine#4871)
Fixes https://github.com/flutter/flutter/issues/15884
2018-03-26 15:43:38 -07:00