Fix AppPrediction/Smartspace leak

AppPrediction and Smartspace session info are associated with two types of Binder objects: one maps to the client object (i.e. AppPredictor/SmartspaceSession) that represents the session itself, the other one maps to the callback functions that handles incoming update at the client side.

The death recipient of the former performs the clean-up which removes
the session info object from system process followed by calling a destroy on the session info object, while the other one simply calls destroy.

Unfortunately upon destroy of the session info object, we unlink the
former from its death recipient, which means if the callback function
objects died before the session object in the client process, the death recipient is unlinked, therefore the clean-up will not be performed.

Both the callback function object and the session info object lives in the same process, when the process dies, both object dies, so there's no reason to having cleanup logic in both places.

This CL removes the death recipient associated with the callback in favor of the one associated with the session since the later provides more coverage, e.g. in case the process died before it start listening to prediction updates.

Bug: 230696939
Test: manual
Change-Id: I27641d347c2b436eaafba306842854a97a440f7a
(cherry picked from commit f9ba3f64c07fd5fc6b93523e78751dbe26a93400)
Merged-In: I27641d347c2b436eaafba306842854a97a440f7a
2 files changed