Conditionally swallows Exceptions from TextClassificationAsyncTask.

After ag/12036126, the AsyncTask may throw RuntimeException if we
destroy the TCSession before it is done. However, this kind of Exception
should be swallowed silently because we do not need the result anymore.

In b/172627102, the test fails because we perform a cut action to the
text immediately after we trigger a selection. The cut action will
destroy and TCSession and thus cause a session-already-destroyed
Exception in the AsyncTask. With this, we will check whether the Text
Classifier has already been destroyed and therefore can fix it.

Bug: 172627102
Fix: 172627102
Test: atest AccessibilityTextTraversalTest.java

Change-Id: Ia2ca04a06e97858cd897e5d35f707f5edeee56cf
1 file changed