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

Commit 4190762d authored by Wei Wang's avatar Wei Wang Committed by Tom Turney
Browse files

Add opportunistic ble scan mode. (1/2)

Bug: 19003667
Change-Id: Ibed7e9ec604cb11a58736d168d3d19ece53fc77a
(cherry picked from commit 7508ddf8b53bf350a3424ef71f1ce62ea17006b8)
parent 3698af5f
Loading
Loading
Loading
Loading
+10 −1
Original line number Diff line number Diff line
@@ -25,6 +25,15 @@ import android.os.Parcelable;
 * parameters for the scan.
 */
public final class ScanSettings implements Parcelable {

    /**
     * A special Bluetooth LE scan mode. Applications using this scan mode will passively listen for
     * other scan results without starting BLE scans themselves.
     *
     * @hide
     */
    public static final int SCAN_MODE_OPPORTUNISTIC = -1;

    /**
     * Perform Bluetooth LE scan in low power mode. This is the default scan mode as it consumes the
     * least power.
@@ -177,7 +186,7 @@ public final class ScanSettings implements Parcelable {
         * @throws IllegalArgumentException If the {@code scanMode} is invalid.
         */
        public Builder setScanMode(int scanMode) {
            if (scanMode < SCAN_MODE_LOW_POWER || scanMode > SCAN_MODE_LOW_LATENCY) {
            if (scanMode < SCAN_MODE_OPPORTUNISTIC || scanMode > SCAN_MODE_LOW_LATENCY) {
                throw new IllegalArgumentException("invalid scan mode " + scanMode);
            }
            mScanMode = scanMode;