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

Commit f5a85835 authored by Charlie Boutier's avatar Charlie Boutier Committed by Gerrit Code Review
Browse files

Merge changes I133a17ed,I943fad28 into main

* changes:
  HidHostTests: Skip HID tests due to breakage
  BumbleBluetoothTests: Thread accept pairing logic
parents a82aaf80 451eb954
Loading
Loading
Loading
Loading
+16 −6
Original line number Diff line number Diff line
@@ -72,13 +72,17 @@ public class Host(context: Context) : Closeable {
        runBlocking(scope.coroutineContext) {
            withTimeout(TIMEOUT) {
                Truth.assertThat(remoteDevice.createBond()).isTrue()
                val pairingRequestJob = launch {
                    Log.d(TAG, "Waiting for ACTION_PAIRING_REQUEST")
                    flow
                    .filter { it.getAction() == BluetoothDevice.ACTION_PAIRING_REQUEST }
                        .filter { it.action == BluetoothDevice.ACTION_PAIRING_REQUEST }
                        .filter { it.getBluetoothDeviceExtra() == remoteDevice }
                        .first()

                    remoteDevice.setPairingConfirmation(true)
                }

                Log.d(TAG, "Waiting for ACTION_BOND_STATE_CHANGED")
                flow
                    .filter { it.action == BluetoothDevice.ACTION_BOND_STATE_CHANGED }
                    .filter { it.getBluetoothDeviceExtra() == remoteDevice }
@@ -87,6 +91,11 @@ public class Host(context: Context) : Closeable {
                            BluetoothDevice.BOND_BONDED
                    }
                    .first()

                if (pairingRequestJob.isActive) {
                    pairingRequestJob.cancel()
                }

                Log.d(TAG, "createBondAndVerify: bonded")
            }
        }
@@ -118,6 +127,7 @@ public class Host(context: Context) : Closeable {
            val broadcastReceiver: BroadcastReceiver =
                object : BroadcastReceiver() {
                    override fun onReceive(context: Context, intent: Intent) {
                        Log.d(TAG, "intentFlow: onReceive: ${intent.action}")
                        scope.launch { trySendBlocking(intent) }
                    }
                }
+2 −0
Original line number Diff line number Diff line
@@ -38,6 +38,7 @@ import com.google.protobuf.Empty;

import org.junit.After;
import org.junit.Before;
import org.junit.Ignore;
import org.junit.Rule;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -49,6 +50,7 @@ import java.util.concurrent.TimeUnit;

/** Test cases for {@link Hid Host}. */
@RunWith(AndroidJUnit4.class)
@Ignore("b/355328584")
public class HidHostTest {
    private static final String TAG = "HidHostTest";
    private SettableFuture<Integer> mFutureConnectionIntent,