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

Commit adc0250c authored by Nicolo' Mazzucato's avatar Nicolo' Mazzucato
Browse files

Update mirroring dialog to show concurrent displays warning

This introduces config_concurrentDisplayDeviceStates array, that is device specific and is supposed to contain all device states that represent "concurrent displays".

This also creates a DeviceStateRepository that allows interactors to use the state provided by DeviceStateManager easily.
Several other places in sysui are doing something similar (e.g. DevicePostureController and DisplayStateRepository), but with a slighly different logic that doesn't suit this use case (DPC is using an androidx related res that doesn't contain the concurrent state and having some logic to use the base state in certain cases, and DSR is only listening for specific states). Eventually, those other classes should be refactored to use DeviceStateRepository under the wood.

This is only enabled for devices overriding the config_concurrentDisplayDeviceStates array in an overlay.

Flag: ACONFIG enable_dual_display_blocking DISABLED
Test: ConnectedDisplayInteractorTest, DeviceStateRepositoryTest, MirroringConfirmationDialogScerenshotTest
Bug: 296211844
Change-Id: I68c0b1489019471aec0a72fda70f57a7bc1ed29d
parent 4aa3999f
Loading
Loading
Loading
Loading
+10 −0
Original line number Diff line number Diff line
@@ -693,6 +693,16 @@
        -->
    </integer-array>

    <!-- The device states (supplied by DeviceStateManager) that should be treated as concurrent
    display state. Default is empty. -->
    <integer-array name="config_concurrentDisplayDeviceStates">
        <!-- Example:
        <item>0</item>
        <item>1</item>
        <item>2</item>
        -->
    </integer-array>

    <!-- Indicates whether the window manager reacts to half-fold device states by overriding
     rotation. -->
    <bool name="config_windowManagerHalfFoldAutoRotateOverride">false</bool>
+1 −0
Original line number Diff line number Diff line
@@ -4142,6 +4142,7 @@
  <java-symbol type="array" name="config_foldedDeviceStates" />
  <java-symbol type="array" name="config_halfFoldedDeviceStates" />
  <java-symbol type="array" name="config_rearDisplayDeviceStates" />
  <java-symbol type="array" name="config_concurrentDisplayDeviceStates" />
  <java-symbol type="bool" name="config_windowManagerHalfFoldAutoRotateOverride" />
  <java-symbol type="bool" name="config_windowManagerPauseRotationWhenUnfolding" />
  <java-symbol type="integer" name="config_pauseRotationWhenUnfolding_hingeEventTimeout" />
+2 −0
Original line number Diff line number Diff line
@@ -190,6 +190,7 @@ android_library {
        "androidx.room_room-runtime",
        "androidx.room_room-ktx",
        "com.google.android.material_material",
        "device_state_flags_lib",
        "kotlinx_coroutines_android",
        "kotlinx_coroutines",
        "iconloader_base",
@@ -302,6 +303,7 @@ android_library {
        "androidx.exifinterface_exifinterface",
        "androidx.room_room-runtime",
        "androidx.room_room-ktx",
        "device_state_flags_lib",
        "kotlinx-coroutines-android",
        "kotlinx-coroutines-core",
        "kotlinx_coroutines_test",
+9 −0
Original line number Diff line number Diff line
@@ -45,6 +45,15 @@
        android:text="@string/connected_display_dialog_start_mirroring"
        android:textAppearance="@style/TextAppearance.Dialog.Title" />

    <TextView
        android:id="@+id/dual_display_warning"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:gravity="center"
        android:visibility="gone"
        android:text="@string/connected_display_dialog_dual_display_stop_warning"
        android:textAppearance="@style/TextAppearance.Dialog.Body" />

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
+2 −0
Original line number Diff line number Diff line
@@ -3245,6 +3245,8 @@

    <!--- Title of the dialog appearing when an external display is connected, asking whether to start mirroring [CHAR LIMIT=NONE]-->
    <string name="connected_display_dialog_start_mirroring">Mirror to external display?</string>
    <!--- Body of the mirroring dialog, shown when dual display is enabled. This signals that enabling mirroring will stop concurrent displays on a foldable device. [CHAR LIMIT=NONE]-->
    <string name="connected_display_dialog_dual_display_stop_warning">Any dual screen activity currently running will be stopped</string>
    <!--- Label of the "enable display" button of the dialog appearing when an external display is connected [CHAR LIMIT=NONE]-->
    <string name="mirror_display">Mirror display</string>
    <!--- Label of the dismiss button of the dialog appearing when an external display is connected [CHAR LIMIT=NONE]-->
Loading