* Fix null safety error in inspector service extensions taking variable numbers of args.
Fixes https://github.com/flutter/flutter/issues/68627.
Also fix all inspector tests that do not rely on golden image functionality
so that they run with --enable-experiment=non-nullable. This verifies there
is test coverage to ensure there isn't a regression.
* Remove uses of dynamic.
- - When I added notification of key events before processing them as text, it made it so that shortcut key bindings like the spacebar would prevent spaces from being inserted into text fields, which is obviously not desirable (and so that change was reverted). At the same time, we do want to make it possible to override key events so that they can do things like intercept a tab key or arrow keys that change the focus.
This PR changes the behavior of the Shortcuts widget so that if it has a shortcut defined, but no action is bound to the intent, then instead of responding that the key is "handled", it responds as if nothing handled it. This allows the engine to continue to process the key as text entry.
This PR includes:
- Modification of the callback type for key handlers to return a KeyEventResult instead of a bool, so that we can return more information (i.e. the extra state of "stop propagation").
- Modification of the ActionDispatcher.invokeAction contract to require that Action.isEnabled return true before calling it. It will now assert if the action isn't enabled when invokeAction is called. This is to allow optimization of the number of calls to isEnabled, since the shortcuts widget now wants to know if the action was enabled before deciding to either handle the key or to return ignored.
- Modification to ShortcutManager.handleKeypress to return KeyEventResult.ignored for keys which don't have an enabled action associated with them.
- Adds an attribute to DoNothingAction that allows it to mark a key as not handled, even though it does have an action associated with it. This will allow disabling of a shortcut for a subtree.
Remove devicelab specific code for shutting down gradle daemon, add --android-gradle-daemon option to build/run/drive`. Avoids need for un-tested devicelab specific handler. There are also some feature requests for this, so 2 birds one stone.
Example:
flutter build apk --no-android-gradle-daemon will pass --no-daemon on to gradle
Remove devicelab specific code for shutting down gradle daemon, add --android-gradle-daemon option to build/run/drive`. Avoids need for un-tested devicelab specific handler. There are also some feature requests for this, so 2 birds one stone.
Example:
flutter build apk --no-android-gradle-daemon will pass --no-daemon on to gradle
This PR suggests improving the IntelliJ plugin "jar" detection logic.
Previously:
The IntelliJ Flutter plugin was contained flutter-intellij.jar.
Currently:
It is named flutter-intellij-X.Y.Z.jar and does not contain META-INF/plugin.xml.
META-INF/plugin.xml is included in flutter-idea-X.Y.Z.jar.
So this PR changes the rules for searching the plugin's jar file.
Concretely, it looks for the jar file containing META-INF/plugin.xml in the plugin's package directory and reads the package version from its META-INF/plugin.xml.
Co-authored-by: Jonah Williams <jonahwilliams@google.com>
We'd like to see how many of these flakes are transient and how many involve the device/machine getting temporarily wedged. Add a retry with no delay to see if it is possible to add sufficient error handling to startApp/installApp to handle this.
Both start and stop app create an application package, but only start app used the application binary. Create the application package once and pass it to both start and stop app.
Do not allow attach in release mode, as there is not VM Service to connect to. Observed in crash reporting as thrown string which is changed to exception below.
--use-application-binary allows running with an already built APK. This can be useful for speeding up CI test cases, or in our case eventually supporting some sort of build server. Demonstrate that this works by updating the old gallery test to use it. Fixes#56604
Co-authored-by: Jenn Magder <magder@google.com>
This class is entirely superseded by the application package factory. Only drive and install use it, and removing it from drive will allow use-application-binary support.
Android Studio 4.1 moved the location of the .home file on Windows which is used to located the install directory. This functionality is important because it is how we locate and discover the Android SDK functionality, as well as the appropriate JRE.
fixes#67986
All of the network requests from google cloud storage include an x-goog-hash header which contains an MD5 checksum. If present, use to validate that the downloaded binary is valid. This will rule out corrupt files as the cause of getting started crashers in the flutter_tool.
#38980
This does not fully resolve the above issue, because while we can check if the checksum matches what was expected from cloud storage, this A) may not necessarily be present and B) may not match up to what should be uploaded as part of the engine build process.
But when life gives you lemons you hash those lemons using an outdated hashing algorithm.
A change which sped up hot restart locally caused many of the devicelab measures to regress. I think this is because we do not measure when the isolate is actually "ready", so starting a reload or restart prematurely can cause time spent doing initialization to be registered as part of the reload operation.
A fix for this would be to have the framework include some sort of "initialization complete" event ... but it is not clear what the correct trigger would be. Perhaps after the first frame is successfully registered?
(9a3a0dc caused the benchmark regression - possibly since we spend less time syncing files now so we start the restart earlier)
Reland of #67669
The flutter tool has a number of crashes on stable where an ArgumentError is thrown due to the process manager not being able to resolve an executable.
So that we can adjust/modify this logic, fold it into flutter and add some additional logging.
caches the resolved executable per target directory, to avoid repeated look ups.
Instead of throwing an argument error, attempts to run the executable as given if an exact path can't be found
Accept files or symlinks for the executable path.
user where/which to resolve path instead of package:process logic.
On every hot reload, the flutter tool must file stat each asset in the bundle. With a large number of assets or a slow file system, this can take 20 - 30 ms. Do this operation while the flutter tool is waiting for a response from the frontend_server.
No tests updated since this is only a timing update. Any difference in behavior will be shown on benchmarks
The flutter tool has a number of crashes on stable where an ArgumentError is thrown due to the process manager not being able to resolve an executable. Fold the resolution logic into the tool and use where/which instead of the package:process specific logic.
Work towards #39925
Currently flutter run will uninstall and reinstall if the initial install fails and the APK was previously installed. Allow drive to share this same logic by moving it into installApp and out of startApp.
This should reduce the occurrence of the error in the devicelab.
This failure has been happening for a while but was covered by the overly broad catch. Removing that revealed that newer intellij versions have a different plugins file. The tool still can't find the file, but it won't crash now
Fixes#67918
For historical reasons, the flutter tool uploads dill files to paths based on the entrypoint URI. This isn't actually necessary, and the tool can use specific files : main.dart.incremental.dill for incremental dills, and main.dart.dill/main.dart.swap.dill for full dills. This allows hot restarting applications with an entrypoint outside of lib/ and simplifies the devFS code.
Fixes#63243
* Revert "Revert "Improve the behavior of Scrollable.ensureVisible when Scrollable nested (#65226)" (#66918)"
This reverts commit e8812c409b.
* Fix for page views
* comment
[flutter tools] Add a DelegatingLogger class
Move most of `DelegateLogger` `from test/src/testbed.dart` to
`lib/src/base/logger.dart` to better formalize the common practice of
chaining `Logger`s together. I renamed the class since it isn't
itself the delegate and to better match the `Delegating...` classes
from `package:collection`.
Additionally, add a freestanding `asLogger<T>` function to "cast" a
`Logger` into a matching delegate if possible. This will allow
`Logger` chains to be ordered a *bit* more freely (e.g.
`NotifyingLogger` and `AppRunLogger` will no longer required to be
at the end of the chain, an unwritten rule that has led to breakage in
google3). Chain order still matters since lack of virtual dispatch
means that parent `Logger`s can never invoke child methods, however.
I made `asLogger<T>` a freestanding function because I didn't want to
make it part of the `Logger` interface (and I thought that making it
an extension method might be weird).
Bonus cleanup:
There no longer appears to be a way to construct an `AppRunLogger`
with a null parent, so remove all of code paths for that case and
make the `parent` construction parameter required.
If the vm of an attached device rejects a hot reload, pretty print the reason. Suggest a hot restart so that users are aware that they do not have to detach and rebuild. Also resets the last compilation time, so a subsequent restart would still apply the last change. Adds an integration test for the const field removal.
Fixes#64027
The train command does nothing and was originally added to provide a no-output default for generating app-jit snapshots. The inject-plugins command is only for a repo-only analysis check, which is not necessary since we regenerate during pub get.
#29805
Move the intellij validator to its own file, and split off the tests. Remove globals from each, and remove dependency on a real jar/filesystem by creating a minimal version of the manifest xml and setting it up in the memory file system.
#47161
Do not upload all assets on initial devFS sync. This should increase the reliability of the initial connection, even in the face of flaky devfs behavior, in addition to a moderate perf improvement.
Updates fast-start to build assets as part of the initial bundle
Requires flutter/engine#21436
Requires flutter/engine#21586
Requires flutter/engine#21611
* adding tests that uses integration_test (e2e) package to flutter
* change the package name for the import
* fix licenses. fix README commands. add links
* adding dependency change auto generated by the tool
* more analyzer error fixes
This converts the packages/flutter/test/services directory to NNBD, now that the services package is converted.
I changed the signature of checkMessageHandler and checkMockMessageHandler on BinaryMessenger to take a nullable handler, since the tests wanted to check to make sure a handler wasn't set, and that functionality no longer works if the handler is non-nullable.
When setting the TextSelection in a TextEditingController, preserve the
composing range so long as the new selection is:
* a collapsed selection; in other words, a cursor rather than a
selection with an extent. A selection with an extent is not
permitted when composing.
* within the composing region. Moving the cursor outside the composing
region ends composing mode.
When using physical keyboards for input with an IME, users expect to be
able to navigate using the cursor within the composing region with the
arrow keys in order to edit text in the composing range.
As an example, a user might erroneously enter the composing text
にほんごにゅうろく in kana, then hit the left arrow, followed by
backspace in order to delete the ろ, then input りょ in order to
generate the correct composing text にほんごにゅうりょく, before then
hitting the conversion key to convert to the kanji text 日本語入力 and
commit.
There have been some more additional reports of a missing 'package:characters' import after upgrading flutter, as well as problems with detecting the correct language version. This has me concerned that our pub caching logic is incorrect. Instead of the tool attempting to guess when pub should be run, always delegate to pub.
* Add transformAlignment and clipBehavior to AnimatedContainer, make Container.transformAlignment an AlignmentGeometry.
* Add clipBehavior test
* Fix comment
* Clarify clipBehavior animation
Split from #66776
Even if pub does not change the packge_config contents, it will still update a timestamp in one of the fields. This causes unnecessary rebuilds. To fix this, generate an additional file when running pub get that only contains the relevant fields and then update the KernelSnapshot rule to depend on it only.
Ensures all of the libraries that the application side code import are migrated to null safety. full null safety migration is blocked by json rpc 2 and a breaking change to vm service client.
When the developer doesn't have permission to create symlinks, we
display specific instructions, but they were only correct for recent
versions of Windows 10. This improves them by:
- Giving the correct instructions for older versions.
- For recent versions, adds a command that will deep-link into the
settings application so that developers don't have to figure out
where/how to enable developer mode.
Fixes https://github.com/flutter/flutter/issues/66973
Remove globals from the flutter validator class, and refactor the tests into a separate file. Applies some other cleanup like adding doc comments, and making the doctor validator work like it is documented to work - removing the gen_snapshot check if the artifact is not downloaded instead of downloading all android artifacts.
#47161
* [flutter_tools] handle case where file is deleted by other program
* Add test cases
* Update file_system.dart
* Update file_system_test.dart
* fix import
* make a static on ErrorHandligFS
* add support for no exit on failure
* address comments
* update doc comment to file or directory
Make the logic for locating a local engine path part of its own class, add documentation, and update tests to cover engine source path locating too.
#47161
Cleans up some undocumented classes and re-organizes the AndroidDevices class to avoid the need for the static testing only member. Adds a script for tracking globals.
Removes usage of global variables, expands documentation, and fixes some formatting inconsistencies. Increased test coverage for android plugin to prove it can determine the embedding version.
Disables source map production by default for build web. For web builds performed as a part of flutter run --release, enable the source maps, or allow force enabling with --source-maps command line flag.
fixes#67328