summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--packages/SystemUI/res/values/strings.xml5
-rw-r--r--packages/SystemUI/src/com/android/systemui/screenrecord/ScreenRecordPermissionViewBinder.kt48
2 files changed, 23 insertions, 30 deletions
diff --git a/packages/SystemUI/res/values/strings.xml b/packages/SystemUI/res/values/strings.xml
index c3d84ff39485..f14ee14889c4 100644
--- a/packages/SystemUI/res/values/strings.xml
+++ b/packages/SystemUI/res/values/strings.xml
@@ -289,8 +289,9 @@
<!-- Screen recording permission option for recording just a single app [CHAR LIMIT=50] -->
<string name="screenrecord_permission_dialog_option_text_single_app">Record one app</string>
<!-- Screen recording permission option for recording the whole screen [CHAR LIMIT=50] -->
- <string name="screenrecord_permission_dialog_option_text_entire_screen" >Record entire screen</string>
- <string name="screenrecord_permission_dialog_option_text_entire_screen_for_display">Record entire screen: %s</string>
+ <string name="screenrecord_permission_dialog_option_text_entire_screen" >Record this screen</string>
+ <!-- Screen recording permission option for recording a connected external display. %s will be replaced by the display name [CHAR LIMIT=50] -->
+ <string name="screenrecord_permission_dialog_option_text_entire_screen_for_display">Record %s</string>
<!-- Message reminding the user that sensitive information may be captured during a full screen recording for the updated dialog that includes partial screen sharing option [CHAR_LIMIT=350]-->
<string name="screenrecord_permission_dialog_warning_entire_screen">When you’re recording your entire screen, anything shown on your screen is recorded. So be careful with things like passwords, payment details, messages, photos, and audio and video.</string>
<!-- Message reminding the user that sensitive information may be captured during a single app screen recording for the updated dialog that includes partial screen sharing option [CHAR_LIMIT=350]-->
diff --git a/packages/SystemUI/src/com/android/systemui/screenrecord/ScreenRecordPermissionViewBinder.kt b/packages/SystemUI/src/com/android/systemui/screenrecord/ScreenRecordPermissionViewBinder.kt
index 91c6b4769c99..88f373ea75a0 100644
--- a/packages/SystemUI/src/com/android/systemui/screenrecord/ScreenRecordPermissionViewBinder.kt
+++ b/packages/SystemUI/src/com/android/systemui/screenrecord/ScreenRecordPermissionViewBinder.kt
@@ -70,6 +70,7 @@ class ScreenRecordPermissionViewBinder(
}
companion object {
+
private val RECORDABLE_DISPLAY_TYPES =
intArrayOf(
Display.TYPE_OVERLAY,
@@ -83,8 +84,10 @@ class ScreenRecordPermissionViewBinder(
.mediaProjectionConnectedDisplayNoVirtualDevice()
fun createOptionList(displayManager: DisplayManager): List<ScreenShareOption> {
- if (!com.android.media.projection.flags.Flags.mediaProjectionConnectedDisplay()) {
- return listOf(
+ val connectedDisplays = getConnectedDisplays(displayManager)
+
+ val options =
+ mutableListOf(
ScreenShareOption(
SINGLE_APP,
R.string.screenrecord_permission_dialog_option_text_single_app,
@@ -103,33 +106,10 @@ class ScreenRecordPermissionViewBinder(
displayName = Build.MODEL,
),
)
- }
- return listOf(
- ScreenShareOption(
- SINGLE_APP,
- R.string.screenrecord_permission_dialog_option_text_single_app,
- R.string.screenrecord_permission_dialog_warning_single_app,
- startButtonText =
- R.string
- .media_projection_entry_generic_permission_dialog_continue_single_app,
- ),
- ScreenShareOption(
- ENTIRE_SCREEN,
- R.string.screenrecord_permission_dialog_option_text_entire_screen_for_display,
- R.string.screenrecord_permission_dialog_warning_entire_screen,
- startButtonText =
- R.string.screenrecord_permission_dialog_continue_entire_screen,
- displayId = Display.DEFAULT_DISPLAY,
- displayName = Build.MODEL,
- ),
- ) +
- displayManager.displays
- .filter {
- it.displayId != Display.DEFAULT_DISPLAY &&
- (!filterDeviceTypeFlag || it.type in RECORDABLE_DISPLAY_TYPES)
- }
- .map {
+ if (connectedDisplays.isNotEmpty()) {
+ options +=
+ connectedDisplays.map {
ScreenShareOption(
ENTIRE_SCREEN,
R.string
@@ -144,6 +124,18 @@ class ScreenRecordPermissionViewBinder(
displayName = it.name,
)
}
+ }
+ return options.toList()
+ }
+
+ private fun getConnectedDisplays(displayManager: DisplayManager): List<Display> {
+ if (!com.android.media.projection.flags.Flags.mediaProjectionConnectedDisplay()) {
+ return emptyList()
+ }
+ return displayManager.displays.filter {
+ it.displayId != Display.DEFAULT_DISPLAY &&
+ (!filterDeviceTypeFlag || it.type in RECORDABLE_DISPLAY_TYPES)
+ }
}
}
}