diff options
Diffstat (limited to 'src/com/android/fmradio/FmService.java')
-rw-r--r-- | src/com/android/fmradio/FmService.java | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/src/com/android/fmradio/FmService.java b/src/com/android/fmradio/FmService.java index d9ac99e..ca940fd 100644 --- a/src/com/android/fmradio/FmService.java +++ b/src/com/android/fmradio/FmService.java @@ -21,6 +21,8 @@ import android.app.Notification; import android.app.Notification.BigTextStyle; import android.app.PendingIntent; import android.app.Service; +import android.bluetooth.BluetoothAdapter; +import android.bluetooth.BluetoothProfile; import android.content.BroadcastReceiver; import android.content.ContentResolver; import android.content.ContentValues; @@ -367,6 +369,17 @@ public class FmService extends Service implements FmRecorder.OnRecorderStateChan setForceUse(isSpeaker); } + /** + * Check if BT headset is connected + * @return true if current is playing with BT headset + */ + public boolean isBluetoothHeadsetInUse() { + BluetoothAdapter btAdapter = BluetoothAdapter.getDefaultAdapter(); + int a2dpState = btAdapter.getProfileConnectionState(BluetoothProfile.HEADSET); + return (BluetoothProfile.STATE_CONNECTED == a2dpState + || BluetoothProfile.STATE_CONNECTING == a2dpState); + } + private synchronized void startRender() { Log.d(TAG, "startRender"); mIsRender = true; |