0

[CrOS Network] Update text for unactivation pSIM Networks

When a user is not logged in or gone through device setup(OOBE), they
cannot perform certain actions, like activating a SIM. Previously we
would show a text informing the user to click on an unactivated SIM
to activate. But in a non logged in state the user cannot perform that
action, this left users confused. This CL fixes this issue, adding
an informative message for this case.

screenshot: https://screenshot.googleplex.com/5er79houcWWxdNk.png

Bug: b/219514319
Test: Deployed to DUT, Ran cq and updated unittest.
Change-Id: Ica3629bc125995c7f374f3bef9da894e32b775f2
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4225722
Reviewed-by: Chad Duffin <chadduffin@chromium.org>
Commit-Queue: Theo Johnson-kanu <tjohnsonkanu@google.com>
Cr-Commit-Position: refs/heads/main@{#1103984}
This commit is contained in:
Theo Johnson-Kanu
2023-02-10 19:50:58 +00:00
committed by Chromium LUCI CQ
parent 1b5cb43a5a
commit 217cae3848
6 changed files with 71 additions and 4 deletions

@ -2344,6 +2344,9 @@ Connect your device to power.
<message name="IDS_ASH_STATUS_TRAY_NETWORK_A11Y_LABEL_ACTIVATE" desc="Accessibility label used for an unactivated cellular network in quick settings network list that opens the activation flow when clicked.">
Click to activate <ph name="NETWORK_NAME">$1<ex>Verizon</ex></ph>
</message>
<message name="IDS_ASH_STATUS_TRAY_NETWORK_A11Y_LABEL_ACTIVATE_AFTER_SETUP" desc="Accessibility label used for an unactivated cellular network in quick settings network list that informs the user a network can only be activated after device setup.">
Activate after device setup <ph name="NETWORK_NAME">$1<ex>Verizon</ex></ph>
</message>
<message name="IDS_ASH_STATUS_TRAY_NETWORK_A11Y_LABEL_SUBTEXT" desc="Accessibility label used for a network in quick settings network list that has a subtext message (e.g. when offline signin is required).">
<ph name="NETWORK_NAME">$1<ex>CaptivePortalNetwork</ex></ph>, <ph name="SUBTEXT">$2<ex>Sign in to network</ex></ph>
</message>
@ -2401,6 +2404,9 @@ Connect your device to power.
<message name="IDS_ASH_STATUS_TRAY_NETWORK_STATUS_CLICK_TO_ACTIVATE" desc="The label used in quick settings to indicate an unactivated cellular network that can be clicked to launch activation through setup flow. [CHAR_LIMIT=29]">
Click to activate
</message>
<message name="IDS_ASH_STATUS_TRAY_NETWORK_STATUS_ACTIVATE_AFTER_DEVICE_SETUP" desc="The label used in quick settings to indicate an unactivated cellular network that can only be activated after the device is fully setup. [CHAR_LIMIT=29]">
Activate after device setup
</message>
<message name="IDS_ASH_STATUS_TRAY_NETWORK_UNAVAILABLE_SIM_NETWORK" desc="Label used in quick settings to indicate a SIM network that is not available to be setup. [CHAR_LIMIT=29]">
Not activated. Contact your carrier.
</message>

@ -0,0 +1 @@
a00a9e632dc7f1e74324c5e2de249e6e099c5891

@ -0,0 +1 @@
a00a9e632dc7f1e74324c5e2de249e6e099c5891

@ -152,7 +152,7 @@ bool IsNetworkManagedByPolicy(
network_properties->source == OncSource::kUserPolicy;
}
bool ShouldShowActivateCellularNetwork(
bool IsCellularNetworkUnActivated(
const NetworkStatePropertiesPtr& network_properties) {
return GetNetworkActivationState(network_properties) ==
ActivationStateType::kNotActivated &&
@ -201,8 +201,14 @@ gfx::ImageSkia GetNetworkImageForNetwork(
int GetCellularNetworkSubText(
const NetworkStatePropertiesPtr& network_properties) {
if (ShouldShowActivateCellularNetwork(network_properties))
if (IsCellularNetworkUnActivated(network_properties)) {
if (Shell::Get()->session_controller()->login_status() ==
LoginStatus::NOT_LOGGED_IN) {
return IDS_ASH_STATUS_TRAY_NETWORK_STATUS_ACTIVATE_AFTER_DEVICE_SETUP;
}
return IDS_ASH_STATUS_TRAY_NETWORK_STATUS_CLICK_TO_ACTIVATE;
}
if (ShouldShowContactCarrier(network_properties))
return IDS_ASH_STATUS_TRAY_NETWORK_UNAVAILABLE_SIM_NETWORK;
if (!IsCellularNetworkSimLocked(network_properties))
@ -383,7 +389,12 @@ std::u16string NetworkListNetworkItemView::GenerateAccessibilityLabel(
IDS_ASH_STATUS_TRAY_NETWORK_A11Y_LABEL_CONNECT, label);
}
if (ShouldShowActivateCellularNetwork(network_properties())) {
if (IsCellularNetworkUnActivated(network_properties())) {
if (Shell::Get()->session_controller()->login_status() ==
LoginStatus::NOT_LOGGED_IN) {
return l10n_util::GetStringFUTF16(
IDS_ASH_STATUS_TRAY_NETWORK_A11Y_LABEL_ACTIVATE_AFTER_SETUP, label);
}
return l10n_util::GetStringFUTF16(
IDS_ASH_STATUS_TRAY_NETWORK_A11Y_LABEL_ACTIVATE, label);
}
@ -487,7 +498,12 @@ std::u16string
NetworkListNetworkItemView::GenerateAccessibilityDescriptionForCellular(
const std::u16string& connection_status,
int signal_strength) {
if (ShouldShowActivateCellularNetwork(network_properties())) {
if (IsCellularNetworkUnActivated(network_properties())) {
if (Shell::Get()->session_controller()->login_status() ==
LoginStatus::NOT_LOGGED_IN) {
return l10n_util::GetStringUTF16(
IDS_ASH_STATUS_TRAY_NETWORK_STATUS_ACTIVATE_AFTER_DEVICE_SETUP);
}
return l10n_util::GetStringUTF16(
IDS_ASH_STATUS_TRAY_NETWORK_STATUS_CLICK_TO_ACTIVATE);
}

@ -224,6 +224,18 @@ TEST_F(NetworkListNetworkItemViewTest, HasCorrectCellularSublabel) {
IDS_ASH_STATUS_TRAY_NETWORK_STATUS_CLICK_TO_ACTIVATE),
network_list_network_item_view()->sub_text_label()->GetText());
// Simulate user logout and check label for pSIM networks that are
// connected but not activated.
GetSessionControllerClient()->Reset();
base::RunLoop().RunUntilIdle();
UpdateViewForNetwork(cellular_network);
EXPECT_EQ(l10n_util::GetStringUTF16(
IDS_ASH_STATUS_TRAY_NETWORK_STATUS_ACTIVATE_AFTER_DEVICE_SETUP),
network_list_network_item_view()->sub_text_label()->GetText());
CreateUserSessions(/*session_count=*/1);
base::RunLoop().RunUntilIdle();
// Label for unactivated eSIM networks.
cellular_network->type_state->get_cellular()->eid = kEid;
UpdateViewForNetwork(cellular_network);
@ -422,6 +434,19 @@ TEST_F(NetworkListNetworkItemViewTest, HasExpectedA11yText) {
base::UTF8ToUTF16(kCellularName)),
network_list_network_item_view()->GetAccessibleName());
// Simulate user logout and check label for pSIM networks that are
// connected but not activated.
GetSessionControllerClient()->Reset();
base::RunLoop().RunUntilIdle();
UpdateViewForNetwork(cellular_network);
EXPECT_EQ(l10n_util::GetStringFUTF16(
IDS_ASH_STATUS_TRAY_NETWORK_A11Y_LABEL_ACTIVATE_AFTER_SETUP,
base::UTF8ToUTF16(kCellularName)),
network_list_network_item_view()->GetAccessibleName());
CreateUserSessions(/*session_count=*/1);
base::RunLoop().RunUntilIdle();
// Contact carrier A11Y label is shown when a eSIM network is connected but
// not yet activated.
cellular_network->type_state->get_cellular()->eid = kEid;
@ -547,6 +572,17 @@ TEST_F(NetworkListNetworkItemViewTest, HasExpectedDescriptionForCellular) {
l10n_util::GetStringUTF16(
IDS_ASH_STATUS_TRAY_NETWORK_STATUS_CLICK_TO_ACTIVATE));
// Cellular is not activate and user is not logged in.
GetSessionControllerClient()->Reset();
base::RunLoop().RunUntilIdle();
AssertA11yDescription(
cellular_network,
l10n_util::GetStringUTF16(
IDS_ASH_STATUS_TRAY_NETWORK_STATUS_ACTIVATE_AFTER_DEVICE_SETUP));
CreateUserSessions(/*session_count=*/1);
base::RunLoop().RunUntilIdle();
// Cellular is not activated and is an eSIM network.
cellular_network->type_state->get_cellular()->eid = kEid;
AssertA11yDescription(

@ -106,6 +106,13 @@ bool IsNetworkDisabled(
return true;
}
if (!Shell::Get()->session_controller()->IsActiveUserSessionStarted() &&
cellular->activation_state ==
chromeos::network_config::mojom::ActivationStateType::kNotActivated &&
network_properties->type_state->get_cellular()->eid.empty()) {
return true;
}
if (cellular->activation_state ==
chromeos::network_config::mojom::ActivationStateType::kActivating) {
return true;