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

Commit 1ff419fc authored by Pradeep Panigrahi's avatar Pradeep Panigrahi Committed by Linux Build Service Account
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
(cherry picked from commit 7ba8616bb2ba13558cdf0f00d7e1ae5b38a6ba53)
(cherry picked from commit 9bda1cf301ea06b0873d28fe1b0fcadaf2b1fb73)
(cherry picked from commit 50f4f58ae97f433b68e79a14cb662a7db9b410c9)
parent f249071f
Loading
Loading
Loading
Loading
+16 −9
Original line number Diff line number Diff line
@@ -878,16 +878,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;
    }

@@ -895,16 +899,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);