Commit 198e6b7e authored by Hugo Benichi's avatar Hugo Benichi Committed by Commit Bot

arc: net: migrate to shill kMeteredProperty

Main rational for migration: user UI override settings for marking a
network metered or unmetered can only be obtained with the new
kMeteredProperty.

BUG=b:156302252
TEST=Flashed Chrome, connected the DUT to an Android hotspot with cell
tethering and checked that ARC tags the wifi hotspot as metered.

Change-Id: I83f4ca01521947edb39785053308cb88b658a69e
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2217711
Commit-Queue: Hugo Benichi <hugobenichi@google.com>
Reviewed-by: default avatarYusuke Sato <yusukes@chromium.org>
Reviewed-by: default avatarJorge Lucangeli Obes <jorgelo@chromium.org>
Cr-Commit-Position: refs/heads/master@{#772601}
parent 71ab3c06
......@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Next MinVersion: 14
// Next MinVersion: 15
// This file defines the mojo interface between the ARC networking stack and
// Chrome OS. There are three different groups of interactions:
......@@ -126,7 +126,8 @@ enum SecurityType {
WPA_EAP,
};
// Tethering state of a |NetworkConfiguration| as a client.
// Deprecated enum. |is_metered| in NetworkConfiguration should be
// used instead.
[Extensible]
enum TetheringClientState {
// Tethering state is detected and confirmed.
......@@ -201,9 +202,8 @@ struct NetworkConfiguration {
// Additional WiFi properties for WiFi network services.
WiFi? wifi;
// Indicates if the physical network is known to have upstream Internet
// access through tethering on a metered network.
[MinVersion=8] TetheringClientState tethering_client_state;
// Deprecated field. Uses |is_metered| instead.
[MinVersion=8] TetheringClientState deprecated_tethering_client_state;
// The name of the network interface on the host.
[MinVersion=10] string? network_interface;
......@@ -266,6 +266,10 @@ struct NetworkConfiguration {
// to ARC and associated with the network service. This can be different
// from the name of the real physical interface managed by shill.
[MinVersion=13] string? arc_network_interface;
// True if the network has been autodetected by the platform as a metered
// network or if the user explicitly marked the network as metered in the UI.
[MinVersion=14] bool is_metered;
};
// Describes a Wifi network configuration that ARC has requested the host to
......
......@@ -228,8 +228,11 @@ arc::mojom::NetworkConfigurationPtr TranslateNetworkProperties(
if (mojo->guid.empty())
LOG(ERROR) << "Missing GUID property for network " << network_state->path();
mojo->type = TranslateNetworkType(network_state->type());
// TODO(b/156302252) Migrate to kMeteredProperty
mojo->tethering_client_state =
mojo->is_metered =
shill_dict &&
shill_dict->FindBoolPath(shill::kMeteredProperty).value_or(false);
// TODO(b/156302252) Remove once ARC side has been migrated to |is_metered|.
mojo->deprecated_tethering_client_state =
TranslateTetheringState(network_state->tethering_state());
// IP configuration data is added from the properties of the underlying shill
......
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