Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit b1dccbdd authored by Vadim Caen's avatar Vadim Caen
Browse files

String update for screen recording

- Only show display name when more than 1 screen is available

   Android now supports recording external display. By default
   we show the device name along the "record screen" option,
   but we don't need to show it when no external display is connected

- Update the default string to match the new UI Mock

Test: CtsMediaProjectionTestCases
Test: SystemUIGoogleRobo2RNGTests
Bug: 362720120
Flag: EXEMPT Bug fix
Change-Id: I5986c9c3720d5e647389ad5fcc8dd62b41d32231
parent 0bd3b99f
Loading
Loading
Loading
Loading
+3 −2
Original line number Diff line number Diff line
@@ -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]-->
+20 −28
Original line number Diff line number Diff line
@@ -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
@@ -145,5 +125,17 @@ class ScreenRecordPermissionViewBinder(
                        )
                    }
            }
            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)
            }
        }
    }
}