Merge "Make profile connection state API public."
This commit is contained in:
committed by
Android (Google) Code Review
commit
234144b56a
@@ -4226,6 +4226,7 @@ package android.bluetooth {
|
||||
method public java.util.Set<android.bluetooth.BluetoothDevice> getBondedDevices();
|
||||
method public static synchronized android.bluetooth.BluetoothAdapter getDefaultAdapter();
|
||||
method public java.lang.String getName();
|
||||
method public int getProfileConnectionState(int);
|
||||
method public boolean getProfileProxy(android.content.Context, android.bluetooth.BluetoothProfile.ServiceListener, int);
|
||||
method public android.bluetooth.BluetoothDevice getRemoteDevice(java.lang.String);
|
||||
method public int getScanMode();
|
||||
|
||||
@@ -777,23 +777,24 @@ public final class BluetoothAdapter {
|
||||
* Get the current connection state of a profile.
|
||||
* This function can be used to check whether the local Bluetooth adapter
|
||||
* is connected to any remote device for a specific profile.
|
||||
* Profile can be one of {@link BluetoothProfile.HEADSET},
|
||||
* {@link BluetoothProfile.A2DP}.
|
||||
* Profile can be one of {@link BluetoothProfile#HEADSET},
|
||||
* {@link BluetoothProfile#A2DP}.
|
||||
*
|
||||
* <p>Requires {@link android.Manifest.permission#BLUETOOTH}.
|
||||
*
|
||||
* <p> Return value can be one of
|
||||
* {@link * BluetoothProfile.STATE_DISCONNECTED},
|
||||
* {@link * BluetoothProfile.STATE_CONNECTING},
|
||||
* {@link * BluetoothProfile.STATE_CONNECTED},
|
||||
* {@link * BluetoothProfile.STATE_DISCONNECTING}
|
||||
* @hide
|
||||
* {@link BluetoothProfile#STATE_DISCONNECTED},
|
||||
* {@link BluetoothProfile#STATE_CONNECTING},
|
||||
* {@link BluetoothProfile#STATE_CONNECTED},
|
||||
* {@link BluetoothProfile#STATE_DISCONNECTING}
|
||||
*/
|
||||
public int getProfileConnectionState(int profile) {
|
||||
if (getState() != STATE_ON) return BluetoothProfile.STATE_DISCONNECTED;
|
||||
try {
|
||||
return mService.getProfileConnectionState(profile);
|
||||
} catch (RemoteException e) {Log.e(TAG, "getProfileConnectionState:", e);}
|
||||
} catch (RemoteException e) {
|
||||
Log.e(TAG, "getProfileConnectionState:", e);
|
||||
}
|
||||
return BluetoothProfile.STATE_DISCONNECTED;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user