Commit Graph
2480 Commits
Author SHA1 Message Date
Francis Tsui 5cddd51876 Remove use of dynamic_cast.
PiperOrigin-RevId: 634559729
2024-05-16 16:13:13 -07:00
Francis Tsui 1097288e54 Fix threading issues in NearbySharingServiceImpl.
PiperOrigin-RevId: 634527776
2024-05-16 14:22:48 -07:00
Francis Tsui 16f820471e Remove use of dynamic_cast from nearby/sharing.
PiperOrigin-RevId: 634519160
2024-05-16 13:57:01 -07:00
Francis Tsui 20c0c5aac3 Fix tsan issues.
PiperOrigin-RevId: 634212412
2024-05-15 22:30:37 -07:00
Anay Wadhera 4aa73df657 Internal changes for stub impl
PiperOrigin-RevId: 634082976
2024-05-15 14:49:33 -07:00
Anay Wadhera fcc08df58b internal change
PiperOrigin-RevId: 634077236
2024-05-15 14:31:46 -07:00
hai007 00e8286021 add connection mode
PiperOrigin-RevId: 633706665
2024-05-14 14:28:03 -07:00
Anay Wadhera a6ec53dc1d Add OnShareTargetUpdated callback to NS C++
PiperOrigin-RevId: 633705421
2024-05-14 14:22:25 -07:00
hai007 da927092e2 Fix build warnings from missing includes, unused includes or clang tidy
PiperOrigin-RevId: 633683523
2024-05-14 13:14:44 -07:00
Francis Tsui 7840f93181 Fix threading in NearbyFileHandler.
PiperOrigin-RevId: 633678194
2024-05-14 12:57:35 -07:00
hai007 1c8395eede Fix the bug that the multiplex socket is not closed properly.
PiperOrigin-RevId: 633675141
2024-05-14 12:47:19 -07:00
Anay Wadhera e73727ea39 Create flag for delaying endpoint loss
PiperOrigin-RevId: 633663638
2024-05-14 12:06:15 -07:00
Will Harmon 12d03e75d3 Shrink the QR code
PiperOrigin-RevId: 633285268
2024-05-13 11:55:55 -07:00
hai007 556a026a6e Automated Code Change
PiperOrigin-RevId: 633055418
2024-05-12 18:49:35 -07:00
hai007 7c72774167 Multiplex implementation - Create Multiplex Socket
PiperOrigin-RevId: 632628955
2024-05-10 16:11:26 -07:00
Francis Tsui 78729abb7d Add method to track active users.
PiperOrigin-RevId: 632594799
2024-05-10 13:55:29 -07:00
Eiden Kim 6d4f2c2606 Add a flag to check illegal characters in the file name and parent folder
PiperOrigin-RevId: 632577432
2024-05-10 12:50:45 -07:00
Hai Shang ce030a76b6 internal cleanup
PiperOrigin-RevId: 632285218
2024-05-09 15:20:03 -07:00
Anay Wadhera 5d6735371b Make sure we never generate a payload ID of 0.
PiperOrigin-RevId: 632210716
2024-05-09 11:15:02 -07:00
hai007 3f1a6d63d1 internal change of annotations
PiperOrigin-RevId: 632206914
2024-05-09 11:05:06 -07:00
Anay Wadhera f26d25ed01 Provide a platform abstraction for RandBytes instead of swapping headers
The `RandBytes` functions were being placed in the `crypto` namespace,
which collides with Chromium's namespace of the same name. Within,
`RandBytes` was defined with almost-the-same API. Then in Chromium
builds, the Chromium header would be used instead (though somewhat
inconsistently).

This creates a lot of pain for Chromium development as there's a
third-party repository directly depending on headers from Chromium's
source tree, and is against the third-party policies for that reason.
There are a number of other headers that mirror Chromium and are
swapped out in the Chromium build that will cause similar pain, such as:
```
include "crypto/aead.h"
include "crypto/ec_private_key.h"
include "crypto/hkdf.h"
```

This CL provides a template for how to get rid of these header swaps and
give a platform abstraction in nearby instead.

We provide a platform abstraction in `platform/crypto.h` (really in
`platform/implementation/crypto.h`) which is implemented in
`platform/implementation/shared/crypto.cc`. However that implementation
is removed by `#ifdef` when in the Chromium build.

Then, in the Chromium repo, we will add (separately) an implementation
of the same abstraction in `//third_party/nearby/platform_impl` with GN
rules to include it in the build. It will replace the implementation
from the nearby repo.

Copybara import of the project:

--
6ca8099 by danakj <danakj@chromium.org>:

Provide a platform abstraction for RandBytes instead of swapping headers

The `RandBytes` functions were being placed in the `crypto` namespace,
which collides with Chromium's namespace of the same name. Within,
`RandBytes` was defined with almost-the-same API. Then in Chromium
builds, the Chromium header would be used instead (though somewhat
inconsistently).

This creates a lot of pain for Chromium development as there's a
third-party repository directly depending on headers from Chromium's
source tree, and is against the third-party policies for that reason.
There are a number of other headers that mirror Chromium and are
swapped out in the Chromium build that will cause similar pain, such as:
```
include "crypto/aead.h"
include "crypto/ec_private_key.h"
include "crypto/hkdf.h"
```

This CL provides a template for how to get rid of these header swaps and
give a platform abstraction in nearby instead.

We provide a platform abstraction in `platform/crypto.h` (really in
`platform/implementation/crypto.h`) which is implemented in
`platform/implementation/shared/crypto.cc`. However that implementation
is removed by `#ifdef` when in the Chromium build.

Then, in the Chromium repo, we will add (separately) an implementation
of the same abstraction in `//third_party/nearby/platform_impl` with GN
rules to include it in the build. It will replace the implementation
from the nearby repo.

--
9c2654b by danakj <danakj@chromium.org>:

Remove CryptoSpan, use absl::Span

The header swapping of Chromium crypto libraries is
problematic, but absl::Span will convert to base::span
so there's no need for the typedef even without
removing the header swapping yet.

--
df1135d by danakj <danakj@chromium.org>:

Add missing files

--
ab18a15 by danakj <danakj@chromium.org>:

Remove the random_unittest.cc from Swift build

The file moved, so the Swift package needs its path
updated.

--
2038f78 by danakj <danakj@chromium.org>:

Combine crypto unittests into crypto_test.cc

--
f7ad176 by danakj <danakj@chromium.org>:

Add stdint and stddef includes for uint8_t and size_t

--
9f04590 by danakj <danakj@chromium.org>:

Mark the shared crypto implementation compatable_with non_prod

--
18eeafd by danakj <danakj@chromium.org>:

Add IWYU pragma for crypto implementation

PiperOrigin-RevId: 632150866
2024-05-09 08:02:50 -07:00
hai007 112da1a737 Remove extra semi which breaks ChromeOs build
PiperOrigin-RevId: 631928582
2024-05-08 14:39:28 -07:00
Hai Shang bc44fee374 use abs to make sure the id is not negative
PiperOrigin-RevId: 631891168
2024-05-08 12:42:34 -07:00
Anay Wadhera 3b701c78f3 Deny and abort payloads with ID 0.
PiperOrigin-RevId: 631864387
2024-05-08 11:24:21 -07:00
hai007 a632a1f691 Cleanup header includes
including log/check.h directly leads to a build error on chrome

PiperOrigin-RevId: 631864164
2024-05-08 11:18:51 -07:00
Ryan Hansberry cc84b6f4a4 Make credential refill asynchronous
Fixes a ChromeOS-deadlock during credential refill. The
previous logic blocked the IO thread that ChromeOS is using
to listen for responses from its CredentialStorage layer,
thus preventing it from signaling the latch.

Given that CheckCredentialsAndRefillIfNeeded is meant to
be async (given its continuation-passing style), this CL
avoids any thread trickiness by removing any latch-waiting
within the function. The nice side-effect of this is breaking
up the function into 3 smaller functions, which should
hopefully make it a bit more readable.

//.../g3/credential_storage_impl.cc has its mutex locks
removed -- they otherwise cause deadlocks, and are now
unnecessary.

This CL introduces a CHECK_EQ to ensure that the number of
remaining valid (not-expired) credentials is equal across the
shared and local list. This actually exposed a bug in the
credential_manager_impl_test.cc -- the test was only expiring
a public credential, and not its corresponding private credential.
Thus, the test is also updated in this CL to correctly mark
the first credential of the shared and local list as expired.

PiperOrigin-RevId: 631822135
2024-05-08 09:14:53 -07:00
Anay Wadhera 85ebca532e Fix not rejecting a frame with an empty endpoint ID.
PiperOrigin-RevId: 631563161
2024-05-07 15:12:09 -07:00
Anay Wadhera bf23ee5851 Remove endpoint ID CHECKs from Core
PiperOrigin-RevId: 631535509
2024-05-07 13:47:36 -07:00
Francis Tsui 346999639c Remove use of ShareTarget from payload tracker.
PiperOrigin-RevId: 631211496
2024-05-06 15:56:37 -07:00
Ryan Hansberry 7d0312eca6 Add Call Transfer action bit
Phones are now broadcasting this action bit. Allow platform
impls to handle these Call Transfer ADVs.

PiperOrigin-RevId: 631085965
2024-05-06 09:24:15 -07:00
Hai Shang 17df967296 replace secrect_id to id inside presence credential manager
PiperOrigin-RevId: 630558485
2024-05-03 19:28:48 -07:00
Francis Tsui dd7dbdf98d Remove unnecessary optional when processing endpoint_id.
PiperOrigin-RevId: 630416001
2024-05-03 09:46:48 -07:00
Francis Tsui d759708f53 Remove unnecessary passing of ShareTarget.
PiperOrigin-RevId: 630226988
2024-05-02 17:37:44 -07:00
hai007 50c1838e00 Use rust based decoding logic by default
PiperOrigin-RevId: 629850723
2024-05-01 15:09:13 -07:00
hai007 464380d931 Implement action bit parsing logic for rust implemented decoder
- This does not change any public APIs, but makes the rust backed impl fill in
   the values of the current public API.

PiperOrigin-RevId: 629844656
2024-05-01 14:48:28 -07:00
Crisrael Lucero fb4099455e [Nearby Presence] Use different include path for NEARBY_CHROMIUM Rust ldt
PiperOrigin-RevId: 629810240
2024-05-01 13:00:00 -07:00
Francis Tsui 8e3cfd04f8 Add tests for sharing_platform_base.
PiperOrigin-RevId: 629794040
2024-05-01 12:05:34 -07:00
hai007 63b1f24432 Automated Code Change
PiperOrigin-RevId: 629361945
2024-04-30 03:54:48 -07:00
Francis Tsui e532ee1b92 Internal change
PiperOrigin-RevId: 629183197
2024-04-29 14:15:45 -07:00
hai007 bba1ca540f Remove provisioned identity type from proto
PiperOrigin-RevId: 629178167
2024-04-29 13:59:55 -07:00
hai007 0b04994f71 Update identity type name
PiperOrigin-RevId: 629163344
2024-04-29 13:12:45 -07:00
Francis Tsui 048e48e415 internal change
PiperOrigin-RevId: 628599038
2024-04-26 22:10:58 -07:00
Francis Tsui af59ff9794 internal changes.
PiperOrigin-RevId: 628561715
2024-04-26 18:14:26 -07:00
hai007 a1b80ff649 Update identity type name
PiperOrigin-RevId: 628545355
2024-04-26 16:57:25 -07:00
hai007 54eff829b5 Update identity type name
PiperOrigin-RevId: 628513553
2024-04-26 14:40:17 -07:00
Francis Tsui 159ca34072 Add Shutdown method to TaskRunner.
PiperOrigin-RevId: 628448253
2024-04-26 10:44:21 -07:00
hai007 7c973ee9d2 1. Refine CATEGORY_NEARBY_ERROR in BT, WFD, Wifi Hotspot outgoing logs
2. Define new result code for the TieBreak cases

PiperOrigin-RevId: 628401240
2024-04-26 07:37:10 -07:00
Guogang Li c9c8544669 Added a new Uuid constructor from UUID string
PiperOrigin-RevId: 628288959
2024-04-25 21:48:39 -07:00
hai007 f72ceedfd2 Automated Code Change
PiperOrigin-RevId: 628287046
2024-04-25 21:36:00 -07:00
hai007 18a03848e7 Records the Wifi Aware supports status
PiperOrigin-RevId: 628267165
2024-04-25 19:47:22 -07:00