Commit 113ff3a3 authored by Azeem Arshad's avatar Azeem Arshad Committed by Commit Bot

[Cellular] Remove automatic cellular network scans.

Scans for cellular networks are disruptive and should be initiated
only by explicit user action. This CL does the following:
* Document that cellular scans should be explicit.
* Remove the periodic scan for all network types in network-select.
* Make sure that cellular scans are initiated only when
  cellular type is explicitly requested.
* Prevent network subpage from triggering cellular scans.

BUG=b/157403230

Change-Id: I3d70ede85b155346fe294bbfc0a0337c1e8c7408
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2217708Reviewed-by: default avatarSteven Bennetts <stevenjb@chromium.org>
Reviewed-by: default avatarDaniel Cheng <dcheng@chromium.org>
Commit-Queue: Azeem Arshad <azeemarshad@chromium.org>
Cr-Commit-Position: refs/heads/master@{#772764}
parent 7a7f7816
...@@ -261,7 +261,9 @@ Polymer({ ...@@ -261,7 +261,9 @@ Polymer({
const INTERVAL_MS = 10 * 1000; const INTERVAL_MS = 10 * 1000;
let type = this.deviceState.type; let type = this.deviceState.type;
if (type == mojom.NetworkType.kCellular && this.tetherDeviceState) { if (type == mojom.NetworkType.kCellular && this.tetherDeviceState) {
type = mojom.NetworkType.kMobile; // Only request tether scan. Cellular scan is disruptive and should
// only be triggered by explicit user action.
type = mojom.NetworkType.kTether;
} }
this.networkConfig_.requestNetworkScan(type); this.networkConfig_.requestNetworkScan(type);
this.scanIntervalId_ = window.setInterval(() => { this.scanIntervalId_ = window.setInterval(() => {
......
...@@ -1060,13 +1060,12 @@ void NetworkStateHandler::RequestScan(const NetworkTypePattern& type) { ...@@ -1060,13 +1060,12 @@ void NetworkStateHandler::RequestScan(const NetworkTypePattern& type) {
else if (type.Equals(NetworkTypePattern::WiFi())) else if (type.Equals(NetworkTypePattern::WiFi()))
return; // Skip notify if disabled and wifi only requested. return; // Skip notify if disabled and wifi only requested.
} }
if (type.Equals(NetworkTypePattern::Cellular()) ||
type.Equals(NetworkTypePattern::Mobile())) { if (type.Equals(NetworkTypePattern::Cellular())) {
// Only request a Cellular scan if Cellular or Mobile is requested // Only request a Cellular scan if Cellular is requested explicitly.
// explicitly.
if (IsTechnologyEnabled(NetworkTypePattern::Cellular())) if (IsTechnologyEnabled(NetworkTypePattern::Cellular()))
shill_property_handler_->RequestScanByType(shill::kTypeCellular); shill_property_handler_->RequestScanByType(shill::kTypeCellular);
else if (type.Equals(NetworkTypePattern::Cellular())) else
return; // Skip notify if disabled and cellular only requested. return; // Skip notify if disabled and cellular only requested.
} }
......
...@@ -316,8 +316,10 @@ class COMPONENT_EXPORT(CHROMEOS_NETWORK) NetworkStateHandler ...@@ -316,8 +316,10 @@ class COMPONENT_EXPORT(CHROMEOS_NETWORK) NetworkStateHandler
DeviceStateList* list) const; DeviceStateList* list) const;
// Requests a network scan. This may trigger updates to the network // Requests a network scan. This may trigger updates to the network
// list, which will trigger the appropriate observer calls. If |type| is // list, which will trigger the appropriate observer calls.
// Cellular, a mobile network scan will be requested if supported. // Note: If |type| is Cellular, a mobile network scan will be requested
// if supported. This is disruptive and should only be triggered by an
// explicit user action.
void RequestScan(const NetworkTypePattern& type); void RequestScan(const NetworkTypePattern& type);
// Requests an update for an existing NetworkState, e.g. after configuring // Requests an update for an existing NetworkState, e.g. after configuring
......
...@@ -893,6 +893,9 @@ interface CrosNetworkConfig { ...@@ -893,6 +893,9 @@ interface CrosNetworkConfig {
// Requests a scan for new networks. If the list updates, // Requests a scan for new networks. If the list updates,
// CrosNetworkConfigObserver::OnNetworkStateListChanged() will be signaled. // CrosNetworkConfigObserver::OnNetworkStateListChanged() will be signaled.
// Note: If |type| is Cellular, a mobile network scan will be requested
// if supported. This is disruptive and should only be triggered by an
// explicit user action.
RequestNetworkScan(NetworkType type); RequestNetworkScan(NetworkType type);
// Returns the global policy properties. These properties are not expected to // Returns the global policy properties. These properties are not expected to
......
...@@ -95,10 +95,13 @@ Polymer({ ...@@ -95,10 +95,13 @@ Polymer({
this.refreshNetworks(); this.refreshNetworks();
const INTERVAL_MS = 10 * 1000; const INTERVAL_MS = 10 * 1000;
const kAll = chromeos.networkConfig.mojom.NetworkType.kAll; // Request only WiFi network scans. Tether and Cellular scans are not useful
this.networkConfig_.requestNetworkScan(kAll); // here. Cellular scans are disruptive and should only be triggered by
// explicit user action.
const kWiFi = chromeos.networkConfig.mojom.NetworkType.kWiFi;
this.networkConfig_.requestNetworkScan(kWiFi);
this.scanIntervalId_ = window.setInterval(function() { this.scanIntervalId_ = window.setInterval(function() {
this.networkConfig_.requestNetworkScan(kAll); this.networkConfig_.requestNetworkScan(kWiFi);
}.bind(this), INTERVAL_MS); }.bind(this), INTERVAL_MS);
}, },
......
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