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

Commit e1536ce9 authored by Chienyuan Huang's avatar Chienyuan Huang
Browse files

Add permission check for directed advertising

Flag: com.android.bluetooth.flags.directed_advertising
Bug: 378230500
Bug: 383304593
Test: m com.andorid.btservices
Change-Id: I720621e6fdfd16da471b2061ccecafb6c6319a9f
parent 8b6cab9e
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -1987,7 +1987,8 @@ public class GattService extends ProfileService {
            return;
        }
        if (parameters.getOwnAddressType() != AdvertisingSetParameters.ADDRESS_TYPE_DEFAULT
                || serverIf != 0) {
                || serverIf != 0
                || parameters.isDirected()) {
            this.enforceCallingOrSelfPermission(BLUETOOTH_PRIVILEGED, null);
        }
        mAdvertiseManager.startAdvertisingSet(
+11 −11
Original line number Diff line number Diff line
@@ -269,9 +269,9 @@ public final class BluetoothLeAdvertiser {
     * method returns immediately, the operation status is delivered through {@code
     * callback.onAdvertisingSetStarted()}.
     *
     * <p>Requires the {@link android.Manifest.permission#BLUETOOTH_PRIVILEGED} permission only when
     * <p>Requires the {@link android.Manifest.permission#BLUETOOTH_PRIVILEGED} permission when
     * {@code parameters.getOwnAddressType()} is different from {@code
     * AdvertisingSetParameters.ADDRESS_TYPE_DEFAULT}.
     * AdvertisingSetParameters.ADDRESS_TYPE_DEFAULT} or {@code parameters.isDirected()} is true.
     *
     * <p>The {@link android.Manifest.permission#BLUETOOTH_ADVERTISE} permission is always enforced.
     *
@@ -319,9 +319,9 @@ public final class BluetoothLeAdvertiser {
     * method returns immediately, the operation status is delivered through {@code
     * callback.onAdvertisingSetStarted()}.
     *
     * <p>Requires the {@link android.Manifest.permission#BLUETOOTH_PRIVILEGED} permission only when
     * <p>Requires the {@link android.Manifest.permission#BLUETOOTH_PRIVILEGED} permission when
     * {@code parameters.getOwnAddressType()} is different from {@code
     * AdvertisingSetParameters.ADDRESS_TYPE_DEFAULT}.
     * AdvertisingSetParameters.ADDRESS_TYPE_DEFAULT} or {@code parameters.isDirected()} is true.
     *
     * <p>The {@link android.Manifest.permission#BLUETOOTH_ADVERTISE} permission is always enforced.
     *
@@ -371,9 +371,9 @@ public final class BluetoothLeAdvertiser {
     * method returns immediately, the operation status is delivered through {@code
     * callback.onAdvertisingSetStarted()}.
     *
     * <p>Requires the {@link android.Manifest.permission#BLUETOOTH_PRIVILEGED} permission only when
     * <p>Requires the {@link android.Manifest.permission#BLUETOOTH_PRIVILEGED} permission when
     * {@code parameters.getOwnAddressType()} is different from {@code
     * AdvertisingSetParameters.ADDRESS_TYPE_DEFAULT}.
     * AdvertisingSetParameters.ADDRESS_TYPE_DEFAULT} or {@code parameters.isDirected()} is true.
     *
     * <p>The {@link android.Manifest.permission#BLUETOOTH_ADVERTISE} permission is always enforced.
     *
@@ -428,9 +428,9 @@ public final class BluetoothLeAdvertiser {
     * method returns immediately, the operation status is delivered through {@code
     * callback.onAdvertisingSetStarted()}.
     *
     * <p>Requires the {@link android.Manifest.permission#BLUETOOTH_PRIVILEGED} permission only when
     * <p>Requires the {@link android.Manifest.permission#BLUETOOTH_PRIVILEGED} permission when
     * {@code parameters.getOwnAddressType()} is different from {@code
     * AdvertisingSetParameters.ADDRESS_TYPE_DEFAULT}.
     * AdvertisingSetParameters.ADDRESS_TYPE_DEFAULT} or {@code parameters.isDirected()} is true.
     *
     * <p>The {@link android.Manifest.permission#BLUETOOTH_ADVERTISE} permission is always enforced.
     *
@@ -494,10 +494,10 @@ public final class BluetoothLeAdvertiser {
     * services/characteristics in this server, rather than the union of all GATT services (across
     * all opened servers).
     *
     * <p>Requires the {@link android.Manifest.permission#BLUETOOTH_PRIVILEGED} permission only when
     * <p>Requires the {@link android.Manifest.permission#BLUETOOTH_PRIVILEGED} permission when
     * {@code parameters.getOwnAddressType()} is different from {@code
     * AdvertisingSetParameters.ADDRESS_TYPE_DEFAULT} or when the {@code gattServer} is already
     * registered
     * AdvertisingSetParameters.ADDRESS_TYPE_DEFAULT} or {@code parameters.isDirected()} is true or
     * when the {@code gattServer} is already registered
     *
     * <p>The {@link android.Manifest.permission#BLUETOOTH_ADVERTISE} permission is always enforced.
     *