Skip to content

Mitigation for Samsung TextInput Hangs - #35967

Closed
NickGerleman wants to merge 1 commit into
react:mainfrom
NickGerleman:export-D42721684
Closed

Mitigation for Samsung TextInput Hangs#35967
NickGerleman wants to merge 1 commit into
react:mainfrom
NickGerleman:export-D42721684

Conversation

@NickGerleman

@NickGerlemanNickGerleman commented Jan 25, 2023

Copy link
Copy Markdown
Contributor

Summary

In #35936 we observed that the presence of AbsoluteSizeSpan may lead to hangs when using the Grammarly keyboard on Samsung.

This mitigation makes it so that we do not emit this span in any case where it is sufficient to rely on already set EditText textSize. In simple cases, tested on two devices, it causes typing into the TextInput to no longer hang.

This does not fully resolve the issue for TextInputs which meaningfully use layout-effecting spans (or at least font size), such as non-uniform text size within the input. We instead just try to reduce to minimum AbsoluteSizeSpan possible.

Testing the first commit was able to resolve hangs in some simpler inputs tested, by me and @cortinico.

Test Plan

For Paper and Fabric, debugged the flow through the algorithm over several examples, along with the effect on underlying TextInput spannable (observed indirectly by text updates).

image

image

image


Changelog:
[Android][Fixed] - Mitigation for Samsung TextInput Hangs

Reviewed By: cortinico

Differential Revision: D42721684

@facebook-github-botfacebook-github-bot added CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. p: Facebook Partner: Facebook Partner fb-exported labels Jan 25, 2023
@facebook-github-bot

Copy link
Copy Markdown
Contributor

This pull request was exported from Phabricator. Differential Revision: D42721684

@analysis-bot

analysis-bot commented Jan 25, 2023

Copy link
Copy Markdown
PlatformEngineArchSize (bytes)Diff
androidhermesarm64-v8a8,463,089+136
androidhermesarmeabi-v7a7,783,450+149
androidhermesx868,936,072+146
androidhermesx86_648,793,971+134
androidjscarm64-v8a9,648,917+23
androidjscarmeabi-v7a8,383,190+18
androidjscx869,710,886+26
androidjscx86_6410,187,735+15

Base commit: a8166bd
Branch: main

@NickGerlemanNickGerleman changed the title Partial Mitigation for Samsung TextInput HangsMitigation for Samsung TextInput HangsJan 26, 2023
@facebook-github-bot

Copy link
Copy Markdown
Contributor

This pull request was exported from Phabricator. Differential Revision: D42721684

@NickGerleman

Copy link
Copy Markdown
ContributorAuthor

FYI to anyone observing, I pushed a new version of this which should be better than the first.

@facebook-github-bot

Copy link
Copy Markdown
Contributor

This pull request was exported from Phabricator. Differential Revision: D42721684

Summary:
Pull Request resolved: react#35967
In react#35936 we observed that the presence of AbsoluteSizeSpan may lead to hangs when using the Grammarly keyboard on Samsung.
This mitigation makes it so that we do not emit this span in any case where it is sufficient to rely on already set EditText textSize. In simple cases, tested on two devices, it causes typing into the TextInput to no longer hang.
This does not fully resolve the issue for TextInputs which meaningfully use layout-effecting spans (or at least font size), such as non-uniform text size within the input. We instead just try to reduce to minimum AbsoluteSizeSpan possible.
Testing the first commit was able to resolve hangs in some simpler inputs tested, by me and cortinico.
Changelog:
[Android][Fixed] - Mitigation for Samsung TextInput Hangs
Reviewed By: cortinico
Differential Revision: D42721684
fbshipit-source-id: 000a8ceb0200abb19a2aa77cdb78276d289c3115
@facebook-github-bot

Copy link
Copy Markdown
Contributor

This pull request was exported from Phabricator. Differential Revision: D42721684

@facebook-github-bot

Copy link
Copy Markdown
Contributor

This pull request has been merged in be69c8b.

@rikur

rikur commented Jan 29, 2023

Copy link
Copy Markdown

Thank you for trying to fix the multiline ANRs on Samsung devices with Android 13. I built with this patch, however, and our app still hangs after a while of typing.

cipolleschi pushed a commit that referenced this pull request Jan 30, 2023
Summary:
Pull Request resolved: #35967
In #35936 we observed that the presence of AbsoluteSizeSpan may lead to hangs when using the Grammarly keyboard on Samsung.
This mitigation makes it so that we do not emit this span in any case where it is sufficient to rely on already set EditText textSize. In simple cases, tested on two devices, it causes typing into the TextInput to no longer hang.
This does not fully resolve the issue for TextInputs which meaningfully use layout-effecting spans (or at least font size), such as non-uniform text size within the input. We instead just try to reduce to minimum AbsoluteSizeSpan possible.
Testing the first commit was able to resolve hangs in some simpler inputs tested, by me and cortinico.
Changelog:
[Android][Fixed] - Mitigation for Samsung TextInput Hangs
Reviewed By: cortinico
Differential Revision: D42721684
fbshipit-source-id: e0388dfb4617f0217bc1d0b71752c733e10261dd
kelset pushed a commit that referenced this pull request Jan 30, 2023
Summary:
Pull Request resolved: #35967
In #35936 we observed that the presence of AbsoluteSizeSpan may lead to hangs when using the Grammarly keyboard on Samsung.
This mitigation makes it so that we do not emit this span in any case where it is sufficient to rely on already set EditText textSize. In simple cases, tested on two devices, it causes typing into the TextInput to no longer hang.
This does not fully resolve the issue for TextInputs which meaningfully use layout-effecting spans (or at least font size), such as non-uniform text size within the input. We instead just try to reduce to minimum AbsoluteSizeSpan possible.
Testing the first commit was able to resolve hangs in some simpler inputs tested, by me and cortinico.
Changelog:
[Android][Fixed] - Mitigation for Samsung TextInput Hangs
Reviewed By: cortinico
Differential Revision: D42721684
fbshipit-source-id: e0388dfb4617f0217bc1d0b71752c733e10261dd
dmytrorykun pushed a commit that referenced this pull request Jan 30, 2023
Summary:
Pull Request resolved: #35967
In #35936 we observed that the presence of AbsoluteSizeSpan may lead to hangs when using the Grammarly keyboard on Samsung.
This mitigation makes it so that we do not emit this span in any case where it is sufficient to rely on already set EditText textSize. In simple cases, tested on two devices, it causes typing into the TextInput to no longer hang.
This does not fully resolve the issue for TextInputs which meaningfully use layout-effecting spans (or at least font size), such as non-uniform text size within the input. We instead just try to reduce to minimum AbsoluteSizeSpan possible.
Testing the first commit was able to resolve hangs in some simpler inputs tested, by me and cortinico.
Changelog:
[Android][Fixed] - Mitigation for Samsung TextInput Hangs
Reviewed By: cortinico
Differential Revision: D42721684
fbshipit-source-id: e0388dfb4617f0217bc1d0b71752c733e10261dd
dmytrorykun pushed a commit that referenced this pull request Jan 30, 2023
Summary:
Pull Request resolved: #35967
In #35936 we observed that the presence of AbsoluteSizeSpan may lead to hangs when using the Grammarly keyboard on Samsung.
This mitigation makes it so that we do not emit this span in any case where it is sufficient to rely on already set EditText textSize. In simple cases, tested on two devices, it causes typing into the TextInput to no longer hang.
This does not fully resolve the issue for TextInputs which meaningfully use layout-effecting spans (or at least font size), such as non-uniform text size within the input. We instead just try to reduce to minimum AbsoluteSizeSpan possible.
Testing the first commit was able to resolve hangs in some simpler inputs tested, by me and cortinico.
Changelog:
[Android][Fixed] - Mitigation for Samsung TextInput Hangs
Reviewed By: cortinico
Differential Revision: D42721684
fbshipit-source-id: e0388dfb4617f0217bc1d0b71752c733e10261dd
diegolmello pushed a commit to RocketChat/react-native that referenced this pull request Feb 2, 2023
Summary:
Pull Request resolved: react#35967
In react#35936 we observed that the presence of AbsoluteSizeSpan may lead to hangs when using the Grammarly keyboard on Samsung.
This mitigation makes it so that we do not emit this span in any case where it is sufficient to rely on already set EditText textSize. In simple cases, tested on two devices, it causes typing into the TextInput to no longer hang.
This does not fully resolve the issue for TextInputs which meaningfully use layout-effecting spans (or at least font size), such as non-uniform text size within the input. We instead just try to reduce to minimum AbsoluteSizeSpan possible.
Testing the first commit was able to resolve hangs in some simpler inputs tested, by me and cortinico.
Changelog:
[Android][Fixed] - Mitigation for Samsung TextInput Hangs
Reviewed By: cortinico
Differential Revision: D42721684
fbshipit-source-id: e0388dfb4617f0217bc1d0b71752c733e10261dd
@cipolleschicipolleschi mentioned this pull request Oct 11, 2023
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

BugCLA SignedThis label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed.fb-exportedMergedThis PR has been merged.p: FacebookPartner: FacebookPartnerPlatform: AndroidAndroid applications.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants

@NickGerleman@facebook-github-bot@analysis-bot@rikur@react-native-bot