592 Commits

Author SHA1 Message Date
Reid Baker
930edba64f Add back FlutterViewTest.java (flutter/engine#55048)
Add back FlutterViewTest.java from 8e096b4 (last commit before it was deleted in https://github.com/flutter/engine/pull/44047)

Fixes flutter/flutter/issues/154746
2024-09-11 15:02:56 +00:00
chunhtai
47bc9a3abb [Android] Drops semantics query when app is not attached (flutter/engine#52040)
Is seems automatic test may send a11y query before the engine is attached. Add a guard to guard against it.

[C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
2024-08-26 16:37:05 +00:00
Jonah Williams
95edf0d8db [android] workaround for HC bug. (flutter/engine#54408)
Testing

FYI @jason-simmons 

"Fixes" https://github.com/flutter/flutter/issues/152691
2024-08-08 00:06:58 +00:00
hangyu
5f18f2ebfd Set deep linking flag to true by default (flutter/engine#52350)
doc: flutter.dev/go/deep-link-flag-migration

Action item: make sure customers are aware of this change before merging
this PR.

## Pre-launch Checklist

- [ ] I read the [Contributor Guide] and followed the process outlined
there for submitting PRs.
- [ ] I read the [Tree Hygiene] wiki page, which explains my
responsibilities.
- [ ] I read and followed the [Flutter Style Guide] and the [C++,
Objective-C, Java style guides].
- [ ] I listed at least one issue that this PR fixes in the description
above.
- [ ] I added new tests to check the change I am making or feature I am
adding, or the PR is [test-exempt]. See [testing the engine] for
instructions on writing and running engine tests.
- [ ] I updated/added relevant documentation (doc comments with `///`).
- [ ] I signed the [CLA].
- [ ] All existing and new tests are passing.

If you need help, consider asking for advice on the #hackers-new channel
on [Discord].

<!-- Links -->
[Contributor Guide]:
https://github.com/flutter/flutter/wiki/Tree-hygiene#overview
[Tree Hygiene]: https://github.com/flutter/flutter/wiki/Tree-hygiene
[test-exempt]:
https://github.com/flutter/flutter/wiki/Tree-hygiene#tests
[Flutter Style Guide]:
https://github.com/flutter/flutter/wiki/Style-guide-for-Flutter-repo
[C++, Objective-C, Java style guides]:
https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
[testing the engine]:
https://github.com/flutter/flutter/wiki/Testing-the-engine
[CLA]: https://cla.developers.google.com/
[flutter/tests]: https://github.com/flutter/tests
[breaking change policy]:
https://github.com/flutter/flutter/wiki/Tree-hygiene#handling-breaking-changes
[Discord]: https://github.com/flutter/flutter/wiki/Chat
2024-08-01 12:58:12 -07:00
Bruno Leroux
555c2ff92a [Android] Revert "Reset IME state on clear text input client" (flutter/engine#54277)
## Description

This PR reverts two commits https://github.com/flutter/engine/pull/49829 and https://github.com/flutter/engine/pull/53662.

The main change was in https://github.com/flutter/engine/pull/49829. https://github.com/flutter/engine/pull/53662 was a follow-up to mitigate the impact of https://github.com/flutter/engine/pull/49829.

## Related Issue

Fixes https://github.com/flutter/flutter/issues/148530
Fixes https://github.com/flutter/flutter/issues/152620

Reopens https://github.com/flutter/flutter/issues/70546.
Reopens https://github.com/flutter/flutter/issues/51478
2024-08-01 19:50:07 +00:00
Chinmay Garde
2160284af8 [Impeller] Enable on-by-default on Android. (flutter/engine#54156)
Developers can control the backend in the following ways:

* **Do nothing**: Impeller with Vulkan is used where Vulkan is available with a fallback to Skia with OpenGL.
* **In `AndroidManifest.xml`, specify `io.flutter.embedding.android.EnableImpeller` as `false`**: Skia with OpenGL is used.
* **On the command line, specify `--no-enable-impeller`**: Skia with OpenGL is used.

Manifest options will take priority command line options when there is a conflict. This matches iOS behavior per https://github.com/flutter/flutter/issues/124049 (closed as WAI).

Fixes https://github.com/flutter/flutter/issues/149360
2024-07-29 03:35:27 +00:00
Greg Spencer
b5648f9fb0 Remove incorrect line (flutter/engine#54021)
## Description

Removes a line that shadows setting the device type correctly for keyboard events.

## Related Issues
 - Fixes https://github.com/flutter/flutter/issues/151308
2024-07-25 01:03:16 +00:00
Camille Simon
0619de0107 Upgrade Engine Android SDK to 35 (flutter/engine#53574)
**REVIEW BUT DO NOT MERGE:** Will merge after https://github.com/flutter/buildroot/pull/870 lands.

1: Updates engine to use Android 35. Part of https://github.com/flutter/flutter/issues/150215.
Engine step of https://github.com/flutter/flutter/blob/master/docs/platforms/android/Upgrading-Engine's-Android-API-version.md.

2: Updates test runner AGP version to 8.5, engine Gradle version to 8.9 to accommodate update.

3: Fixes lint and suppresses deprecation warnings caused by the update. None of the deprecations are unknown by the team (they are handled in the code), but the tests emitted warnings.

[C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
2024-07-24 16:54:38 +00:00
Bruno Leroux
42ec2e55c5 [Android] Call restartInput selectively on clear (flutter/engine#53662)
## Description

This PR restricts the call to `restartInput` which was added in https://github.com/flutter/engine/pull/49829.
The restart is called when input action is null, DONE, or NONE.

## Related Issue

Fixes https://github.com/flutter/flutter/issues/148673.

## Tests

Updates 1 test, adds 3 tests.
2024-07-18 20:27:33 +00:00
Gray Mackall
29a474fe3e More logs for Android unsatisfiedLinkError (flutter/engine#53920)
See https://github.com/flutter/flutter/issues/83596#issuecomment-2140605278, there are two cases:
1. IO issue
2. The directory doesn't exist

Narrow down by including in the logs if the directory exists or not.

[C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
2024-07-16 20:12:03 +00:00
Gray Mackall
8e2c560e10 Re-re-re-land "Upgrade all[most] androidx dependencies to latest" (flutter/engine#53592)
Re-re-re-land https://github.com/flutter/engine/pull/53001.

I recreated the postsubmit failures of the [roll](https://github.com/flutter/flutter/pull/150733) of the [last land](https://github.com/flutter/engine/pull/53532), and then verified on a local branch that those same postsubmits pass with this upgrade after the land of https://github.com/flutter/flutter/pull/150873. 

So I have pretty high confidence this won't cause any problems in the framework repo. I also tested on a previous land attempt that the `all_packages` app builds on this branch, so that is also a good sign for the packages repo.

[C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
2024-06-27 19:56:47 +00:00
Håkon Bertheussen
8311e5eca9 Fix AccessibilityFeatures.disableAnimations flag on Android 12+ (flutter/engine#53428)
This PR fixes the problem where Flutter would not respect the "remove animation" accessibility setting on Android 12+.

Please see this issue for details: https://github.com/flutter/flutter/issues/130976

As [mentioned](https://github.com/flutter/flutter/issues/130976#issuecomment-1931388665) by [horsemankukka](https://github.com/horsemankukka), the problem has to do with reading `Settings.Global.TRANSITION_ANIMATION_SCALE` as a string instead of a float. Flutter would compare it to the string "0" to determine if animations should be disabled. Presumably, this worked because the settings app did indeed use the string "0" or "1" for this setting. But as of Android 12 it's instead written using float representation ("0.0" or "1.0"), at least on Samsung devices. [The documentation](https://developer.android.com/reference/android/provider/Settings.Global#TRANSITION_ANIMATION_SCALE) also states that this setting should be read as a float, which is what this PR does.

[C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
2024-06-27 18:44:04 +00:00
auto-submit[bot]
c352f44015 Reverts "Re-re-land "Upgrade all[most] androidx dependencies to latest" (#53532)" (flutter/engine#53546)
Reverts: flutter/engine#53532
Initiated by: gmackall
Reason for reverting: This breaks apps that use plugins that use compileSdk 31, some of which we use in our postsubmit (so it blocks the tree).
Original PR Author: gmackall

Reviewed By: {reidbaker, matanlurey}

This change reverts the following previous change:
Re-re-land https://github.com/flutter/engine/pull/53001

(Reland attempt was at https://github.com/flutter/engine/pull/53462)

Unblocked by https://github.com/flutter/flutter/pull/150585, but will still need a manual roll because I will need to re-generate a bunch of lockfiles.

Also, https://github.com/flutter/flutter/blob/master/docs/engine/Testing-presubmit-Engine-PRs-with-the-Flutter-framework.md doesn't work (it's blocked on https://github.com/flutter/flutter/issues/149780) so I mostly just have to pray that no new issues occur in the roll. But I believe all issues that came up in the last attempt should be addressed by the above pr and by manual lockfile generation.

[C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
2024-06-25 01:20:29 +00:00
Gray Mackall
f9b2f290ba Re-re-land "Upgrade all[most] androidx dependencies to latest" (flutter/engine#53532)
Re-re-land https://github.com/flutter/engine/pull/53001

(Reland attempt was at https://github.com/flutter/engine/pull/53462)

Unblocked by https://github.com/flutter/flutter/pull/150585, but will still need a manual roll because I will need to re-generate a bunch of lockfiles.

Also, https://github.com/flutter/flutter/blob/master/docs/engine/Testing-presubmit-Engine-PRs-with-the-Flutter-framework.md doesn't work (it's blocked on https://github.com/flutter/flutter/issues/149780) so I mostly just have to pray that no new issues occur in the roll. But I believe all issues that came up in the last attempt should be addressed by the above pr and by manual lockfile generation.

[C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
2024-06-24 21:36:22 +00:00
Matan Lurey
233edc0b8f Add SurfaceProducer.Callback lifecycle hooks (flutter/engine#53280)
Work towards https://github.com/flutter/flutter/issues/148417.
2024-06-24 08:06:56 -07:00
auto-submit[bot]
feefb6ebd8 Reverts "Reland "Upgrade all[most] androidx dependencies to latest" (#53462)" (flutter/engine#53468)
Reverts: flutter/engine#53462
Initiated by: gmackall
Reason for reverting: blocking roll (see https://github.com/flutter/flutter/pull/150465#issuecomment-2177329885).
Original PR Author: gmackall

Reviewed By: {reidbaker}

This change reverts the following previous change:
Relands https://github.com/flutter/engine/pull/53001.

Also pulls in @matanlurey's dependency on `androidx.lifecycle:lifecycle-process`, and upgrades it to `2.7.0`.

It is unblocked by the changes in https://github.com/flutter/flutter/pull/149204.

Tested by building the engine, and then also by building the `flutter/packages` `all_packages` app on this branch, so that hopefully it will also roll smoothly into the packages repo.

[C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
2024-06-19 01:08:48 +00:00
Gray Mackall
4e98015b1e Reland "Upgrade all[most] androidx dependencies to latest" (flutter/engine#53462)
Relands https://github.com/flutter/engine/pull/53001.

Also pulls in @matanlurey's dependency on `androidx.lifecycle:lifecycle-process`, and upgrades it to `2.7.0`.

It is unblocked by the changes in https://github.com/flutter/flutter/pull/149204.

Tested by building the engine, and then also by building the `flutter/packages` `all_packages` app on this branch, so that hopefully it will also roll smoothly into the packages repo.

[C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
2024-06-18 21:14:07 +00:00
Matan Lurey
5300aafdb5 Add a FlutterEngineRule (JUnit TestRule) and use it in FlutterRendererTest (flutter/engine#53361)
In https://github.com/flutter/engine/pull/53280, I'm adding
lifecycle-aware methods to `SurfaceProducer`.

That means, in order to test that it WAI, we'll need to be running in a
simulated activity, and be able to switch scenario states (i.e. to
`RESUMED`). This was mentioned as well in
https://github.com/flutter/flutter/issues/133151 as being something we
want to do.

This PR adds a `FlutterEngineRule`, which allows the creation of a
"real" `FlutterEngine` and an `Intent` that can power
`AndroidScenarioRule<FlutterActivity>`. I felt bad doing all of this
work for a single `@Test`, so I also refactored the rest of the file and
cleaned things up a bit.

That said, I'm happy to revert or make changes if we liked how things
were setup before.
2024-06-13 16:22:54 -07:00
Reid Baker
02d2b7c8e1 Google java format relocation and formatting update (flutter/engine#53118)
Fixes https://github.com/flutter/flutter/issues/149319
Caused by https://github.com/flutter/engine/pull/52582

Follow up required to add a flag that fails on missing jar files instead of skipping missing jar files.
2024-05-31 18:09:23 +00:00
Gray Mackall
dab310ecb8 Manual revert of #53001 (flutter/engine#53075)
Revert label failed due to conflicts

`FlutterFragmentTest.java` was the only file that had merge issues, everything else is the output of `git revert 802e5d2cd3c9e73f336e3fe43487b64a5fdf98d8`

[C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
2024-05-28 23:00:20 +00:00
Justin McCandless
6dfec16435 FlutterFragment predictive back (flutter/engine#52302)
Android add-to-app apps now support predictive back when going between Activities or back to the home screen. Predictive back route transitions within the Flutter part of the app are not yet supported.
2024-05-28 12:52:05 -07:00
Gray Mackall
802e5d2cd3 Upgrade all[most] androidx dependencies to latest (flutter/engine#53001)
Upgrades every `androidx` dependency in the `src/third_party/android_embedding_dependencies` bundle to the latest version, except the `lifecycle` group*. Tested running a couple of apps as well because when updating these dependencies in the past I've been able to build the engine but then flutter run fail when trying to run an app.

Fixes https://github.com/flutter/flutter/issues/129307, also unblocks a feature that will eventually be needed for Scribe.

[*]`2.8.0` is the latest there, but I ran into an issue with dexing when I tried to upgrade, due to b/336164417, an AGP bug that had its fix backported to all >`8.0.0` versions, but we still support less than that so we will have to wait on that upgrade.

[C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
2024-05-28 16:58:59 +00:00
Gray Mackall
b6bb39ad2d Fix non-vd android platform view input event offsets (flutter/engine#52532)
Fixes https://github.com/flutter/flutter/issues/146570, which tracks a regression from https://github.com/flutter/engine/pull/49268 regarding platform view inputs in some specific cases.

This PR translates the input event location to be the same as the location we calculated before https://github.com/flutter/engine/pull/49268, returning to the previous behavior, while maintaining the input event's verified status (I checked this manually with the `InputManager`).

Tested manually with the reproduction in the linked issue.

[C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
2024-05-14 23:07:53 +00:00
Chinmay Garde
f3934883b0 Delete Settings::msaa_samples. (flutter/engine#52780)
Fixes https://github.com/flutter/flutter/issues/148257
2024-05-13 23:51:11 +00:00
John McCutchan
845c75ce6c Workaround HardwareRenderer breakage in Android 14 (flutter/engine#52370)
- Destroy ImageReaders on memory trim.
- Unset the VirtualDisplay's surface on memory trim.
- On resume, recreate ImageReaders.
- On resume, do a dumb little dance and then set the VirtualDisplay's surface

Fixes: https://github.com/flutter/flutter/issues/146499
Fixes: https://github.com/flutter/flutter/issues/144219

Internal bug: b/335646931
Android Fix: https://googleplex-android-review.git.corp.google.com/c/platform/frameworks/base/+/27015418

Android 15 will include the fix. Unclear if Android 14 will be patched.
2024-04-30 05:09:05 +00:00
auto-submit[bot]
c0bd2a3ce0 Reverts "Delete engine v1 android embedding (#51229)" (flutter/engine#51996)
Reverts: flutter/engine#51229
Initiated by: gmackall
Reason for reverting: blocking engine->framework roll (I missed some framework code referencing the v1 embedding).
Original PR Author: gmackall

Reviewed By: {matanlurey, reidbaker}

This change reverts the following previous change:
Fixes https://github.com/flutter/flutter/issues/143531

Also fixes a random typo I found

~TODO to test this~ (no more todo):
-~test the framework against this as well, probably with a dummy PR changing the engine commit to my branch if this is possible~ not possible, made a best effort removal of framework code in https://github.com/flutter/flutter/pull/144726.
-~figure out if the old embedding is used in g3 at all~ removed all uses
-~figure out exactly what the ShimPluginRegistry/ShimRegistrar are doing, and if fully deleting them was right~ (see https://github.com/flutter/engine/pull/51229#issuecomment-1981757743)

[C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
2024-04-09 19:13:47 +00:00
Gray Mackall
797e1ad902 Delete engine v1 android embedding (flutter/engine#51229)
Fixes https://github.com/flutter/flutter/issues/143531

Also fixes a random typo I found

TODO to test this:
-test the framework against this as well, probably with a dummy PR changing the engine commit to my branch if this is possible
-figure out if the old embedding is used in g3 at all
-~figure out exactly what the ShimPluginRegistry/ShimRegistrar are doing, and if fully deleting them was right~ (see https://github.com/flutter/engine/pull/51229#issuecomment-1981757743)

[C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
2024-04-09 18:03:17 +00:00
utzcoz
04f240de45 Bump Robolectric to 4.12.1 (flutter/engine#51800)
See https://github.com/robolectric/robolectric/releases/tag/robolectric-4.12 and https://github.com/robolectric/robolectric/releases/tag/robolectric-4.12.1 .

[C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
2024-04-04 20:07:53 +00:00
John McCutchan
e5289fdce1 Reland https://github.com/flutter/engine/pull/51391 (flutter/engine#51764) 2024-03-29 01:45:16 +00:00
maRci002
79c240e9b5 Platform channel for predictive back in route transitions on android (flutter/engine#49093)
Support for Android's predictive back feature on internal Flutter routes. Reports predictive back gestures to the framework (where supported by the system).
2024-03-27 16:45:47 -07:00
Zachary Anderson
dcd7089bab Revert "Disable cleaning up ImageReaders in memory pressure callback" (flutter/engine#51665)
Reverts flutter/engine#51391

Reason for revert: b/330184547 - I believe there is a good chance that the investigation on that issue was not really adequate to justify this revert, but this change can be easily relanded if reverting this was the wrong choice.
2024-03-25 23:00:00 +00:00
Rulong Chen(陈汝龙)
a697f6e769 [Android] Fix the issue of blank or frozen pages in shared engine scenarios (flutter/engine#50947)
Consider this scenario: In an add-to-app context, where multiple Flutter activities share the same engine, a situation occurs. When navigating from FlutterActivity1 to FlutterActivity2, the Flutter view associated with FlutterActivity1 is detached from the engine. Then, the Flutter view of FlutterActivity2 is attached. Upon navigating back to FlutterActivity1, its Flutter view is re-attached to the shared engine.

The expected behavior is: When a Flutter view detaches from the shared engine, the associated surface should be released. When the Flutter view re-attaches, a new surface should be created.

After #47358, no new surface is created when the Flutter view is attached again. This results in the Flutter view having no underlying surface, which causes the page to appear blank or freeze without responding.

[C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
2024-03-22 03:38:35 +00:00
John McCutchan
2520e4615c Disable cleaning up ImageReaders in memory pressure callback (flutter/engine#51391)
We originally added this cleanup code to work around a Samsung-specific
Android 14 bug where after resuming an application any ImageReaders are
busted. According to the Android team what Samsung is doing is a
violation of the "spec".

The fix ended up breaking VirtualDisplay platform views after a
suspend/resume because the surface we pass to the VirtualDisplay is no
longer valid after the resume and we have no way of fixing that.

This PR removes the Samsung-specific hacky fix, restoring the behaviour
of VirtualDisplay backed platform views.

We have an internal bug with Samsung to address the root cause.
2024-03-13 15:40:11 -07:00
utzcoz
30ce58dc55 Bump Robolectric to 4.11.1 (flutter/engine#51310)
Bump Robolectric to the latest stable 4.11.1.

[C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
2024-03-11 07:47:21 +00:00
Dan Field
a4c787e072 Use io.flutter.Build.API_LEVELS rather than android.os.Build.VERSION_CODES (flutter/engine#51171)
Updates the linting script to ban the use of `VERSION_CODES`.

We currently have a mish-mash of using the integers, using `VERSION_CODES`, and even how we import the version codes. This makes it more confusing when doing things like #51070 - I think it is clearer to see `22` than `LOLLIPOP_MR1`.

I'd like to get LGTM (or at least no opinion) from all the requested reviewers here.
2024-03-08 19:04:20 +00:00
Gray Mackall
879a9147d9 [Re-land] Remove WindowManager reflection in SingleViewPresentation.java (flutter/engine#50890)
relands https://github.com/flutter/engine/pull/49996

Context b/326363243

[C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
2024-03-04 23:49:38 +00:00
Dan Field
2e9e6107eb Reapply "Bump everything to Android 21" (#51056) (flutter/engine#51070)
This reverts commit 98485b3f82fec45a6a0ac932c3c20285a9a14e02.

Reverted in https://github.com/flutter/engine/pull/51056 because it
caused failures in the framework. No changes, but framework test has
been updated to use an actual robolectric implementation to avoid those
failures.

This should not land until
https://github.com/flutter/flutter/pull/144348 has landed in the
framework.

@gaaclarke @johnmccutchan fyi
2024-02-29 09:00:01 -08:00
Matan Lurey
bc4d5caa20 Test the SurfaceTextureSurfaceProducer-branch in the Android scenario_app (flutter/engine#51061)
This PR does the following:
- Relands https://github.com/flutter/engine/pull/50993.
- Fixes a bug in `SurfaceTextureSurfaceProducer` where it would crash on
release (now tested, yay!)

Closes https://github.com/flutter/flutter/issues/143539.
Closes https://github.com/flutter/flutter/issues/143483.

/cc @gaaclarke @chinmaygarde, this PR should (after landed) test/verify
https://github.com/flutter/engine/pull/50730.
2024-02-28 14:17:21 -08:00
Dan Field
98485b3f82 Revert "Bump everything to Android 21" (flutter/engine#51056)
Reverts flutter/engine#51032

Probably causing some of the failures in https://github.com/flutter/flutter/pull/144326

@johnmccutchan fyi
2024-02-28 19:15:04 +00:00
Dan Field
6efee79357 Bump everything to Android 21 (flutter/engine#51032)
Followed the linter, got rid of a bunch of version check/guards we don't need anymore.
2024-02-28 15:56:40 +00:00
Dan Field
7fd214252c Remove timeouts from CountdownLatch.await in tests (flutter/engine#50930)
See
https://github.com/flutter/flutter/wiki/Style-guide-for-Flutter-repo#never-check-if-a-port-is-available-before-using-it-never-add-timeouts-and-other-race-conditions

This may be contributing to flakiness in the Java/Scenario_app tests. We
should just timeout when CI says it's taken too long - on a slow machine
5 or 10 seconds may not be enough time.
2024-02-23 15:10:16 -08:00
auto-submit[bot]
ab20c1255c Reverts "Remove WindowManager reflection in SingleViewPresentation.java (#49996)" (flutter/engine#50873)
Reverts flutter/engine#49996

Initiated by: gmackall

Reason for reverting: b/326363243 

Original PR Author: gmackall

Reviewed By: {johnmccutchan, reidbaker}

This change reverts the following previous change:
Original Description:
Fixes https://github.com/flutter/flutter/issues/106449. Changes it to a static proxy, as the comment recommended. This does mean we will have to update it to override new methods as they are added to the interface when updating the version of the Android sdk we use.

[C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
2024-02-22 18:07:17 +00:00
Gray Mackall
a64eabf997 Remove WindowManager reflection in SingleViewPresentation.java (flutter/engine#49996)
Fixes https://github.com/flutter/flutter/issues/106449. Changes it to a static proxy, as the comment recommended. This does mean we will have to update it to override new methods as they are added to the interface when updating the version of the Android sdk we use.

[C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
2024-02-21 18:31:31 +00:00
John McCutchan
304382c276 Hook ImageReaderSurfaceProducer to the onTrimMemory listener interface (flutter/engine#50792)
- Close all ImageReaders and Images when we get an onTrimMemory
callback.
- Remove the first frame fix based around caching the last image
displayed because it isn't safe to do on some platforms. Leave a TODO to
revisit this.

We have seen some reports of platform views not working after an
application is backgrounded and then resumed. According to Android GPU
folks ImageReader/Image/HardwareBuffers should be valid after an
application has been resumed. However on Samsung we know that isn't the
case and there are (unconfirmed) reports of it also impacting Pixel
devices.

Should fix https://github.com/flutter/flutter/issues/142978 and
https://github.com/flutter/flutter/issues/139039

Also fixes https://github.com/flutter/flutter/issues/143720
2024-02-21 10:02:55 -08:00
Bart Cone
1b95fed6c0 [Android] Fix TextInputType.none for devices with physical keyboard (flutter/engine#49980)
## Description

This PR fixes an issue where keystrokes aren't received on Android
devices with physical keyboards (e.g. rugged Zebra devices) when
`keyboardType` is set to `TextInputType.none` on a `TextField`.

The logic in `setTextInputClient` and `canShowTextInput` created an
`inputTarget` with `InputTarget.Type.NO_TARGET` which caused the [input
connection to short
circuit](https://github.com/flutter/engine/blob/main/shell/platform/android/io/flutter/plugin/editing/TextInputPlugin.java#L296)
and not be established.

Bug introduction PR: https://github.com/flutter/engine/pull/26585

## Related Issue

https://github.com/flutter/flutter/issues/89983

## Unit Test Notes

- The existing `showTextInput_textInputTypeNone()` stays green after
update.
- `inputConnection_textInputTypeNone()` updated to `assertNotNull`. I
would make this more specific, but this is my first venture into the
Flutter engine and don't know enough about those connection attributes.

## Demo

Video below with Zebra MC9300 device. This issue can also be reproduced
in a standard android emulator. Simply add a `TextField`, configure
`keyboardType` to be `TextInputType.none` and attempt to enter text
after running and giving focus to textfield.

Before


https://github.com/flutter/engine/assets/1988098/348ca061-b8b9-4483-956e-0732c1238207

After


https://github.com/flutter/engine/assets/1988098/b65c7251-59b4-4c73-9b85-7ac03f47a7e4

## Pre-launch Checklist

- [x] I read the [Contributor Guide] and followed the process outlined
there for submitting PRs.
- [x] I read the [Tree Hygiene] wiki page, which explains my
responsibilities.
- [x] I read and followed the [Flutter Style Guide] and the [C++,
Objective-C, Java style guides].
- [x] I listed at least one issue that this PR fixes in the description
above.
- [ ] I added new tests to check the change I am making or feature I am
adding, or the PR is [test-exempt]. See [testing the engine] for
instructions on writing and running engine tests.
- [ ] I updated/added relevant documentation (doc comments with `///`).
- [x] I signed the [CLA].
- [x] All existing and new tests are passing.
2024-02-01 23:24:39 -08:00
杨加康
59947fce84 Revert "Close connection on keyboard close (#41500)" (flutter/engine#49366)
Related issue:

https://github.com/flutter/flutter/issues/140508
2024-01-30 19:20:25 +00:00
John McCutchan
028c80cee5 Re-Re-land Manually revert TLHC optimizations (flutter/engine#50155)
- ImageReaderSurfaceProducer no longer drops frames when the producer and the consumers are up to two frames out of sync.
- Have the native C++ side of the Android external textures check if a new frame has been pushed and that the texture needs to be updated. This avoids having to schedule a task on the raster thread for each updated texture.
- Notify the engine earlier that a frame is needed when updating a TLHC texture.
- Re-land fix: Don't close the last dequeued from image reader until the dequeued image is no longer used.
2024-01-30 00:51:10 +00:00
Matan Lurey
43f0f4e1ce Manually revert TLHC optimizations, holding on to width/height changes. (flutter/engine#50144)
Reverts https://github.com/flutter/engine/pull/50065 due to https://github.com/flutter/flutter/issues/142459.

[Discord](https://discord.com/channels/608014603317936148/608020293944082452/1201589744690270338):

> It looks like the failing tests are the resize tests for webview_flutter and google_maps_flutter
I can reproduce the failure locally for: https://github.com/flutter/packages/blob/main/packages/webview_flutter/webview_flutter_android/example/integration_test/webview_flutter_test.dart#L296

I manually merged this to keep https://github.com/flutter/engine/pull/50066.
2024-01-29 19:21:05 +00:00
Matan Lurey
036ccdbd2c Avoid sizing ImageReaderSurfaceProducer smaller than 1x1 (flutter/engine#50066)
Partial fix towards https://github.com/flutter/flutter/issues/142082.

This fixes OpenGLES + SurfaceProducer, but not Vulkan + SurfaceProducer (that requires VK-specific changes).
2024-01-26 00:56:58 +00:00
John McCutchan
b9c9338455 Reland Optimizations for TLHC frame rate and jank (flutter/engine#50065)
- ImageReaderSurfaceProducer no longer drops frames when the producer
and the consumers are up to two frames out of sync.
- Have the native C++ side of the Android external textures check if a
new frame has been pushed and that the texture needs to be updated. This
avoids having to schedule a task on the raster thread for each updated
texture.
- Notify the engine earlier that a frame is needed when updating a TLHC
texture.
- Reland fix: Call SurfaceTextureExternalTexture::ProcessFrame if
dl_image_ is null.
2024-01-25 16:01:54 -08:00