Fix random SmartLinkify-related TextView bugs.

1. Preserve selection when the TC times out. (See: SelectionActionModeHelper)

2. Fix highlight/toolbar flicker when tapping on a smart link.
   - Highlight flicker happening because we reset the selection while in
     the process of starting a link action mode.
     i.e. onLinkDown: show highlight
          onLinkUp: start the link action mode asynchronously
	  onLinkUp: reset the selection to an insertion cursor*
	  onLinkActionModeStarted: reset the highlight
	  *Fix: Don't reset selection while starting a link action mode.
   - Toolbar flicker happening because the toolbar positions itself over
     the current selection. The way link highlights have traditionally
     been done is to set the selection to the links bounds*
     *Fix: Hide the toolbar for a few milliseconds when changing
     selection for smoother transition.

3. Fix Paste menu overriding link action mode toolbar after a recent
   "Copy" action. The Paste menu appearing is a feature. Whenever the
   user inserts a cursor after just copying some text, we show the Paste
   menu as a way to make it easy for the user to select the text.
   Because of the problem described in (2) above, changing the selection
   to an insertion triggers the Paste menu feature. Fixing (2) fixes
   this.

4. Fix IME popping up on non-selectable + focusable TextViews.
   See: imm.showSoftInput(...) in Editor. And see comment in the code
   around that. We should only pop up the IME for editable text.

Fixes: 73872461
Fixes: 75985239
Fixes: 76011461

Test: bit CtsWidgetTestCases:android.widget.cts.TextViewTest
Test: bit FrameworksCoreTests:android.widget.TextViewActivityTest
Change-Id: If9ddb7f4e6d4db480ba4a495a22f7f2924ab937e
4 files changed