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

Commit 3f0aa505 authored by Wei Wang's avatar Wei Wang Committed by Android Git Automerger
Browse files

am 34020eb6: Merge "Add support of advertising through standard instance.(1/4)" into lmp-sprout-dev

* commit '34020eb6':
  Add support of advertising through standard instance.(1/4)
parents 4f89e3b2 34020eb6
Loading
Loading
Loading
Loading
+17 −1
Original line number Diff line number Diff line
@@ -464,7 +464,8 @@ public final class BluetoothAdapter {
        if (getState() != STATE_ON) {
            return null;
        }
        if (!isMultipleAdvertisementSupported()) {
        if (!isMultipleAdvertisementSupported() && !isPeripheralModeSupported()) {
            Log.e(TAG, "bluetooth le advertising not supported");
            return null;
        }
        synchronized(mLock) {
@@ -916,6 +917,21 @@ public final class BluetoothAdapter {
        return false;
    }

    /**
     * Returns whether peripheral mode is supported.
     *
     * @hide
     */
    public boolean isPeripheralModeSupported() {
        if (getState() != STATE_ON) return false;
        try {
            return mService.isPeripheralModeSupported();
        } catch (RemoteException e) {
            Log.e(TAG, "failed to get peripheral mode capability: ", e);
        }
        return false;
    }

    /**
     * Return true if offloaded filters are supported
     *
+1 −0
Original line number Diff line number Diff line
@@ -92,6 +92,7 @@ interface IBluetooth
    boolean configHciSnoopLog(boolean enable);

    boolean isMultiAdvertisementSupported();
    boolean isPeripheralModeSupported();
    boolean isOffloadedFilteringSupported();
    boolean isOffloadedScanBatchingSupported();
    boolean isActivityAndEnergyReportingSupported();
+2 −1
Original line number Diff line number Diff line
@@ -111,7 +111,8 @@ public final class BluetoothLeAdvertiser {
            if (callback == null) {
                throw new IllegalArgumentException("callback cannot be null");
            }
            if (!mBluetoothAdapter.isMultipleAdvertisementSupported()) {
            if (!mBluetoothAdapter.isMultipleAdvertisementSupported() &&
                    !mBluetoothAdapter.isPeripheralModeSupported()) {
                postStartFailure(callback,
                        AdvertiseCallback.ADVERTISE_FAILED_FEATURE_UNSUPPORTED);
                return;