Assigned
Status Update
Comments
al...@google.com <al...@google.com> #2
Any updates on this? It's been a month already since I reported it, and it seems this crash is occurring quite frequently for my users.
[Deleted User] <[Deleted User]> #3
I am still regularly receiving reports about this issue, and it seems it has not been addressed in the latest 1.4.0-rc01 release.
ha...@google.com <ha...@google.com> #4
Seems like a fairly easy fix on our end. I'll see to that it is fixed in 1.5.
no...@google.com <no...@google.com> #5
Yeah, looks like it. We should unwrap the precomputed text for the shadow text otherwise the PcT will throw an exception due to incompatible draw parameters.
Unfortunately, the crash is happening inside framework, we may need to find a workaround in the library side. Maybe, unwrap the PcT and call setText in performLongClick
callback
[Deleted User] <[Deleted User]> #6
Can we do that outside the library? If yes, Can you guide?
Description
try {
Future<PrecomputedTextCompat> textFuture = PrecomputedTextCompat.getTextFuture(spanned,
getTextMetricsParams(this), AsyncTask.THREAD_POOL_EXECUTOR);
setTextFuture(textFuture);
} catch (Exception exception) {
exception.printStackTrace();
if (spanned != null) {
super.setText(spanned, BufferType.SPANNABLE);
}
}
}
Following code is creating a crash.
Logs.
java.lang.IllegalArgumentException: PrecomputedText's Parameters don't match the parameters of this TextView.Consider using setTextMetricsParams(precomputedText.getParams()) to override the settings of this TextView: PrecomputedText: {textSize=32.0, textScaleX=1.0, textSkewX=0.0, letterSpacing=0.0, textLocale=[en_GB], typeface=android.graphics.Typeface@3c15f4b3, variationSettings=null, elegantTextHeight=false, textDir=android.text.TextDirectionHeuristics$TextDirectionHeuristicInternal@b5db39a, breakStrategy=1, hyphenationFrequency=0}TextView: {textSize=51.0, textScaleX=1.0, textSkewX=0.0, letterSpacing=0.0, textLocale=[en_GB], typeface=null, variationSettings=null, elegantTextHeight=false, textDir=android.text.TextDirectionHeuristics$TextDirectionHeuristicInternal@b5db39a, breakStrategy=1, hyphenationFrequency=0}
at android.widget.TextView.setText(TextView.java:6206)
at android.widget.TextView.setText(TextView.java:6124)
at android.widget.TextView.setText(TextView.java:6076)
at android.widget.Editor.getTextThumbnailBuilder(Editor.java:2698)
at android.widget.Editor.startDragAndDrop(Editor.java:1241)
at android.widget.Editor.performLongClick(Editor.java:1267)
at android.widget.TextView.performLongClick(TextView.java:12244)
at android.view.View.performLongClick(View.java:7241)
at android.view.View$CheckForLongPress.run(View.java:27642)
at android.os.Handler.handleCallback(Handler.java:883)
at android.os.Handler.dispatchMessage(Handler.java:100)
at android.os.Looper.loop(Looper.java:224)
at android.app.ActivityThread.main(ActivityThread.java:7562)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:539)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:950)
Component used: PrecomputedTextCompat
Version used: 1.6.0
Devices/Android versions reproduced on: Android 10,11,12
If this is a bug in the library, we would appreciate if you could attach:
-Steps to reproduce the issue
1. Long Press on Textview > you will get block of selected text.
2. Long Press on block of selected Text > App Crashes.