Commit d680078a authored by Sonny Sasaka's avatar Sonny Sasaka Committed by Commit Bot

arc_bluetooth_bridge: Increase Android power intent timeout

Android takes 3-4 seconds to fulfill power state change, so the timeout
of 5 seconds is too close that the probability of the timeout hit is
high enough to happen to users. As a result, users often encounter
Bluetooth turned off by itself. This CL changes the timeout to 8 seconds
to provide safer buffer, if there is no response from Android after 8
seconds it is considered as lost (will never respond).

Future larger work is needed to avoid relying on timeout to make it more
robust, but at this moment we need a low-risk solution to be merged to
stable channel.

BUG=843650

Change-Id: I9aded127e3eb510ff58b1167900bda9546226aa5
Reviewed-on: https://chromium-review.googlesource.com/1062773Reviewed-by: default avatarMiao-chen Chou <mcchou@chromium.org>
Reviewed-by: default avatarLuis Hector Chavez <lhchavez@chromium.org>
Commit-Queue: Sonny Sasaka <sonnysasaka@chromium.org>
Cr-Commit-Position: refs/heads/master@{#559315}
parent e8567a18
...@@ -108,11 +108,11 @@ constexpr uint32_t kBluetoothComputerClass = 0x100; ...@@ -108,11 +108,11 @@ constexpr uint32_t kBluetoothComputerClass = 0x100;
// Bluetooth Service in Java space, so the signaling to Chrome about the // Bluetooth Service in Java space, so the signaling to Chrome about the
// to-be-happen sleep cannot be done. This timeout tries to ensure the validity // to-be-happen sleep cannot be done. This timeout tries to ensure the validity
// and the order of toggles on power state sent to Android. // and the order of toggles on power state sent to Android.
// If Android takes more than 5 seconds to complete the intent initiated by // If Android takes more than 8 seconds to complete the intent initiated by
// Chrome, Chrome will take EnableAdapter/DisableAdapter calls as a request from // Chrome, Chrome will take EnableAdapter/DisableAdapter calls as a request from
// Android to toggle the power state. The power state will be synced on both // Android to toggle the power state. The power state will be synced on both
// Chrome and Android, but as a result, Bluetooth will be off. // Chrome and Android, but as a result, Bluetooth will be off.
constexpr base::TimeDelta kPowerIntentTimeout = base::TimeDelta::FromSeconds(5); constexpr base::TimeDelta kPowerIntentTimeout = base::TimeDelta::FromSeconds(8);
using GattReadCallback = using GattReadCallback =
base::OnceCallback<void(arc::mojom::BluetoothGattValuePtr)>; base::OnceCallback<void(arc::mojom::BluetoothGattValuePtr)>;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment