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

Commit f600698e authored by Jakub Pawlowski's avatar Jakub Pawlowski Committed by Gerrit Code Review
Browse files

Merge "LE Maximum Advertising Data Length (2/4)"

parents bd8d38d5 997a7b32
Loading
Loading
Loading
Loading
+20 −0
Original line number Diff line number Diff line
@@ -82,6 +82,7 @@ class AdapterProperties {
    private boolean mIsLeCodedPhySupported;
    private boolean mIsLeExtendedAdvertisingSupported;
    private boolean mIsLePeriodicAdvertisingSupported;
    private int mLeMaximumAdvertisingDataLength;

    private BroadcastReceiver mReceiver = new BroadcastReceiver() {
        @Override
@@ -312,6 +313,13 @@ class AdapterProperties {
        return mIsLePeriodicAdvertisingSupported;
    }

    /**
     * @return the getLeMaximumAdvertisingDataLength
     */
    int getLeMaximumAdvertisingDataLength() {
        return mLeMaximumAdvertisingDataLength;
    }

    /**
     * @return total number of trackable advertisements
     */
@@ -629,6 +637,8 @@ class AdapterProperties {
        mIsLeCodedPhySupported = ((0xFF & ((int) val[15])) != 0);
        mIsLeExtendedAdvertisingSupported = ((0xFF & ((int) val[16])) != 0);
        mIsLePeriodicAdvertisingSupported = ((0xFF & ((int) val[17])) != 0);
        mLeMaximumAdvertisingDataLength =   (0xFF & ((int)val[18]))
                                         + ((0xFF & ((int)val[19])) << 8);

        Log.d(TAG, "BT_PROPERTY_LOCAL_LE_FEATURES: update from BT controller"
                + " mNumOfAdvertisementInstancesSupported = "
@@ -650,6 +660,16 @@ class AdapterProperties {
                + mIsExtendedScanSupported
                + " mIsDebugLogSupported = "
                + mIsDebugLogSupported
                + " mIsLe2MPhySupported = "
                + mIsLe2MPhySupported
                + " mIsLeCodedPhySupported = "
                + mIsLeCodedPhySupported
                + " mIsLeExtendedAdvertisingSupported = "
                + mIsLeExtendedAdvertisingSupported
                + " mIsLePeriodicAdvertisingSupported = "
                + mIsLePeriodicAdvertisingSupported
                + " mLeMaximumAdvertisingDataLength = "
                + mLeMaximumAdvertisingDataLength
                );
    }

+11 −0
Original line number Diff line number Diff line
@@ -1352,6 +1352,12 @@ public class AdapterService extends Service {
             return service.isLePeriodicAdvertisingSupported();
         }

         public int getLeMaximumAdvertisingDataLength() {
             AdapterService service = getService();
             if (service == null) return 0;
             return service.getLeMaximumAdvertisingDataLength();
         }

         public boolean isActivityAndEnergyReportingSupported() {
             AdapterService service = getService();
             if (service == null) return false;
@@ -1919,6 +1925,11 @@ public class AdapterService extends Service {
        return mAdapterProperties.isLePeriodicAdvertisingSupported();
    }

    public int getLeMaximumAdvertisingDataLength() {
        enforceCallingOrSelfPermission(BLUETOOTH_PERM, "Need BLUETOOTH permission");
        return mAdapterProperties.getLeMaximumAdvertisingDataLength();
    }

    private BluetoothActivityEnergyInfo reportActivityInfo() {
        enforceCallingOrSelfPermission(BLUETOOTH_PRIVILEGED, "Need BLUETOOTH permission");
        if (mAdapterProperties.getState() != BluetoothAdapter.STATE_ON ||