0

ash: Update network pod to consider 5G

This change updates the network feature pod to be able to correctly
generate the sub-label for 5G cellular networks, and to update multiple
NOTREACHED() sites to instead be NET_LOG(ERROR) to avoid these becoming
fatal in the future.

Bug: b/289128400
Test: Manually verified on DUT.
Change-Id: I928673f2d2a06d991a7902d4f1eee7315aec6bef
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4651957
Reviewed-by: Kyle Horimoto <khorimoto@chromium.org>
Commit-Queue: Kyle Horimoto <khorimoto@chromium.org>
Auto-Submit: Chad Duffin <chadduffin@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1164243}
This commit is contained in:
Chad Duffin
2023-06-29 18:21:14 +00:00
committed by Chromium LUCI CQ
parent 0d4a3aa364
commit 462e5b4a01
3 changed files with 11 additions and 4 deletions

@ -2872,6 +2872,9 @@ Connect your device to power.
<message name="IDS_ASH_STATUS_TRAY_NETWORK_CELLULAR_TYPE_LTE_PLUS" desc="The sub label text used when a cellular connection is using the LTE Advanced connectivity type.">
LTE+
</message>
<message name="IDS_ASH_STATUS_TRAY_NETWORK_CELLULAR_TYPE_FIVE_G" desc="The sub label text used when a cellular connection is using the 5G connectivity type.">
5G
</message>
<message name="IDS_ASH_STATUS_TRAY_NETWORK_SIGNAL_WEAK_SUBLABEL" desc="The sub label text used when WiFi signal strength is weak (among weak, medium, and strong.) [CHAR_LIMIT=14]">
Weak
</message>

@ -0,0 +1 @@
f2c8e1dbb4f9fde3773b263bfe742e3732add154

@ -25,6 +25,7 @@
#include "base/notreached.h"
#include "base/strings/utf_string_conversions.h"
#include "chromeos/services/network_config/public/cpp/cros_network_config_util.h"
#include "components/device_event_log/device_event_log.h"
#include "components/onc/onc_constants.h"
#include "third_party/cros_system_api/dbus/service_constants.h"
#include "third_party/cros_system_api/dbus/shill/dbus-constants.h"
@ -92,11 +93,16 @@ std::u16string GetSubLabelForConnectedNetwork(
return l10n_util::GetStringUTF16(
IDS_ASH_STATUS_TRAY_NETWORK_CELLULAR_TYPE_LTE_PLUS);
}
if (cellular->network_technology == onc::cellular::kTechnology5gNr) {
return l10n_util::GetStringUTF16(
IDS_ASH_STATUS_TRAY_NETWORK_CELLULAR_TYPE_FIVE_G);
}
// All connectivity types exposed by Shill should be covered above. However,
// as a fail-safe, return the default "Connected" string here to protect
// against Shill providing an unexpected value.
NOTREACHED();
NET_LOG(ERROR) << "Unexpected cellular network technology: "
<< cellular->network_technology;
return l10n_util::GetStringUTF16(
IDS_ASH_STATUS_TRAY_NETWORK_STATUS_CONNECTED);
}
@ -118,9 +124,6 @@ std::u16string GetSubLabelForConnectedNetwork(
return l10n_util::GetStringUTF16(
IDS_ASH_STATUS_TRAY_NETWORK_SIGNAL_STRONG_SUBLABEL);
}
NOTREACHED();
return l10n_util::GetStringUTF16(
IDS_ASH_STATUS_TRAY_NETWORK_STATUS_CONNECTED);
}
// Returns |true| if the network type can be toggled to state |enabled|.