am a0c2b539
: Merge "Fix issue 2811538: System server crash when disconnecting BT headset after using SCO off call." into gingerbread
Merge commit 'a0c2b53966238125143dec01d3f2598a8b9e33a2' into gingerbread-plus-aosp * commit 'a0c2b53966238125143dec01d3f2598a8b9e33a2': Fix issue 2811538: System server crash when disconnecting BT headset after using SCO off call.
This commit is contained in:
@ -16,6 +16,7 @@
|
|||||||
|
|
||||||
package android.media;
|
package android.media;
|
||||||
|
|
||||||
|
import java.util.NoSuchElementException;
|
||||||
import android.app.ActivityManagerNative;
|
import android.app.ActivityManagerNative;
|
||||||
import android.content.BroadcastReceiver;
|
import android.content.BroadcastReceiver;
|
||||||
import android.content.ComponentName;
|
import android.content.ComponentName;
|
||||||
@ -1016,7 +1017,11 @@ public class AudioService extends IAudioService.Stub {
|
|||||||
} else {
|
} else {
|
||||||
mStartcount--;
|
mStartcount--;
|
||||||
if (mStartcount == 0) {
|
if (mStartcount == 0) {
|
||||||
mCb.unlinkToDeath(this, 0);
|
try {
|
||||||
|
mCb.unlinkToDeath(this, 0);
|
||||||
|
} catch (NoSuchElementException e) {
|
||||||
|
Log.w(TAG, "decCount() going to 0 but not registered to binder");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
requestScoState(BluetoothHeadset.AUDIO_STATE_DISCONNECTED);
|
requestScoState(BluetoothHeadset.AUDIO_STATE_DISCONNECTED);
|
||||||
}
|
}
|
||||||
@ -1025,8 +1030,14 @@ public class AudioService extends IAudioService.Stub {
|
|||||||
|
|
||||||
public void clearCount(boolean stopSco) {
|
public void clearCount(boolean stopSco) {
|
||||||
synchronized(mScoClients) {
|
synchronized(mScoClients) {
|
||||||
|
if (mStartcount != 0) {
|
||||||
|
try {
|
||||||
|
mCb.unlinkToDeath(this, 0);
|
||||||
|
} catch (NoSuchElementException e) {
|
||||||
|
Log.w(TAG, "clearCount() mStartcount: "+mStartcount+" != 0 but not registered to binder");
|
||||||
|
}
|
||||||
|
}
|
||||||
mStartcount = 0;
|
mStartcount = 0;
|
||||||
mCb.unlinkToDeath(this, 0);
|
|
||||||
if (stopSco) {
|
if (stopSco) {
|
||||||
requestScoState(BluetoothHeadset.AUDIO_STATE_DISCONNECTED);
|
requestScoState(BluetoothHeadset.AUDIO_STATE_DISCONNECTED);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user