| Index: components/proximity_auth/remote_device_life_cycle_impl.cc
|
| diff --git a/components/proximity_auth/remote_device_life_cycle_impl.cc b/components/proximity_auth/remote_device_life_cycle_impl.cc
|
| index 0661088b13709e29cb4509abfc3cf395249c7810..f6b5a78d913936ff7113efd05ec54dd2114ecc61 100644
|
| --- a/components/proximity_auth/remote_device_life_cycle_impl.cc
|
| +++ b/components/proximity_auth/remote_device_life_cycle_impl.cc
|
| @@ -7,7 +7,6 @@
|
| #include <utility>
|
|
|
| #include "base/bind.h"
|
| -#include "base/command_line.h"
|
| #include "base/location.h"
|
| #include "base/memory/ptr_util.h"
|
| #include "base/threading/thread_task_runner_handle.h"
|
| @@ -17,13 +16,13 @@
|
| #include "components/cryptauth/device_to_device_authenticator.h"
|
| #include "components/cryptauth/secure_context.h"
|
| #include "components/cryptauth/secure_message_delegate.h"
|
| +#include "components/proximity_auth/ble/bluetooth_low_energy_connection.h"
|
| +#include "components/proximity_auth/ble/bluetooth_low_energy_connection_finder.h"
|
| #include "components/proximity_auth/bluetooth_connection.h"
|
| #include "components/proximity_auth/bluetooth_connection_finder.h"
|
| -#include "components/proximity_auth/bluetooth_low_energy_connection_finder.h"
|
| #include "components/proximity_auth/logging/logging.h"
|
| #include "components/proximity_auth/messenger_impl.h"
|
| #include "components/proximity_auth/proximity_auth_client.h"
|
| -#include "components/proximity_auth/switches.h"
|
|
|
| namespace proximity_auth {
|
|
|
| @@ -32,6 +31,9 @@
|
| // The UUID of the Smart Lock classic Bluetooth service.
|
| const char kClassicBluetoothServiceUUID[] =
|
| "704EE561-3782-405A-A14B-2D47A2DDCDDF";
|
| +
|
| +// The UUID of the Bluetooth Low Energy service.
|
| +const char kBLESmartLockServiceUUID[] = "b3b7e28e-a000-3e17-bd86-6e97b9e28c11";
|
|
|
| // The time to wait, in seconds, after authentication fails, before retrying
|
| // another connection.
|
| @@ -80,19 +82,11 @@
|
|
|
| std::unique_ptr<cryptauth::ConnectionFinder>
|
| RemoteDeviceLifeCycleImpl::CreateConnectionFinder() {
|
| - if (base::CommandLine::ForCurrentProcess()->HasSwitch(
|
| - proximity_auth::switches::kEnableBluetoothLowEnergyDiscovery)) {
|
| - cryptauth::RemoteBeaconSeedFetcher fetcher(
|
| - proximity_auth_client_->GetCryptAuthDeviceManager());
|
| - std::vector<cryptauth::BeaconSeed> beacon_seeds;
|
| - if (!fetcher.FetchSeedsForDevice(remote_device_, &beacon_seeds)) {
|
| - PA_LOG(ERROR) << "Unable to fetch BeaconSeeds for "
|
| - << remote_device_.name;
|
| - return nullptr;
|
| - }
|
| -
|
| + if (remote_device_.bluetooth_address.empty()) {
|
| return base::MakeUnique<BluetoothLowEnergyConnectionFinder>(
|
| - remote_device_, beacon_seeds, bluetooth_throttler_);
|
| + remote_device_, kBLESmartLockServiceUUID,
|
| + BluetoothLowEnergyConnectionFinder::FinderStrategy::FIND_PAIRED_DEVICE,
|
| + nullptr, bluetooth_throttler_, 3);
|
| } else {
|
| return base::MakeUnique<BluetoothConnectionFinder>(
|
| remote_device_, device::BluetoothUUID(kClassicBluetoothServiceUUID),
|
| @@ -119,13 +113,6 @@
|
|
|
| void RemoteDeviceLifeCycleImpl::FindConnection() {
|
| connection_finder_ = CreateConnectionFinder();
|
| - if (!connection_finder_) {
|
| - // TODO(tengs): We need to introduce a failed state if the RemoteDevice data
|
| - // is invalid.
|
| - TransitionToState(RemoteDeviceLifeCycleImpl::State::FINDING_CONNECTION);
|
| - return;
|
| - }
|
| -
|
| connection_finder_->Find(
|
| base::Bind(&RemoteDeviceLifeCycleImpl::OnConnectionFound,
|
| weak_ptr_factory_.GetWeakPtr()));
|
|
|