Strips spans from AssistStructure text

When a new view becomes visible on the screen, the view notifies
AutofillManager about its visibility. AutofillManager then requests the
activity to compile an AssistStructure object which will contain the
view hierarchy of the activity as well as texts contained inside all the
views. If there are Span text fields that contain custom implementation of ClickableSpan, these spans are also copied over during the construction of the AssistStructure. By keeping the references to the ClickableSpan, it causes memory leak when the AssistStructure object outlives the activity.

Test: atest CtsAutoFillServiceTestCases, atest CtsAssistTestCases, atest android.widget.cts.TextViewTest
Bug: 146100180
Change-Id: I1fd97d9d6fdc569d14529347fcb85da409c3c1ff
(cherry picked from commit e42d05e3d01f4c3b8aa7bce29086cd968970b4ec)
1 file changed