1. Pull out the common intent genereation logic to TemplateIntentFactory,
so that it could be used by actions.
2. Fix a bug that we are freeing the annotator immediately when
we are switching annotator model file. It is incorrect as
it could be used by another thread / model.
Test: atest frameworks/base/core/tests/coretests/src/android/view/textclassifier/
BUG: 123745079
Change-Id: I6c5364595470b900be2dd976dda6e9fc90464de9