Resolved Xiaomi Android 10 crashes when typing in an email address


MKliewe123

Members
Jun 27, 2020
3
3
Hello Xiaomi,

I hope I'm posting this bug correctly here. If I should report it somewhere else, please tell me.

We see a lot of crashes in our app if a user types in an email address. The app crashes when writing the "dot" after the "@" sign. Our app is "mail.de Mail" (de.mail.android.mailapp).

We only get reports from Xiaomi devices with Android 10, no other vendors have this bug/crash. It must be a Xiaomi-customized functionality in Android 10. In the stacktrace you can see that our app code is not involved.

In the top 5 devices that have crashes are 4 Xiaomi devices:
- Redmi Note 8 pro (Redmi Note 8 Pro)
- MI 9
- MI 8
- MI 9 SE

All of them have crashes in
android.widget.Editor$SelectionModifierCursorController.access$300 (Editor.java:6709)

See attached stracktrace from Firebase.

We told customers to report this to you, but I will do it here again, because I don't know if our customers reported it to you.

See attached stacktrace.

Edit: Many more people/projects have this problem:


Thanks
Michael
 

Attachments

  • stacktrace.txt
    4.7 KB · Views: 282
Last edited:
Looks like you are wrong here. This is not Xiaomi, but the forum of a custom ROM based on MIUI. You should report your issue directly to official Xiaomi forum.
 
Thanks for your answer, and sorry for posting here. I will go and search for the "official Xiomi forum", it seems to be a little hard to find. Searching for "xiaomi bug report" or "xiaomi bugtracker" lead to this forum :)
 
Who is we? The issue is already open on the official Mi Community...

I apologize for not introducing propperly!
"We" means my team and me. We are developing an Android App, having the same problem of having problems with the EditText view.
It happens exclusively on Xiaomi Redmi devices with Android 10.
I was hoping to find a solution here.


Code:
Fatal Exception: java.lang.NullPointerException
Attempt to invoke direct method 'void android.widget.Editor$SelectionModifierCursorController.initDrawables()' on a null object reference
android.widget.Editor$SelectionModifierCursorController.access$300 (Editor.java:6718)
android.widget.Editor.getEmailPopupWindow (Editor.java:1472)
android.widget.Editor.showEmailPopupWindow (Editor.java:1480)
android.widget.Editor.handleEmailPopup (Editor.java:1459)
android.widget.Editor.updateCursorPosition (Editor.java:2102)
android.widget.TextView.getUpdatedHighlightPath (TextView.java:7823)
android.widget.TextView.onDraw (TextView.java:8008)
android.view.View.draw (View.java:21594)
android.view.View.updateDisplayListIfDirty (View.java:20437)
android.view.View.draw (View.java:21312)
android.view.ViewGroup.drawChild (ViewGroup.java:4472)
android.view.ViewGroup.dispatchDraw (ViewGroup.java:4231)
android.view.View.draw (View.java:21601)
android.view.View.updateDisplayListIfDirty (View.java:20437)
android.view.View.draw (View.java:21312)
android.view.ViewGroup.drawChild (ViewGroup.java:4472)
android.view.ViewGroup.dispatchDraw (ViewGroup.java:4231)
android.view.View.updateDisplayListIfDirty (View.java:20428)
android.view.View.draw (View.java:21312)
android.view.ViewGroup.drawChild (ViewGroup.java:4472)
android.view.ViewGroup.dispatchDraw (ViewGroup.java:4231)
android.view.View.updateDisplayListIfDirty (View.java:20428)
android.view.View.draw (View.java:21312)
android.view.ViewGroup.drawChild (ViewGroup.java:4472)
android.view.ViewGroup.dispatchDraw (ViewGroup.java:4231)
android.view.View.updateDisplayListIfDirty (View.java:20428)
android.view.View.draw (View.java:21312)
android.view.ViewGroup.drawChild (ViewGroup.java:4472)
android.view.ViewGroup.dispatchDraw (ViewGroup.java:4231)
android.view.View.updateDisplayListIfDirty (View.java:20428)
android.view.View.draw (View.java:21312)
android.view.ViewGroup.drawChild (ViewGroup.java:4472)
android.view.ViewGroup.dispatchDraw (ViewGroup.java:4231)
android.view.View.draw (View.java:21601)
android.view.View.updateDisplayListIfDirty (View.java:20437)
android.view.View.draw (View.java:21312)
android.view.ViewGroup.drawChild (ViewGroup.java:4472)
android.view.ViewGroup.dispatchDraw (ViewGroup.java:4231)
android.view.View.updateDisplayListIfDirty (View.java:20428)
android.view.View.draw (View.java:21312)
android.view.ViewGroup.drawChild (ViewGroup.java:4472)
android.view.ViewGroup.dispatchDraw (ViewGroup.java:4231)
android.view.View.updateDisplayListIfDirty (View.java:20428)
android.view.View.draw (View.java:21312)
android.view.ViewGroup.drawChild (ViewGroup.java:4472)
android.view.ViewGroup.dispatchDraw (ViewGroup.java:4231)
android.view.View.updateDisplayListIfDirty (View.java:20428)
android.view.View.draw (View.java:21312)
android.view.ViewGroup.drawChild (ViewGroup.java:4472)
android.view.ViewGroup.dispatchDraw (ViewGroup.java:4231)
android.view.View.updateDisplayListIfDirty (View.java:20428)
android.view.View.draw (View.java:21312)
android.view.ViewGroup.drawChild (ViewGroup.java:4472)
android.view.ViewGroup.dispatchDraw (ViewGroup.java:4231)
android.view.View.updateDisplayListIfDirty (View.java:20428)
android.view.View.draw (View.java:21312)
android.view.ViewGroup.drawChild (ViewGroup.java:4472)
androidx.drawerlayout.widget.DrawerLayout.drawChild (DrawerLayout.java:1426)
android.view.ViewGroup.dispatchDraw (ViewGroup.java:4231)
android.view.View.updateDisplayListIfDirty (View.java:20428)
android.view.View.draw (View.java:21312)
android.view.ViewGroup.drawChild (ViewGroup.java:4472)
android.view.ViewGroup.dispatchDraw (ViewGroup.java:4231)
android.view.View.updateDisplayListIfDirty (View.java:20428)
android.view.View.draw (View.java:21312)
android.view.ViewGroup.drawChild (ViewGroup.java:4472)
android.view.ViewGroup.dispatchDraw (ViewGroup.java:4231)
android.view.View.updateDisplayListIfDirty (View.java:20428)
android.view.View.draw (View.java:21312)
android.view.ViewGroup.drawChild (ViewGroup.java:4472)
android.view.ViewGroup.dispatchDraw (ViewGroup.java:4231)
android.view.View.updateDisplayListIfDirty (View.java:20428)
android.view.View.draw (View.java:21312)
android.view.ViewGroup.drawChild (ViewGroup.java:4472)
android.view.ViewGroup.dispatchDraw (ViewGroup.java:4231)
android.view.View.updateDisplayListIfDirty (View.java:20428)
android.view.View.draw (View.java:21312)
android.view.ViewGroup.drawChild (ViewGroup.java:4472)
android.view.ViewGroup.dispatchDraw (ViewGroup.java:4231)
android.view.View.draw (View.java:21601)
com.android.internal.policy.DecorView.draw (DecorView.java:829)
android.view.View.updateDisplayListIfDirty (View.java:20437)
android.view.ThreadedRenderer.updateViewTreeDisplayList (ThreadedRenderer.java:575)
android.view.ThreadedRenderer.updateRootDisplayList (ThreadedRenderer.java:581)
android.view.ThreadedRenderer.draw (ThreadedRenderer.java:654)
android.view.ViewRootImpl.draw (ViewRootImpl.java:3863)
android.view.ViewRootImpl.performDraw (ViewRootImpl.java:3654)
android.view.ViewRootImpl.performTraversals (ViewRootImpl.java:2974)
android.view.ViewRootImpl.doTraversal (ViewRootImpl.java:1884)
android.view.ViewRootImpl$TraversalRunnable.run (ViewRootImpl.java:8055)
android.view.Choreographer$CallbackRecord.run (Choreographer.java:969)
android.view.Choreographer.doCallbacks (Choreographer.java:793)
android.view.Choreographer.doFrame (Choreographer.java:728)
android.view.Choreographer$FrameDisplayEventReceiver.run (Choreographer.java:954)
android.os.Handler.handleCallback (Handler.java:883)
android.os.Handler.dispatchMessage (Handler.java:100)
android.os.Looper.loop (Looper.java:224)
android.app.ActivityThread.main (ActivityThread.java:7519)
java.lang.reflect.Method.invoke (Method.java)
com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run (RuntimeInit.java:539)
com.android.internal.os.ZygoteInit.main (ZygoteInit.java:995)
 
I apologize for not introducing propperly!
"We" means my team and me. We are developing an Android App, having the same problem of having problems with the EditText view.
It happens exclusively on Xiaomi Redmi devices with Android 10.
I was hoping to find a solution here.


Code:
Fatal Exception: java.lang.NullPointerException
Attempt to invoke direct method 'void android.widget.Editor$SelectionModifierCursorController.initDrawables()' on a null object reference
android.widget.Editor$SelectionModifierCursorController.access$300 (Editor.java:6718)
android.widget.Editor.getEmailPopupWindow (Editor.java:1472)
android.widget.Editor.showEmailPopupWindow (Editor.java:1480)
android.widget.Editor.handleEmailPopup (Editor.java:1459)
android.widget.Editor.updateCursorPosition (Editor.java:2102)
android.widget.TextView.getUpdatedHighlightPath (TextView.java:7823)
android.widget.TextView.onDraw (TextView.java:8008)
android.view.View.draw (View.java:21594)
android.view.View.updateDisplayListIfDirty (View.java:20437)
android.view.View.draw (View.java:21312)
android.view.ViewGroup.drawChild (ViewGroup.java:4472)
android.view.ViewGroup.dispatchDraw (ViewGroup.java:4231)
android.view.View.draw (View.java:21601)
android.view.View.updateDisplayListIfDirty (View.java:20437)
android.view.View.draw (View.java:21312)
android.view.ViewGroup.drawChild (ViewGroup.java:4472)
android.view.ViewGroup.dispatchDraw (ViewGroup.java:4231)
android.view.View.updateDisplayListIfDirty (View.java:20428)
android.view.View.draw (View.java:21312)
android.view.ViewGroup.drawChild (ViewGroup.java:4472)
android.view.ViewGroup.dispatchDraw (ViewGroup.java:4231)
android.view.View.updateDisplayListIfDirty (View.java:20428)
android.view.View.draw (View.java:21312)
android.view.ViewGroup.drawChild (ViewGroup.java:4472)
android.view.ViewGroup.dispatchDraw (ViewGroup.java:4231)
android.view.View.updateDisplayListIfDirty (View.java:20428)
android.view.View.draw (View.java:21312)
android.view.ViewGroup.drawChild (ViewGroup.java:4472)
android.view.ViewGroup.dispatchDraw (ViewGroup.java:4231)
android.view.View.updateDisplayListIfDirty (View.java:20428)
android.view.View.draw (View.java:21312)
android.view.ViewGroup.drawChild (ViewGroup.java:4472)
android.view.ViewGroup.dispatchDraw (ViewGroup.java:4231)
android.view.View.draw (View.java:21601)
android.view.View.updateDisplayListIfDirty (View.java:20437)
android.view.View.draw (View.java:21312)
android.view.ViewGroup.drawChild (ViewGroup.java:4472)
android.view.ViewGroup.dispatchDraw (ViewGroup.java:4231)
android.view.View.updateDisplayListIfDirty (View.java:20428)
android.view.View.draw (View.java:21312)
android.view.ViewGroup.drawChild (ViewGroup.java:4472)
android.view.ViewGroup.dispatchDraw (ViewGroup.java:4231)
android.view.View.updateDisplayListIfDirty (View.java:20428)
android.view.View.draw (View.java:21312)
android.view.ViewGroup.drawChild (ViewGroup.java:4472)
android.view.ViewGroup.dispatchDraw (ViewGroup.java:4231)
android.view.View.updateDisplayListIfDirty (View.java:20428)
android.view.View.draw (View.java:21312)
android.view.ViewGroup.drawChild (ViewGroup.java:4472)
android.view.ViewGroup.dispatchDraw (ViewGroup.java:4231)
android.view.View.updateDisplayListIfDirty (View.java:20428)
android.view.View.draw (View.java:21312)
android.view.ViewGroup.drawChild (ViewGroup.java:4472)
android.view.ViewGroup.dispatchDraw (ViewGroup.java:4231)
android.view.View.updateDisplayListIfDirty (View.java:20428)
android.view.View.draw (View.java:21312)
android.view.ViewGroup.drawChild (ViewGroup.java:4472)
androidx.drawerlayout.widget.DrawerLayout.drawChild (DrawerLayout.java:1426)
android.view.ViewGroup.dispatchDraw (ViewGroup.java:4231)
android.view.View.updateDisplayListIfDirty (View.java:20428)
android.view.View.draw (View.java:21312)
android.view.ViewGroup.drawChild (ViewGroup.java:4472)
android.view.ViewGroup.dispatchDraw (ViewGroup.java:4231)
android.view.View.updateDisplayListIfDirty (View.java:20428)
android.view.View.draw (View.java:21312)
android.view.ViewGroup.drawChild (ViewGroup.java:4472)
android.view.ViewGroup.dispatchDraw (ViewGroup.java:4231)
android.view.View.updateDisplayListIfDirty (View.java:20428)
android.view.View.draw (View.java:21312)
android.view.ViewGroup.drawChild (ViewGroup.java:4472)
android.view.ViewGroup.dispatchDraw (ViewGroup.java:4231)
android.view.View.updateDisplayListIfDirty (View.java:20428)
android.view.View.draw (View.java:21312)
android.view.ViewGroup.drawChild (ViewGroup.java:4472)
android.view.ViewGroup.dispatchDraw (ViewGroup.java:4231)
android.view.View.updateDisplayListIfDirty (View.java:20428)
android.view.View.draw (View.java:21312)
android.view.ViewGroup.drawChild (ViewGroup.java:4472)
android.view.ViewGroup.dispatchDraw (ViewGroup.java:4231)
android.view.View.draw (View.java:21601)
com.android.internal.policy.DecorView.draw (DecorView.java:829)
android.view.View.updateDisplayListIfDirty (View.java:20437)
android.view.ThreadedRenderer.updateViewTreeDisplayList (ThreadedRenderer.java:575)
android.view.ThreadedRenderer.updateRootDisplayList (ThreadedRenderer.java:581)
android.view.ThreadedRenderer.draw (ThreadedRenderer.java:654)
android.view.ViewRootImpl.draw (ViewRootImpl.java:3863)
android.view.ViewRootImpl.performDraw (ViewRootImpl.java:3654)
android.view.ViewRootImpl.performTraversals (ViewRootImpl.java:2974)
android.view.ViewRootImpl.doTraversal (ViewRootImpl.java:1884)
android.view.ViewRootImpl$TraversalRunnable.run (ViewRootImpl.java:8055)
android.view.Choreographer$CallbackRecord.run (Choreographer.java:969)
android.view.Choreographer.doCallbacks (Choreographer.java:793)
android.view.Choreographer.doFrame (Choreographer.java:728)
android.view.Choreographer$FrameDisplayEventReceiver.run (Choreographer.java:954)
android.os.Handler.handleCallback (Handler.java:883)
android.os.Handler.dispatchMessage (Handler.java:100)
android.os.Looper.loop (Looper.java:224)
android.app.ActivityThread.main (ActivityThread.java:7519)
java.lang.reflect.Method.invoke (Method.java)
com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run (RuntimeInit.java:539)
com.android.internal.os.ZygoteInit.main (ZygoteInit.java:995)
Sadly that error message doesn't point anywhere in Email app, only system framework components, so it's not possible to track down the problem.
 
Sadly that error message doesn't point anywhere in Email app, only system framework components, so it's not possible to track down the problem.

Ah, sorry for hijacking this thread. I'm not working on that email app. This is a completely different project - but sharing the same issue.
If you want I can give you the code / XML definition for the EditText. However, there is not much magic hapening.
The way I understood the issue was that the system tries to make suggestions for emails but then fails with the given NPE.

The View itself is defined like this

Code:
  <com.google.android.material.textfield.TextInputEditText
            android:id="@+id/inputEditText"
            android:layout_width="0dp"
            android:layout_height="match_parent"
            android:layout_marginStart="11dp"
            android:layout_marginLeft="11dp"
            android:layout_marginTop="4dp"
            android:layout_marginEnd="4dp"
            android:layout_marginRight="4dp"
            android:layout_marginBottom="4dp"
            android:layout_weight="1"
            android:background="@android:color/transparent"
            android:clickable="true"
            android:focusable="true"
            android:focusableInTouchMode="true"
            android:gravity="center_vertical"
            android:imeOptions="actionDone"
            android:inputType="text"
            android:lines="1"
            android:maxLines="1"
            android:minLines="1"
            android:textColor="@color/text"
            android:textSize="@dimen/textsize_user_choice"
            app:layout_constraintBaseline_toBaselineOf="@+id/unitTV"
            app:layout_constraintBottom_toBottomOf="@+id/unitTV"
            app:layout_constraintEnd_toStartOf="@+id/unitTV"
            app:layout_constraintStart_toStartOf="parent"
            app:layout_constraintTop_toTopOf="@+id/unitTV"
            tools:text="some input \nText" />

and gets defined further in code:

Code:
 inputEditText.inputType = InputType.TYPE_TEXT_VARIATION_EMAIL_ADDRESS

I also tried using

Code:
 inputEditText.inputType = InputType.TYPE_CLASS_TEXT

but I still get crashes.

Does this help any further?

Best regards,

Tobias
 
Ah, sorry for hijacking this thread. I'm not working on that email app. This is a completely different project - but sharing the same issue.
If you want I can give you the code / XML definition for the EditText. However, there is not much magic hapening.
The way I understood the issue was that the system tries to make suggestions for emails but then fails with the given NPE.

The View itself is defined like this

Code:
  <com.google.android.material.textfield.TextInputEditText
            android:id="@+id/inputEditText"
            android:layout_width="0dp"
            android:layout_height="match_parent"
            android:layout_marginStart="11dp"
            android:layout_marginLeft="11dp"
            android:layout_marginTop="4dp"
            android:layout_marginEnd="4dp"
            android:layout_marginRight="4dp"
            android:layout_marginBottom="4dp"
            android:layout_weight="1"
            android:background="@android:color/transparent"
            android:clickable="true"
            android:focusable="true"
            android:focusableInTouchMode="true"
            android:gravity="center_vertical"
            android:imeOptions="actionDone"
            android:inputType="text"
            android:lines="1"
            android:maxLines="1"
            android:minLines="1"
            android:textColor="@color/text"
            android:textSize="@dimen/textsize_user_choice"
            app:layout_constraintBaseline_toBaselineOf="@+id/unitTV"
            app:layout_constraintBottom_toBottomOf="@+id/unitTV"
            app:layout_constraintEnd_toStartOf="@+id/unitTV"
            app:layout_constraintStart_toStartOf="parent"
            app:layout_constraintTop_toTopOf="@+id/unitTV"
            tools:text="some input \nText" />

and gets defined further in code:

Code:
 inputEditText.inputType = InputType.TYPE_TEXT_VARIATION_EMAIL_ADDRESS

I also tried using

Code:
 inputEditText.inputType = InputType.TYPE_CLASS_TEXT

but I still get crashes.

Does this help any further?

Best regards,

Tobias
Not enough clues. The error still points deep in the framework, doesn't even mention what in the Email app started the call.
 
Hmm, I see this seems to be tricky. What else can I show?
I have no exact idea what called this but expect the user to click on it and entering the email.
 
Well, as I said, I was hijacking the thread. So it is not "The Email app" but specifically this one:
https://play.google.com/store/apps/details?id=com.newsenselab.android.msense

The error comes directly when starting the app. It will ask you whether you are a user having already an account. When entering the email address it crashes directly.
Looks like that email input field is not selectable. Why?
When I write some text in it, then tap it and then "Select all", the cursor just goes to the beginning of the input field...
While I agree that EmailAddPopupWindow is Xiaomi's proprietary implementation, your input field doesn't seem to behave normally...
 
You are right, this is because the view got that parameter, too. Sorry, I forgot to mention:

Code:
inputEditText.movementMethod = ScrollingMovementMethod()

Do you think this is related?
 
You are right, this is because the view got that parameter, too. Sorry, I forgot to mention:

Code:
inputEditText.movementMethod = ScrollingMovementMethod()

Do you think this is related?
Most definitely.
ScrollingMovementMethod extends BaseMovementMethod, which defines canSelectArbitrarily() to return false (and then the TextView's textCanBeSelected returns false as well), in which case the SelectionModifierCursorController will not be created. I patched a system method to avoid this crash, although without a MovementMethod that has canSelectArbitrarily() return true (either ArrowKeyMovementMethod or LinkMovementMethod), there won't be any email popup window, if that even bothers you.
With the patch, it at least avoids a crash, but being able to select the text in this field is a better way to solve it, even from user experience perspective, or if you wish to fix this issue on official MIUI ROMs as well, since we have no control over that.
30899
 
  • Like
Reactions: AndroidDev
Most definitely.
ScrollingMovementMethod extends BaseMovementMethod, which defines canSelectArbitrarily() to return false (and then the TextView's textCanBeSelected returns false as well), in which case the SelectionModifierCursorController will not be created. I patched a system method to avoid this crash, although without a MovementMethod that has canSelectArbitrarily() return true (either ArrowKeyMovementMethod or LinkMovementMethod), there won't be any email popup window, if that even bothers you.
With the patch, it at least avoids a crash, but being able to select the text in this field is a better way to solve it, even from user experience perspective, or if you wish to fix this issue on official MIUI ROMs as well, since we have no control over that.

Ahh, interesting. Thanks for the info. I guess we gonna try this with the next patch release and see if it works.
Thank you very much for the idea. Hope this works!

Best regards,
Tobias
 

Similar threads