Commit Graph
245 Commits
Author SHA1 Message Date
Janusz Sobczak 9f42452386 Fix PCP handler cleanup
All tasks in base_pcp_handler must complete before
p2p_cluster_pcp_handler is destroyed to prevent use-after-free errors.

Added a couple of missing StopDiscovery calls.

PiperOrigin-RevId: 547931350
2023-07-13 14:56:14 -07:00
Janusz Sobczak 31e4b45dd4 Sync before checking logs
The events are logged on a different threads. We should wait until all logs
are processed before verifying expectations.

PiperOrigin-RevId: 547926810
2023-07-13 14:41:36 -07:00
Hai Shang 66d101926a internal clean up
PiperOrigin-RevId: 547874111
2023-07-13 11:56:55 -07:00
Janusz Sobczak 11ed2cec74 Improve timing in OfflineServiceControllerTest
Some of the tests are flaky.
Significantly increased timeouts will give us confidence that
tests are failing due to a defect and not due to a test taking a little
bit more time than usual.

PiperOrigin-RevId: 547819011
2023-07-13 09:10:35 -07:00
Janusz Sobczak 02e37e8a0c Fix flakiness in analytics
`session_was_logged_` could be set out of order if a new session started
immediately after terminating the previous. Fixing that.

Check the logged messages rather then the voltile analytics recorder state
in the tests.

PiperOrigin-RevId: 547732773
2023-07-13 02:35:21 -07:00
Guogang Li 4a71c4d2d0 Move NS implementation to third party folder
PiperOrigin-RevId: 546966492
2023-07-10 13:39:42 -07:00
Anay Wadhera eff0e2d3c6 Commonize callback construction for discovery.
PiperOrigin-RevId: 546934102
2023-07-10 11:35:34 -07:00
Anay Wadhera 4ecbd3bca1 Filter devices based on type when listening for incoming connections.
PiperOrigin-RevId: 546124493
2023-07-06 16:40:00 -07:00
Anay Wadhera 5369c33112 fix tsan error in NC when accessing discovered_endpoints
PiperOrigin-RevId: 546060069
2023-07-06 12:22:55 -07:00
Anay Wadhera 4a185d0317 Add NearbyDevice::ToProto() API
PiperOrigin-RevId: 546055852
2023-07-06 12:07:01 -07:00
hai007 036d4ee490 Exchange ClientIntroductionFrame/ClientIntroductionAckFrame after reconnected successfully
PiperOrigin-RevId: 544683178
2023-06-30 09:58:09 -07:00
Anay Wadhera f05e24f7ea Plumb updateDiscoveryOptions into pcp handler.
PiperOrigin-RevId: 544431325
2023-06-29 12:33:16 -07:00
hai007 aca7ebf6a9 Clarify a log message
PiperOrigin-RevId: 544225952
2023-06-28 19:33:26 -07:00
hai007 6823b7105d Remove dead code.
PiperOrigin-RevId: 544209534
2023-06-28 17:51:06 -07:00
Anay Wadhera 1ddd4d91ea Check listening options when checking for bwu possibility
PiperOrigin-RevId: 543509150
2023-06-26 12:22:49 -07:00
Anay Wadhera c5c65714a0 Implement updateAdvertisingOptions
PiperOrigin-RevId: 543502031
2023-06-26 11:55:11 -07:00
Anay Wadhera 7f1d6a4bba Check listening options as well when we want to enforce topology constraints
PiperOrigin-RevId: 543497497
2023-06-26 11:40:17 -07:00
Guogang Li 86e39b004c Fixed the crash when handling keep alive packet
PiperOrigin-RevId: 542870226
2023-06-23 08:48:57 -07:00
Anay Wadhera da678f5b55 Adjust device provider registration API to match NP expectations
PiperOrigin-RevId: 542634789
2023-06-22 12:29:47 -07:00
Guogang Li 4e5d91b970 Fixed the crash when handling keep alive packet
PiperOrigin-RevId: 542592058
2023-06-22 10:05:46 -07:00
Anay Wadhera 5da4b33824 Revert "Revert incoming connections listener changes for internal breakages."
PiperOrigin-RevId: 542381558
2023-06-21 15:36:44 -07:00
Anay Wadhera 1973b09849 Revert incoming connections listener changes for internal breakages.
PiperOrigin-RevId: 542010849
2023-06-20 12:16:10 -07:00
Anay Wadhera b6a8802cb9 remove shared_ptr hack for std::function Runnable.
PiperOrigin-RevId: 541063821
2023-06-16 18:29:44 -07:00
Anay Wadhera 2a9bf7c883 Introduce connections authentication transport
PiperOrigin-RevId: 541057398
2023-06-16 17:55:06 -07:00
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