[sl4f] Unblock outgoing pairing requests

When we have IO capabilities set to something other than NONE
pairing requests were blocking all SL4F interactions until
the pairing function returned. This blocks crucial steps
of KEYBOARD/DISPLAY IO capabilities where the input and
retrieval of the pairing pin is important.

Bug: None
Test: BluetoothCmdLineTest
Change-Id: Ia2f3ff2e495d8c6df792336fcafbb9a76a58a89f
Reviewed-on: https://fuchsia-review.googlesource.com/c/fuchsia/+/392781
Reviewed-by: Tom Turney <tturney@google.com>
Testability-Review: Tom Turney <tturney@google.com>
Commit-Queue: Tom Turney <tturney@google.com>
diff --git a/garnet/bin/sl4f/src/bluetooth/bt_control_facade.rs b/garnet/bin/sl4f/src/bluetooth/bt_control_facade.rs
index 1dba830..881ae28 100644
--- a/garnet/bin/sl4f/src/bluetooth/bt_control_facade.rs
+++ b/garnet/bin/sl4f/src/bluetooth/bt_control_facade.rs
@@ -120,7 +120,7 @@
                         displayed_passkey,
                         responder,
                     } => {
-                        if let Some(key) = displayed_passkey {
+                        if let Some(key) = displayed_passkey.clone() {
                             let _res = pin_sender.try_send(key);
                         }
                         fx_log_info!(
@@ -136,7 +136,18 @@
                         let (confirm, entered_passkey) = match method {
                             PairingMethod::Consent => (consent, None),
                             PairingMethod::PasskeyComparison => (consent, None),
-                            PairingMethod::PasskeyDisplay => (consent, None),
+                            PairingMethod::PasskeyDisplay => {
+                                if let Some(key) = displayed_passkey.clone() {
+                                    fx_log_info!(
+                                        "Passkey {:?} provided for 'Passkey Display`.",
+                                        key
+                                    );
+                                    (true, None)
+                                } else {
+                                    fx_log_info!("No passkey provided for 'Passkey Display`.");
+                                    (false, None)
+                                }
+                            }
                             PairingMethod::PasskeyEntry => {
                                 let timeout = 10.seconds();
                                 let pin = match pin_receiver
@@ -509,22 +520,26 @@
             transport: Some(transport),
         };
 
-        match &self.inner.read().control_interface_proxy {
-            Some(proxy) => {
-                let resp = proxy.pair(&mut PeerId { value: peer_id }, pairing_options).await?;
-                match resp.error {
-                    Some(err) => {
-                        let err_msg = format!("Error: {:?}", Sl4fError::from(*err));
-                        fx_err_and_bail!(&with_line!(tag), err_msg)
-                    }
-                    None => Ok(()),
-                }
-            }
+        let proxy = match &self.inner.read().control_interface_proxy {
+            Some(p) => p.clone(),
             None => fx_err_and_bail!(
                 &with_line!(tag),
                 format!("{:?}", ERR_NO_CONTROL_PROXY_DETECTED.to_string())
             ),
-        }
+        };
+
+        let fut = async move {
+            let result = proxy.pair(&mut PeerId { value: peer_id }, pairing_options).await;
+            if let Err(err) = result {
+                fx_log_err!(
+                    tag: &with_line!("BluetoothControlFacade::pair"),
+                    "Failed to pair with: {:?}",
+                    err
+                );
+            }
+        };
+        fasync::spawn(fut);
+        Ok(())
     }
 
     /// Disconnects an active BR/EDR connection by input device ID.