Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 234144b5 authored by Jaikumar Ganesh's avatar Jaikumar Ganesh Committed by Android (Google) Code Review
Browse files

Merge "Make profile connection state API public."

parents 7b71e458 9354790f
Loading
Loading
Loading
Loading
+1 −0
Original line number Original line Diff line number Diff line
@@ -4226,6 +4226,7 @@ package android.bluetooth {
    method public java.util.Set<android.bluetooth.BluetoothDevice> getBondedDevices();
    method public java.util.Set<android.bluetooth.BluetoothDevice> getBondedDevices();
    method public static synchronized android.bluetooth.BluetoothAdapter getDefaultAdapter();
    method public static synchronized android.bluetooth.BluetoothAdapter getDefaultAdapter();
    method public java.lang.String getName();
    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 boolean getProfileProxy(android.content.Context, android.bluetooth.BluetoothProfile.ServiceListener, int);
    method public android.bluetooth.BluetoothDevice getRemoteDevice(java.lang.String);
    method public android.bluetooth.BluetoothDevice getRemoteDevice(java.lang.String);
    method public int getScanMode();
    method public int getScanMode();
+9 −8
Original line number Original line Diff line number Diff line
@@ -777,23 +777,24 @@ public final class BluetoothAdapter {
     * Get the current connection state of a profile.
     * Get the current connection state of a profile.
     * This function can be used to check whether the local Bluetooth adapter
     * This function can be used to check whether the local Bluetooth adapter
     * is connected to any remote device for a specific profile.
     * is connected to any remote device for a specific profile.
     * Profile can be one of {@link BluetoothProfile.HEADSET},
     * Profile can be one of {@link BluetoothProfile#HEADSET},
     * {@link BluetoothProfile.A2DP}.
     * {@link BluetoothProfile#A2DP}.
     *
     *
     * <p>Requires {@link android.Manifest.permission#BLUETOOTH}.
     * <p>Requires {@link android.Manifest.permission#BLUETOOTH}.
     *
     *
     * <p> Return value can be one of
     * <p> Return value can be one of
     * {@link * BluetoothProfile.STATE_DISCONNECTED},
     * {@link BluetoothProfile#STATE_DISCONNECTED},
     * {@link * BluetoothProfile.STATE_CONNECTING},
     * {@link BluetoothProfile#STATE_CONNECTING},
     * {@link * BluetoothProfile.STATE_CONNECTED},
     * {@link BluetoothProfile#STATE_CONNECTED},
     * {@link * BluetoothProfile.STATE_DISCONNECTING}
     * {@link BluetoothProfile#STATE_DISCONNECTING}
     * @hide
     */
     */
    public int getProfileConnectionState(int profile) {
    public int getProfileConnectionState(int profile) {
        if (getState() != STATE_ON) return BluetoothProfile.STATE_DISCONNECTED;
        if (getState() != STATE_ON) return BluetoothProfile.STATE_DISCONNECTED;
        try {
        try {
            return mService.getProfileConnectionState(profile);
            return mService.getProfileConnectionState(profile);
        } catch (RemoteException e) {Log.e(TAG, "getProfileConnectionState:", e);}
        } catch (RemoteException e) {
            Log.e(TAG, "getProfileConnectionState:", e);
        }
        return BluetoothProfile.STATE_DISCONNECTED;
        return BluetoothProfile.STATE_DISCONNECTED;
    }
    }