@@ -1347,11 +1347,10 @@ private void requestScoState(int state) {
13471347 // currently controlled by the same client process.
13481348 if ((AudioService .this .mMode == AudioSystem .MODE_NORMAL ||
13491349 mSetModeDeathHandlers .get (0 ).getPid () == mCreatorPid ) &&
1350- mBluetoothHeadsetDevice != null &&
13511350 (mScoAudioState == SCO_STATE_INACTIVE ||
13521351 mScoAudioState == SCO_STATE_DEACTIVATE_REQ )) {
13531352 if (mScoAudioState == SCO_STATE_INACTIVE ) {
1354- if (mBluetoothHeadset != null ) {
1353+ if (mBluetoothHeadset != null && mBluetoothHeadsetDevice != null ) {
13551354 if (mBluetoothHeadset .startScoUsingVirtualVoiceCall (
13561355 mBluetoothHeadsetDevice )) {
13571356 mScoAudioState = SCO_STATE_ACTIVE_INTERNAL ;
@@ -1370,11 +1369,10 @@ private void requestScoState(int state) {
13701369 broadcastScoConnectionState (AudioManager .SCO_AUDIO_STATE_DISCONNECTED );
13711370 }
13721371 } else if (state == BluetoothHeadset .STATE_AUDIO_DISCONNECTED &&
1373- mBluetoothHeadsetDevice != null &&
13741372 (mScoAudioState == SCO_STATE_ACTIVE_INTERNAL ||
13751373 mScoAudioState == SCO_STATE_ACTIVATE_REQ )) {
13761374 if (mScoAudioState == SCO_STATE_ACTIVE_INTERNAL ) {
1377- if (mBluetoothHeadset != null ) {
1375+ if (mBluetoothHeadset != null && mBluetoothHeadsetDevice != null ) {
13781376 if (!mBluetoothHeadset .stopScoUsingVirtualVoiceCall (
13791377 mBluetoothHeadsetDevice )) {
13801378 mScoAudioState = SCO_STATE_INACTIVE ;
0 commit comments