Commit Graph
221 Commits
Author SHA1 Message Date
Anay Wadhera 44fb9b4fa2 implement stoplisteningforincomingconnections
PiperOrigin-RevId: 540724954
2023-06-15 16:43:56 -07:00
Anay Wadhera 5737b867ed implement startlisteningforincomingconnections
PiperOrigin-RevId: 540707703
2023-06-15 15:31:08 -07:00
Juliet Levesque aee56f0729 [Nearby Connections] Add CancellationFlag::Uncancel
Add CancellationFlag::Uncancel and on calls to ClientProxy::AddCancellationFlag, if a flag is already in the map, uncancel it. This will address the case when users use NC to share/receive a file, then cancel in the middle because the wrong file was selected, and  then re-do right after. Without this change, the second share/receive process will be seen as cancelled with cancellation flags enabled. However this change will uncancel the flag which is added in RequestConnection and OnConnectionInitiated in the NS flow.

PiperOrigin-RevId: 540633470
2023-06-15 11:07:44 -07:00
hai007 ebe02e1174 Allow auto-resume the payload transfer when disconnection
PiperOrigin-RevId: 540438831
2023-06-14 18:35:04 -07:00
Anay Wadhera a25ef756e7 Isolate ble_v2/wifi_lan on incoming connection logic
PiperOrigin-RevId: 540420565
2023-06-14 17:02:25 -07:00
Anay Wadhera cf9170ba16 Isolate Ble accept handler logic
PiperOrigin-RevId: 540401997
2023-06-14 15:47:43 -07:00
Anay Wadhera 169087dc96 convert bluetooth connection handler to a front binder
PiperOrigin-RevId: 540355517
2023-06-14 13:00:33 -07:00
Guogang Li f05bf7fc40 Fixed transfer sync issue in payload callback
PiperOrigin-RevId: 540333269
2023-06-14 11:37:45 -07:00
Guogang Li 2c90a61fca Fixed crash when flag update in peripheral tracker
PiperOrigin-RevId: 540294615
2023-06-14 09:35:47 -07:00
hai007 1e34f097aa Add test case to verify Connection can fall back to BT if WIFI_LAN fails
PiperOrigin-RevId: 539877670
2023-06-13 00:32:07 -07:00
Juliet Levesque 6f69e97421 [Nearby Connections] Stop 3 AttemptsToConnect over BluetoothClassic for CancellationFlag
CancellationFlags will be used to prevent crashes during the shutdown of Nearby Connections from pending tasks taking too long during the shutdown period. By using CancellationFlags, we can prevent the retries occuring during the Shutdown by short-circuiting an in flight AttemptToConnect, and checking for Cancellation before retries.

Because BluetoothClassic does not use futures, the short circuit only requires a check after ConnectToService, and returning an empty
socket.

PiperOrigin-RevId: 539755631
2023-06-12 14:05:36 -07:00
Juliet Levesque 240159e872 [Nearby Connections] Stop 3 AttemptsToConnect over WebRTC for CancellationFlag
CancellationFlags will be used to prevent crashes during the shutdown of Nearby Connections from pending tasks taking too long during the shutdown period. WebRTC using 3 x 10s retries to connect, which means we are potentially waiting for 30 seconds of retries to execute during shutdown (which is longer than the 10s duration alloted for Core shutdown).

By using CancellationFlags, we can prevent the retries occuring during the Shutdown by short-circuiting an in flight AttemptToConnect, and checking for Cancellation before retries.

PiperOrigin-RevId: 539690403
2023-06-12 10:16:36 -07:00
hai007 742f57423c Enable WIFI_DIRECT in NC connection layer
PiperOrigin-RevId: 538827162
2023-06-08 10:36:32 -07:00
Anay Wadhera 0ab31f6312 Implement device loss alarms
PiperOrigin-RevId: 538822094
2023-06-08 10:19:44 -07:00
Guogang Li dbd42b0de3 Handle GATT query in separate thread
PiperOrigin-RevId: 538819295
2023-06-08 10:10:00 -07:00
Crisrael Lucero a821e0378c Replace dynamic_cast with reinterpret_cast
PiperOrigin-RevId: 538330024
2023-06-06 17:03:12 -07:00
hai007 224ab6b698 Automated visibility attribute cleanup.
PiperOrigin-RevId: 538205367
2023-06-06 09:23:59 -07:00
Guogang Li 19bc10ff26 Fixed the issue to initialize discovery tracker
PiperOrigin-RevId: 537995407
2023-06-05 15:22:40 -07:00
hai007 e77c1e862e safe_to_disconnect_version for safe-to-disconnect features.
PiperOrigin-RevId: 537501354
2023-06-03 00:01:35 -07:00
Anay Wadhera 20622608b3 Plumb core into servicecontroller
PiperOrigin-RevId: 537480170
2023-06-02 21:21:57 -07:00
Anay Wadhera b0568ecc26 Update ServiceControllerRouter for v3 API entrypoint
PiperOrigin-RevId: 537478014
2023-06-02 21:06:58 -07:00
Eiden Kim 7c931aa9c7 Changed number (1/0) to true/false in Connections Dump()
PiperOrigin-RevId: 537092962
2023-06-01 12:09:56 -07:00
hai007 1e868a1a65 Fix a crash problem related to OnEndpointFound
PiperOrigin-RevId: 536541918
2023-05-30 16:35:11 -07:00
Juliet Levesque f38728bb0b [Nearby Connections] Do not erase CancellationFlag map entry in ClientProxy
To prevent invalid access of already destroyed CancellationFlag pointers, do not erase the map entry of a CancellationFlag in ClientProxy::CancelEndpoint. Crashes were caused by consumers accessing CancellationFlag::Cancelled to check if the flags were cancelled, however since the flags was destroyed by erasing the map entry in ClientProxy::CancelEndpoint, consumers are calling gabrage memory.

PiperOrigin-RevId: 536470187
2023-05-30 12:03:51 -07:00
Juliet Levesque 9c09f325e0 [Nearby Connections] Do not destroy CancellationFlag map in ClientProxy
To prevent invalid access of already destroyed CancellationFlag pointers, do not clear the map of CancellationFlags in ClientProxy::CancelAllEndpoints. Crashes
were caused by consumers accessing CancellationFlag::Cancelled to check if the flags were cancelled, however since the flags were destroyed by erasing the map in ClientProxy::CancelAllEndpoints, consumers are calling gabrage memory.

PiperOrigin-RevId: 535284214
2023-05-25 09:34:26 -07:00
hai007 1b59c39c02 Fix OnEndpointLost behavior error
PiperOrigin-RevId: 533488774
2023-05-19 10:23:41 -07:00
hai007 47aea4b689 Fix Tsan data race error
PiperOrigin-RevId: 533486198
2023-05-19 10:14:21 -07:00
Anay Wadhera f2cadc2815 move payload listeners to absl::AnyInvocable
PiperOrigin-RevId: 533365325
2023-05-18 23:30:01 -07:00
Juliet Levesque 8a78212bb8 [Nearby Connections] Check for shutdown before accessing ClientProxy.
During the destruction of NearbyConnections, Core (which owns ClientProxy) is destructed before ServiceController (which owns EndpointManager), which means any pending tasks on the EndpointManager executor that use ClientProxy will be using
garbage memory. To fix this issue, EndpointManager::DiscardEndpoint will check
for an `is_shutdown` boolean set during ~EndpointManager before accessing
ClientProxy. The assumption is that any accessing of ClientProxy after the
destruction will be invalid.

PiperOrigin-RevId: 532581122
2023-05-16 14:54:20 -07:00
Anay Wadhera e4be4677c4 update ukey2 to use bazel
PiperOrigin-RevId: 532532700
2023-05-16 12:05:48 -07:00
Anay Wadhera 99e951dc53 ClientProxy: Wire in DeviceProvider
PiperOrigin-RevId: 532259220
2023-05-15 16:17:16 -07:00
Nick Bourdakos ae35b1a242 Internal change
PiperOrigin-RevId: 532215519
2023-05-15 13:56:22 -07:00
Janusz Sobczak 0901aec6e2 Add BleMedium::GetRemotePeripheral
Added:
nearby::api::ble_v2::BlePeripheral::GetUniqueId()
nearby::api::ble_v2::BleMedium::GetRemotePeripheral(...)

Moved BlePeripheral implementation from bluetooth_adapter_* to ble_v2.*
Added G3 (test) implementation for the new methods.

PiperOrigin-RevId: 531023568
2023-05-10 15:40:38 -07:00
Guogang Li 072d24238b Made kPeripheralLostTimeout as flag
PiperOrigin-RevId: 530408275
2023-05-08 14:29:02 -07:00
hai007 4eaaeb254d Clean up third_party/nearby/connections/implementation/analytics
PiperOrigin-RevId: 529811175
2023-05-05 14:13:49 -07:00
hai007 ff412edde1 Skip the analytics recording on the closed connection without strategy sessions
PiperOrigin-RevId: 529502206
2023-05-04 13:41:08 -07:00
Nick Bourdakos 58772e95f9 Internal change
PiperOrigin-RevId: 529464527
2023-05-04 11:24:39 -07:00
Anay Wadhera 7caeb98443 Remove v2 callbacks from client_proxy
PiperOrigin-RevId: 529181183
2023-05-03 13:35:59 -07:00
hai007 10174f8a47 Fix data overflow problem
PiperOrigin-RevId: 528023236
2023-04-28 17:16:44 -07:00
Anay Wadhera 5edd8e25ca Introduce v3 NC API callbacks
PiperOrigin-RevId: 527747390
2023-04-27 19:01:39 -07:00
Johnson Lu 83739b3185 [Connections] Switch to use P2P IPv6 address
PiperOrigin-RevId: 527502244
2023-04-27 01:05:22 -07:00
Edwin Wu 576b0babfa [Connections] Implement NC/NP Handshake & Connection Authentication, part IV
PiperOrigin-RevId: 525618680
2023-04-19 19:56:59 -07:00
Edwin Wu a706e95e7b [Connections] Implement NC/NP Handshake & Connection Authentication, part III
PiperOrigin-RevId: 525615681
2023-04-19 19:32:44 -07:00
hai007 b68431e6a8 Add IFTTT comment for linter.
PiperOrigin-RevId: 524593948
2023-04-15 20:30:24 -07:00
Johnson Lu 7fb90aea30 Add connections_device and presence_device fields in ConnectionRequestFrame
PiperOrigin-RevId: 523024392
2023-04-09 21:12:02 -07:00
hai007 82b9cb50fa Fix the Hotspot and WFD unit tests when cancellation flag is enabled
PiperOrigin-RevId: 522643865
2023-04-07 11:29:31 -07:00
hai007 388c96d125 Close webrtc socket before closing the PeerConnection.
PiperOrigin-RevId: 522140908
2023-04-05 13:36:30 -07:00
hai007 f8f9c4fd4e Don't unregister an observer while inside an observer callback.
PiperOrigin-RevId: 521860015
2023-04-04 14:05:32 -07:00
Hai Shang c312442f3d internal clean up
PiperOrigin-RevId: 521555239
2023-04-03 14:00:22 -07:00
hai007 1a6ba0d32c Clean up nearby dependencies.
PiperOrigin-RevId: 521039910
2023-03-31 16:36:40 -07:00