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

Commit 0aba4ae6 authored by Ömer Faruk Yılmaz's avatar Ömer Faruk Yılmaz
Browse files

Move ScanNativeInterface from package `gatt` to `le_scan`

See go/scan-manager-refactor for more details.

Test: m com.android.btservices
Bug: 313335632
Bug: 267361243
Change-Id: Id764e4a7626ff44540e7be98de8266b2415459aa
parent a147ee3e
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -2599,7 +2599,7 @@ static int register_com_android_bluetooth_gatt_scan(JNIEnv* env) {
       (void*)gattSetScanParametersNative},
  };
  return REGISTER_NATIVE_METHODS(
      env, "com/android/bluetooth/gatt/ScanNativeInterface", methods);
      env, "com/android/bluetooth/le_scan/ScanNativeInterface", methods);
}

static int register_com_android_bluetooth_gatt_advertise_manager(JNIEnv* env) {
+1 −0
Original line number Diff line number Diff line
@@ -25,6 +25,7 @@ import com.android.bluetooth.btservice.BluetoothAdapterProxy;
import com.android.bluetooth.flags.FeatureFlags;
import com.android.bluetooth.le_scan.PeriodicScanManager;
import com.android.bluetooth.le_scan.ScanManager;
import com.android.bluetooth.le_scan.ScanNativeInterface;

/**
 * Factory class for object initialization to help with unit testing
+1 −1
Original line number Diff line number Diff line
@@ -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

    class Entry {
    public static class Entry {
        public byte type;
        public String address;
        public byte addr_type;
+0 −1
Original line number Diff line number Diff line
@@ -54,7 +54,6 @@ import com.android.bluetooth.gatt.GattService;
import com.android.bluetooth.gatt.GattServiceConfig;
import com.android.bluetooth.gatt.ScanClient;
import com.android.bluetooth.gatt.ScanFilterQueue;
import com.android.bluetooth.gatt.ScanNativeInterface;
import com.android.internal.annotations.GuardedBy;
import com.android.internal.annotations.VisibleForTesting;

+7 −4
Original line number Diff line number Diff line
@@ -14,7 +14,10 @@
 * limitations under the License.
 */

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

import com.android.bluetooth.gatt.FilterParams;
import com.android.bluetooth.gatt.ScanFilterQueue;

import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit;
@@ -176,16 +179,16 @@ public class ScanNativeInterface {
        gattClientReadScanReportsNative(clientIf, scanType);
    }

    public void callbackDone() {
    void callbackDone() {
        mLatch.countDown();
    }

    public void resetCountDownLatch() {
    void resetCountDownLatch() {
        mLatch = new CountDownLatch(1);
    }

    // Returns true if mLatch reaches 0, false if timeout or interrupted.
    public boolean waitForCallback(int timeoutMs) {
    boolean waitForCallback(int timeoutMs) {
        try {
            return mLatch.await(timeoutMs, TimeUnit.MILLISECONDS);
        } catch (InterruptedException e) {
Loading