0

[Exo] Added and updated text in error dialog for different network error

Added different text for different network error according to mocks.
UX mocks: go/appstream-ux

Screenshot:
Different network: https://screenshot.googleplex.com/h8L2TzyWDrKTABP.png
Phone on cellelar: https://screenshot.googleplex.com/9FMf9BjAqGSXsxc.png
Unsupported network: https://screenshot.googleplex.com/BS4KkCmTuvTbGo7.png

different network settings. Although I'm not able to test unsupported network in my home network.

Tested: manually verified different text will be shown based on
Bug: b/273823160
Change-Id: I478eb46ae09d8cfb02e8467f3532ae3b261552fd
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4401079
Commit-Queue: Pu Shi <pushi@google.com>
Reviewed-by: Crisrael Lucero <crisrael@google.com>
Cr-Commit-Position: refs/heads/main@{#1129519}
This commit is contained in:
Pu Shi
2023-04-12 21:51:16 +00:00
committed by Chromium LUCI CQ
parent da08f1bea8
commit ebd9c4f823
14 changed files with 86 additions and 33 deletions

@ -2592,6 +2592,7 @@ component("ash") {
"//ash/style",
"//ash/webui/diagnostics_ui/mojom:mojom",
"//ash/webui/eche_app_ui:eche_connection_status",
"//ash/webui/eche_app_ui:system_info_provider",
"//ash/webui/eche_app_ui/mojom:mojom",
"//ash/webui/personalization_app/mojom",
"//ash/webui/personalization_app/proto",

@ -6402,14 +6402,20 @@ New install
<message name="IDS_ASH_ECHE_APP_STREMING_ERROR_DIALOG_TITLE" desc="The title of dialog that appears when there is a connection error trying to stream app">
Can't stream apps
</message>
<message name="IDS_ASH_ECHE_APP_STREAMING_ERROR_DIALOG_MAIN_TEXT" desc="The main description in the dialog that appears when there is a connection error trying to stream app">
<message name="IDS_ASH_ECHE_APP_STREAMING_ERROR_DIALOG_UNSUPPORTED_NETWORK_TEXT" desc="The main description in the dialog that appears when devices are on unsupported network">
This network doesn't support streaming apps from your phone. Try using your phone's hotspot. <ph name="LEARN_MORE">$1<ex>Learn more</ex></ph>
</message>
<message name="IDS_ASH_ECHE_APP_STREAMING_ERROR_DIALOG_DIFFERENT_NETWORK_TEXT" desc="The main description in the dialog that appears when devices are on different networks">
Make sure your phone and Chromebook are on the same network and then try again. <ph name="LEARN_MORE">$1<ex>Learn more</ex></ph>
</message>
<message name="IDS_ASH_ECHE_APP_STREAMING_ERROR_DIALOG_PHONE_ON_CELLULAR_TEXT" desc="The main description in the dialog that appears when phone is on cellular">
Your phone is using a mobile network. Make Sure your phone and Chromebook are on the same Wi-Fi network and then try again. <ph name="LEARN_MORE">$1<ex>Learn more</ex></ph>
</message>
<message name="IDS_ASH_ECHE_APP_STREMING_ERROR_DIALOG_TURN_ON_HOTSPOT" desc="The button in the dialog that appears when there is a connection error trying to stream app to turn on hotspot">
Turn on hotspot
</message>
<message name="IDS_ASH_ECHE_APP_STREAMING_ERROR_DIALOG_OK_TEXT" desc="Confirm button on the connection error dialog to acknowledge.">
Ok
<message name="IDS_ASH_ECHE_APP_STREAMING_ERROR_DIALOG_DISMISS_TEXT" desc="The text on the button to dismiss dialog">
Dismiss
</message>
<!-- Deferred update dialog -->

@ -0,0 +1 @@
133d285331d6c36c7ca8ae5546bb3c38a4e8a53d

@ -0,0 +1 @@
750187313937e14b97706d785a64f33205306bf6

@ -1 +0,0 @@
fc6d2fc17ebc565b4dc3025fa68ad7335a79a9a0

@ -1 +0,0 @@
fc6d2fc17ebc565b4dc3025fa68ad7335a79a9a0

@ -0,0 +1 @@
c84378105fca12f57c7efce90e3b7cb3f130e13b

@ -0,0 +1 @@
0657225691d6720605b25657e4ef96b4594715e8

@ -62,7 +62,9 @@ constexpr int kMarginBetweenButtons = 8;
class ConnectionErrorDialogDelegateView : public views::WidgetDelegateView {
public:
explicit ConnectionErrorDialogDelegateView(
StartTetheringCallback start_tethering_callback)
StartTetheringCallback start_tethering_callback,
bool is_on_different_network,
bool is_phone_on_cellular)
: start_tethering_callback_(std::move(start_tethering_callback)) {
SetModalType(ui::MODAL_TYPE_WINDOW);
@ -104,14 +106,27 @@ class ConnectionErrorDialogDelegateView : public views::WidgetDelegateView {
title_->layer()->SetFillsBoundsOpaquely(false);
// Add dialog body.
const std::u16string learn_more_link =
l10n_util::GetStringUTF16(IDS_ASH_LEARN_MORE);
size_t offset;
const std::u16string body_text = l10n_util::GetStringFUTF16(
IDS_ASH_ECHE_APP_STREAMING_ERROR_DIALOG_MAIN_TEXT, learn_more_link,
&offset);
body_ = AddChildView(std::make_unique<views::StyledLabel>());
std::u16string body_text;
const std::u16string learn_more_link =
l10n_util::GetStringUTF16(IDS_ASH_LEARN_MORE);
// To record where "Learn more" text begin in the dialog body.
size_t offset;
if (is_phone_on_cellular) {
body_text = l10n_util::GetStringFUTF16(
IDS_ASH_ECHE_APP_STREAMING_ERROR_DIALOG_PHONE_ON_CELLULAR_TEXT,
learn_more_link, &offset);
} else if (is_on_different_network) {
body_text = l10n_util::GetStringFUTF16(
IDS_ASH_ECHE_APP_STREAMING_ERROR_DIALOG_DIFFERENT_NETWORK_TEXT,
learn_more_link, &offset);
} else {
body_text = l10n_util::GetStringFUTF16(
IDS_ASH_ECHE_APP_STREAMING_ERROR_DIALOG_UNSUPPORTED_NETWORK_TEXT,
learn_more_link, &offset);
}
body_->SetText(body_text);
views::StyledLabel::RangeStyleInfo style;
@ -155,19 +170,33 @@ class ConnectionErrorDialogDelegateView : public views::WidgetDelegateView {
kMarginBetweenButtons))
->set_main_axis_alignment(views::BoxLayout::MainAxisAlignment::kEnd);
cancel_button_ = button_row->AddChildView(std::make_unique<ash::PillButton>(
views::Button::PressedCallback(base::BindRepeating(
&ConnectionErrorDialogDelegateView::OnCancelClicked,
base::Unretained(this))),
l10n_util::GetStringUTF16(IDS_APP_CANCEL),
PillButton::Type::kDefaultWithoutIcon, nullptr));
accept_button_ = button_row->AddChildView(std::make_unique<ash::PillButton>(
views::Button::PressedCallback(base::BindRepeating(
&ConnectionErrorDialogDelegateView::OnStartTetheringClicked,
base::Unretained(this))),
l10n_util::GetStringUTF16(
IDS_ASH_ECHE_APP_STREMING_ERROR_DIALOG_TURN_ON_HOTSPOT),
PillButton::Type::kPrimaryWithoutIcon, nullptr));
if (!is_on_different_network && !is_phone_on_cellular) {
cancel_button_ =
button_row->AddChildView(std::make_unique<ash::PillButton>(
views::Button::PressedCallback(base::BindRepeating(
&ConnectionErrorDialogDelegateView::OnCancelClicked,
base::Unretained(this))),
l10n_util::GetStringUTF16(
IDS_ASH_ECHE_APP_STREAMING_ERROR_DIALOG_DISMISS_TEXT),
PillButton::Type::kDefaultWithoutIcon, nullptr));
accept_button_ =
button_row->AddChildView(std::make_unique<ash::PillButton>(
views::Button::PressedCallback(base::BindRepeating(
&ConnectionErrorDialogDelegateView::OnStartTetheringClicked,
base::Unretained(this))),
l10n_util::GetStringUTF16(
IDS_ASH_ECHE_APP_STREMING_ERROR_DIALOG_TURN_ON_HOTSPOT),
PillButton::Type::kPrimaryWithoutIcon, nullptr));
} else {
cancel_button_ =
button_row->AddChildView(std::make_unique<ash::PillButton>(
views::Button::PressedCallback(base::BindRepeating(
&ConnectionErrorDialogDelegateView::OnCancelClicked,
base::Unretained(this))),
l10n_util::GetStringUTF16(
IDS_ASH_ECHE_APP_STREAMING_ERROR_DIALOG_DISMISS_TEXT),
PillButton::Type::kPrimaryWithoutIcon, nullptr));
}
}
ConnectionErrorDialogDelegateView(const ConnectionErrorDialogDelegateView&) =
@ -235,10 +264,12 @@ class ConnectionErrorDialogDelegateView : public views::WidgetDelegateView {
AppStreamConnectionErrorDialog::AppStreamConnectionErrorDialog(
views::View* host_view,
base::OnceClosure on_close_callback,
StartTetheringCallback button_callback)
StartTetheringCallback button_callback,
bool is_different_network,
bool is_phone_one_cellular)
: host_view_(host_view), on_close_callback_(std::move(on_close_callback)) {
auto dialog = std::make_unique<ConnectionErrorDialogDelegateView>(
std::move(button_callback));
std::move(button_callback), is_different_network, is_phone_one_cellular);
views::Widget* const parent = host_view_->GetWidget();
widget_ = new views::Widget();

@ -30,7 +30,9 @@ class ASH_EXPORT AppStreamConnectionErrorDialog : public views::WidgetObserver,
AppStreamConnectionErrorDialog(
views::View* host_view,
base::OnceClosure on_close_callback,
StartTetheringCallback start_tethering_callback);
StartTetheringCallback start_tethering_callback,
bool is_different_network,
bool is_phone_on_cellular);
AppStreamConnectionErrorDialog(const AppStreamConnectionErrorDialog& other) =
delete;
AppStreamConnectionErrorDialog& operator=(

@ -139,7 +139,8 @@ phone_hub_metrics::Screen PhoneConnectedView::GetScreenForMetrics() const {
return phone_hub_metrics::Screen::kPhoneConnected;
}
void PhoneConnectedView::ShowAppStreamErrorDialog() {
void PhoneConnectedView::ShowAppStreamErrorDialog(bool is_different_network,
bool is_phone_on_cellular) {
if (!features::IsEcheNetworkConnectionStateEnabled()) {
return;
}
@ -148,7 +149,8 @@ void PhoneConnectedView::ShowAppStreamErrorDialog() {
base::BindOnce(&PhoneConnectedView::OnAppStreamErrorDialogClosed,
base::Unretained(this)),
base::BindOnce(&PhoneConnectedView::OnAppStreamErrorDialogButtonClicked,
base::Unretained(this)));
base::Unretained(this)),
is_different_network, is_phone_on_cellular);
app_stream_error_dialog_->UpdateBounds();
app_stream_error_dialog_->widget()->Show();
}

@ -35,7 +35,8 @@ class PhoneConnectedView : public PhoneHubContentView {
// PhoneHubContentView:
phone_hub_metrics::Screen GetScreenForMetrics() const override;
void ShowAppStreamErrorDialog();
void ShowAppStreamErrorDialog(bool is_different_network,
bool is_phone_on_cellular);
private:
void OnAppStreamErrorDialogClosed();

@ -22,6 +22,7 @@
#include "ash/system/phonehub/ui_constants.h"
#include "ash/system/tray/tray_constants.h"
#include "ash/webui/eche_app_ui/mojom/eche_app.mojom.h"
#include "ash/webui/eche_app_ui/system_info_provider.h"
#include "base/cxx17_backports.h"
#include "base/metrics/histogram_functions.h"
#include "base/ranges/algorithm.h"
@ -516,7 +517,15 @@ void PhoneHubRecentAppsView::SwitchToFullAppsList() {
void PhoneHubRecentAppsView::ShowConnectionErrorDialog() {
if (features::IsEcheNetworkConnectionStateEnabled()) {
connected_view_->ShowAppStreamErrorDialog();
connected_view_->ShowAppStreamErrorDialog(
phone_hub_manager_->GetSystemInfoProvider()
? phone_hub_manager_->GetSystemInfoProvider()
->is_different_network()
: false,
phone_hub_manager_->GetSystemInfoProvider()
? phone_hub_manager_->GetSystemInfoProvider()
->android_device_on_cellular()
: false);
}
}

@ -5,7 +5,6 @@
#ifndef CHROMEOS_ASH_COMPONENTS_PHONEHUB_FAKE_PHONE_HUB_MANAGER_H_
#define CHROMEOS_ASH_COMPONENTS_PHONEHUB_FAKE_PHONE_HUB_MANAGER_H_
#include "ash/webui/eche_app_ui/system_info_provider.h"
#include "chromeos/ash/components/phonehub/app_stream_launcher_data_model.h"
#include "chromeos/ash/components/phonehub/app_stream_manager.h"
#include "chromeos/ash/components/phonehub/fake_browser_tabs_model_provider.h"