Commit affdaea5 authored by Kyle Horimoto's avatar Kyle Horimoto Committed by Commit Bot

[CrOS Tether] Update "enable GmsCore notifications" UI.

This UI is shown on the settings page when a phone tells the Chromebook
that it does not have GmsCore notifications enabled.

This CL:
  (1) Updates HostScannerOperation to accept an additional enum value
      indicating that GmsCore notifications are disabled.
  (2) Updates the settings page to show an extra step which is needed in
      some cases to enable notifications.

Bug: 793936, 672263
Cq-Include-Trybots: master.tryserver.chromium.linux:closure_compilation
Change-Id: I65f34db384956189e6ea3c157a57f48bc4701fe4
Reviewed-on: https://chromium-review.googlesource.com/894729Reviewed-by: default avatarSteven Bennetts <stevenjb@chromium.org>
Commit-Queue: Kyle Horimoto <khorimoto@chromium.org>
Cr-Commit-Position: refs/heads/master@{#533167}
parent ba14b002
...@@ -1625,25 +1625,28 @@ ...@@ -1625,25 +1625,28 @@
Unable to detect your phone Unable to detect your phone
</message> </message>
<message name="IDS_SETTINGS_INTERNET_GMSCORE_NOTIFICATIONS_TITLE" desc="Title of the section which explains how to enable Google Play Services notifications on an Android phone in order to use Instant Tethering."> <message name="IDS_SETTINGS_INTERNET_GMSCORE_NOTIFICATIONS_TITLE" desc="Title of the section which explains how to enable Google Play Services notifications on an Android phone in order to use Instant Tethering.">
Google Play Services notifications are required for Instant Tethering To use Instant Tethering, turn on notifications for Google Play Services.
</message> </message>
<message name="IDS_SETTINGS_INTERNET_GMSCORE_NOTIFICATIONS_ONE_DEVICE_SUBTITLE" desc="Subtitle of the section which explains how to enable Google Play Services notifications. This subtitle is used when only one phone needs to have its notifications enabled."> <message name="IDS_SETTINGS_INTERNET_GMSCORE_NOTIFICATIONS_ONE_DEVICE_SUBTITLE" desc="Subtitle of the section which explains how to enable Google Play Services notifications. This subtitle is used when only one phone needs to have its notifications enabled.">
On your '<ph name="PHONE_NAME">$1<ex>Google Pixel</ex></ph>', enable notifications by following these steps: On your '<ph name="PHONE_NAME">$1<ex>Google Pixel</ex></ph>':
</message> </message>
<message name="IDS_SETTINGS_INTERNET_GMSCORE_NOTIFICATIONS_TWO_DEVICES_SUBTITLE" desc="Subtitle of the section which explains how to enable Google Play Services notifications. This subtitle is used when two phones need to have their notifications enabled."> <message name="IDS_SETTINGS_INTERNET_GMSCORE_NOTIFICATIONS_TWO_DEVICES_SUBTITLE" desc="Subtitle of the section which explains how to enable Google Play Services notifications. This subtitle is used when two phones need to have their notifications enabled.">
On your '<ph name="PHONE_NAME_1">$1<ex>Google Pixel</ex></ph>' and '<ph name="PHONE_NAME_2">$2<ex>Google Pixel 2</ex></ph>', enable notifications by following these steps: On your '<ph name="PHONE_NAME_1">$1<ex>Google Pixel</ex></ph>' and '<ph name="PHONE_NAME_2">$2<ex>Google Pixel 2</ex></ph>':
</message> </message>
<message name="IDS_SETTINGS_INTERNET_GMSCORE_NOTIFICATIONS_MANY_DEVICES_SUBTITLE" desc="Subtitle of the section which explains how to enable Google Play Services notifications. This subtitle is used when three or more phones need to have their notifications enabled."> <message name="IDS_SETTINGS_INTERNET_GMSCORE_NOTIFICATIONS_MANY_DEVICES_SUBTITLE" desc="Subtitle of the section which explains how to enable Google Play Services notifications. This subtitle is used when three or more phones need to have their notifications enabled.">
On your devices, enable notifications by following these steps: On your devices:
</message> </message>
<message name="IDS_SETTINGS_INTERNET_GMSCORE_NOTIFICATIONS_FIRST_STEP" desc="First instruction for how to enable Google Play Services notifications on an Android phone. This step teaches the user how to look at Google Play Services settings."> <message name="IDS_SETTINGS_INTERNET_GMSCORE_NOTIFICATIONS_FIRST_STEP" desc="First instruction for how to enable Google Play Services notifications on an Android phone. This step teaches the user how to look at notification settings.">
Go to Settings &gt; Apps &amp; notifications &gt; All apps &gt; Google Play Services. Go to Settings &gt; Apps &amp; notifications &gt; Notifications.
</message> </message>
<message name="IDS_SETTINGS_INTERNET_GMSCORE_NOTIFICATIONS_SECOND_STEP" desc="Second instruction for how to enable Google Play Services notifications on an Android phone. This step teaches the user how to look at notification settings when already viewing Google Play Services settings."> <message name="IDS_SETTINGS_INTERNET_GMSCORE_NOTIFICATIONS_SECOND_STEP" desc="Second instruction for how to enable Google Play Services notifications on an Android phone. This step teaches the user how to look at notification settings for the Google Play Services app.">
Tap on App notifications. Tap App notifications &gt; Google Play services.
</message> </message>
<message name="IDS_SETTINGS_INTERNET_GMSCORE_NOTIFICATIONS_THIRD_STEP" desc="Third instruction for how to enable Google Play Services notifications on an Android phone. This step teaches the user how to enable notifications when already viewing noticiations settings for Google Play Services."> <message name="IDS_SETTINGS_INTERNET_GMSCORE_NOTIFICATIONS_THIRD_STEP" desc="Third instruction for how to enable Google Play Services notifications on an Android phone. This step teaches the user how to enable notifications when already viewing noticiations settings for Google Play Services.">
Check that app notifications are "On". If not, toggle to enable. Turn on Google Play services.
</message>
<message name="IDS_SETTINGS_INTERNET_GMSCORE_NOTIFICATIONS_FOURTH_STEP" desc="Fourth instruction for how to enable Google Play Services notifications on an Android phone. This step teaches the user how to enable the Instant Tethering notification channel for Google Play Services.">
Scroll to the bottom of the screen and turn on Instant Tethering, if it appears. If it doesn't, you're all set.
</message> </message>
<message name="IDS_SETTINGS_INTERNET_NO_NETWORKS_MOBILE_DATA" desc="Text shown when viewing the Mobile data page when there are no cellular or tether networks available."> <message name="IDS_SETTINGS_INTERNET_NO_NETWORKS_MOBILE_DATA" desc="Text shown when viewing the Mobile data page when there are no cellular or tether networks available.">
No mobile connection found. Turn on Instant Tethering on your other devices and try again. &lt;a target="_blank" href="<ph name="URL">$1<ex>https://google.com/</ex></ph>"&gt;Learn more&lt;/a&gt; No mobile connection found. Turn on Instant Tethering on your other devices and try again. &lt;a target="_blank" href="<ph name="URL">$1<ex>https://google.com/</ex></ph>"&gt;Learn more&lt;/a&gt;
......
...@@ -143,6 +143,7 @@ ...@@ -143,6 +143,7 @@
<li>$i18n{gmscoreNotificationsFirstStep}</li> <li>$i18n{gmscoreNotificationsFirstStep}</li>
<li>$i18n{gmscoreNotificationsSecondStep}</li> <li>$i18n{gmscoreNotificationsSecondStep}</li>
<li>$i18n{gmscoreNotificationsThirdStep}</li> <li>$i18n{gmscoreNotificationsThirdStep}</li>
<li>$i18n{gmscoreNotificationsFourthStep}</li>
</ol> </ol>
</div> </div>
</template> </template>
......
...@@ -1091,6 +1091,8 @@ void AddInternetStrings(content::WebUIDataSource* html_source) { ...@@ -1091,6 +1091,8 @@ void AddInternetStrings(content::WebUIDataSource* html_source) {
IDS_SETTINGS_INTERNET_GMSCORE_NOTIFICATIONS_SECOND_STEP}, IDS_SETTINGS_INTERNET_GMSCORE_NOTIFICATIONS_SECOND_STEP},
{"gmscoreNotificationsThirdStep", {"gmscoreNotificationsThirdStep",
IDS_SETTINGS_INTERNET_GMSCORE_NOTIFICATIONS_THIRD_STEP}, IDS_SETTINGS_INTERNET_GMSCORE_NOTIFICATIONS_THIRD_STEP},
{"gmscoreNotificationsFourthStep",
IDS_SETTINGS_INTERNET_GMSCORE_NOTIFICATIONS_FOURTH_STEP},
{"tetherConnectionDialogTitle", {"tetherConnectionDialogTitle",
IDS_SETTINGS_INTERNET_TETHER_CONNECTION_DIALOG_TITLE}, IDS_SETTINGS_INTERNET_TETHER_CONNECTION_DIALOG_TITLE},
{"tetherConnectionAvailableDeviceTitle", {"tetherConnectionAvailableDeviceTitle",
......
...@@ -64,8 +64,11 @@ bool AreGmsCoreNotificationsDisabled( ...@@ -64,8 +64,11 @@ bool AreGmsCoreNotificationsDisabled(
return false; return false;
return response->response_code() == return response->response_code() ==
TetherAvailabilityResponse_ResponseCode:: TetherAvailabilityResponse_ResponseCode::
TetherAvailabilityResponse_ResponseCode_NOTIFICATIONS_DISABLED; TetherAvailabilityResponse_ResponseCode_NOTIFICATIONS_DISABLED_LEGACY ||
response->response_code() ==
TetherAvailabilityResponse_ResponseCode::
TetherAvailabilityResponse_ResponseCode_NOTIFICATIONS_DISABLED_WITH_NOTIFICATION_CHANNEL;
} }
} // namespace } // namespace
...@@ -181,7 +184,7 @@ void HostScannerOperation::OnMessageReceived( ...@@ -181,7 +184,7 @@ void HostScannerOperation::OnMessageReceived(
PA_LOG(INFO) << "Received TetherAvailabilityResponse from device with ID " PA_LOG(INFO) << "Received TetherAvailabilityResponse from device with ID "
<< remote_device.GetTruncatedDeviceIdForLogs() << " which " << remote_device.GetTruncatedDeviceIdForLogs() << " which "
<< "indicates that Google Play Services notifications are " << "indicates that Google Play Services notifications are "
<< "disabled."; << "disabled. Response code: " << response->response_code();
gms_core_notifications_disabled_devices_.push_back(remote_device); gms_core_notifications_disabled_devices_.push_back(remote_device);
NotifyObserversOfScannedDeviceList(false /* is_final_scan_result */); NotifyObserversOfScannedDeviceList(false /* is_final_scan_result */);
} else if (!IsTetheringAvailableWithValidDeviceStatus(response)) { } else if (!IsTetheringAvailableWithValidDeviceStatus(response)) {
......
...@@ -325,14 +325,27 @@ TEST_F(HostScannerOperationTest, TestOperation_OneDevice_NoSimCard) { ...@@ -325,14 +325,27 @@ TEST_F(HostScannerOperationTest, TestOperation_OneDevice_NoSimCard) {
} }
TEST_F(HostScannerOperationTest, TEST_F(HostScannerOperationTest,
TestOperation_OneDevice_NotificationsDisabled) { TestOperation_OneDevice_NotificationsDisabled_Legacy) {
EXPECT_CALL(*mock_tether_host_response_recorder_, EXPECT_CALL(*mock_tether_host_response_recorder_,
RecordSuccessfulTetherAvailabilityResponse(_)) RecordSuccessfulTetherAvailabilityResponse(_))
.Times(0); .Times(0);
TestOperationWithOneDevice( TestOperationWithOneDevice(
TetherAvailabilityResponse_ResponseCode :: TetherAvailabilityResponse_ResponseCode ::
TetherAvailabilityResponse_ResponseCode_NOTIFICATIONS_DISABLED); TetherAvailabilityResponse_ResponseCode_NOTIFICATIONS_DISABLED_LEGACY);
EXPECT_EQ(std::vector<cryptauth::RemoteDevice>{test_devices_[0]},
test_observer_->gms_core_notifications_disabled_devices());
}
TEST_F(HostScannerOperationTest,
TestOperation_OneDevice_NotificationsDisabled_NotificationChannel) {
EXPECT_CALL(*mock_tether_host_response_recorder_,
RecordSuccessfulTetherAvailabilityResponse(_))
.Times(0);
TestOperationWithOneDevice(
TetherAvailabilityResponse_ResponseCode ::
TetherAvailabilityResponse_ResponseCode_NOTIFICATIONS_DISABLED_WITH_NOTIFICATION_CHANNEL);
EXPECT_EQ(std::vector<cryptauth::RemoteDevice>{test_devices_[0]}, EXPECT_EQ(std::vector<cryptauth::RemoteDevice>{test_devices_[0]},
test_observer_->gms_core_notifications_disabled_devices()); test_observer_->gms_core_notifications_disabled_devices());
} }
......
...@@ -63,7 +63,7 @@ message DeviceStatus { ...@@ -63,7 +63,7 @@ message DeviceStatus {
// Next id: 1 // Next id: 1
message TetherAvailabilityRequest {} message TetherAvailabilityRequest {}
// Next id: 6 // Next id: 7
message TetherAvailabilityResponse { message TetherAvailabilityResponse {
enum ResponseCode { enum ResponseCode {
UNKNOWN_ERROR = 0; UNKNOWN_ERROR = 0;
...@@ -71,7 +71,8 @@ message TetherAvailabilityResponse { ...@@ -71,7 +71,8 @@ message TetherAvailabilityResponse {
SETUP_NEEDED = 2; SETUP_NEEDED = 2;
NO_RECEPTION = 3; NO_RECEPTION = 3;
NO_SIM_CARD = 4; NO_SIM_CARD = 4;
NOTIFICATIONS_DISABLED = 5; NOTIFICATIONS_DISABLED_LEGACY = 5;
NOTIFICATIONS_DISABLED_WITH_NOTIFICATION_CHANNEL = 6;
} }
optional ResponseCode response_code = 1; optional ResponseCode response_code = 1;
......
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