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

Commit 30ad5333 authored by Rahul Sabnis's avatar Rahul Sabnis Committed by android-build-merger
Browse files

Merge "Create systemapis to connect/disconnect all bt profiles" am: 1f887775

am: 29cddeb3

Change-Id: I391f50f749bcf0ab215efb8814ee3037ae407c2a
parents e45e29c5 29cddeb3
Loading
Loading
Loading
Loading
+50 −0
Original line number Diff line number Diff line
@@ -1733,6 +1733,56 @@ public final class BluetoothAdapter {
        return false;
    }

    /**
     * Connects all enabled and supported bluetooth profiles between the local and remote device
     *
     * @param device is the remote device with which to connect these profiles
     * @return true if all profiles successfully connected, false if an error occurred
     *
     * @hide
     */
    @SystemApi
    @RequiresPermission(Manifest.permission.BLUETOOTH_ADMIN)
    public boolean connectAllEnabledProfiles(@NonNull BluetoothDevice device) {
        try {
            mServiceLock.readLock().lock();
            if (mService != null) {
                return mService.connectAllEnabledProfiles(device);
            }
        } catch (RemoteException e) {
            Log.e(TAG, "", e);
        } finally {
            mServiceLock.readLock().unlock();
        }

        return false;
    }

    /**
     * Disconnects all enabled and supported bluetooth profiles between the local and remote device
     *
     * @param device is the remote device with which to disconnect these profiles
     * @return true if all profiles successfully disconnected, false if an error occurred
     *
     * @hide
     */
    @SystemApi
    @RequiresPermission(Manifest.permission.BLUETOOTH_ADMIN)
    public boolean disconnectAllEnabledProfiles(@NonNull BluetoothDevice device) {
        try {
            mServiceLock.readLock().lock();
            if (mService != null) {
                return mService.disconnectAllEnabledProfiles(device);
            }
        } catch (RemoteException e) {
            Log.e(TAG, "", e);
        } finally {
            mServiceLock.readLock().unlock();
        }

        return false;
    }

    /**
     * Return true if the multi advertisement is supported by the chipset
     *