Fix a fun bug with multiple service bindings from an activity.

There was a flaw in the service management, when the same activity
is doing a bindService() for the same service IBinder.  In this case
the activity would correctly keep a list of all generated connections,
however some other data structures would assume there is only one
connection per IBinder, and thus only remember the last.

When that last connection was unbound, the service would be destroyed
since it thought there were no more connections.  Then when the
activity was finished, it would try to destroy the service again and
end up with an ANR because the service was already gone and would
not respond.

Change-Id: I59bde38bc24e78147b90b0a7cd525c2a1d20489f
2 files changed