Commit d72e6be0 authored by Regan Hsu's avatar Regan Hsu Committed by Chromium LUCI CQ

[CrOS PhoneHub] Correct TetherConnectionResult::kSuccess logging place.

Previously, this metric was logged in UpdateStatus(), which can be
influenced by connecting to a tether network in locations other than
via PhoneHub (e.g in OS Settings). This CL adds an attempt connection
tracking variable which is checked in UpdateStatus() before logging
the success metric.

Fixed: 1164570
Bug: 1106937
Change-Id: I9c070b7e644bcd6357bdb78f9b1e8a06bb275349
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2622953Reviewed-by: default avatarKyle Horimoto <khorimoto@chromium.org>
Commit-Queue: Regan Hsu <hsuregan@chromium.org>
Cr-Commit-Position: refs/heads/master@{#842825}
parent 2538bef0
......@@ -122,6 +122,7 @@ void TetherControllerImpl::AttemptConnection() {
user_action_recorder_->RecordTetherConnectionAttempt();
util::LogTetherConnectionResult(
util::TetherConnectionResult::kAttemptConnection);
is_attempting_connection_ = true;
FeatureState feature_state =
multidevice_setup_client_->GetFeatureState(Feature::kInstantTethering);
......@@ -393,11 +394,13 @@ void TetherControllerImpl::UpdateStatus() {
PA_LOG(INFO) << "TetherController status update: " << status_ << " => "
<< status;
// Log the connection attempt result if it has succeed.
if (status == Status::kConnected)
status_ = status;
if (is_attempting_connection_ && status_ == Status::kConnected)
util::LogTetherConnectionResult(util::TetherConnectionResult::kSuccess);
status_ = status;
if (status_ != Status::kConnecting)
is_attempting_connection_ = false;
NotifyStatusChanged();
}
......
......@@ -164,6 +164,9 @@ class TetherControllerImpl
ConnectDisconnectStatus::kIdle;
Status status_ = Status::kIneligibleForFeature;
// Whether this class is attempting a tether connection.
bool is_attempting_connection_ = false;
network_config::mojom::NetworkStatePropertiesPtr tether_network_;
std::unique_ptr<TetherNetworkConnector> connector_;
......
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