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

Commit b6e743e5 authored by Ömer Faruk Yılmaz's avatar Ömer Faruk Yılmaz Committed by Gerrit Code Review
Browse files

Merge changes from topic "scan-manager-refactor" into main

* changes:
  Move ScanClient from package `gatt` to `le_scan`
  Move ScanFilterQueue from package `gatt` to `le_scan`
parents fb92adb2 2b32e429
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -2589,7 +2589,7 @@ static int register_com_android_bluetooth_gatt_scan(JNIEnv* env) {
      {"gattClientScanFilterParamClearAllNative", "(I)V",
       (void*)gattClientScanFilterParamClearAllNative},
      {"gattClientScanFilterAddNative",
       "(I[Lcom/android/bluetooth/gatt/ScanFilterQueue$Entry;I)V",
       "(I[Lcom/android/bluetooth/le_scan/ScanFilterQueue$Entry;I)V",
       (void*)gattClientScanFilterAddNative},
      {"gattClientScanFilterClearNative", "(II)V",
       (void*)gattClientScanFilterClearNative},
+2 −2
Original line number Diff line number Diff line
@@ -381,7 +381,7 @@
        id="SimpleDateFormat"
        message="To get local formatting use `getDateInstance()`, `getDateTimeInstance()`, or `getTimeInstance()`, or use `new SimpleDateFormat(String template, Locale locale)` with for example `Locale.US` for ASCII dates.">
        <location
            file="packages/modules/Bluetooth/android/app/src/com/android/bluetooth/gatt/AppScanStats.java"
            file="packages/modules/Bluetooth/android/app/src/com/android/bluetooth/le_scan/AppScanStats.java"
            line="51"/>
    </issue>

+1 −0
Original line number Diff line number Diff line
@@ -98,6 +98,7 @@ import com.android.bluetooth.flags.FeatureFlagsImpl;
import com.android.bluetooth.flags.Flags;
import com.android.bluetooth.le_scan.AppScanStats;
import com.android.bluetooth.le_scan.PeriodicScanManager;
import com.android.bluetooth.le_scan.ScanClient;
import com.android.bluetooth.le_scan.ScanManager;
import com.android.bluetooth.util.NumberUtils;
import com.android.internal.annotations.VisibleForTesting;
+4 −6
Original line number Diff line number Diff line
@@ -14,15 +14,13 @@
 * limitations under the License.
 */

package com.android.bluetooth.gatt;
package com.android.bluetooth.le_scan;

import android.bluetooth.le.ScanFilter;
import android.bluetooth.le.ScanSettings;
import android.os.Binder;
import android.os.UserHandle;

import com.android.bluetooth.le_scan.AppScanStats;

import java.util.List;
import java.util.Objects;

@@ -55,7 +53,7 @@ public class ScanClient {
    private static final ScanSettings DEFAULT_SCAN_SETTINGS =
            new ScanSettings.Builder().setScanMode(ScanSettings.SCAN_MODE_LOW_LATENCY).build();

    ScanClient(int scannerId) {
    public ScanClient(int scannerId) {
        this(scannerId, DEFAULT_SCAN_SETTINGS, null);
    }

@@ -63,7 +61,7 @@ public class ScanClient {
        this(scannerId, settings, filters, Binder.getCallingUid());
    }

    ScanClient(int scannerId, ScanSettings settings, List<ScanFilter> filters, int appUid) {
    public ScanClient(int scannerId, ScanSettings settings, List<ScanFilter> filters, int appUid) {
        this.scannerId = scannerId;
        this.settings = settings;
        this.scanModeApp = settings.getScanMode();
@@ -106,7 +104,7 @@ public class ScanClient {
     * @param newScanMode
     * @return true if scan settings are updated, false otherwise.
     */
    public boolean updateScanMode(int newScanMode) {
    boolean updateScanMode(int newScanMode) {
        if (settings.getScanMode() == newScanMode) {
            return false;
        }
+6 −6
Original line number Diff line number Diff line
@@ -14,7 +14,7 @@
 * limitations under the License.
 */

package com.android.bluetooth.gatt;
package com.android.bluetooth.le_scan;

import android.bluetooth.BluetoothAssignedNumbers.OrganizationId;
import android.bluetooth.BluetoothUuid;
@@ -33,7 +33,7 @@ import java.util.UUID;
 *
 * @hide
 */
public class ScanFilterQueue {
/* package */ class ScanFilterQueue {
    public static final int TYPE_DEVICE_ADDRESS = 0;
    public static final int TYPE_SERVICE_DATA_CHANGED = 1;
    public static final int TYPE_SERVICE_UUID = 2;
@@ -54,7 +54,7 @@ public class ScanFilterQueue {
    public static final int TYPE_INVALID = 0x00;
    public static final int TYPE_WIFI_NAN_HASH = 0x01; // WIFI NAN HASH type

    public static class Entry {
    static class Entry {
        public byte type;
        public String address;
        public byte addr_type;
@@ -195,7 +195,7 @@ public class ScanFilterQueue {
    /**
     * Compute feature selection based on the filters presented.
     */
    public int getFeatureSelection() {
    int getFeatureSelection() {
        int selc = 0;
        for (Entry entry : mEntries) {
            selc |= (1 << entry.type);
@@ -203,14 +203,14 @@ public class ScanFilterQueue {
        return selc;
    }

    public ScanFilterQueue.Entry[] toArray() {
    ScanFilterQueue.Entry[] toArray() {
        return mEntries.toArray(new ScanFilterQueue.Entry[mEntries.size()]);
    }

    /**
     * Add ScanFilter to scan filter queue.
     */
    public void addScanFilter(ScanFilter filter) {
    void addScanFilter(ScanFilter filter) {
        if (filter == null) {
            return;
        }
Loading