This repository was archived by the owner on Feb 25, 2025. It is now read-only.
Commit e292632
authored
[Android] Fix TextInputType.none for devices with physical keyboard (#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: #26585
## Related Issue
flutter/flutter#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.1 parent 0eb7b10 commit e292632
File tree
2 files changed
+19
-17
lines changed- shell/platform/android
- io/flutter/plugin/editing
- test/io/flutter/plugin/editing
2 files changed
+19
-17
lines changedLines changed: 4 additions & 13 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
376 | 376 | | |
377 | 377 | | |
378 | 378 | | |
379 | | - | |
380 | | - | |
381 | | - | |
382 | | - | |
383 | | - | |
384 | | - | |
385 | | - | |
386 | 379 | | |
387 | 380 | | |
388 | | - | |
| 381 | + | |
| 382 | + | |
| 383 | + | |
389 | 384 | | |
390 | 385 | | |
391 | 386 | | |
| |||
409 | 404 | | |
410 | 405 | | |
411 | 406 | | |
412 | | - | |
413 | | - | |
414 | | - | |
415 | | - | |
416 | | - | |
| 407 | + | |
417 | 408 | | |
418 | 409 | | |
419 | 410 | | |
| |||
Lines changed: 15 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
| 4 | + | |
4 | 5 | | |
5 | 6 | | |
6 | 7 | | |
| |||
1176 | 1177 | | |
1177 | 1178 | | |
1178 | 1179 | | |
1179 | | - | |
1180 | | - | |
| 1180 | + | |
| 1181 | + | |
1181 | 1182 | | |
1182 | 1183 | | |
1183 | 1184 | | |
| |||
1194 | 1195 | | |
1195 | 1196 | | |
1196 | 1197 | | |
1197 | | - | |
| 1198 | + | |
1198 | 1199 | | |
1199 | 1200 | | |
1200 | 1201 | | |
| |||
1232 | 1233 | | |
1233 | 1234 | | |
1234 | 1235 | | |
| 1236 | + | |
| 1237 | + | |
| 1238 | + | |
| 1239 | + | |
| 1240 | + | |
| 1241 | + | |
| 1242 | + | |
| 1243 | + | |
| 1244 | + | |
| 1245 | + | |
1235 | 1246 | | |
1236 | 1247 | | |
1237 | 1248 | | |
| |||
1310 | 1321 | | |
1311 | 1322 | | |
1312 | 1323 | | |
1313 | | - | |
| 1324 | + | |
1314 | 1325 | | |
1315 | 1326 | | |
1316 | 1327 | | |
| |||
0 commit comments