Repository navigation
[Android] Add numeric-password variation to TextInputType (embedding) - #190207
Conversation
There was a problem hiding this comment.
Code Review
This pull request introduces support for numeric password fields in the Android text input channel. It updates TextInputChannel.InputType to parse and store an isPassword flag from JSON, and updates TextInputPlugin to apply the InputType.TYPE_NUMBER_VARIATION_PASSWORD flag to the Android EditorInfo. Comprehensive unit tests have been added to verify JSON parsing, backward compatibility, and correct mapping of IME input type flags. There are no review comments, and I have no additional feedback to provide.
There was a problem hiding this comment.
Code Review
This pull request introduces support for a numeric password input type variation on Android. It updates TextInputChannel to parse a password field from JSON, exposes isPassword on InputType, and maps it to InputType.TYPE_NUMBER_VARIATION_PASSWORD in TextInputPlugin. Comprehensive unit tests are added to verify the parsing and mapping behavior. The review feedback suggests removing the unused NoSuchFieldException from the throws declarations of the new test methods to keep the signatures clean.
camsim99
left a comment
There was a problem hiding this comment.
LGTM! Changes all look reasonable.
|
Sorry just noticed the CICD label wasn't added. Just added so we can verify the tests pass! |
|
@camsim99 Could you help investigating the failing Google tests? 🤔 |
camsim99
left a comment
There was a problem hiding this comment.
Approving again to get Google testing to run. Looks like it was stuck on an engine test flake!
Still failing so far 👀 |
just re-ran Google testing. The failures look unrelated. Hoping it passes this time 🤞🏻. |
…utter#190637) Working towards flutter#190204. Framework companion to the engine/embedding change in flutter#190207. ## Summary Adds a `password` parameter to `TextInputType.numberWithOptions`, symmetric to the existing `visiblePassword` text-class variation. ```dart const TextInputType.numberWithOptions({ this.signed = false, this.decimal = false, this.password = false, // NEW }); ``` On Android this maps to [`TYPE_NUMBER_VARIATION_PASSWORD`](https://developer.android.com/reference/android/text/InputType#TYPE_NUMBER_VARIATION_PASSWORD), which the embedding now parses via `json.optBoolean("password", false)` and ORs into the NUMBER branch of `TextInputPlugin.inputTypeFromTextInputType` (flutter#190207). It has no effect on iOS, web, or desktop. `password: true` declares the **platform** input classification only. It does not obscure the glyphs Flutter renders — that remains the responsibility of `obscureText`. ## Backward compatibility - Additive; default `false`; existing `TextInputType.number` and `numberWithOptions(...)` callers are byte-for-byte unchanged. - JSON is additive — older engines ignore the extra `password` key. - No change to `obscureText`, `AutofillHints`, or `enableIMEPersonalizedLearning` semantics. `toJson`, `operator ==`, `hashCode`, `toString`, and dartdoc are updated accordingly. ## Landing order Per Tree Hygiene the engine JSON parsing + Android mapping (flutter#190207, merged) lands first; this framework field follows once the engine revision is rolled into the framework. ## Pre-launch Checklist - [x] I read the [Contributor Guide] and followed the process outlined there for submitting PRs. - [x] I read the [AI contribution guidelines] and understand my responsibilities, or I am not using AI tools. - [x] I read the [Tree Hygiene] wiki page, which explains my responsibilities. - [x] I read and followed the [Flutter Style Guide], including [Features we expect every widget to implement]. - [x] I signed the [CLA]. - [x] I listed at least one issue that this PR fixes in the description above. - [x] I updated/added relevant documentation (doc comments with `///`). - [x] I added new tests to check the change I am making, or this PR is [test-exempt]. - [x] I followed the [breaking change policy] and added [Data Driven Fixes] where supported. - [x] All existing and new tests are passing. <!-- Links --> [Contributor Guide]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#overview [AI contribution guidelines]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#ai-contribution-guidelines [Tree Hygiene]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md [test-exempt]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#tests [Flutter Style Guide]: https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md [Features we expect every widget to implement]: https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md#features-we-expect-every-widget-to-implement [CLA]: https://cla.developers.google.com/ [flutter/tests]: https://github.com/flutter/tests [breaking change policy]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#handling-breaking-changes [Data Driven Fixes]: https://github.com/flutter/flutter/blob/main/docs/contributing/Data-driven-Fixes.md
…191244) Working towards flutter#190204. Follow-up to flutter#190207. ## Summary Removes the 3-arg convenience constructor `InputType(type, isSigned, isDecimal)` from `TextInputChannel.InputType`. Since flutter#190207 added `isPassword`, the canonical constructor is the 4-arg one; the 3-arg overload only remained for compatibility with existing test call sites, which are now migrated to the 4-arg form with `isPassword = false`. This matches `Configuration`, which keeps a single canonical constructor. No production callers remain — `InputType.fromJson` was already the only construction path in the embedding. ## Test Plan - Existing `TextInputPluginTest` / `TextInputChannelTest` pass unchanged in behavior (matrix tests already cover `isPassword` separately). - Verified locally that both changed files compile against the embedding classpath. Co-authored-by: Camille Simon <[email protected]>
Working towards #190204.
Adds
isPasswordto the Android embedding'sTextInputChannel.InputTypeand OR'sTYPE_NUMBER_VARIATION_PASSWORDinto the NUMBER branch ofTextInputPlugin.inputTypeFromTextInputTypewhen set.Configuration.fromJson/InputType.fromJsonparse the additive"password"JSON key. The framework Dart field is a companion change (not in this PR).Pre-launch Checklist
///).