Do not create a TextClassificationSession if we are not going to use it.

The issue:
ExtServices creates session even though it is not going to use it
to create smart suggestions for notification.
If TCMS is not yet bound to a TCS, it will then cache the request
as a PendingRequest until a TCS is bound.
TCS is not bound until the user gets a messge notification or perofrms
a text selection. By that time, the system may already crash because
of caching too many binder objects.

Solution:
1. Do not create a session if we are not calling
suggestConversationActions.

Test: atest TextClassifierNotificationTests
Test: Send a lot of non-message type notifications.
      Check the dumpsys textclassification output, no more pending request.


TODO: Consider to modify TCMS so that onCreateTextClassificationSession
and onDestoryTextClassificationSession will also proactively bind to
the TCS.

Bug: 156266657
Bug: 156683847

Change-Id: I51cb7b020b55c6f5b8557bdfa329ca6bab3269ef
2 files changed