floss: set LL privacy after receiving floss enabled callback
Set LL privacy after receiving the set floss enabled callback and if Floss is enabled. This is to avoid the race condition. When floss is trying to register the btmanagerd callbacks, the adapter is restarted by the SetLLPrivacy dbus call, and UI is out of sync with the adapter state. BUG=b:384597542 TEST=compile, deploy, manual test Change-Id: I7d04d8a35e95c8c4a767a9b04a87e5e875ce5532 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6121030 Reviewed-by: Michael Sun <michaelfsun@google.com> Commit-Queue: Zhengping Jiang <jiangzp@google.com> Reviewed-by: Katherine Lai <laikatherine@chromium.org> Cr-Commit-Position: refs/heads/main@{#1401071}
This commit is contained in:

committed by
Chromium LUCI CQ

parent
3d34cc1285
commit
374059904a
@ -300,17 +300,6 @@ void FlossManagerClient::Init(dbus::Bus* bus,
|
||||
base::BindOnce(&FlossManagerClient::CompleteSetFlossEnabled,
|
||||
weak_ptr_factory_.GetWeakPtr()));
|
||||
|
||||
if (floss::features::IsLLPrivacyAvailable()) {
|
||||
SetLLPrivacy(
|
||||
base::BindOnce([](DBusResult<bool> ret) {
|
||||
if (!ret.has_value()) {
|
||||
LOG(ERROR) << "Set LL privacy returned error: " << ret.error();
|
||||
} else if (!ret.value()) {
|
||||
LOG(ERROR) << "Dbus call to set LL privary returned false.\n";
|
||||
}
|
||||
}),
|
||||
base::FeatureList::IsEnabled(bluez::features::kLinkLayerPrivacy));
|
||||
}
|
||||
#endif // BUILDFLAG(IS_CHROMEOS_ASH)
|
||||
}
|
||||
|
||||
@ -544,6 +533,18 @@ void FlossManagerClient::CompleteSetFlossEnabled(DBusResult<bool> ret) {
|
||||
LOG(ERROR) << "Floss couldn't be enabled. Error=" << ret.error();
|
||||
} else {
|
||||
DVLOG(1) << "Completed SetFlossEnabled with value " << *ret;
|
||||
// Set LL privacy if floss is enabled.
|
||||
if (floss::features::IsLLPrivacyAvailable() && ret.value()) {
|
||||
SetLLPrivacy(
|
||||
base::BindOnce([](DBusResult<bool> ret) {
|
||||
if (!ret.has_value()) {
|
||||
LOG(ERROR) << "Set LL privacy returned error: " << ret.error();
|
||||
} else if (!ret.value()) {
|
||||
LOG(ERROR) << "Dbus call to set LL privary returned false.\n";
|
||||
}
|
||||
}),
|
||||
base::FeatureList::IsEnabled(bluez::features::kLinkLayerPrivacy));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user