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

Commit 9354790f authored by Jaikumar Ganesh's avatar Jaikumar Ganesh
Browse files

Make profile connection state API public.

Change-Id: I1f2810d4e820142435f7bbda051c98ec3e3cf3eb
parent f9838d0b
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -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();
+9 −8
Original line number Diff line number Diff line
@@ -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;
    }