[Mobile] Don't manually invalidate cached connections
Remove our former call to `dropUnusedReposFromCache`, because there is a
potential case where these dropped repos are still connected to
downstream clients.
For now, we will just keep weak references around to any connection that
has been put in the cache (when it has been realized by connecting to
the downstream). There really shouldn't be any performance impact, since
the downstreams _will_ disconnect once the subscription is gone from the
list. This just protects us against losing track of them in the
meantime.
In the future, we can look into something more robust such as upgrading
the keys to have more information, or re-structuring the way that we
allow subscribers to show up and request repos.
Here's the pathological case that seems to be triggering the issue:
1. An existing subscription is feeding the views. Let's call it 1 for
subId=1.
2. User toggles the SIM off. This action removes subId1 from the list of
valid subscriptions.
3. Importantly, the active subscription is still 1, so it's not removed
from the cache yet.
4. User toggles the SIM back on, which causes a somewhat chaotic set of
changes. The first change removes the active subId which allows us to
remove the cached repo. At the same time, a new list comes back to us
with the same subId1.
5. In this state, the theory is that the views are still holding onto
the now-invalid reference of the old repository, when they should
have been transferred over to the new one.
Test: manual
Test: all tests in com.android.systemiu.statusbar.pipeline
Bug: 332737118
Bug: 333912012
Flag: NONE
Change-Id: Ib490062208506d646add2fe7e5e5d4df5fb3e66e
4 files changed