Release text when finishing StaticLayout.Builder

DynamicLayout reuses a StaticLayout.Builder object to avoid having to
allocate. There is a "finish" method that releases any expensive
internal state of the builder object, but it didn't release a
reference to the text object (which in turn may contain references to
lots of other things, especially if it's a Spannable).

This patch releases the text, as well as a few other arrays, at time
of finish.

Bug: 22822416
Change-Id: Icc8b6cd41a9a2d11689df7bd1b9f524c6524f706
diff --git a/core/java/android/text/StaticLayout.java b/core/java/android/text/StaticLayout.java
index efc9e1a..3b0def2 100644
--- a/core/java/android/text/StaticLayout.java
+++ b/core/java/android/text/StaticLayout.java
@@ -112,6 +112,10 @@
         // release any expensive state
         /* package */ void finish() {
             nFinishBuilder(mNativePtr);
+            mText = null;
+            mPaint = null;
+            mLeftIndents = null;
+            mRightIndents = null;
             mMeasuredText.finish();
         }