From 201e52f0706d44c8ea8daba9a4e59cdaded1ce2f Mon Sep 17 00:00:00 2001 From: Caitlin Shkuratov Date: Mon, 22 Jul 2024 20:31:20 +0000 Subject: [Screen share] Update strings and icon for share-to-app dialog. Bug: 352327853 Flag: NONE string changes Test: Share screen to app -> verify dialog has new strings and icon for both single app case and entire screen cast Test: atest ShareToAppPermissionDialogDelegateTest Change-Id: Ib5ad8dacf0ce1bab63c7d0c4054551998e2a34cb --- packages/SystemUI/res/values/strings.xml | 13 +++++-- .../ShareToAppPermissionDialogDelegate.kt | 15 ++++++-- .../ShareToAppPermissionDialogDelegateTest.kt | 43 +++++++++++++++++++++- 3 files changed, 61 insertions(+), 10 deletions(-) diff --git a/packages/SystemUI/res/values/strings.xml b/packages/SystemUI/res/values/strings.xml index dd4ede4022fc..d30b77e018c7 100644 --- a/packages/SystemUI/res/values/strings.xml +++ b/packages/SystemUI/res/values/strings.xml @@ -1367,13 +1367,18 @@ - Start recording or casting with %s? + Share your screen with %s? + + + Share one app + + Share entire screen - When you’re sharing, recording, or casting, %s has access to anything visible on your screen or played on your device. So be careful with things like passwords, payment details, messages, photos, and audio and video. + When you’re sharing your entire screen, anything on your screen is visible to %s. So be careful with things like passwords, payment details, messages, photos, and audio and video. - When you’re sharing, recording, or casting an app, %s has access to anything shown or played on that app. So be careful with things like passwords, payment details, messages, photos, and audio and video. + When you’re sharing an app, anything shown or played in that app is visible to %s. So be careful with things like passwords, payment details, messages, photos, and audio and video. - Start + Share screen %1$s has disabled this option diff --git a/packages/SystemUI/src/com/android/systemui/mediaprojection/permission/ShareToAppPermissionDialogDelegate.kt b/packages/SystemUI/src/com/android/systemui/mediaprojection/permission/ShareToAppPermissionDialogDelegate.kt index 8bf220277c12..4b132d0db3fc 100644 --- a/packages/SystemUI/src/com/android/systemui/mediaprojection/permission/ShareToAppPermissionDialogDelegate.kt +++ b/packages/SystemUI/src/com/android/systemui/mediaprojection/permission/ShareToAppPermissionDialogDelegate.kt @@ -48,6 +48,7 @@ class ShareToAppPermissionDialogDelegate( appName, hostUid, mediaProjectionMetricsLogger, + dialogIconDrawable = R.drawable.ic_present_to_all, ) { override fun onCreate(dialog: AlertDialog, savedInstanceState: Bundle?) { super.onCreate(dialog, savedInstanceState) @@ -83,22 +84,28 @@ class ShareToAppPermissionDialogDelegate( listOf( ScreenShareOption( mode = SINGLE_APP, - spinnerText = R.string.screen_share_permission_dialog_option_single_app, + spinnerText = + R.string + .media_projection_entry_app_permission_dialog_option_text_single_app, warningText = R.string .media_projection_entry_app_permission_dialog_warning_single_app, startButtonText = - R.string.media_projection_entry_app_permission_dialog_continue, + R.string + .media_projection_entry_generic_permission_dialog_continue_single_app, spinnerDisabledText = singleAppDisabledText, ), ScreenShareOption( mode = ENTIRE_SCREEN, - spinnerText = R.string.screen_share_permission_dialog_option_entire_screen, + spinnerText = + R.string + .media_projection_entry_app_permission_dialog_option_text_entire_screen, warningText = R.string .media_projection_entry_app_permission_dialog_warning_entire_screen, startButtonText = - R.string.media_projection_entry_app_permission_dialog_continue, + R.string + .media_projection_entry_app_permission_dialog_continue_entire_screen, ) ) return if (singleAppDisabledText != null) { diff --git a/packages/SystemUI/tests/src/com/android/systemui/mediaprojection/permission/ShareToAppPermissionDialogDelegateTest.kt b/packages/SystemUI/tests/src/com/android/systemui/mediaprojection/permission/ShareToAppPermissionDialogDelegateTest.kt index c57aa369490b..04ef1be9c057 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/mediaprojection/permission/ShareToAppPermissionDialogDelegateTest.kt +++ b/packages/SystemUI/tests/src/com/android/systemui/mediaprojection/permission/ShareToAppPermissionDialogDelegateTest.kt @@ -29,6 +29,7 @@ import com.android.systemui.mediaprojection.MediaProjectionMetricsLogger import com.android.systemui.res.R import com.android.systemui.statusbar.phone.AlertDialogWithDelegate import com.android.systemui.statusbar.phone.SystemUIDialog +import com.google.common.truth.Truth.assertThat import kotlin.test.assertEquals import org.junit.After import org.junit.Test @@ -44,8 +45,10 @@ class ShareToAppPermissionDialogDelegateTest : SysuiTestCase() { private val appName = "Test App" - private val resIdSingleApp = R.string.screen_share_permission_dialog_option_single_app - private val resIdFullScreen = R.string.screen_share_permission_dialog_option_entire_screen + private val resIdSingleApp = + R.string.media_projection_entry_app_permission_dialog_option_text_single_app + private val resIdFullScreen = + R.string.media_projection_entry_app_permission_dialog_option_text_entire_screen private val resIdSingleAppDisabled = R.string.media_projection_entry_app_permission_dialog_single_app_disabled @@ -115,6 +118,36 @@ class ShareToAppPermissionDialogDelegateTest : SysuiTestCase() { assertEquals(context.getString(resIdFullScreen), secondOptionText) } + @Test + fun startButtonText_entireScreenSelected() { + setUpAndShowDialog() + onSpinnerItemSelected(ENTIRE_SCREEN) + + val startButtonText = dialog.requireViewById(android.R.id.button1).text + + assertThat(startButtonText) + .isEqualTo( + context.getString( + R.string.media_projection_entry_app_permission_dialog_continue_entire_screen + ) + ) + } + + @Test + fun startButtonText_singleAppSelected() { + setUpAndShowDialog() + onSpinnerItemSelected(SINGLE_APP) + + val startButtonText = dialog.requireViewById(android.R.id.button1).text + + assertThat(startButtonText) + .isEqualTo( + context.getString( + R.string.media_projection_entry_generic_permission_dialog_continue_single_app + ) + ) + } + private fun setUpAndShowDialog( mediaProjectionConfig: MediaProjectionConfig? = null, overrideDisableSingleAppOption: Boolean = false, @@ -142,4 +175,10 @@ class ShareToAppPermissionDialogDelegateTest : SysuiTestCase() { delegate.onCreate(dialog, savedInstanceState = null) dialog.show() } + + private fun onSpinnerItemSelected(position: Int) { + val spinner = dialog.requireViewById(R.id.screen_share_mode_options) + checkNotNull(spinner.onItemSelectedListener) + .onItemSelected(spinner, mock(), position, /* id= */ 0) + } } -- cgit v1.2.3-59-g8ed1b