Skip to content

[Android] Add numeric-password variation to TextInputType (embedding) - #190207

Merged
auto-submit[bot] merged 4 commits into
flutter:masterfrom
AlexV525:numeric-password-embedding
Aug 5, 2026
Merged

auto-submit[bot] merged 4 commits into
flutter:masterfrom
AlexV525:numeric-password-embedding

Conversation

@AlexV525

Copy link
Copy Markdown
Member

Working towards #190204.

Adds isPassword to the Android embedding's TextInputChannel.InputType and OR's TYPE_NUMBER_VARIATION_PASSWORD into the NUMBER branch of TextInputPlugin.inputTypeFromTextInputType when set. Configuration.fromJson / InputType.fromJson parse the additive "password" JSON key. The framework Dart field is a companion change (not in this PR).

Pre-launch Checklist

@github-actions github-actions Bot added a: text input Entering text in a text field or keyboard related problems platform-android Android applications specifically engine flutter/engine related. See also e: labels. team-android Owned by Android platform team labels Jul 29, 2026

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@AlexV525
AlexV525 marked this pull request as ready for review July 29, 2026 11:29
@AlexV525
AlexV525 requested a review from a team as a code owner July 29, 2026 11:29
@AlexV525
AlexV525 requested review from jesswrd and removed request for a team July 29, 2026 11:29

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@Renzo-Olivares
Renzo-Olivares requested a review from camsim99 July 30, 2026 20:31
@AlexV525 AlexV525 changed the title [Android] Add numeric-password variation to TextInputType [Android] Add numeric-password variation to TextInputType (embedding)) Jul 31, 2026
@AlexV525 AlexV525 changed the title [Android] Add numeric-password variation to TextInputType (embedding)) [Android] Add numeric-password variation to TextInputType (embedding) Jul 31, 2026
camsim99
camsim99 previously approved these changes Aug 3, 2026

@camsim99 camsim99 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Changes all look reasonable.

@camsim99 camsim99 added the CICD Run CI/CD label Aug 3, 2026
@camsim99

camsim99 commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

Sorry just noticed the CICD label wasn't added. Just added so we can verify the tests pass!

@AlexV525

AlexV525 commented Aug 3, 2026

Copy link
Copy Markdown
Member Author

@camsim99 Could you help investigating the failing Google tests? 🤔

@camsim99 camsim99 added CICD Run CI/CD and removed CICD Run CI/CD labels Aug 4, 2026

@camsim99 camsim99 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approving again to get Google testing to run. Looks like it was stuck on an engine test flake!

@AlexV525

AlexV525 commented Aug 5, 2026

Copy link
Copy Markdown
Member Author

Looks like it was stuck on an engine test flake!

Still failing so far 👀

@jesswrd

jesswrd commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

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 🤞🏻.

@AlexV525 AlexV525 added the autosubmit Merge PR when tree becomes green via auto submit App label Aug 5, 2026
@auto-submit
auto-submit Bot added this pull request to the merge queue Aug 5, 2026
Merged via the queue into flutter:master with commit 12939d7 Aug 5, 2026
28 checks passed
@flutter-dashboard flutter-dashboard Bot removed the autosubmit Merge PR when tree becomes green via auto submit App label Aug 5, 2026
@AlexV525
AlexV525 deleted the numeric-password-embedding branch August 6, 2026 00:03
pull Bot pushed a commit to edisplay/flutter that referenced this pull request Aug 18, 2026
…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
pull Bot pushed a commit to Mu-L/flutter that referenced this pull request Aug 26, 2026
…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]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

a: text input Entering text in a text field or keyboard related problems CICD Run CI/CD engine flutter/engine related. See also e: labels. platform-android Android applications specifically team-android Owned by Android platform team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants