Merge "Change HFP Client API to support multi device"
This commit is contained in:
@@ -963,38 +963,6 @@ public final class BluetoothHeadsetClient implements BluetoothProfile {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Accept the incoming connection.
|
|
||||||
*/
|
|
||||||
public boolean acceptIncomingConnect(BluetoothDevice device) {
|
|
||||||
if (DBG) log("acceptIncomingConnect");
|
|
||||||
if (mService != null && isEnabled()) {
|
|
||||||
try {
|
|
||||||
return mService.acceptIncomingConnect(device);
|
|
||||||
} catch (RemoteException e) {Log.e(TAG, e.toString());}
|
|
||||||
} else {
|
|
||||||
Log.w(TAG, "Proxy not attached to service");
|
|
||||||
if (DBG) Log.d(TAG, Log.getStackTraceString(new Throwable()));
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Reject the incoming connection.
|
|
||||||
*/
|
|
||||||
public boolean rejectIncomingConnect(BluetoothDevice device) {
|
|
||||||
if (DBG) log("rejectIncomingConnect");
|
|
||||||
if (mService != null) {
|
|
||||||
try {
|
|
||||||
return mService.rejectIncomingConnect(device);
|
|
||||||
} catch (RemoteException e) {Log.e(TAG, e.toString());}
|
|
||||||
} else {
|
|
||||||
Log.w(TAG, "Proxy not attached to service");
|
|
||||||
if (DBG) Log.d(TAG, Log.getStackTraceString(new Throwable()));
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns current audio state of Audio Gateway.
|
* Returns current audio state of Audio Gateway.
|
||||||
*
|
*
|
||||||
@@ -1016,13 +984,15 @@ public final class BluetoothHeadsetClient implements BluetoothProfile {
|
|||||||
/**
|
/**
|
||||||
* Sets whether audio routing is allowed.
|
* Sets whether audio routing is allowed.
|
||||||
*
|
*
|
||||||
|
* @param device remote device
|
||||||
|
* @param allowed if routing is allowed to the device
|
||||||
* Note: This is an internal function and shouldn't be exposed
|
* Note: This is an internal function and shouldn't be exposed
|
||||||
*/
|
*/
|
||||||
public void setAudioRouteAllowed(boolean allowed) {
|
public void setAudioRouteAllowed(BluetoothDevice device, boolean allowed) {
|
||||||
if (VDBG) log("setAudioRouteAllowed");
|
if (VDBG) log("setAudioRouteAllowed");
|
||||||
if (mService != null && isEnabled()) {
|
if (mService != null && isEnabled()) {
|
||||||
try {
|
try {
|
||||||
mService.setAudioRouteAllowed(allowed);
|
mService.setAudioRouteAllowed(device, allowed);
|
||||||
} catch (RemoteException e) {Log.e(TAG, e.toString());}
|
} catch (RemoteException e) {Log.e(TAG, e.toString());}
|
||||||
} else {
|
} else {
|
||||||
Log.w(TAG, "Proxy not attached to service");
|
Log.w(TAG, "Proxy not attached to service");
|
||||||
@@ -1032,14 +1002,15 @@ public final class BluetoothHeadsetClient implements BluetoothProfile {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns whether audio routing is allowed.
|
* Returns whether audio routing is allowed.
|
||||||
*
|
* @param device remote device
|
||||||
|
* @return whether the command succeeded
|
||||||
* Note: This is an internal function and shouldn't be exposed
|
* Note: This is an internal function and shouldn't be exposed
|
||||||
*/
|
*/
|
||||||
public boolean getAudioRouteAllowed() {
|
public boolean getAudioRouteAllowed(BluetoothDevice device) {
|
||||||
if (VDBG) log("getAudioRouteAllowed");
|
if (VDBG) log("getAudioRouteAllowed");
|
||||||
if (mService != null && isEnabled()) {
|
if (mService != null && isEnabled()) {
|
||||||
try {
|
try {
|
||||||
return mService.getAudioRouteAllowed();
|
return mService.getAudioRouteAllowed(device);
|
||||||
} catch (RemoteException e) {Log.e(TAG, e.toString());}
|
} catch (RemoteException e) {Log.e(TAG, e.toString());}
|
||||||
} else {
|
} else {
|
||||||
Log.w(TAG, "Proxy not attached to service");
|
Log.w(TAG, "Proxy not attached to service");
|
||||||
@@ -1053,15 +1024,16 @@ public final class BluetoothHeadsetClient implements BluetoothProfile {
|
|||||||
*
|
*
|
||||||
* It setup SCO channel with remote connected Handsfree AG device.
|
* It setup SCO channel with remote connected Handsfree AG device.
|
||||||
*
|
*
|
||||||
|
* @param device remote device
|
||||||
* @return <code>true</code> if command has been issued successfully;
|
* @return <code>true</code> if command has been issued successfully;
|
||||||
* <code>false</code> otherwise;
|
* <code>false</code> otherwise;
|
||||||
* upon completion HFP sends {@link #ACTION_AUDIO_STATE_CHANGED}
|
* upon completion HFP sends {@link #ACTION_AUDIO_STATE_CHANGED}
|
||||||
* intent;
|
* intent;
|
||||||
*/
|
*/
|
||||||
public boolean connectAudio() {
|
public boolean connectAudio(BluetoothDevice device) {
|
||||||
if (mService != null && isEnabled()) {
|
if (mService != null && isEnabled()) {
|
||||||
try {
|
try {
|
||||||
return mService.connectAudio();
|
return mService.connectAudio(device);
|
||||||
} catch (RemoteException e) {
|
} catch (RemoteException e) {
|
||||||
Log.e(TAG, e.toString());
|
Log.e(TAG, e.toString());
|
||||||
}
|
}
|
||||||
@@ -1077,15 +1049,16 @@ public final class BluetoothHeadsetClient implements BluetoothProfile {
|
|||||||
*
|
*
|
||||||
* It tears down the SCO channel from remote AG device.
|
* It tears down the SCO channel from remote AG device.
|
||||||
*
|
*
|
||||||
|
* @param device remote device
|
||||||
* @return <code>true</code> if command has been issued successfully;
|
* @return <code>true</code> if command has been issued successfully;
|
||||||
* <code>false</code> otherwise;
|
* <code>false</code> otherwise;
|
||||||
* upon completion HFP sends {@link #ACTION_AUDIO_STATE_CHANGED}
|
* upon completion HFP sends {@link #ACTION_AUDIO_STATE_CHANGED}
|
||||||
* intent;
|
* intent;
|
||||||
*/
|
*/
|
||||||
public boolean disconnectAudio() {
|
public boolean disconnectAudio(BluetoothDevice device) {
|
||||||
if (mService != null && isEnabled()) {
|
if (mService != null && isEnabled()) {
|
||||||
try {
|
try {
|
||||||
return mService.disconnectAudio();
|
return mService.disconnectAudio(device);
|
||||||
} catch (RemoteException e) {
|
} catch (RemoteException e) {
|
||||||
Log.e(TAG, e.toString());
|
Log.e(TAG, e.toString());
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -29,9 +29,6 @@ interface IBluetoothHeadsetClient {
|
|||||||
boolean connect(in BluetoothDevice device);
|
boolean connect(in BluetoothDevice device);
|
||||||
boolean disconnect(in BluetoothDevice device);
|
boolean disconnect(in BluetoothDevice device);
|
||||||
|
|
||||||
boolean acceptIncomingConnect(in BluetoothDevice device);
|
|
||||||
boolean rejectIncomingConnect(in BluetoothDevice device);
|
|
||||||
|
|
||||||
List<BluetoothDevice> getConnectedDevices();
|
List<BluetoothDevice> getConnectedDevices();
|
||||||
List<BluetoothDevice> getDevicesMatchingConnectionStates(in int[] states);
|
List<BluetoothDevice> getDevicesMatchingConnectionStates(in int[] states);
|
||||||
int getConnectionState(in BluetoothDevice device);
|
int getConnectionState(in BluetoothDevice device);
|
||||||
@@ -58,10 +55,10 @@ interface IBluetoothHeadsetClient {
|
|||||||
boolean getLastVoiceTagNumber(in BluetoothDevice device);
|
boolean getLastVoiceTagNumber(in BluetoothDevice device);
|
||||||
|
|
||||||
int getAudioState(in BluetoothDevice device);
|
int getAudioState(in BluetoothDevice device);
|
||||||
boolean connectAudio();
|
boolean connectAudio(in BluetoothDevice device);
|
||||||
boolean disconnectAudio();
|
boolean disconnectAudio(in BluetoothDevice device);
|
||||||
void setAudioRouteAllowed(boolean allowed);
|
void setAudioRouteAllowed(in BluetoothDevice device, boolean allowed);
|
||||||
boolean getAudioRouteAllowed();
|
boolean getAudioRouteAllowed(in BluetoothDevice device);
|
||||||
|
|
||||||
Bundle getCurrentAgFeatures(in BluetoothDevice device);
|
Bundle getCurrentAgFeatures(in BluetoothDevice device);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user