Commit Graph
1473 Commits
Author SHA1 Message Date
Nick Bourdakos e21f736588 Internal change
PiperOrigin-RevId: 519180519
2023-03-24 11:05:33 -07:00
Nick Bourdakos b5787017cf Add a PR template
PiperOrigin-RevId: 519160041
2023-03-24 09:16:15 -07:00
Qin Wang fd955d864f Add FakeFastPairDataEncryptor to help unit test FastPairHandshake
PiperOrigin-RevId: 518967535
2023-03-23 14:44:42 -07:00
hai007 f2331cfb42 Clean up build file.
PiperOrigin-RevId: 518966242
2023-03-23 14:40:43 -07:00
Janusz Sobczak 4bd7da967a Add MessageStream fuzzing test
PiperOrigin-RevId: 518920458
2023-03-23 11:41:39 -07:00
Aaron Yu e232149008 Add catch(...) exceptions to catch unknown exceptions in NC bluetooth adapter
PiperOrigin-RevId: 518902703
2023-03-23 10:43:07 -07:00
Anay Wadhera 3f1b0c81e3 Weave port [2/n]: Introduce Weave packetizer implementation
PiperOrigin-RevId: 518881931
2023-03-23 09:30:55 -07:00
Janusz Sobczak dbd31508fa Add medium fuzzing tests
PiperOrigin-RevId: 518722768
2023-03-22 18:08:09 -07:00
Janusz Sobczak adcb341190 Verify that IO on closed socket returns an error
The test implementation of BluetoothSocket::GetInputStream() would crash if
the socket was closed. That's not ideal because the caller can't verify if the
socket is open or closed.

New test verifies that GetOutputStream() and GetInputStream() always return a
valid reference.

PiperOrigin-RevId: 518722540
2023-03-22 18:04:12 -07:00
Janusz Sobczak 1a78b33a89 Add InputStream::ReadExactly
Read() can return fewer bytes than requested.
ReadExactly() will call Read() repeatedly until we
have read as many bytes as we need.

PiperOrigin-RevId: 518719418
2023-03-22 17:45:50 -07:00
Nick Bourdakos ebf87cc581 Update issue template
PiperOrigin-RevId: 518676538
2023-03-22 14:40:04 -07:00
Aaron Yu 59fc030843 Harden NC bluetooth adapter with try catch exceptions
PiperOrigin-RevId: 518664644
2023-03-22 13:55:27 -07:00
Nick Bourdakos 87af84cddd Add issue templates
PiperOrigin-RevId: 518658906
2023-03-22 13:33:59 -07:00
Anay Wadhera abeabc3911 Add PresenceAction vector to PresenceDevice
PiperOrigin-RevId: 518650656
2023-03-22 13:03:44 -07:00
Nick Bourdakos cbf50a3d49 Add more visibilities
PiperOrigin-RevId: 518647351
2023-03-22 12:51:23 -07:00
Anay Wadhera 5fadbd2388 Add property vector to PresenceDevice
PiperOrigin-RevId: 518645129
2023-03-22 12:42:46 -07:00
Nick Bourdakos 0b3c759aa3 Remove unneeded WebRTC flags
PiperOrigin-RevId: 518629654
2023-03-22 11:44:12 -07:00
hai007 8b1791caab Automated visibility attribute cleanup.
PiperOrigin-RevId: 518628538
2023-03-22 11:39:32 -07:00
hai007 548b51f331 Add MagicPairLog and magic_pair_enums to third_party.
PiperOrigin-RevId: 518603122
2023-03-22 10:16:24 -07:00
Nick Bourdakos ec025502dc Refactor WebRTC code to avoid use of select for stubs
PiperOrigin-RevId: 518491132
2023-03-22 00:25:54 -07:00
Janusz Sobczak b2da1efbbf Parse events from message stream.
Adds parsing for standard events, everything except audio switch.

PiperOrigin-RevId: 518425430
2023-03-21 17:23:42 -07:00
hai007 72ac6e8df0 Add new SETUP_WIZARD event to Nearby Sharing analytics.
PiperOrigin-RevId: 518363414
2023-03-21 13:29:52 -07:00
Nick Bourdakos 39df20d821 Internal change
PiperOrigin-RevId: 518186148
2023-03-20 23:51:16 -07:00
Guogang Li 78145f4433 Fixed crash during devices scanning
PiperOrigin-RevId: 518127975
2023-03-20 18:03:49 -07:00
hai007 d0b258971d Remove the coroutines workaround from Nearby and drop experimental/coroutines.
In Prod LLVM release branch 515643669.1 ( cl/517696539 ) the experimental coroutines implementation is dropped. The `experimental/coroutines` header is removed.

Nearby doesn't use coroutines, but it uses libraries that depend on the existence of coroutine function definitions. Specifically, WinRT needs certain coroutine function definitions in order to compile.

Ordinarily, WinRT relied on the coroutine function definitions provided in the MSVC STL' `experimental/coroutines` header. The introduction of libc++ complicated this dependency for Nearby, because libc++' `experimental/coroutines` header took the place of the MSVC version, and (correctly, for C++17) provided none of the coroutine function definitions.

To resolve these issues, we implemented a patch of WinRT. The patch provided placeholder definitions, which allowed WinRT to pass compilation. This patch was submitted in cl/495104919. The patch was necessary to enable the Nearby migration from MSVC STL to libc++.

--

The removal of `experimental/coroutines` from libc++ makes this patch unnecessary. However, the patch will not compile without libc++' `experimental/coroutines` header.

The presence of libc++' `experimental/coroutines` header had prevented the corresponding MSVC STL' header from defining the functions for which the patch makes placeholders. Without the libc++' `experimental/coroutines` header, the MSVC STL header is employed and makes these definitions. The patch then redefines these functions, which causes a compilation failure.

--

This CL makes two changes: 1) It eliminates the patch, and 2) It eliminates the libc++ `experimental/coroutines` file from the Lexan libc++ distribution. This allows Nearby to function identically before and after the release of Lexan 515643669.1.

This change prevents a break from occurring when Lexan 515643669.1 is released.

PiperOrigin-RevId: 518119913
2023-03-20 17:20:47 -07:00
Janusz Sobczak a7a3eb8a92 Use consistent return value in Pipe read.
Previously reading from an empty, closed Pipe returned:
* IO exception if there were no writes to the pipe,
* Empty byte array if there were writes to the pipe.
With this change, we return an empty byte array on both paths.

This also fixes a subtle race condition in the following flow:
1. Pipe is empty
2. Thread A is reading from the pipe (blocking call).
3. Thread B writes to the pipe and immediately closes it.
4. Thread A is unblocked and returns IO error. The data written by thread B is
   ignored!

The new test in bluetooth_classic_test triggered that defect consistently.

PiperOrigin-RevId: 518107700
2023-03-20 16:26:52 -07:00
hai007 903fa9817c Add logging of impressions to Nearby Share setup wizard screen.
PiperOrigin-RevId: 518085655
2023-03-20 15:00:24 -07:00
Nick Bourdakos 57dd89c34c Internal change
PiperOrigin-RevId: 518076706
2023-03-20 14:27:22 -07:00
Janusz Sobczak e202af3ccc Add value parameter to future listeners
Pass the Future result to listeners as a parameter.
This makes the AddListener() API a bit more convenient.

PiperOrigin-RevId: 518040156
2023-03-20 12:15:47 -07:00
Nick Bourdakos ced4369202 Fix README link typo
PiperOrigin-RevId: 518024831
2023-03-20 11:24:20 -07:00
Nick Bourdakos f5eac5c47d Update README
PiperOrigin-RevId: 518014725
2023-03-20 10:50:10 -07:00
Suet-Fei Li 68f6b5bfbf Refactor oauth and network to better handle retryable errors.
PiperOrigin-RevId: 518007417
2023-03-20 10:28:07 -07:00
Guogang Li 465a82dc1e Avoid task execution to crash thread pool
PiperOrigin-RevId: 517980691
2023-03-20 08:53:03 -07:00
Guogang Li 12156937ee Check device name before calling update callback
PiperOrigin-RevId: 517851883
2023-03-19 20:26:56 -07:00
Guogang Li 44e6ff7bb1 Avoid task execution to crash thread pool
PiperOrigin-RevId: 517558076
2023-03-17 18:58:28 -07:00
Guogang Li 700d5c9dcc Fixed crash bug in BluetoothAdapter
PiperOrigin-RevId: 517556635
2023-03-17 18:44:51 -07:00
Anay Wadhera 69d2098ecb Weave port [1/n]: Introduce Weave packet implementation
PiperOrigin-RevId: 517526002
2023-03-17 15:44:09 -07:00
Janusz Sobczak 8f887064ec Fix dead-lock during executor shutdown
The flow below caused a dead-lock:
1. A lengthy task A is running on an executor.
2. Executor is destructed, or `Shutdown()` on another thread. The call blocks
   waiting for A to complete.
3. Task A executes another task B on the executor. The call blocks forever.

PiperOrigin-RevId: 517495348
2023-03-17 13:34:57 -07:00
Nick Bourdakos 076da722b1 Move CONTRIBUTING.md and CODE_OF_CONDUCT.md to the repo root and delete the docs directory
PiperOrigin-RevId: 517480463
2023-03-17 12:37:22 -07:00
Qin Wang 86ca85b85a Migrate fake functions to third_party/nearby to help unit test
PiperOrigin-RevId: 517433481
2023-03-17 09:34:58 -07:00
Edwin Wu 94ff506d1e Fixes HelloConnections that can't discover Pixel device from iPhone for Ble_v2 medium.
PiperOrigin-RevId: 517318035
2023-03-16 22:25:21 -07:00
hai007 debe65ce54 Tidy up for cl/516905639
PiperOrigin-RevId: 517279013
2023-03-16 18:08:41 -07:00
Guogang Li 335c07624e Fixed the issue to encode BLE V2 advertisement header
PiperOrigin-RevId: 517267592
2023-03-16 17:06:02 -07:00
Janusz Sobczak 2096795496 Use ExceptionOr::result()
ExceptionOr::result() returns a reference, unlike GetResult(), which returns a
copy of the value.
PiperOrigin-RevId: 517238836
2023-03-16 15:09:05 -07:00
Nick Bourdakos 2e8d6efdb8 Update build dependencies to fix broken macOS Dart build
PiperOrigin-RevId: 517235243
2023-03-16 14:55:17 -07:00
Guogang Li f7e6deb8ab internal cleanup
PiperOrigin-RevId: 517211099
2023-03-16 13:27:26 -07:00
hai007 3f61031345 1. Supports payload received ack sync for sender
2. Supports safe-to-disconnect check (no auto reconnect or auto resume transfer yet)

PiperOrigin-RevId: 517191691
2023-03-16 12:17:04 -07:00
hai007 fbee16103b Supports Multiplex transmission for Bluetooth to allow multiple clients reuse the existed connection. See go/nc_multiplex for more details.
PiperOrigin-RevId: 517039657
2023-03-16 00:11:27 -07:00
hai007 86d33f749a Supports Multiplex transmission for Bluetooth to allow multiple clients reuse the existed connection. See go/nc_multiplex for more details.
PiperOrigin-RevId: 517028681
2023-03-15 22:54:56 -07:00
Janusz Sobczak 02ffb5d45e Add Message Stream
Define MessageStream class for exchanging messages betweek the seeker and the
provider over rfcomm.

PiperOrigin-RevId: 516986541
2023-03-15 18:42:39 -07:00