Commit Graph
529 Commits
Author SHA1 Message Date
hai007 9ea22bb1e4 Automated Code Change
PiperOrigin-RevId: 655112620
2024-07-23 04:24:22 -07:00
Guogang Li 52c80303e3 Enhance on advertising
PiperOrigin-RevId: 655044204
2024-07-22 23:57:16 -07:00
Guogang Li d576caa4f3 Internal API fix
PiperOrigin-RevId: 653475092
2024-07-17 22:02:13 -07:00
Guogang Li 304a0e2851 Add more logs for GATT advertising
PiperOrigin-RevId: 653282565
2024-07-17 10:35:57 -07:00
Guogang Li f2724e85f2 Apply task scheduler
PiperOrigin-RevId: 653046912
2024-07-16 18:17:56 -07:00
Anay Wadhera 01e9a6e0e2 internal fix
PiperOrigin-RevId: 652927652
2024-07-16 11:57:29 -07:00
Guogang Li d30f53f92b Added a class to schedule multiple tasks
PiperOrigin-RevId: 652871095
2024-07-16 09:20:24 -07:00
Guogang Li 0f4f02c7f0 Internal crash fix
PiperOrigin-RevId: 651635619
2024-07-11 21:25:06 -07:00
Guogang Li 32cee3439b Pause Bluetooth classic discovery
PiperOrigin-RevId: 647333108
2024-06-27 08:52:58 -07:00
Guogang Li 0640832025 Allowed G3 to simulated BLE device supported extended advertisement
PiperOrigin-RevId: 646503301
2024-06-25 09:20:58 -07:00
Guogang Li 7ccbfef89b internal fix
PiperOrigin-RevId: 644430280
2024-06-18 10:20:18 -07:00
Crisrael Lucero acc38a809b [Nearby Presence] Update ScanManager to trigger changed and lost events
PiperOrigin-RevId: 644072733
2024-06-17 11:17:00 -07:00
Francis Tsui 3d2adf8b42 internal changes.
PiperOrigin-RevId: 642056854
2024-06-10 16:20:30 -07:00
Edwin Wu 152cabab7c Fix a bug in file payload.
PiperOrigin-RevId: 640494382
2024-06-05 05:43:02 -07:00
hai007 a2d018cd87 Add nullability annotation
PiperOrigin-RevId: 637062647
2024-05-24 16:19:04 -07:00
Eiden Kim dca2997f5d Added more checks to file path validation.
PiperOrigin-RevId: 635580793
2024-05-20 15:03:50 -07:00
Eiden Kim b224f8660c Check illegal characters from the file and parent folder name
PiperOrigin-RevId: 634941778
2024-05-17 18:46:26 -07:00
Eiden Kim 33d66fd169 Check illegal characters from the file and parent folder name
PiperOrigin-RevId: 634598623
2024-05-16 18:54:45 -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 556a026a6e Automated Code Change
PiperOrigin-RevId: 633055418
2024-05-12 18:49:35 -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
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
Hai Shang 17df967296 replace secrect_id to id inside presence credential manager
PiperOrigin-RevId: 630558485
2024-05-03 19:28:48 -07:00
hai007 19adc300a0 Automated Code Change
PiperOrigin-RevId: 627267684
2024-04-22 22:39:50 -07:00
Ryan Hansberry 5c933e5b9c [Device Provider] Add FakeDeviceProvider for testing
Create a FakeDeviceProvider class which will be used in testing for NearbyPresence
and NearbyConnections. To assist with testing PresenceService will store a NearbyDeviceProvider base class instead of the implementation specific PresenceDeviceProvider.

PiperOrigin-RevId: 625845617
2024-04-17 16:47:31 -07:00
Edwin Wu 78505e91f7 Add the privacy manifests for swift NC-SDK.
PiperOrigin-RevId: 623676227
2024-04-10 19:19:11 -07:00
hai007 c198af1495 Automated Code Change
PiperOrigin-RevId: 623376075
2024-04-09 22:14:22 -07:00
Francis Tsui 8d41593056 Internal changes.
PiperOrigin-RevId: 623002360
2024-04-08 17:56:34 -07:00
hai007 2a56254756 Automated Code Change
PiperOrigin-RevId: 621908243
2024-04-04 10:52:30 -07:00
Francis Tsui d33c8c6aef Fix preference file loading bug.
PiperOrigin-RevId: 621604205
2024-04-03 12:27:51 -07:00
hai007 80570e55b0 Automated Code Change
PiperOrigin-RevId: 620702020
2024-03-31 16:16:32 -07:00
Francis Tsui 1e08b2d886 Fixed remaining filesystem calls that throws exceptions.
PiperOrigin-RevId: 620379472
2024-03-29 17:33:25 -07:00
Guogang Li 387a51b260 internal update
PiperOrigin-RevId: 619595164
2024-03-27 11:25:55 -07:00
Francis Tsui 0c086a3c93 Minor fixes to reduce copying.
PiperOrigin-RevId: 616927443
2024-03-18 13:22:56 -07:00
Hai Shang 30c9c55d3b Initial Async version of StartAdvertising for windows.
PiperOrigin-RevId: 616915567
2024-03-18 12:43:12 -07:00
Francis Tsui a082f36021 Switch glog to absl::log.
PiperOrigin-RevId: 615535748
2024-03-13 14:03:23 -07:00
hai007 cf2a1eb0b1 Internal change
PiperOrigin-RevId: 613133183
2024-03-06 10:21:45 -08:00
Copybara-Service ee404cb766 Merge pull request #2307 from ChenWangG:patch-1
PiperOrigin-RevId: 612604370
2024-03-04 15:42:43 -08:00
Daniel Classon f09368247b [Nearby Connections] Use async StartScanning when flag enabled
Creates the feature flag `enable_ble_v2_async_scanning_advertising` which
enables/disables the use of the async StartScanning, StopScanning,
StartAdvertising, StopAdvertising, etc methods over the soon-to-be deprecated
synchronous versions of those methods. Opted for feature flag over NearbyFlag,
as ChromeOS is the only current consumer and doesn't use Mendel.

Also sets the feature flag to enabled in the ServiceControllerRouter, which
is where ChromeOS sets NC feature flags at startup.

This CL also fully links up the asynchronous Scanning methods. Advertising
will be addressed in a follow up CL.

PiperOrigin-RevId: 608158273
2024-02-18 12:59:02 -08:00
Juliet Levesque 6b2f7fa94e [Nearby Presence] Fetch and select correct local credentials
Fetch the local credentials and select the correct local credential by verifying the validity of the time. This CL will be followed by
using the selected local credential for authentication. See go/cros-nearby-presence-np-nc-authentication  for details.

PiperOrigin-RevId: 603772266
2024-02-02 17:23:41 -08:00
Guogang Li caa82a41d8 Added flag control to Bluetooth update
PiperOrigin-RevId: 599538193
2024-01-18 09:54:54 -08:00
hai007 744219b1e6 Fix Intel PIE bugs and update test code
PiperOrigin-RevId: 598965857
2024-01-16 14:54:48 -08:00
Guogang Li e1f7044f28 Fixed the bug to get file size
PiperOrigin-RevId: 597266370
2024-01-10 09:05:15 -08:00
Guogang Li cd4963b0f9 Added write timeout for Wi-Fi LAN socket
PiperOrigin-RevId: 596987503
2024-01-09 11:06:28 -08:00
Francis Tsui 1072030be8 Copy sharing/internal, sharing/common and sharing/scheduling to github.
- Move Abseil pin to same as that used in Chromium.
- Disabled layering_check due to build failure in absl.

PiperOrigin-RevId: 596631921
2024-01-08 10:20:37 -08:00
hai007 6ae46a9496 Add visibilities
PiperOrigin-RevId: 596118852
2024-01-05 17:26:39 -08:00
Francis Tsui aea7a09a24 Switch DeviceInfo to use UTF-8 strings.
- Move conversion from native to UTF-8 into platform impl.

PiperOrigin-RevId: 592912664
2023-12-21 11:35:20 -08:00
hai007 16cb7f70b3 Implement Auto-reconnect after disconnection [1]
PiperOrigin-RevId: 592344338
2023-12-19 14:27:40 -08:00
Francis Tsui 63e744e133 Finish migrating account_manager.h to new location.
PiperOrigin-RevId: 592074168
2023-12-18 19:11:52 -08:00