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

Commit dfc2e8e7 authored by Treehugger Robot's avatar Treehugger Robot Committed by Gerrit Code Review
Browse files

Merge "Bluetooth 5 feature check implementation (3/3)"

parents d4e63485 0b2a78a8
Loading
Loading
Loading
Loading
+36 −0
Original line number Diff line number Diff line
@@ -78,6 +78,10 @@ class AdapterProperties {
    private boolean mIsExtendedScanSupported;
    private boolean mIsDebugLogSupported;
    private boolean mIsActivityAndEnergyReporting;
    private boolean mIsLe2MPhySupported;
    private boolean mIsLeCodedPhySupported;
    private boolean mIsLeExtendedAdvertisingSupported;
    private boolean mIsLePeriodicAdvertisingSupported;

    private BroadcastReceiver mReceiver = new BroadcastReceiver() {
        @Override
@@ -280,6 +284,34 @@ class AdapterProperties {
        return mIsActivityAndEnergyReporting;
    }

    /**
     * @return the mIsLe2MPhySupported
     */
    boolean isLe2MPhySupported() {
        return mIsLe2MPhySupported;
    }

    /**
     * @return the mIsLeCodedPhySupported
     */
    boolean isLeCodedPhySupported() {
        return mIsLeCodedPhySupported;
    }

    /**
     * @return the mIsLeExtendedAdvertisingSupported
     */
    boolean isLeExtendedAdvertisingSupported() {
        return mIsLeExtendedAdvertisingSupported;
    }

    /**
     * @return the mIsLePeriodicAdvertisingSupported
     */
    boolean isLePeriodicAdvertisingSupported() {
        return mIsLePeriodicAdvertisingSupported;
    }

    /**
     * @return total number of trackable advertisements
     */
@@ -593,6 +625,10 @@ class AdapterProperties {
                            + (0xFF & ((int)val[10]));
        mIsExtendedScanSupported = ((0xFF & ((int)val[12])) != 0);
        mIsDebugLogSupported = ((0xFF & ((int)val[13])) != 0);
        mIsLe2MPhySupported = ((0xFF & ((int) val[14])) != 0);
        mIsLeCodedPhySupported = ((0xFF & ((int) val[15])) != 0);
        mIsLeExtendedAdvertisingSupported = ((0xFF & ((int) val[16])) != 0);
        mIsLePeriodicAdvertisingSupported = ((0xFF & ((int) val[17])) != 0);

        Log.d(TAG, "BT_PROPERTY_LOCAL_LE_FEATURES: update from BT controller"
                + " mNumOfAdvertisementInstancesSupported = "
+32 −4
Original line number Diff line number Diff line
@@ -1333,19 +1333,27 @@ public class AdapterService extends Service {
         }

         public boolean isLe2MPhySupported() {
             return false;
             AdapterService service = getService();
             if (service == null) return false;
             return service.isLe2MPhySupported();
         }

         public boolean isLeCodedPhySupported() {
             return false;
             AdapterService service = getService();
             if (service == null) return false;
             return service.isLeCodedPhySupported();
         }

         public boolean isLeExtendedAdvertisingSupported() {
             return false;
             AdapterService service = getService();
             if (service == null) return false;
             return service.isLeExtendedAdvertisingSupported();
         }

         public boolean isLePeriodicAdvertisingSupported() {
             return false;
             AdapterService service = getService();
             if (service == null) return false;
             return service.isLePeriodicAdvertisingSupported();
         }

         public boolean isActivityAndEnergyReportingSupported() {
@@ -1895,6 +1903,26 @@ public class AdapterService extends Service {
        return mAdapterProperties.isActivityAndEnergyReportingSupported();
    }

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

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

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

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

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