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

Commit fb57449e authored by Andriy Naborskyy's avatar Andriy Naborskyy Committed by Md Shahriar Hossain Sajib
Browse files

ble advertisement: permission check and pass own_address_type to native stack

Test: build passes, IOP and BCST
Tag: #feature
Bug: 155993389
Bug: 199827901
Change-Id: I06f5fa8443a927f2b14e0f674c217cfc19dc2806
parent 1c9e4c30
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -1973,6 +1973,8 @@ static AdvertiseParameters parseParams(JNIEnv* env, jobject i) {
  uint32_t interval = env->CallIntMethod(i, methodId);
  methodId = env->GetMethodID(clazz, "getTxPowerLevel", "()I");
  int8_t txPowerLevel = env->CallIntMethod(i, methodId);
  methodId = env->GetMethodID(clazz, "getOwnAddressType", "()I");
  int8_t ownAddressType = env->CallIntMethod(i, methodId);

  uint16_t props = 0;
  if (isConnectable) props |= 0x01;
@@ -1993,6 +1995,7 @@ static AdvertiseParameters parseParams(JNIEnv* env, jobject i) {
  p.primary_advertising_phy = primaryPhy;
  p.secondary_advertising_phy = secondaryPhy;
  p.scan_request_notification_enable = false;
  p.own_address_type = ownAddressType;
  return p;
}

+3 −0
Original line number Diff line number Diff line
@@ -2583,6 +2583,9 @@ public class GattService extends ProfileService {
                this, attributionSource, "GattService startAdvertisingSet")) {
            return;
        }
        if (parameters.getOwnAddressType() != AdvertisingSetParameters.ADDRESS_TYPE_DEFAULT) {
            Utils.enforceBluetoothPrivilegedPermission(this);
        }
        mAdvertiseManager.startAdvertisingSet(parameters, advertiseData, scanResponse,
                periodicParameters, periodicData, duration, maxExtAdvEvents, callback);
    }