Fix binder death and disconnection.
After this fix:
* If we just get a `onServiceDisconnected`, we will only clear the
wrapper but won't unbind. According to the docs, this may reconnect by
the system (the binder is still alive).
* If the binder dies (either detected by ServiceConnection or
DeathRecipient), we clear the wrapper and unbind. After that, if we
still want to be bound (mBound.get() == true), we will schedule a
rebind later. We will only rebind if by that time, we still want to be
bound.
Also add component name to log lines.
Fixes: 302657931
Test: atest TileLifecycleManagerTest
Test: manual, crash the tileservice package and see the rebinds (unless
the shade is closed).
Test: manual, check that at any time there's only one instance of the
binding (adb shell dumpsys activity services).
Flag: NONE
Change-Id: I1fdd8aaa62d175d292a3ad38f86eaec3582dd27a
2 files changed