Skip to content
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 12, 2015
1 parent c911612 commit d7c020e9e525f1db44da1d0428d87a53babb3927
Showing with 361 additions and 189 deletions.
  1. +361 −189 core/java/android/text/

1 comment on commit d7c020e


This comment has been minimized.

Copy link

@tibot tibot commented on d7c020e Dec 15, 2016


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(
at android.view.inputmethod.BaseInputConnection.removeComposingSpans(
at android.view.inputmethod.BaseInputConnection.finishComposingText(
at android.os.Handler.dispatchMessage(
at android.os.Looper.loop(
at java.lang.reflect.Method.invoke(Native Method)
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.