Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Samsung Keyboard duplicates text when restoring composing regions (restart text input, punctuation) #31512

Closed
markmoskalenko opened this issue Apr 23, 2019 · 139 comments · Fixed by flutter/engine#12780 or flutter/engine#16547
Assignees
Labels
a: text input Entering text in a text field or keyboard related problems customer: crowd Affects or could affect many people, though not necessarily a specific customer. e: device-specific Only manifests on certain devices engine flutter/engine repository. See also e: labels. f: material design flutter/packages/flutter/material repository. platform-android Android applications specifically

Comments

@markmoskalenko
Copy link

markmoskalenko commented Apr 23, 2019

Hello!

Within a flutter application that has TextField or TextFormField the text can get duplicated upon first time data entry.

When first entering a keypress, within a field that already has text pre-filled, the text duplicates then your keypress is attached.

I am experiencing something that exhibits this behavior on my Samsung Galaxy S7, S8 and S9 (only devices I have to test with). This doesn't occur within the emulator (Galaxy Nexus9 and Pixel 2).

If I place a space at the end of the field, this problem doesn't happen, however, if I tap in middle of a pre filled field (using controller or initialValue) and press a key it does occur.

class SampleTextFormPage extends StatefulWidget {
    @override
    State<StatefulWidget> createState() => new _SampleTextFormPage();
}

class _SampleTextFormPage extends State<SampleTextFormPage> {
    final _scaffoldKey = new GlobalKey<ScaffoldState>();

    TextEditingController _txtController;

    @override
    void initState() {
        super.initState();

        _txtController = TextEditingController(text:'Using Controller');
    }

    @override
    Widget build(BuildContext context) { Scaffold scaffold = new Scaffold(
        key: _scaffoldKey,
        appBar: new AppBar(
            title: new Text('Text Entry',
                style: const TextStyle(
                    color: Colors.white)
            ),
            backgroundColor: Colors.indigo
        ),
        body:  Column(children: [
            //field 1
            TextField(
                 autocorrect: false,
                 autofocus: true,
                 controller: _txtController,
            ),

           //field 2
           TextFormField(
               autocorrect: false,
               autofocus: true,
               initialValue: 'Using initialValue',
           )
        ])
    );

    return scaffold;
    }
}

https://stackoverflow.com/questions/52894507/flutter-texfield-and-textformfield-duplicates-text-when-using-initial-value-or-c

@markmoskalenko markmoskalenko changed the title Flutter TexField and TextFormField duplicates text when using initial value or controller to set initial text Flutter TexField and TextFormField duplicates text when using initial value or controller to set initial text. Samsung Apr 23, 2019
@markmoskalenko
Copy link
Author

Error on any application written flutter. Even on the base with one input field.
Playback error when entering Russian words / letters

@HansMuller HansMuller added f: material design flutter/packages/flutter/material repository. framework flutter/packages/flutter repository. See also f: labels. labels Apr 23, 2019
@justinmc
Copy link
Contributor

Thanks for submitting this. I'm unable to reproduce it on a physical Pixel 2 right now. I think I have an S7 that I can try this on tomorrow. I'll post back with what happens.

@markmoskalenko
Copy link
Author

Thanks for submitting this. I'm unable to reproduce it on a physical Pixel 2 right now. I think I have an S7 that I can try this on tomorrow. I'll post back with what happens.

I'm testing on galaxy s8 and s9
Reproduced only with Russian letters.
Scenario

  • Enter the word
  • Spacebar
  • Delete twice (one space and one letter will be removed)
  • Enter any letter in Russian

Total: duplicates the entire word + letter

@markmoskalenko
Copy link
Author

The error is reproduced in Google Ad. Installed with play market

@justinmc
Copy link
Contributor

Ok I've got an S6 and I just installed a Russian keyboard, but I don't see the bug using the code that you provided above.

Start your app and delete the existing text:

Type a word in Russian followed by one space:

Press backspace twice:

Type a letter, but I see no duplication:

@markmoskalenko
Copy link
Author

Take any phone of the galaxy s8 or s9 family.
Install an empty application with one input and try on a standard keyboard with Russian letters.

Tested on two top Samsung s8/s9.

https://www.youtube.com/watch?v=MVR8lW_tYww

@justinmc
Copy link
Contributor

justinmc commented May 1, 2019

Can you try this in a native app and confirm that you don't see this behavior?

@justinmc justinmc added the waiting for customer response The Flutter team cannot make further progress on this issue until the original reporter responds label May 1, 2019
@markmoskalenko
Copy link
Author

I use the standard firmware Samsung Galaxy S8 and Galaxy S9.
All applications that are installed on the phone work fine. Native App, react native, telegram, skype, google and so on.

We encountered this problem at the release stage of our flutter application

@no-response no-response bot removed the waiting for customer response The Flutter team cannot make further progress on this issue until the original reporter responds label May 2, 2019
@justinmc
Copy link
Contributor

justinmc commented May 2, 2019

Alright I see, thanks for clarifying. I tried again with the S6 but with the default keyboard in Russian and couldn't reproduce it still. I'll try to track down an S8 or S9.

@larssn
Copy link

larssn commented May 3, 2019

Russian keyboard not required.
Tested this on an Samsung T580.

Create an app with a TextField:

  • Enter a few letters.
  • Press the 'done' button on the keyboard to close it.
  • Click the field again and click a letter.

So if you enter 'La', close, open, and press '!'. The TextField will read "LaLa!".

This was tested on the dev (1.5.8) and stable (1.2.1) branch.

Note: It is not reproducible on an Samsung S8.
Related SO: https://stackoverflow.com/questions/52894507/flutter-texfield-and-textformfield-duplicates-text-when-using-initial-value-or-c

@justinmc
Copy link
Contributor

justinmc commented May 3, 2019

I found a Samsung T110 and couldn't reproduce it. Hope to try it on an S9 or T580 when I can.

@justinmc
Copy link
Contributor

The above issue also reported this same problem on: Samsung Galaxy Tablet 8 A (Android 8.1). A bunch of good reproduction instructions there too. It seems like this definitely has to do with Samsung's predictive text.

@markmoskalenko
Copy link
Author

The above issue also reported this same problem on: Samsung Galaxy Tablet 8 A (Android 8.1). A bunch of good reproduction instructions there too. It seems like this definitely has to do with Samsung's predictive text.

when to expect a solution to the problem?

@justinmc
Copy link
Contributor

This is on my list of things I'd like to fix, though I still haven't come across a device that can reproduce it...

If you or anyone else has some time to work on a PR to fix this in the meantime, please do!

@charlesokt
Copy link

More testing per #33255 showed another interesting behavior @justinmc
I typed in 'abc def' initially. With space in the middle.
Hit done.
Touched the input again, typed 'g'
Edit widget now shows 'abc defdefg'

Wondering if this was looking at the last word, I tried another test case.

Initial text

abc def ghi

Hit Done, touch widget to edit it
Input

j

Edit widget now shows: 'abc def ghighij'

@SaltH2OFish
Copy link

SaltH2OFish commented Jun 4, 2019

Flutter v1.5.4-hotfix.2,

Stock Keyboard
In agreement with @charlesokt. I tested this on Galaxy S9 and S9 Note. Turning off Samsung Keyboard predictive text does prevent the duplication from occurring.

Initial Text value / removing all text to smaller caret size
If you create a new textfield/textFormField with no initial text value set, the issue doesn't seem to manifest. However, when the initial values are set it will occur. If you have an initial value and press the delete key to 'completely' remove all text, you will notice the Caret size will go from a larger size to a smaller size. When it reaches the smaller size, the duplication issue will not occur even though you have set the initial text value.

Potential related issue
I ran across this discussion that seems pertinent to this bug. Notice the discussion on duplicated text, predictive text, etc.

#22828

@markmoskalenko
Copy link
Author

Help solve the problem! Our release is delayed because of this.

Here is a similar problem #19743
A year has passed ..

@justinmc
Copy link
Contributor

To add another affected device to the list, this issue was seen in #19743 on a Galaxy Grand Prime with Android 5.1.1.

@charlesokt
Copy link

charlesokt commented Jun 11, 2019

I can't make promises, but I compiled the flutter engine and will attempt to diagnose and/or fix this.

Below is more full logs of what I'm seeing with a debug build of the engine running my test scenario as detailed in #33255. I did a print statement for when the text edit controller receives the message that text has changed, so you'll see a "new text -> " log entry when the controller is called from my TextEdit. For this test, I did the following:

  1. touched the TextEdit
  2. hit 'a', done
  3. touched TextEdit again
  4. hit 'd'.
  5. TextEdit widget now shows 'aad'.

For sake of completeness, this issue seems to only affect Samsung devices and turning off Predictive Text on the device seems to avoid the issue.

The test here was done against SM-T380, Samsung Galaxy Note 8A, Android 8.1.1 using the current Beta 1.6.3.
Framework: bc7bc94
Engine: 8dc3a4c

Debug logs for anyone else so inclined and interested:

06-10 19:02:23.050 5555 5584 I flutter : new text -> a
06-10 19:02:23.051 1566 1566 V Surface : sf_framedrop debug : 0x4f4c, game : false, logging : 0
06-10 19:02:23.051 1566 1566 D ViewRootImpl@6844e5e[InputMethod]: Relayout returned: old=[0,542][800,1280] new=[0,542][800,1280] result=0x7 surface={valid=true 2333847552} changed=true
06-10 19:02:23.053 1566 4806 W Adreno-EGL: <qeglDrvAPI_eglGetConfigAttrib:612>: EGL_BAD_ATTRIBUTE
06-10 19:02:23.058 1566 4806 D vndksupport: Loading /vendor/lib/hw/gralloc.msm8937.so from current namespace instead of sphal namespace.
06-10 19:02:23.059 1566 4806 D OpenGLRenderer: eglCreateWindowSurface = 0xac813f48, 0x8b1bb008
06-10 19:02:23.062 1566 1566 I SKBD : azs getNavigationBarHeight() first use took : 1
06-10 19:02:23.071 1566 1566 V InputMethodManager: Not IME target window, ignoring
06-10 19:02:23.072 1566 1566 I chatty : uid=10126(com.sec.android.inputmethod) identical 3 lines
06-10 19:02:23.072 1566 1566 V InputMethodManager: Not IME target window, ignoring
06-10 19:02:23.073 1566 1566 I SKBD : ToolBarContainer [PF_OP][updateToolBarPage] 5126562
06-10 19:02:23.141 1566 1566 I SKBD : AbstractKeyboardView drawAllKey nanoTime= 55282031, isOrientationLandscape() = false
06-10 19:02:23.141 1566 1566 I SKBD_Performance: AbstractKeyboardView [PF_OP] onDraw 57409948
06-10 19:02:23.142 1566 1566 I SKBD_Performance: AbstractKeyboardView [PF_OP] onDraw 44687
06-10 19:02:23.150 1094 1121 D WindowManager: finishDrawingWindow: Window{d04c601 u0 InputMethod} mDrawState=DRAW_PENDING
06-10 19:02:23.155 1571 16310 D PipManager: onImeVisibilityChanged - imeVisible : true imeHeight:0
06-10 19:02:23.155 1571 16310 D PipManager: onMovementBoundsChanged
06-10 19:02:23.160 1566 1566 I SKBD : alf [PF_KL][SIIC] getSelectedText done 6
06-10 19:02:23.160 1566 1566 E SKBD : bbd [USICM][getSelectedText] updated, but null is returned
06-10 19:02:23.162 1566 1566 I SKBD : alf [PF_KL][SIIC] getTextBeforeCursor[ 127 ] done 2
06-10 19:02:23.165 1566 1566 I SKBD : alf [PF_KL][SIIC] getTextAfterCursor[ 127 ] done 2
06-10 19:02:23.166 1566 1566 I SKBD_Performance: [IIManager] [PF_KL] IIfo BuildTime - tookTime : 0
06-10 19:02:23.168 1571 1908 D PipManager: onImeVisibilityChanged - imeVisible : true imeHeight:494
06-10 19:02:23.168 1571 1908 D PipManager: onMovementBoundsChanged
06-10 19:02:23.169 5555 5555 D ViewRootImpl@e872005[MainActivity]: MSG_RESIZED: frame=Rect(0, 0 - 800, 1280) ci=Rect(0, 32 - 0, 494) vi=Rect(0, 32 - 0, 494) or=1
06-10 19:02:23.171 1566 1566 I SKBD : azw getNetworkState : 2
06-10 19:02:23.172 1566 1566 I SKBD_Performance: [IIManager] [PF_KL] IIfo BuildTime - tookTime : 0
06-10 19:02:23.181 1094 6754 V WindowManager: Relayout Window{59011d4 u0 com.keyotech.testflutter/com.keyotech.testflutter.MainActivity}: viewVisibility=0 req=800x1280 WM.LayoutParams{(0,0)(fillxfill) sim=110 ty=1 fl=#81810100 pfl=0x20000 fmt=-3 wanim=0x1030001 vsysui=0x700 needsMenuKey=2 colorMode=0 naviIconColor=0}
06-10 19:02:23.196 5555 5555 D ViewRootImpl@e872005[MainActivity]: Relayout returned: old=[0,0][800,1280] new=[0,0][800,1280] result=0x1 surface={valid=true 2382137344} changed=false
06-10 19:02:23.197 479 479 I SurfaceFlinger: Display 0 HWC layers:
06-10 19:02:23.197 479 479 I SurfaceFlinger: type | handle | flag | format | source crop (l,t,r,b) | frame | name
06-10 19:02:23.197 479 479 I SurfaceFlinger: ------------+--------------+------+-----------+----------------------------+---------------------+------
06-10 19:02:23.197 479 479 I SurfaceFlinger: Device | 0xa90a9100 | 0002 | RGBA_8888 | 0.0 0.0 800.0 1280.0 | 0 0 800 1280 | SurfaceView - com.keyotech.testflutt[...]utter.MainActivity@c5eb781@0[5555]#0
06-10 19:02:23.197 479 479 I SurfaceFlinger: Device | 0xa90a9400 | 0000 | RGBA_8888 | 0.0 0.0 800.0 32.0 | 0 0 800 32 | com.keyotech.testflutter/com.keyotech.testflutter.MainActivity[5555]#0
06-10 19:02:23.197 479 479 I SurfaceFlinger: Device | 0xa90a9080 | 0000 | RGBA_8888 | 0.0 0.0 800.0 631.0 | 0 649 800 1280 | InputMethod[1566]#0
06-10 19:02:23.197 479 479 I SurfaceFlinger: Device | 0xa90a9480 | 0000 | RGBA_8888 | 0.0 0.0 800.0 32.0 | 0 0 800 32 | StatusBar[1571]#0
06-10 19:02:23.197 479 479 I SurfaceFlinger:
06-10 19:02:23.260 1094 1651 E Watchdog: @sync 29140 [2019-06-10 19:02:23.260]
06-10 19:02:23.319 1094 1121 D CustomFrequencyManagerService: releaseDVFSLockLocked : Getting Lock type frm List : DVFS_MIN_LIMIT frequency : 1094400 uid : 1000 pid : 1094 tag : com.sec.android.inputmethod@35
06-10 19:02:23.797 1824 1824 D io_stats: !@ 179,0 r 554029 22731934 w 1087505 19387128 d 87448 30637640 f 326046 326037 iot 2055220 2348326 th 51200 0 0 pt 0 inp 0 0 874428.354
06-10 19:02:28.803 1824 1824 D io_stats: !@ 179,0 r 554029 22731934 w 1087515 19387260 d 87449 30637676 f 326047 326038 iot 2055220 2348340 th 51200 0 0 pt 0 inp 0 0 874433.360
06-10 19:02:29.163 683 30287 V APM_AudioPolicyManager: getAudioPolicyConfig: audioParam;outDevice
06-10 19:02:29.163 683 30287 V APM_AudioPolicyManager: getNewOutputDevice() selected device 0
06-10 19:02:29.163 683 30287 V APM_AudioPolicyManager: ### curdevice : 2
06-10 19:02:29.163 1094 4176 D SSRM:i : AudioType = 2, Vol = 0
06-10 19:02:29.271 1094 4176 D TelephonyManager: getAllCellInfo : Caller (PID / UID / TID): 1094 / 1000 / 4176
06-10 19:02:29.291 1094 4176 D SSRM:c : SIOP:: AP:327(331,0) BAT:322(322,0) CHG:0(0,0) ATC:0(0,0)
06-10 19:02:32.115 1094 1147 V MARsPolicyManager: updateFromMARsThread
06-10 19:02:32.116 1094 1148 D MARsDBManager: updatePkgsToSMDB : begin --size 1
06-10 19:02:32.132 1094 1148 D MARsDBManager: updatePkgsToSMDB : end
06-10 19:02:32.132 1094 1148 D MARsDBManager: onChange - mSmartManagerObserver! Uri = content://com.samsung.android.sm/AppFreezer?MARs-self=true&MARs=true
06-10 19:02:32.287 1094 1257 D SensorService: [SO] 0.002 0.145 10.047
06-10 19:02:33.808 1824 1824 D io_stats: !@ 179,0 r 554030 22731938 w 1087527 19387308 d 87449 30637676 f 326047 326038 iot 2055220 2348347 th 51200 0 0 pt 0 inp 0 0 874438.364
06-10 19:02:38.813 1824 1824 D io_stats: !@ 179,0 r 554030 22731938 w 1087531 19387336 d 87449 30637676 f 326048 326039 iot 2055220 2348353 th 51200 0 0 pt 0 inp 0 0 874443.369
06-10 19:02:39.302 683 30287 V APM_AudioPolicyManager: getAudioPolicyConfig: audioParam;outDevice
06-10 19:02:39.302 683 30287 V APM_AudioPolicyManager: getNewOutputDevice() selected device 0
06-10 19:02:39.302 683 30287 V APM_AudioPolicyManager: ### curdevice : 2
06-10 19:02:39.302 1094 4176 D SSRM:i : AudioType = 2, Vol = 0
06-10 19:02:39.324 1094 4176 D SSRM:c : SIOP:: AP:327(330,0) BAT:322(322,0) CHG:0(0,0) ATC:0(0,0)
06-10 19:02:39.577 1094 1378 D WifiTrafficPoller: TrafficStats TxPkts=145921 RxPkts=212115 TxBytes=49347685 RxBytes=191056925 , Foreground uid=10157 pkgName=com.keyotech.testflutter txBytes=90328121 rxBytes=1114885
06-10 19:02:39.799 1094 6592 D BatteryService: !@BatteryListener : batteryPropertiesChanged!
06-10 19:02:40.024 1094 1291 D InputReader: Input event(5): value=1 when=874444581494000
06-10 19:02:40.024 1094 1291 D InputReader: Input event(5): value=1 when=874444581494000
06-10 19:02:40.024 1094 1291 I InputReader: Touch event's action is 0x0 (deviceType=0) [pCnt=1, s=0.789 ] when=874444581494000
06-10 19:02:40.024 1094 1290 I InputDispatcher: Delivering touch to (1571): action: 0x4, toolType: 1
06-10 19:02:40.024 1094 1290 I InputDispatcher: Delivering touch to (1566): action: 0x0, toolType: 1
06-10 19:02:40.025 1566 1566 D ViewRootImpl@6844e5e[InputMethod]: ViewPostIme pointer 0
06-10 19:02:40.027 1094 1290 D PowerManagerService: [api] userActivityFromNative : 10 (event: 2 flags: 0) eventTime = 874444581
06-10 19:02:40.029 1566 1566 E SKBDC : SSLanguageModelManager buildContextualCLM()::Word Probability is zero
06-10 19:02:40.029 1566 1566 I SKBD : bnd [PF_KL][getKeyIndexAndNearbyCodes] 411822, In Tyme, getSimpleKeyIndexAndNearbyCodes
06-10 19:02:40.033 1566 1566 I SKBD_Performance: AbstractKeyboardView [PF_KL] onTouchEvent 0 5 4 4875312
06-10 19:02:40.034 1566 1566 I SKBD_Performance: AbstractKeyboardView [PF_OP] onDraw 36302
06-10 19:02:40.064 1094 1291 D InputReader: Input event(5): value=0 when=874444621591000
06-10 19:02:40.064 1094 1291 D InputReader: Input event(5): value=0 when=874444621591000
06-10 19:02:40.064 1094 1291 I InputReader: Touch event's action is 0x1 (deviceType=0) [pCnt=1, s=] when=874444621591000
06-10 19:02:40.064 1094 1290 I InputDispatcher: Delivering touch to (1566): action: 0x1, toolType: 1
06-10 19:02:40.065 1566 1566 D ViewRootImpl@6844e5e[InputMethod]: ViewPostIme pointer 1
06-10 19:02:40.071 1566 1566 I SKBD : alf [PF_KL][SIIC] getTextBeforeCursor[ 2 ] done 1
06-10 19:02:40.072 1566 1566 I SKBD : alf [PF_KL][SIIC] getTextBeforeCursor[ 127 ] done 1
06-10 19:02:40.073 1566 1566 I SKBD : alf [PF_KL][SIIC] getTextAfterCursor[ 127 ] done 1
06-10 19:02:40.074 1566 1566 I SKBD_Performance: [IIManager] [PF_KL] IIfo BuildTime - tookTime : 0
06-10 19:02:40.077 1566 1566 I SKBD : alf [PF_KL][SIIC] getExtractedText done 2
06-10 19:02:40.079 5555 5555 E SpannableStringBuilder: SPAN_EXCLUSIVE_EXCLUSIVE spans cannot have a zero length
06-10 19:02:40.079 5555 5555 E SpannableStringBuilder: SPAN_EXCLUSIVE_EXCLUSIVE spans cannot have a zero length
06-10 19:02:40.079 1566 1566 I SKBD : [IIManager] IIfo SI [il:0x656e4742] [p:1] [c:1] [t:1] [im:0/0/0/0/0/0] [sC:0] [aC:1] [sS:0] [aS:1] [aP:1] [pW:0] [eM:0] [uR:0] [acI:0] [iT:8001] [iO:2000006] [pID:5555] [pO:null]
06-10 19:02:40.079 1566 1566 I SKBD : [IIManager] IIfo II [ir:0] [rand:b8d870a07e094cc9a48dc5687ec7e6d8] [hC:0] [hI:0] [tr:0] [tc:1] [long:0] [cpl:2] [xyD:0/-2] [xycD:-14/-11] [kWHG:63/75/8] [tD:40] [tP:13] [fil:true] [IC:9/20] [cB:6/1]
06-10 19:02:40.080 1566 1566 I SKBD : alf [SIIC] setComposingText : true , 1
06-10 19:02:40.080 1566 1566 I SKBD : [ATIM] [PF_KL][onCharacterKey] 11
06-10 19:02:40.080 1566 1566 I SKBD : apf [PF_KL][onKeyHandleNormalKey::onCharacterKey] 11564479
06-10 19:02:40.080 1566 1566 I SKBD : ako [PF_KL][onKey] 12110468
06-10 19:02:40.081 1566 1566 I SKBD_Performance: AbstractKeyboardView [PF_KL] onTouchEvent 1 2 15 15242968
06-10 19:02:40.081 1566 1566 I SKBD_Performance: AbstractKeyboardView [PF_OP] onDraw 25365
06-10 19:02:40.099 1566 1566 I SKBD : [ATIM] [updateSelectionForInputModule] oldSelStart : 1, oldSelEnd : 1, newSelStart : 3, newSelEnd : 3, candidatesStart : 1, candidatesEnd : 3, viewClicked : false
06-10 19:02:40.099 1566 1566 I SKBD : [ATIM] [updateSelectionForInputModule] isTyping : true, viewClicked : false, isKBDShown : true
> 06-10 19:02:40.104 5555 5584 I flutter : new text -> aad
06-10 19:02:40.128 1566 1566 E SKBD : bbl Dismiss keyPreviewView is null

@GaryQian
Copy link
Contributor

GaryQian commented Jun 11, 2019

If you wanted to explore our android text input handling, you can take a look at shell/platform/android/io/flutter/plugin/editing/InputConnectionAdaptor.java and TextInputPlugin.java

I could imaging the Samsung predictive text is using the android's text API/callbacks strangely or in an unintended way, causing us to misinterpret predicted words or parts of predicted words as additional input. Nonetheless, we should still find a way to support Samsung keyboards without negatively impacting other platforms.

@GaryQian
Copy link
Contributor

GaryQian commented Feb 20, 2020

@exptk3 You are testing on stable channel, which does not have the fixes. Please try again on master channel (flutter channel master).

I have verified it is fixed on the following test devices I have: S7 S9 S10 Note9 (same generation as s8), as well as on various tablets including Galaxy Tab A 2017 and 2018. I also have access to a bunch of pre-s7 devices that I have not recently tried, but those devices are quite old now and many of them did not repro the issue originally.

@GaryQian
Copy link
Contributor

GaryQian commented Feb 20, 2020

I was able to reproduce the punctuation version of this bug on a J6+ that I dug up (SM J610G/DS). The hide keyboard version of this bug does not occur.

@exptk3
Copy link

exptk3 commented Feb 20, 2020

@exptk3 You are testing on stable channel, which does not have the fixes. Please try again on master channel (flutter channel master).

I have verified it is fixed on the following test devices I have: S7 S9 S10 Note9 (same generation as s8), as well as on various tablets including Galaxy Tab A 2017 and 2018. I also have access to a bunch of pre-s7 devices that I have not recently tried, but those devices are quite old now and many of them did not repro the issue originally.

Okay.
I just tested it on the master channel. By the way, the duplicate input problem still occurred and there was another problem added that was not present.
It took about 3~15 seconds or more(The time required is different each time) for the keyboard to come up and down to work.
After the keyboard went down and up, the duplicate input problem still occurred.
Even the keyboard that came up after the exit of the app is on the phone home screen.
The current situation is worse than before, so even users of other countries who do not use the Korean keyboard can cause problems.

*** Another Bug confirmed
In addition to the above, after applying the master channel's modifications, the enter to go to the next line was also disabled. This will break from the first use of the text field regardless of keyboard up & down and will not go to the next line.

My test device is the Galaxy S8 as mentioned in the article above.
Please check the above


  • This is my TextField (nothing special)
    TextField(
    maxLengthEnforced: true,
    maxLength: 500,
    decoration: InputDecoration(
    labelStyle: TextStyle(fontSize: 15),
    labelText: 'xxxxxx',
    hintStyle: TextStyle(
    fontSize: 13, color: Colors.grey[400]),
    hintText: 'xxxxxx',
    ),
    controller: _xxxxxController,
    keyboardType: TextInputType.multiline,
    maxLines: null,
    onChanged: (val) {xxx },
    )

  • Console message when keyboard up and down
  1. keyboard down
    D/ViewRootImpl@3eb9136MainActivity: MSG_RESIZED: frame=Rect(0, 0 - 1080, 2220) ci=Rect(0, 72 - 0, 144) vi=Rect(0, 72 - 0, 144) or=1
    D/ViewRootImpl@3eb9136MainActivity: Relayout returned: old=[0,0][1080,2220] new=[0,0][1080,2220] result=0x1 surface={valid=true 524530458624} changed=false

  2. keyboard up
    W/IInputConnectionWrapper(21669): getExtractedText on inactive InputConnection
    W/IInputConnectionWrapper(21669): getExtractedText on inactive InputConnection
    W/IInputConnectionWrapper(21669): getExtractedText on inactive InputConnection
    .....
    < ..... same message so many times .....>
    .....
    W/IInputConnectionWrapper(21669): getExtractedText on inactive InputConnection
    W/IInputConnectionWrapper(21669): getExtractedText on inactive InputConnection
    W/IInputConnectionWrapper(21669): getExtractedText on inactive InputConnection


See the console log above.
Thank you.

@exptk3
Copy link

exptk3 commented Feb 20, 2020

< Clean Project Test >

The above is the result of testing with my Real World app. I wanted to see if there was any difference in the initial flutter app that I created, so I created a new project and tested it again, but the result is the same as the real app. It was reproduced as it is.

  • In this case, reproduce the duplicate input problem : word input --> hide the keyboard and show keyboard-> type another word-> do not wait for the keyboard focus to disappear naturally, but press the space button(on device soft keyboard) immediately after the word to release the focus. If you do this, duplicate input is better reproduced.
    (this is important test tip)

  • The above test was run on a clean project created like below.

children: [
Text(
'You have pushed the button this many times:',
),
Text(
'$_counter',
style: Theme.of(context).textTheme.display1,
),
TextField(
maxLengthEnforced: true,
maxLength: 500,
decoration: InputDecoration(
labelStyle: TextStyle(fontSize: 15),
labelText: 'xxxxxx',
hintStyle: TextStyle(
fontSize: 13, color: Colors.grey[400]),
hintText: 'xxxxxx',
),
keyboardType: TextInputType.multiline,
maxLines: null,
onChanged: (val) { },
)
],


  • Console Log (keyboard up and down)
    W/IInputConnectionWrapper(14019): getExtractedText on inactive InputConnection
    W/IInputConnectionWrapper(14019): getExtractedText on inactive InputConnection
    ......
    ..... so many times
    .....
    W/IInputConnectionWrapper(14019): getExtractedText on inactive InputConnection
    W/IInputConnectionWrapper(14019): getExtractedText on inactive InputConnection
    D/ViewRootImpl@82a4301MainActivity: MSG_RESIZED: frame=Rect(0, 0 - 1080, 2220) ci=Rect(0, 72 - 0, 1071) vi=Rect(0, 72 - 0, 1071) or=1
    D/ViewRootImpl@82a4301MainActivity: Relayout returned: old=[0,0][1080,2220] new=[0,0][1080,2220] result=0x1 surface={valid=true 488086081536} changed=false
    D/ViewRootImpl@82a4301MainActivity: ViewPostIme pointer 0
    D/ViewRootImpl@82a4301MainActivity: ViewPostIme pointer 1
    D/InputMethodManager(14019): HSIFW - flag : 0 Pid : 14019
    D/ViewRootImpl@82a4301MainActivity: MSG_RESIZED: frame=Rect(0, 0 - 1080, 2220) ci=Rect(0, 72 - 0, 144) vi=Rect(0, 72 - 0, 144) or=1
    D/ViewRootImpl@82a4301MainActivity: Relayout returned: old=[0,0][1080,2220] new=[0,0][1080,2220] result=0x1 surface={valid=true 488086081536} changed=false

*** The problem is summarized below.
Problems occurring when the modified version of the master channel is applied :

  1. Time delay of the keyboard up and down
  2. abnormal display of the keyboard even after the app is closed (on device home screen)
  3. word duplication input
  4. input line can not be changed during keyboard input

I hope this helps you solve various problems.

@Endebert
Copy link

@GaryQian In case it helps: the Samsung Experience Service version of the device we tested with is 10.6.00.13.

The rest of the information you requested was already included in the flutter doctor I posted, but here it is again:

device: Galaxy Tab A (2019, 10.1)
model: SM-T510
Android version: Android 9 (API 28)

@bleroux
Copy link
Contributor

bleroux commented Feb 24, 2020

Same problem here on master and a Galaxy Tab A (SM-T510) device.

flutter doctor -v
[✓] Flutter (Channel master, v1.15.4-pre.140, on Linux, locale fr_FR.UTF-8)
    • Flutter version 1.15.4-pre.140 at /home/bruno/flutter/flutter
    • Framework revision 1d4667bb38 (il y a 5 heures), 2020-02-24 08:56:02 +0530
    • Engine revision f2f8c342be
    • Dart version 2.8.0 (build 2.8.0-dev.9.0 0f141be8bd)

[!] Android toolchain - develop for Android devices (Android SDK version 28.0.3)
    • Android SDK at /home/bruno/Android/Sdk
    • Android NDK location not configured (optional; useful for native profiling support)
    • Platform android-28, build-tools 28.0.3
    • Java binary at: /home/bruno/flutter/android-studio/jre/bin/java
    • Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1248-b01)
    ✗ Android license status unknown.
      Try re-installing or updating your Android SDK Manager.
      See https://developer.android.com/studio/#downloads or visit https://flutter.dev/setup/#android-setup for detailed
      instructions.

[✓] Linux toolchain - develop for Linux desktop
    • clang++ 7.0.0
    • GNU Make 4.2.1

[✓] Android Studio (version 3.3)
    • Android Studio at /home/bruno/flutter/android-studio
    • Flutter plugin version 34.0.1
    • Dart plugin version 182.5215
    • Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1248-b01)

[✓] VS Code (version 1.42.1)
    • VS Code at /usr/share/code
    • Flutter extension version 3.8.1

[✓] Connected device (2 available)
    • SM T510 • R52M40T1T7H • android-arm • Android 9 (API 28)
    • Linux   • Linux       • linux-x64   • Linux

@bleroux
Copy link
Contributor

bleroux commented Feb 24, 2020

For people looking for a quick workaround : replace Samsung Keyboard app by another Android Keyboard application ;-)

@GaryQian
Copy link
Contributor

@Endebert @bleroux Since we have two reports of the bug still on SM-T510, I have one ordered, arriving Wednesday.

@GaryQian
Copy link
Contributor

Can confirm that all versions of this bug still occur on SM-T510 (Galaxy Tab A 2019 10.1")

@GaryQian
Copy link
Contributor

Update: Interestingly, the devices that are still reproing some variant of this bug are each doing something strange differently.

For example, on SM-T510, the keyboard is sending a finishComposingText call immediately after the first character typed into the field. This is causing it experience the initial character duplication. None of the other samsung keyboards (or non-samsung keyboards) does this. The SMT510 keyboard also seems to completely ignore calls to updateSelection and updateCursorAnchorInfo, almost as if those methods were just not implemented in that version. It seems to totally dependent on its internal tracking of this information. I am able to send any gibberish data through those calls with zero impact on the the results. This makes my workarounds useless on this device.

The duplication is also inconsistent on the J6+.

@tedhenry100
Copy link

@GaryQian Wow this seems like a complex issue! I always imagined that someone at Google on such a high profile project such as Flutter would be able to contact the Android and Samsung teams directly to get help with something like this. Not the case?

@ghost
Copy link

ghost commented Mar 1, 2020

Is this even allowed ? Unimplememted core functions ?? I cant think that flutter is the only one affected by this , right ??
& can someone explain how the native android text field is working fine ?

@tedhenry100
Copy link

Why does flutter even use the native keyboard?! 😏

@GaryQian
Copy link
Contributor

GaryQian commented Mar 2, 2020

@tedhenry100 We have been in contact with Samsung, however, this is one of those things where even if they fixed it on their end, we would still have to fix it here as it is unlikely all the keyboards in the wild can be updated.

@GaryQian
Copy link
Contributor

GaryQian commented Mar 3, 2020

Since the original filing of this issue, the state of the bug has evolved. The severity has been greatly reduced for most devices, and new behaviors have been uncovered, evolving it towards a different set of issues. Since this can be difficult (and laggy) to follow in this thread of hundreds of comments, I will be moving further discussion to a new issue #51893 where we can focus on the current state of the issue.

Please continue to contribute/report/comment on #51893 and reference comments in this thread as appropriate. Thanks!

@GaryQian
Copy link
Contributor

GaryQian commented Apr 2, 2020

From the new thread:

I have landed flutter/engine#17426 which seems to fix many of the bugs on my test devices. It would be great if others could confirm that this also fixes bugs for them.

Please try the change on master channel!

@njovy
Copy link

njovy commented Apr 10, 2020

@GaryQian I've been testing this keyboard issue and I found a duplicate issue with the latest beta which flutter/engine#17391 is applied.
For some reason the letter '@' causes this duplicates in english as well.

@GaryQian
Copy link
Contributor

GaryQian commented Apr 10, 2020

Please do testing on master channel, I believe that bug has already been addressed in the other continuation thread via the getExtractedText() fix.

Beta channel is often times over a month old, and many flutter bugs are fixed/updated on a daily basis.

In particular, the getExtractedText() fix was only landed this week.

@njovy
Copy link

njovy commented Apr 10, 2020

@GaryQian I'm using the latest beta 1.17.dev.3.1. Is there any other updates regarding this other than flutter/engine#17391? I will let you know with the latest master commit.

@GaryQian
Copy link
Contributor

flutter/engine#17426 should resolve the duplication.

@njovy
Copy link

njovy commented Apr 10, 2020

@GaryQian I thought #17391 was the latest commit and you are right this issue doesn't appear with the latest master. Sorry for the confusion. I really appreciate your help and thank you very much for your hard work to fix this.

@lock
Copy link

lock bot commented Apr 25, 2020

This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of flutter doctor -v and a minimal reproduction of the issue.

@lock lock bot locked and limited conversation to collaborators Apr 25, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
a: text input Entering text in a text field or keyboard related problems customer: crowd Affects or could affect many people, though not necessarily a specific customer. e: device-specific Only manifests on certain devices engine flutter/engine repository. See also e: labels. f: material design flutter/packages/flutter/material repository. platform-android Android applications specifically
Projects
None yet