quick_settings: Network list updates for modem flashing
Changes to the cellular network list entry when modem is in flashing state. go/cros-modemup-ux Bug=b:324323448 Test=Tested on Corsolla using force flash Change-Id: I7d1e086d4ec9e5f4787e864d4bcf3d3ab1421b19 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5719530 Reviewed-by: Steven Bennetts <stevenjb@chromium.org> Commit-Queue: Ujjwal Pande <ujjwalpande@google.com> Reviewed-by: Jason Zhang <jiajunz@google.com> Cr-Commit-Position: refs/heads/main@{#1336344}
This commit is contained in:

committed by
Chromium LUCI CQ

parent
2a9aa9f2f9
commit
be338ea994
@ -3812,6 +3812,9 @@ No devices connected.
|
||||
<message name="IDS_ASH_STATUS_TRAY_NO_NETWORKS" desc="The message to display in the network info bubble when it is otherwise empty.">
|
||||
No network information available
|
||||
</message>
|
||||
<message name="IDS_ASH_STATUS_TRAY_UPDATING" desc="The message to display in the network info bubble when modem firmware is updating.">
|
||||
Updating
|
||||
</message>
|
||||
<message name="IDS_ASH_STATUS_TRAY_NO_MOBILE_NETWORKS" desc="The message to display in the network list when no mobile networks are available.">
|
||||
No mobile networks set up
|
||||
</message>
|
||||
|
@ -0,0 +1 @@
|
||||
24baae5d4f965ee1a1fbc3e95dbf7487e455a687
|
@ -102,6 +102,16 @@ bool IsCellularDeviceInhibited() {
|
||||
chromeos::network_config::mojom::InhibitReason::kNotInhibited;
|
||||
}
|
||||
|
||||
bool IsCellularDeviceFlashing() {
|
||||
const DeviceStateProperties* cellular_device =
|
||||
Shell::Get()->system_tray_model()->network_state_model()->GetDevice(
|
||||
NetworkType::kCellular);
|
||||
if (!cellular_device) {
|
||||
return false;
|
||||
}
|
||||
return cellular_device->is_flashing;
|
||||
}
|
||||
|
||||
bool IsESimSupported() {
|
||||
const DeviceStateProperties* cellular_device =
|
||||
Shell::Get()->system_tray_model()->network_state_model()->GetDevice(
|
||||
@ -505,8 +515,9 @@ void NetworkListViewControllerImpl::MaybeShowConnectionWarningManagedIcon(
|
||||
}
|
||||
|
||||
bool NetworkListViewControllerImpl::ShouldAddESimEntry() const {
|
||||
const bool is_add_esim_enabled =
|
||||
is_mobile_network_enabled_ && !IsCellularDeviceInhibited();
|
||||
const bool is_add_esim_enabled = is_mobile_network_enabled_ &&
|
||||
!IsCellularDeviceInhibited() &&
|
||||
!IsCellularDeviceFlashing();
|
||||
|
||||
bool is_add_esim_visible = IsESimSupported();
|
||||
const GlobalPolicy* global_policy = model()->global_policy();
|
||||
@ -808,6 +819,23 @@ void NetworkListViewControllerImpl::UpdateMobileToggleAndSetStatusMessage() {
|
||||
return;
|
||||
}
|
||||
|
||||
if (IsCellularDeviceFlashing()) {
|
||||
// When a device is flashing, it cannot process any new operations. Thus,
|
||||
// keep the toggle on to show users that the device is active, but set it
|
||||
// to be disabled to make it clear that users cannot update it until
|
||||
// operation completes.
|
||||
CreateInfoLabelIfMissingAndUpdate(IDS_ASH_STATUS_TRAY_UPDATING,
|
||||
&mobile_status_message_);
|
||||
|
||||
mobile_header_view_->SetToggleVisibility(/*visible=*/true);
|
||||
mobile_header_view_->SetToggleState(/*enabled=*/false,
|
||||
/*is_on=*/true,
|
||||
/*animate_toggle=*/true);
|
||||
network_detailed_network_view()->UpdateMobileStatus(true);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
const bool cellular_enabled = cellular_state == DeviceStateType::kEnabled;
|
||||
|
||||
// The toggle will never be enabled for secondary users.
|
||||
|
@ -1680,4 +1680,37 @@ TEST_P(NetworkListViewControllerTest, NetworkItemIsEnabled) {
|
||||
EXPECT_TRUE(GetNetworkListItemIsEnabled(NetworkType::kCellular, 0u));
|
||||
}
|
||||
|
||||
TEST_P(NetworkListViewControllerTest, NetworkItemDuringFlashing) {
|
||||
auto properties =
|
||||
chromeos::network_config::mojom::DeviceStateProperties::New();
|
||||
properties->type = NetworkType::kCellular;
|
||||
properties->device_state = DeviceStateType::kEnabled;
|
||||
properties->sim_infos = CellularSIMInfos(kCellularTestIccid, kTestBaseEid);
|
||||
|
||||
cros_network()->SetDeviceProperties(properties.Clone());
|
||||
ASSERT_THAT(GetMobileSubHeader(), NotNull());
|
||||
EXPECT_TRUE(GetAddESimEntry()->GetVisible());
|
||||
|
||||
cros_network()->AddNetworkAndDevice(
|
||||
CrosNetworkConfigTestHelper::CreateStandaloneNetworkProperties(
|
||||
kCellularName, NetworkType::kCellular,
|
||||
ConnectionStateType::kConnected));
|
||||
|
||||
CheckNetworkListItem(NetworkType::kCellular, /*index=*/0u, kCellularName);
|
||||
EXPECT_TRUE(GetNetworkListItemIsEnabled(NetworkType::kCellular, 0u));
|
||||
|
||||
properties->is_flashing = true;
|
||||
cros_network()->SetDeviceProperties(properties.Clone());
|
||||
|
||||
EXPECT_FALSE(GetNetworkListItemIsEnabled(NetworkType::kCellular, 0u));
|
||||
ASSERT_THAT(GetMobileStatusMessage(), NotNull());
|
||||
EXPECT_EQ(l10n_util::GetStringUTF16(IDS_ASH_STATUS_TRAY_UPDATING),
|
||||
GetMobileStatusMessage()->label()->GetText());
|
||||
|
||||
properties->is_flashing = false;
|
||||
cros_network()->SetDeviceProperties(properties.Clone());
|
||||
EXPECT_TRUE(GetNetworkListItemIsEnabled(NetworkType::kCellular, 0u));
|
||||
EXPECT_THAT(GetMobileStatusMessage(), IsNull());
|
||||
}
|
||||
|
||||
} // namespace ash
|
||||
|
@ -128,6 +128,10 @@ bool IsNetworkDisabled(
|
||||
return true;
|
||||
}
|
||||
|
||||
if (IsCellularDeviceFlashing(network_properties)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -147,4 +151,19 @@ bool IsNetworkInhibited(
|
||||
chromeos::network_config::IsInhibited(cellular_device);
|
||||
}
|
||||
|
||||
bool IsCellularDeviceFlashing(
|
||||
const chromeos::network_config::mojom::NetworkStatePropertiesPtr&
|
||||
network_properties) {
|
||||
if (!chromeos::network_config::NetworkTypeMatchesType(
|
||||
network_properties->type, NetworkType::kCellular)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
const DeviceStateProperties* cellular_device =
|
||||
Shell::Get()->system_tray_model()->network_state_model()->GetDevice(
|
||||
NetworkType::kCellular);
|
||||
|
||||
return cellular_device && cellular_device->is_flashing;
|
||||
}
|
||||
|
||||
} // namespace ash
|
||||
|
@ -63,6 +63,10 @@ ASH_EXPORT bool IsNetworkInhibited(
|
||||
const chromeos::network_config::mojom::NetworkStatePropertiesPtr&
|
||||
network_properties);
|
||||
|
||||
ASH_EXPORT bool IsCellularDeviceFlashing(
|
||||
const chromeos::network_config::mojom::NetworkStatePropertiesPtr&
|
||||
network_properties);
|
||||
|
||||
ASH_EXPORT int GetStringIdForNetworkDetailedViewTitleRow(
|
||||
NetworkDetailedViewListType list_type);
|
||||
} // namespace ash
|
||||
|
Reference in New Issue
Block a user