Fix an issue that it is impossible to have multiple active sessions

Root cause:
TCM caches SystemTC. TCM.createTCSession returns a wrapper of
the same SystemTC and it just updates the sessionID
(and some other session related stuff) of the shared system TC.
That means, if clients call createTCSession multiple times for multiple
active sessions, all of these session TCs have the same session ID
(the latest one) because they all point to the same SystemTC.

It has been an issue since P. But we don't really have code that creates
multiple active sessions before R. In R, we create a session per each
notification, and thus hit the bug.

Solution:
Don't cache SystemTC. SystemTC is just a thin wrapper that forwards calls
to TCMS anyway.

BUG: 149012454
Test: atest CtsTextClassifierService (Added a new test in ag/10260978.)
Test: Sanity tests: smart selection and smart replies are still working.

Change-Id: I71fe558b2f3d2c5d9eb0b6fc7f258fb4d8ad48d6
1 file changed