Run search UI on its own thread.

Details:

- Add a new SearchDialogWrapper class that makes sure
  all access to the SearchDialog is run one a single thread
  other than the main ServerThread.
- Don't save/restore seach dialog state in Activity.
  This resulted in lots of calls to the SearchManager
  throughout the life cycle of all activities, for
  the questionable benefit of restoring the search dialog
  in a few cases.
- Remove search UI state save/restore, and the isVisible()
  method from SearchManagerService. They are no longer used,
  and were tricky to implement since they return values from
  the search UI thread to the service.
- Handle configuration changes in searchDialogWrapper instead
  of calling through from Activity.

Fixes http://b/issue?id=1938101

TODO:
- Activity.performPause() calls stopSearch(). This call may not happen
  until the new activity has been started. If the new activity starts a
  search immediately, this search could be cancelled by the old activity's
  call top stopSearch().
8 files changed