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

Commit c000b1d2 authored by Pradeep Panigrahi's avatar Pradeep Panigrahi Committed by Steve Kondik
Browse files

Bluetooth: Add trust device feature.

Add set trust feature where the remote device is marked
as a trusted device for subsequent connection.

CRs-fixed: 523135

Change-Id: I9bde4d7dfe07d9d63b58a661ed2413f45501bd7b
parent 03e0e555
Loading
Loading
Loading
Loading
+16 −9
Original line number Diff line number Diff line
@@ -863,16 +863,20 @@ public final class BluetoothDevice implements Parcelable {
    /**
     * Get trust state of a remote device.
     * <p>Requires {@link android.Manifest.permission#BLUETOOTH}.
     * @return true/false
     * @hide
     */
    public boolean getTrustState() {
        //TODO(BT)
        /*
        if (sService == null) {
            Log.e(TAG, "BT not enabled. Cannot get Remote Device Alias");
            return false;
        }

        try {
            return sService.getTrustState(this);
            return sService.getRemoteTrust(this);
        } catch (RemoteException e) {
            Log.e(TAG, "", e);
        }*/
        }
        return false;
    }

@@ -880,16 +884,19 @@ public final class BluetoothDevice implements Parcelable {
     * Set trust state for a remote device.
     * <p>Requires {@link android.Manifest.permission#BLUETOOTH_ADMIN}.
     * @param value the trust state value (true or false)
     * @return true/false
     * @hide
     */
    public boolean setTrust(boolean value) {
        //TODO(BT)
        /*
    public boolean setTrust(boolean trustValue) {
        if (sService == null) {
            Log.e(TAG, "BT not enabled. Cannot set Remote Device name");
            return false;
        }
        try {
            return sService.setTrust(this, value);
            return sService.setRemoteTrust(this, trustValue);
        } catch (RemoteException e) {
            Log.e(TAG, "", e);
        }*/
        }
        return false;
    }

+2 −0
Original line number Diff line number Diff line
@@ -63,6 +63,8 @@ interface IBluetooth
    int getRemoteType(in BluetoothDevice device);
    String getRemoteAlias(in BluetoothDevice device);
    boolean setRemoteAlias(in BluetoothDevice device, in String name);
    boolean setRemoteTrust(in BluetoothDevice device, in boolean value);
    boolean getRemoteTrust(in BluetoothDevice device);
    int getRemoteClass(in BluetoothDevice device);
    ParcelUuid[] getRemoteUuids(in BluetoothDevice device);
    boolean fetchRemoteUuids(in BluetoothDevice device);