Permalink
Browse files

Interval tree for SpannableStringBuilder

This CL greatly improves the speed of SpannableStringBuilder by storing
the spans as an interval tree with binary search.

Bug: 7404182
Change-Id: I2540b2cfe8aef128337e63829479660ba51e62b5
  • Loading branch information...
raphlinus committed Feb 5, 2015
1 parent c911612 commit d7c020e9e525f1db44da1d0428d87a53babb3927
Showing with 361 additions and 189 deletions.
  1. +361 −189 core/java/android/text/SpannableStringBuilder.java
Oops, something went wrong.

1 comment on commit d7c020e

@tibot

This comment has been minimized.

tibot commented on d7c020e Dec 15, 2016

Hi,

We currently have a framework bug probably caused by this revision.
Below you will find ly stack trace :

E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.tetra4d.pdf3dviewer, PID: 23172
java.lang.ArrayIndexOutOfBoundsException: length=9; index=-1
at android.text.SpannableStringBuilder.getSpanFlags(SpannableStringBuilder.java:808)
at android.view.inputmethod.BaseInputConnection.removeComposingSpans(BaseInputConnection.java:82)
at android.view.inputmethod.BaseInputConnection.finishComposingText(BaseInputConnection.java:272)
at com.android.internal.view.IInputConnectionWrapper.executeMessage(IInputConnectionWrapper.java:362)
at com.android.internal.view.IInputConnectionWrapper$MyHandler.handleMessage(IInputConnectionWrapper.java:78)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:148)
at android.app.ActivityThread.main(ActivityThread.java:5417)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
E/GAv4: Successfully bound to service but never got onServiceConnected callback
I/Process: Sending signal. PID: 23172 SIG: 9
Application terminated.

I can reproduce the problem evrytime I create Spannable objects.
Is there a workaround overide the default class? How is it possible to broke the framework and obtaining this kind of bug?

Thanks for your answer

Thibault Tournier
Tetra4D engineering team

Please sign in to comment.