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

Commit 5615c053 authored by Jayden Kim's avatar Jayden Kim
Browse files

Add conditional privileged permission annotation on pbap client

This change is just required along with adding bluetooth socket offload option, but it not actually used by the pbap client.

Bug: 342012881
Bug: 367419086
Test: atest com.android.bluetooth.pbapclient
Test: m com.android.btservices

Change-Id: Ib17b46b73667177b19e4ac8c6ae79e988f926fde
parent aa0a9cb5
Loading
Loading
Loading
Loading
+4 −1
Original line number Diff line number Diff line
@@ -17,6 +17,7 @@
package com.android.bluetooth.pbapclient;

import static android.Manifest.permission.BLUETOOTH_CONNECT;
import static android.Manifest.permission.BLUETOOTH_PRIVILEGED;

import android.accounts.Account;
import android.annotation.RequiresPermission;
@@ -468,7 +469,9 @@ class PbapClientObexClient {

    /* Utilize SDP, if available, to create a socket connection over L2CAP, RFCOMM specified
     * channel, or RFCOMM default channel. */
    @RequiresPermission(BLUETOOTH_CONNECT)
    @RequiresPermission(
            allOf = {BLUETOOTH_CONNECT, BLUETOOTH_PRIVILEGED},
            conditional = true)
    private PbapClientSocket connectSocket(int transport, int channelOrPsm) {
        debug(
                "Connect socket, transport="
+4 −1
Original line number Diff line number Diff line
@@ -17,6 +17,7 @@
package com.android.bluetooth.pbapclient;

import static android.Manifest.permission.BLUETOOTH_CONNECT;
import static android.Manifest.permission.BLUETOOTH_PRIVILEGED;

import android.annotation.RequiresPermission;
import android.bluetooth.BluetoothDevice;
@@ -101,7 +102,9 @@ public class PbapClientSocket {
    }

    /** Invokes the underlying BluetoothSocket#connect(), or does nothing if a socket is injected */
    @RequiresPermission(BLUETOOTH_CONNECT)
    @RequiresPermission(
            allOf = {BLUETOOTH_CONNECT, BLUETOOTH_PRIVILEGED},
            conditional = true)
    public void connect() throws IOException {
        if (mSocket != null) {
            mSocket.connect();