Commit Graph
256 Commits
Author SHA1 Message Date
Janusz Sobczak 522ac8c13e Fix threading issues in tests
The changes make thread sanitizer happy.

PiperOrigin-RevId: 546960147
2023-07-10 13:17:12 -07:00
Qin Wang 5bab62fbb1 Get/Write/Delete account associated device from/to footprints
PiperOrigin-RevId: 546342820
2023-07-07 11:57:29 -07:00
Qin Wang 61820e49fb BugFix //third_party/nearby/fastpair/scanning/fastpair:fast_pair_discoverable_scanner_impl_test
PiperOrigin-RevId: 546253578
2023-07-07 05:38:00 -07:00
Qin Wang d7be85607f BugFix - //third_party/nearby/fastpair/handshake:fast_pair_handshake_impl_test
PiperOrigin-RevId: 546253109
2023-07-07 05:34:34 -07:00
Qin Wang 5bce94d8ee Move fast_pair_repository to third_party/nearby/fastpair/repository and remove all deprecated files
PiperOrigin-RevId: 546057062
2023-07-06 12:10:57 -07:00
Janusz Sobczak d516e52204 Add FastPairService adapter.
Add an adapter and windows plugin for scalable seeker,

PiperOrigin-RevId: 545920541
2023-07-06 02:18:02 -07:00
Qin Wang 5b6ba679c7 Download device's metadata using FastPairClient::GetObservedDevice to call fast pair backend API
PiperOrigin-RevId: 545809920
2023-07-05 16:01:20 -07:00
Janusz Sobczak 7a99b5e0a3 Specialize ExceptionOr<bool>
ExceptionOr<T>::ok() returns true if the value is set. This can be misleading
for boolean types.
ExceptionOr<bool> result = SomeFunction();
if (result.ok()) {
 if (result.result() {
  // Case 1: SomeFunction returned true
 } else {
  // Case 2: SomeFunction returned false
} else {
  // Case 3: SomeFunction returned an exception
}
It's easy to overlook case 2.
The specialized ExceptionOr<bool>::ok() returns false in Case 2, which allows
us to write:
if (result) {
 // SomeFunction returned true
} else {
 // SomeFunction returned false or an exception
 // result.GetException() can be used if we need to handle different exceptions
 // differenty
}

PiperOrigin-RevId: 544715641
2023-06-30 11:59:43 -07:00
Janusz Sobczak e00bdfb3e3 Add retro pairing in scalable seeker
Listen for manual pairing events and notify plugins.
Add retroactive pairing flow in the scalable seeker.
Actually upload the account key to the provider.
Missing bits:
- Notify the user and get their permission,
- Upload the new Account Key to user's account.

PiperOrigin-RevId: 544616348
2023-06-30 04:06:43 -07:00
Qin Wang d55caf0c4b Enable ble_medium scanning for advertisement with Fast Pair Service UUID
PiperOrigin-RevId: 544158039
2023-06-28 14:17:36 -07:00
hai007 a35b3c1bf1 Creating UI binding platform as dart interface.
PiperOrigin-RevId: 543851724
2023-06-27 14:26:15 -07:00
Qin Wang 259350e343 Implement FastPairClient to provides APIs to the FastPair backend OAuth/un-OAuth API
PiperOrigin-RevId: 543807725
2023-06-27 11:42:27 -07:00
Janusz Sobczak b89eeb1ac1 Pass screen locked event to plugins
PiperOrigin-RevId: 543512467
2023-06-26 12:37:45 -07:00
Janusz Sobczak cabad16421 Register BluetoothClassicMedium::Observer
PiperOrigin-RevId: 543506617
2023-06-26 12:12:28 -07:00
Janusz Sobczak 33abd7d879 Increase plugin life time
A plugin is created when it is first needed and destroyed when the FP device
is destroyed. This allows the plugins to keep state during long running
operations such as presenting a UI query.

PiperOrigin-RevId: 543502491
2023-06-26 11:58:56 -07:00
Qin Wang 7a25b33603 Builds FastPairInfo proto to upload device to footprints
PiperOrigin-RevId: 543496714
2023-06-26 11:36:38 -07:00
Janusz Sobczak 36132890cd Initialize metadata repository
Make sure that FastPairRepository is initalized.
FastPairRepository is required to fetch metadata information

PiperOrigin-RevId: 542906473
2023-06-23 11:06:20 -07:00
Janusz Sobczak 3cf20ee3bc Store metadata in FastPairDevice
Add DeviceMetadata to FastPairDevice after downloading it.
It simplifies the code and prevents fetching the same metadata several times.
FastPairDataEncryptorImpl does not download the metadata anymore. Metadata
must have already been downloaded, otherwise we wouldn't know what FP protocol
to use.

PiperOrigin-RevId: 542490742
2023-06-22 01:48:56 -07:00
Qin Wang e4b12dbd80 Interface for passing HTTP Responses/Requests to observers
PiperOrigin-RevId: 542402792
2023-06-21 17:06:23 -07:00
Janusz Sobczak 20acd4eeb9 Add initial pairing in scalable seeker
PiperOrigin-RevId: 541034178
2023-06-16 16:14:14 -07:00
Janusz Sobczak 4914cbc2f9 Set FastPairDevice version
PiperOrigin-RevId: 541030067
2023-06-16 16:00:31 -07:00
Qin Wang 4b13033389 Add fast pair proto to third_party/nearby/fastpair
PiperOrigin-RevId: 540977348
2023-06-16 13:09:38 -07:00
hai007 b5f1added4 Adding components for binding the C++ libraries with flutter app
- Branch class Listener from google3/location/nearby/cpp/sharing/clients/dart/platform/lib/listener.dart for further use of listening the change from notification controller.
- Create Device Metadata to store the device information relating to UI showing.
- Create binding class to bind C++ libraries to dart language.

PiperOrigin-RevId: 540644654
2023-06-15 11:44:11 -07:00
hai007 87fd2f130a Remove redundant design of fast pair wrapper.
PiperOrigin-RevId: 540410011
2023-06-14 16:18:48 -07:00
Janusz Sobczak c4139c83b0 Use RobustGattClient
PiperOrigin-RevId: 540060033
2023-06-13 13:42:19 -07:00
Qin Wang e20fb4f75d Add screen locked listener for fast pair windows
PiperOrigin-RevId: 540038338
2023-06-13 12:26:20 -07:00
hai007 5efbbe4a40 Connect UI related key services in mediator to flutter app. The whole fast pair libraries are in C++ language while flutter app is in dart language. That is, the purpose of adapter is connecting dart (flutter app) and c++ (Fast Pair libraries).
PiperOrigin-RevId: 540013256
2023-06-13 10:58:48 -07:00
Janusz Sobczak ca60afa007 Add robust gatt client
PiperOrigin-RevId: 539817203
2023-06-12 18:29:59 -07:00
hai007 589c126725 Create dart proto for transferring the data from C++ to flutter app.
- callback: transfer device C++ proto to dart proto
 - device: transfer metadata that get from the observer to dart proto
 - enum: transfer Discovery Action class to dart proto

PiperOrigin-RevId: 538935072
2023-06-08 17:36:11 -07:00
Guogang Li ae900f0baf Added flag to enable GATT on non-extended device
PiperOrigin-RevId: 538851144
2023-06-08 11:56:24 -07:00
Chun Zhang e101795cac Add Fast Pair Switches.
PiperOrigin-RevId: 538605609
2023-06-07 15:17:00 -07:00
hai007 4095b7978d Add Mediator Factory to avoid creating variables other than mediator in further adapter. The main purpose of the adapter is connecting dart (flutter app) and c++ (Fast Pair libraries).
PiperOrigin-RevId: 538604362
2023-06-07 15:12:21 -07:00
Chun Zhang 2027fed32f Add Fast Pair Preferences.
PiperOrigin-RevId: 538597935
2023-06-07 14:48:06 -07:00
Qin Wang c786b07fcf Add pair_broker to FastPairMediator/FastPairSeeker
PiperOrigin-RevId: 538592398
2023-06-07 14:27:29 -07:00
Qin Wang ba740c9a5c Implement RetroactivePairingDetector
PiperOrigin-RevId: 538319791
2023-06-06 16:18:38 -07:00
hai007 aefef91114 Add UI Discovery check and show into Mediator.
PiperOrigin-RevId: 538000396
2023-06-05 15:43:24 -07:00
Qin Wang 94b3263b63 Implement PairerBroker for fast pair windows
PiperOrigin-RevId: 537982117
2023-06-05 14:29:36 -07:00
Qin Wang 3dd893dd4c Implement FastPairPairer to handle the pairing process
PiperOrigin-RevId: 537124512
2023-06-01 14:07:22 -07:00
Janusz Sobczak ddbb711b7b Add InitialPair plugin
Creates plugins/ directory which will store internal plugins used for admin
tasks and testing. In this CL
* FakeFastPairPlugin for tests
* InitalPairPlugin - simple plugin that triggers Initial Pair flow

PiperOrigin-RevId: 536775192
2023-05-31 11:36:00 -07:00
Suet-Fei Li 7aa1d852f1 Use public link for MessageStream.
PiperOrigin-RevId: 536516027
2023-05-30 14:52:10 -07:00
Janusz Sobczak 82b5e10d5b Implement StartFastPairScan
PiperOrigin-RevId: 536487662
2023-05-30 13:08:31 -07:00
Suet-fei Li 9e37ea08be . 2023-05-27 01:08:14 +00:00
Janusz Sobczak 3adb98a5ff Introduce scanning sessions
FastPairScanner::ScanningSession and ScannerBroker::ScanningSession separate
the lifetime of FastPairScanner/ScannerBroker from the lifetime of scanning
sessions. This simplifies the cleanup.
PiperOrigin-RevId: 535675988
2023-05-26 11:50:54 -07:00
Chun Zhang 4596f32499 Adds Fast Pair account key related proto to communicate with Nearby Service.
PiperOrigin-RevId: 535415537
2023-05-25 15:53:17 -07:00
Janusz Sobczak 5bad45aed1 Use FastPairDeviceRepository in FastPairSevice
PiperOrigin-RevId: 535386036
2023-05-25 14:25:41 -07:00
Qin Wang 55750a0843 Write Accountkey to remote device via GATT connection
PiperOrigin-RevId: 534992810
2023-05-24 14:59:40 -07:00
Qin Wang 6b08c4dda7 Data Parse for subsequent pairing non-discoverable advertisement
PiperOrigin-RevId: 534929577
2023-05-24 11:57:58 -07:00
Qin Wang 1d5abfcc0f Create fast pair data encryptor with Accountkey
PiperOrigin-RevId: 534908947
2023-05-24 11:04:41 -07:00
Janusz Sobczak b80426a043 Inject SingleThreadExecutor in scanning classes
The goal is to use the same background thread for callbacks whenever possible.
It should simplify the locking.

PiperOrigin-RevId: 534632495
2023-05-23 18:34:14 -07:00
Janusz Sobczak 43291da5fd Define scalable seeker API
Defines the scalable seeker skeleton
* FastPairService - singleton FP service instance
* FastPairSeeker - FP interface for plugins
* FastPairPlugin - plugin interface

PiperOrigin-RevId: 534623965
2023-05-23 18:01:27 -07:00