Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

[Android] Send connectionClosed message when keyboard becomes invisible to ensure framework focus state is correct. #40746

Merged
merged 8 commits into from
Apr 14, 2023

Conversation

ksballetba
Copy link
Contributor

Fix:

Before this patch:

before.fix.mp4

After this patch:

after.fix.mp4

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 Hixie said 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.

@flutter-dashboard
Copy link

It looks like this pull request may not have tests. Please make sure to add tests before merging. If you need an exemption to this rule, contact Hixie on the #hackers channel in Chat (don't just cc him here, he won't see it! He's on Discord!).

If you are not sure if you need tests, consider this rule of thumb: the purpose of a test is to make sure someone doesn't accidentally revert the fix. Ask yourself, is there anything in your PR that you feel it is important we not accidentally revert back to how it was before your fix?

Reviewers: Read the Tree Hygiene page and make sure this patch meets those guidelines before LGTMing.

@luckysmg luckysmg requested review from LongCatIsLooong and reidbaker and removed request for LongCatIsLooong March 29, 2023 05:51
@luckysmg luckysmg requested a review from jason-simmons March 29, 2023 05:52
Copy link
Contributor

@reidbaker reidbaker left a comment

Choose a reason for hiding this comment

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

This looks reasonable to me but I would like and LGTM from someone who understands this code better. Possibly @LongCatIsLooong

@ksballetba ksballetba changed the title [Android] Send unfocus message to framework to ensure focus state is correct. [Android] Send connectionClosed message when resignFirstResponder to ensure framework focus state is correct. Mar 30, 2023
@chinmaygarde
Copy link
Member

chinmaygarde commented Apr 6, 2023

Ping @LongCatIsLooong for +1.

@luckysmg luckysmg changed the title [Android] Send connectionClosed message when resignFirstResponder to ensure framework focus state is correct. [Android] Send connectionClosed message when keyboard becomes invisible to ensure framework focus state is correct. Apr 11, 2023
Copy link
Member

@chinmaygarde chinmaygarde left a comment

Choose a reason for hiding this comment

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

@LongCatIsLooong is going to be OOO for a couple of weeks. We eyeballed this in triage and it seemed fine.

@luckysmg
Copy link
Contributor

luckysmg commented Apr 14, 2023

Thx @chinmaygarde ^_^ .

Adding label for merging. ^_^

@luckysmg luckysmg added the autosubmit Merge PR when tree becomes green via auto submit App label Apr 14, 2023
@auto-submit auto-submit bot merged commit c9adff6 into flutter:main Apr 14, 2023
zhongwuzw pushed a commit to zhongwuzw/engine that referenced this pull request Apr 14, 2023
…le to ensure framework focus state is correct. (flutter#40746)

[Android] Send connectionClosed message when keyboard becomes invisible to ensure framework focus state is correct.
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Apr 14, 2023
…es invisible to ensure framework focus state is correct. (flutter/engine#40746)
CaseyHillers added a commit that referenced this pull request Apr 14, 2023
… invisible to ensure framework focus state is correct. (#40746)"

This reverts commit c9adff6.
auto-submit bot pushed a commit that referenced this pull request Apr 14, 2023
… invisible to ensure framework focus state is correct." (#41211)

Reverts #40746

Googler bug: b/278174021

Failing on

```
shell/platform/android/io/flutter/plugin/editing/TextInputPlugin.java:239: Error: This method should only be accessed from tests or within private scope [VisibleForTests]
      imeSyncCallback.remove();
```
@luckysmg
Copy link
Contributor

Emm any plan to reland this? I think this is necessary. What changes we should make to reland this?
@reidbaker Do you have any advice?

@luckysmg
Copy link
Contributor

@CaseyHillers @reidbaker I think the issue in revert PR is still exists on main channel.

See #41211 (comment)

And code in still have issue:

Maybe it is not on the PR #40746

I m not sure we should use @SuppressLint({"NewApi", "VisibleForTests"}) to solve it.

Just like:

@ksballetba
Copy link
Contributor Author

image

set otherwise to VisibleForTesting.PACKAGE_PRIVATE for VisibleForTesting annotation could solve this problem.

@luckysmg
Copy link
Contributor

Yes. See the same usage in FlutterEngine.java I think this is a good idea to solve.

image

@luckysmg luckysmg mentioned this pull request May 5, 2023
8 tasks
@MeandNi
Copy link
Contributor

MeandNi commented Nov 20, 2023

I think this PR is unnecessary. Is there a situation where I want to keep the focus when the keyboard disappears? For example, when I pop up a custom emoji picker, I will put away the keyboard. At this time, I want the focus to remain on above the input box.

As for the situation described above, we can choose focus state by observing whether the keyboard is visible.

cc\ @ksballetba @reidbaker

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
autosubmit Merge PR when tree becomes green via auto submit App customer: alibaba platform-android
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants