Chromium Code Reviews| Index: components/pairing/bluetooth_host_pairing_controller.cc |
| diff --git a/components/pairing/bluetooth_host_pairing_controller.cc b/components/pairing/bluetooth_host_pairing_controller.cc |
| index 8b0b201521495019db5cac03930a610c0a98a362..689db715ec7af539f7c51282dfc333e4d69d851f 100644 |
| --- a/components/pairing/bluetooth_host_pairing_controller.cc |
| +++ b/components/pairing/bluetooth_host_pairing_controller.cc |
| @@ -196,10 +196,18 @@ void BluetoothHostPairingController::OnGetAdapter( |
| void BluetoothHostPairingController::SetName() { |
|
zork
2017/05/17 16:59:07
I think a better name for this function would be "
|
| // Hash the bluetooth address and take the lower 2 bytes to create a human |
| - // readable device name. |
| - const uint32_t device_id = base::Hash(adapter_->GetAddress()) & 0xFFFF; |
| - device_name_ = |
| - base::StringPrintf("%s_%04X", GetChromeOSDeviceType().c_str(), device_id); |
| + // readable device name. Clean |device_name_| if pairing is finished. Make |
| + // sure the device will not be found by Android enrollment app after |
| + // successful enrollment. |
| + if (current_stage_ == STAGE_FINISHED) { |
|
xdai1
2017/05/17 17:46:51
Per offline discussion, I would suggest to have a
|
| + device_name_ = std::string(); |
| + } else if (device_name_.empty()) { |
| + const uint32_t device_id = base::Hash(adapter_->GetAddress()) & 0xFFFF; |
| + device_name_ = base::StringPrintf( |
| + "%s_%04X", GetChromeOSDeviceType().c_str(), device_id); |
| + } else { |
| + return; |
| + } |
| adapter_->SetName( |
| device_name_, |
| @@ -431,6 +439,7 @@ void BluetoothHostPairingController::OnCompleteSetupMessage( |
| } else { |
| // TODO(zork): Handle adding another controller. (http://crbug.com/405757) |
| ChangeStage(STAGE_FINISHED); |
| + SetName(); |
|
xdai1
2017/05/17 17:46:51
I think you should reset Bluetooth name for both s
|
| } |
| Reset(); |
| } |