OSDN Git Service

Fix issue 2811538: System server crash when disconnecting BT headset after using...
authorEric Laurent <elaurent@google.com>
Thu, 1 Jul 2010 02:41:56 +0000 (19:41 -0700)
committerEric Laurent <elaurent@google.com>
Thu, 1 Jul 2010 23:23:34 +0000 (16:23 -0700)
commitc03befe3d62eb2a3e1d56fec0ca188a6094d53dd
tree8786b553e993ef0b2e091b9b024e770256f6a4ef
parentd581484ef8fac80c15ebf652e66f918374df5109
Fix issue 2811538: System server crash when disconnecting BT headset after using SCO off call.

Problem:
When the bluetooth device is removed, the AudioService clears all active SCO connections
and unlinks from the client application's binder interface death.
The problem is that the unlinking is done even if no more connections are active for a given client,
which throws a runtime exception that is not catched causing the system server to crash.

The fix consists in calling unlinkToDeath() in ScoClient.clearCount() only if the number of
active SCO connections for this client is not 0. The NoSuchElementException exception is also
catched when calling unlinkToDeath()

Change-Id: I7086424301fc63a5666da61c38169349d3e078f4
media/java/android/media/AudioService.java