summaryrefslogtreecommitdiffstats
path: root/src/com/android/fmradio/FmService.java
diff options
context:
space:
mode:
authorNicholas Sauer <nicksauer@google.com>2014-12-31 04:34:34 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2014-12-31 04:34:34 +0000
commit0dedb6b1c809ebad637021782b3bdd1abc9970be (patch)
tree5ba7e08e5ce0be136552149fd5de4f7e3ba033e2 /src/com/android/fmradio/FmService.java
parent13d8588359fa1d89b8a0437c18aa0bd099513458 (diff)
parent2816b93f7207ca62e83dda35716e8ce267e84197 (diff)
downloadandroid_packages_apps_FMRadio-0dedb6b1c809ebad637021782b3bdd1abc9970be.tar.gz
android_packages_apps_FMRadio-0dedb6b1c809ebad637021782b3bdd1abc9970be.tar.bz2
android_packages_apps_FMRadio-0dedb6b1c809ebad637021782b3bdd1abc9970be.zip
Merge "[FM] "Speaker on/headset" should not be available while BT earphone is connected" into lmp-mr1-dev
Diffstat (limited to 'src/com/android/fmradio/FmService.java')
-rw-r--r--src/com/android/fmradio/FmService.java13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/com/android/fmradio/FmService.java b/src/com/android/fmradio/FmService.java
index 8681224..6c39d66 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;
@@ -370,6 +372,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;