Fixed
Status Update
Comments
il...@google.com <il...@google.com>
al...@google.com <al...@google.com> #2
This should be moved to the Android Public Tracker > Text
component, but I don't have permissions so I'm redirecting to the appropriate owner.
al...@google.com <al...@google.com> #3
So after updating to 1.4.1 and all deps too, the crash was a little different see below.
The repro for that one is easy
- create a new app from AS 7.1 RC 1
- update deps to (Appcompat 1.4.1/Material 1.5.0/Constraintlayout 2.1.3)
- Add 2 textViews
<TextView
android:id="@+id/text1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Hello World!"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/text2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Hello World!"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toBottomOf="@+id/text1" />```
- In onCreate:
val t1 = findViewById<TextView>(R.id.text1)
val t2 = findViewById<TextView>(R.id.text2)
val charBuffer1 = CharArrayBuffer("AAA".toCharArray())
charBuffer1.sizeCopied = 3
val charBuffer2 = CharArrayBuffer("AAA".toCharArray())
charBuffer2.sizeCopied = 3
t1.setText(charBuffer1.data, 0, charBuffer1.sizeCopied)
t2.setText(charBuffer2.data, 0, charBuffer2.sizeCopied)
- Run see the texts updated then crash with the following. (Tested on P6 Pro Android 12)
Process: org.debug.myapplication, PID: 32493
java.lang.NullPointerException: src == null
at java.lang.System.arraycopy(Native Method)
at android.widget.TextView$CharWrapper.getChars(TextView.java:13588)
at android.text.TextUtils.getChars(TextUtils.java:155)
at android.text.BoringLayout.hasAnyInterestingChars(BoringLayout.java:314)
at android.text.BoringLayout.isBoring(BoringLayout.java:340)
at android.widget.TextView.onMeasure(TextView.java:9413)
at androidx.appcompat.widget.AppCompatTextView.onMeasure(AppCompatTextView.java:607)
at android.view.View.measure(View.java:25774)
at androidx.constraintlayout.widget.ConstraintLayout$Measurer.measure(ConstraintLayout.java:811)
at androidx.constraintlayout.core.widgets.analyzer.BasicMeasure.measure(BasicMeasure.java:466)
at androidx.constraintlayout.core.widgets.analyzer.BasicMeasure.measureChildren(BasicMeasure.java:134)
at androidx.constraintlayout.core.widgets.analyzer.BasicMeasure.solverMeasure(BasicMeasure.java:278)
at androidx.constraintlayout.core.widgets.ConstraintWidgetContainer.measure(ConstraintWidgetContainer.java:120)
at androidx.constraintlayout.widget.ConstraintLayout.resolveSystem(ConstraintLayout.java:1594)
at androidx.constraintlayout.widget.ConstraintLayout.onMeasure(ConstraintLayout.java:1708)
at android.view.View.measure(View.java:25774)
at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6980)
at android.widget.FrameLayout.onMeasure(FrameLayout.java:194)
at androidx.appcompat.widget.ContentFrameLayout.onMeasure(ContentFrameLayout.java:145)
at android.view.View.measure(View.java:25774)
at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6980)
at androidx.appcompat.widget.ActionBarOverlayLayout.onMeasure(ActionBarOverlayLayout.java:496)
at android.view.View.measure(View.java:25774)
at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6980)
at android.widget.FrameLayout.onMeasure(FrameLayout.java:194)
at android.view.View.measure(View.java:25774)
at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6980)
at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1552)
at android.widget.LinearLayout.measureVertical(LinearLayout.java:842)
at android.widget.LinearLayout.onMeasure(LinearLayout.java:721)
at android.view.View.measure(View.java:25774)
at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6980)
at android.widget.FrameLayout.onMeasure(FrameLayout.java:194)
at com.android.internal.policy.DecorView.onMeasure(DecorView.java:761)
at android.view.View.measure(View.java:25774)
at android.view.ViewRootImpl.performMeasure(ViewRootImpl.java:3628)
at android.view.ViewRootImpl.measureHierarchy(ViewRootImpl.java:2424)
at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:2694)
at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:2143)
at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:8665)
at android.view.Choreographer$CallbackRecord.run(Choreographer.java:1037)
at android.view.Choreographer.doCallbacks(Choreographer.java:845)
at android.view.Choreographer.doFrame(Choreographer.java:780)
at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:1022)
at android.os.Handler.handleCallback(Handler.java:938)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loopOnce(Looper.java:201)
at android.os.Looper.loop(Looper.java:288)
at android.app.ActivityThread.main(ActivityThread.java:7839)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:548)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1003)
ap...@google.com <ap...@google.com> #4
since it is possibly related to emojicompat reassigned
il...@google.com <il...@google.com> #5
Thanks for the report.
What version of Android are you testing this on?
Description
android.net.MailTo contains a couple of bugs that prevents it from properly parsing some mailto: URIs that are found in the wild. My blog post contains more details:https://cketti.de/2020/06/22/android-net-mailto-is-broken/
I also fixed the bugs and published the class as a small library that can be used to replace usages of android.net.MailTo:https://github.com/cketti/MailToCompat
It has been suggested to me that the fixed up class could also be part of AndroidX Core. I'm happy to reformat the class to match the AOSP code style and create a CL if this is something you'd be fine with including in the library. Ian Lake volunteered to help with reviewing ❤️
Please let me know if such a contribution would be welcome.