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

Commit 2ddd0f73 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Automerger Merge Worker
Browse files

Merge "Fix BLE scan result filtering in CompanionDeviceManager." into rvc-dev...

Merge "Fix BLE scan result filtering in CompanionDeviceManager." into rvc-dev am: d43f5fff am: 6cf71932

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/11733921

Change-Id: I4dfa9a45ea62c0818eedb05ad821c293500f62ad
parents d0e74868 6cf71932
Loading
Loading
Loading
Loading
+0 −7
Original line number Diff line number Diff line
@@ -51,13 +51,6 @@ public class BluetoothDeviceFilterUtils {
        return s == null ? null : Pattern.compile(s);
    }

    static boolean matches(ScanFilter filter, BluetoothDevice device) {
        boolean result = matchesAddress(filter.getDeviceAddress(), device)
                && matchesServiceUuid(filter.getServiceUuid(), filter.getServiceUuidMask(), device);
        if (DEBUG) debugLogMatchResult(result, device, filter);
        return result;
    }

    static boolean matchesAddress(String deviceAddress, BluetoothDevice device) {
        final boolean result = deviceAddress == null
                || (device != null && deviceAddress.equals(device.getAddress()));
+5 −9
Original line number Diff line number Diff line
@@ -37,7 +37,6 @@ import android.util.Log;

import com.android.internal.util.BitUtils;
import com.android.internal.util.ObjectUtils;
import com.android.internal.util.Preconditions;

import libcore.util.HexEncoding;

@@ -166,21 +165,18 @@ public final class BluetoothLeDeviceFilter implements DeviceFilter<ScanResult> {

    /** @hide */
    @Override
    public boolean matches(ScanResult device) {
        boolean result = matches(device.getDevice())
    public boolean matches(ScanResult scanResult) {
        BluetoothDevice device = scanResult.getDevice();
        boolean result = getScanFilter().matches(scanResult)
                && BluetoothDeviceFilterUtils.matchesName(getNamePattern(), device)
                && (mRawDataFilter == null
                    || BitUtils.maskedEquals(device.getScanRecord().getBytes(),
                    || BitUtils.maskedEquals(scanResult.getScanRecord().getBytes(),
                            mRawDataFilter, mRawDataFilterMask));
        if (DEBUG) Log.i(LOG_TAG, "matches(this = " + this + ", device = " + device +
                ") -> " + result);
        return result;
    }

    private boolean matches(BluetoothDevice device) {
        return BluetoothDeviceFilterUtils.matches(getScanFilter(), device)
                && BluetoothDeviceFilterUtils.matchesName(getNamePattern(), device);
    }

    /** @hide */
    @Override
    public int getMediumType() {