summaryrefslogtreecommitdiffstats
path: root/core/java/android/bluetooth
diff options
context:
space:
mode:
Diffstat (limited to 'core/java/android/bluetooth')
-rw-r--r--core/java/android/bluetooth/BluetoothA2dp.java12
-rw-r--r--core/java/android/bluetooth/BluetoothHeadset.java14
2 files changed, 26 insertions, 0 deletions
diff --git a/core/java/android/bluetooth/BluetoothA2dp.java b/core/java/android/bluetooth/BluetoothA2dp.java
index b0b0154..2ea45d5 100644
--- a/core/java/android/bluetooth/BluetoothA2dp.java
+++ b/core/java/android/bluetooth/BluetoothA2dp.java
@@ -49,6 +49,7 @@ import java.util.List;
*/
public class BluetoothA2dp {
private static final String TAG = "BluetoothA2dp";
+ private static final boolean DBG = false;
/** int extra for SINK_STATE_CHANGED_ACTION */
public static final String SINK_STATE =
@@ -103,6 +104,7 @@ public class BluetoothA2dp {
* @hide
*/
public int connectSink(String address) {
+ if (DBG) log("connectSink(" + address + ")");
try {
return mService.connectSink(address);
} catch (RemoteException e) {
@@ -119,6 +121,7 @@ public class BluetoothA2dp {
* @hide
*/
public int disconnectSink(String address) {
+ if (DBG) log("disconnectSink(" + address + ")");
try {
return mService.disconnectSink(address);
} catch (RemoteException e) {
@@ -133,6 +136,7 @@ public class BluetoothA2dp {
* @hide
*/
public boolean isSinkConnected(String address) {
+ if (DBG) log("isSinkConnected(" + address + ")");
int state = getSinkState(address);
return state == STATE_CONNECTED || state == STATE_PLAYING;
}
@@ -142,6 +146,7 @@ public class BluetoothA2dp {
* @hide
*/
public List<String> listConnectedSinks() {
+ if (DBG) log("listConnectedSinks()");
try {
return mService.listConnectedSinks();
} catch (RemoteException e) {
@@ -156,6 +161,7 @@ public class BluetoothA2dp {
* @hide
*/
public int getSinkState(String address) {
+ if (DBG) log("getSinkState(" + address + ")");
try {
return mService.getSinkState(address);
} catch (RemoteException e) {
@@ -177,6 +183,7 @@ public class BluetoothA2dp {
* @return Result code, negative indicates an error
*/
public int setSinkPriority(String address, int priority) {
+ if (DBG) log("setSinkPriority(" + address + ", " + priority + ")");
try {
return mService.setSinkPriority(address, priority);
} catch (RemoteException e) {
@@ -191,6 +198,7 @@ public class BluetoothA2dp {
* @return non-negative priority, or negative error code on error.
*/
public int getSinkPriority(String address) {
+ if (DBG) log("getSinkPriority(" + address + ")");
try {
return mService.getSinkPriority(address);
} catch (RemoteException e) {
@@ -244,4 +252,8 @@ public class BluetoothA2dp {
return "<unknown state " + state + ">";
}
}
+
+ private static void log(String msg) {
+ Log.d(TAG, msg);
+ }
}
diff --git a/core/java/android/bluetooth/BluetoothHeadset.java b/core/java/android/bluetooth/BluetoothHeadset.java
index 34196bf..e23545b 100644
--- a/core/java/android/bluetooth/BluetoothHeadset.java
+++ b/core/java/android/bluetooth/BluetoothHeadset.java
@@ -126,6 +126,7 @@ public class BluetoothHeadset {
* are ok.
*/
public synchronized void close() {
+ if (DBG) log("close()");
if (mConnection != null) {
mContext.unbindService(mConnection);
mConnection = null;
@@ -138,6 +139,7 @@ public class BluetoothHeadset {
* object is currently not connected to the Headset service.
*/
public int getState() {
+ if (DBG) log("getState()");
if (mService != null) {
try {
return mService.getState();
@@ -156,6 +158,7 @@ public class BluetoothHeadset {
* service.
*/
public String getHeadsetAddress() {
+ if (DBG) log("getHeadsetAddress()");
if (mService != null) {
try {
return mService.getHeadsetAddress();
@@ -180,6 +183,7 @@ public class BluetoothHeadset {
* will be expected.
*/
public boolean connectHeadset(String address) {
+ if (DBG) log("connectHeadset(" + address + ")");
if (mService != null) {
try {
if (mService.connectHeadset(address)) {
@@ -199,6 +203,7 @@ public class BluetoothHeadset {
* if not currently connected to the headset service.
*/
public boolean isConnected(String address) {
+ if (DBG) log("isConnected(" + address + ")");
if (mService != null) {
try {
return mService.isConnected(address);
@@ -216,6 +221,7 @@ public class BluetoothHeadset {
* not currently connected to the Headset service.
*/
public boolean disconnectHeadset() {
+ if (DBG) log("disconnectHeadset()");
if (mService != null) {
try {
mService.disconnectHeadset();
@@ -235,6 +241,7 @@ public class BluetoothHeadset {
* error.
*/
public boolean startVoiceRecognition() {
+ if (DBG) log("startVoiceRecognition()");
if (mService != null) {
try {
return mService.startVoiceRecognition();
@@ -252,6 +259,7 @@ public class BluetoothHeadset {
* headset is not in voice recognition mode, or on error.
*/
public boolean stopVoiceRecognition() {
+ if (DBG) log("stopVoiceRecognition()");
if (mService != null) {
try {
return mService.stopVoiceRecognition();
@@ -282,6 +290,7 @@ public class BluetoothHeadset {
* @return True if successful, false if there was some error.
*/
public boolean setPriority(String address, int priority) {
+ if (DBG) log("setPriority(" + address + ", " + priority + ")");
if (mService != null) {
try {
return mService.setPriority(address, priority);
@@ -299,6 +308,7 @@ public class BluetoothHeadset {
* @return non-negative priority, or negative error code on error.
*/
public int getPriority(String address) {
+ if (DBG) log("getPriority(" + address + ")");
if (mService != null) {
try {
return mService.getPriority(address);
@@ -350,4 +360,8 @@ public class BluetoothHeadset {
}
}
};
+
+ private static void log(String msg) {
+ Log.d(TAG, msg);
+ }
}