Merge "Add Bluetooth headset API to allow disabling audio route." into cw-e-dev am: cb8749c903 am: 0fa22022a3 am: e2861471b9
am: 52d93db91d
* commit '52d93db91dcf883f236c7b1e75d1dd4b2421a1d3':
Add Bluetooth headset API to allow disabling audio route.
This commit is contained in:
@@ -684,6 +684,48 @@ public final class BluetoothHeadset implements BluetoothProfile {
|
|||||||
return BluetoothHeadset.STATE_AUDIO_DISCONNECTED;
|
return BluetoothHeadset.STATE_AUDIO_DISCONNECTED;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets whether audio routing is allowed. When set to {@code false}, the AG will not route any
|
||||||
|
* audio to the HF unless explicitly told to.
|
||||||
|
* This method should be used in cases where the SCO channel is shared between multiple profiles
|
||||||
|
* and must be delegated by a source knowledgeable
|
||||||
|
* Note: This is an internal function and shouldn't be exposed
|
||||||
|
*
|
||||||
|
* @param allowed {@code true} if the profile can reroute audio, {@code false} otherwise.
|
||||||
|
*
|
||||||
|
* @hide
|
||||||
|
*/
|
||||||
|
public void setAudioRouteAllowed(boolean allowed) {
|
||||||
|
if (VDBG) log("setAudioRouteAllowed");
|
||||||
|
if (mService != null && isEnabled()) {
|
||||||
|
try {
|
||||||
|
mService.setAudioRouteAllowed(allowed);
|
||||||
|
} 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()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns whether audio routing is allowed. see {@link #setAudioRouteAllowed(boolean)}.
|
||||||
|
* Note: This is an internal function and shouldn't be exposed
|
||||||
|
*
|
||||||
|
* @hide
|
||||||
|
*/
|
||||||
|
public boolean getAudioRouteAllowed() {
|
||||||
|
if (VDBG) log("getAudioRouteAllowed");
|
||||||
|
if (mService != null && isEnabled()) {
|
||||||
|
try {
|
||||||
|
return mService.getAudioRouteAllowed();
|
||||||
|
} 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;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check if Bluetooth SCO audio is connected.
|
* Check if Bluetooth SCO audio is connected.
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -50,6 +50,8 @@ interface IBluetoothHeadset {
|
|||||||
boolean isAudioOn();
|
boolean isAudioOn();
|
||||||
boolean connectAudio();
|
boolean connectAudio();
|
||||||
boolean disconnectAudio();
|
boolean disconnectAudio();
|
||||||
|
void setAudioRouteAllowed(boolean allowed);
|
||||||
|
boolean getAudioRouteAllowed();
|
||||||
boolean startScoUsingVirtualVoiceCall(in BluetoothDevice device);
|
boolean startScoUsingVirtualVoiceCall(in BluetoothDevice device);
|
||||||
boolean stopScoUsingVirtualVoiceCall(in BluetoothDevice device);
|
boolean stopScoUsingVirtualVoiceCall(in BluetoothDevice device);
|
||||||
void phoneStateChanged(int numActive, int numHeld, int callState, String number, int type);
|
void phoneStateChanged(int numActive, int numHeld, int callState, String number, int type);
|
||||||
|
|||||||
Reference in New Issue
Block a user