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

Commit 6dd79270 authored by Mariia Sandrikova's avatar Mariia Sandrikova
Browse files

[1/n] Camera Compat UI: Refactor size compat mode UI controller.

First CL in the chain that will add a camera compat UI control which will be used to correct stretched issues in TextureView and SurfaceView cause by apps not handling mismatch between camera buffers and view size correctly.

This change is necessary because right now there are 2 instances of WindowlessWindowManager (SizeCompatUIWindowManager) in SizeCompatUILayout: for a hint and for a restart button. They are also positioned relatively by computing offsets in java code rather than by specifying layout with XML. This code structure will cause issues since with upcoming camera changes there will be a need to coordinate relative position of 4 UI elements (2 buttons and 2 hints).

What is changing in this CL:
- Majority of changes are simple renaming from "size compat UI" to "compat UI" since, starting from the next change, two different compat controls will be supported.
- Merging 2 instances of SizeCompatUIWindowManager into one (CompatUIWindowManager) and for that create a joint layout in compat_ui_layout.xml
- Merge SizeCompatLayout logic into CompatUIWindowManager since in absence of 2 instances of WindowlessWindowManager there is no good reason to keep them separate.
- Merging and renaming tests to follow refactoring of the implementation.

Test: atest WMShellUnitTests (the same set of tests should be sufficient since this refactoring just reorganized the structure of the implementation)
Bug: 206602997
Change-Id: I7141c69b7ba4742c5b7b2018329b91a1b37b45bc
parent 535795b3
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -16,6 +16,6 @@
  -->
<shape xmlns:android="http://schemas.android.com/apk/res/android"
       android:shape="rectangle">
    <solid android:color="@color/size_compat_background"/>
    <corners android:radius="@dimen/size_compat_hint_corner_radius"/>
    <solid android:color="@color/compat_controls_background"/>
    <corners android:radius="@dimen/compat_hint_corner_radius"/>
</shape>
 No newline at end of file
+2 −2
Original line number Diff line number Diff line
@@ -15,11 +15,11 @@
  ~ limitations under the License.
  -->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
        android:width="@dimen/size_compat_hint_point_width"
        android:width="@dimen/compat_hint_point_width"
        android:height="8dp"
        android:viewportWidth="10"
        android:viewportHeight="8">
    <path
        android:fillColor="@color/size_compat_background"
        android:fillColor="@color/compat_controls_background"
        android:pathData="M10,0 l-4.1875,6.6875 a1,1 0 0,1 -1.625,0 l-4.1875,-6.6875z"/>
</vector>
+3 −3
Original line number Diff line number Diff line
@@ -20,16 +20,16 @@
        android:viewportWidth="48"
        android:viewportHeight="48">
    <path
        android:fillColor="@color/size_compat_background"
        android:fillColor="@color/compat_controls_background"
        android:pathData="M0,24 a24,24 0 1,0 48,0 a24,24 0 1,0 -48,0" />
    <group
        android:translateX="12"
        android:translateY="12">
        <path
            android:fillColor="@color/size_compat_text"
            android:fillColor="@color/compat_controls_text"
            android:pathData="M6,13c0,-1.65 0.67,-3.15 1.76,-4.24L6.34,7.34C4.9,8.79 4,10.79 4,13c0,4.08 3.05,7.44 7,7.93v-2.02C8.17,18.43 6,15.97 6,13z"/>
        <path
            android:fillColor="@color/size_compat_text"
            android:fillColor="@color/compat_controls_text"
            android:pathData="M20,13c0,-4.42 -3.58,-8 -8,-8c-0.06,0 -0.12,0.01 -0.18,0.01v0l1.09,-1.09L11.5,2.5L8,6l3.5,3.5l1.41,-1.41l-1.08,-1.08C11.89,7.01 11.95,7 12,7c3.31,0 6,2.69 6,6c0,2.97 -2.17,5.43 -5,5.91v2.02C16.95,20.44 20,17.08 20,13z"/>
    </group>
</vector>
+46 −0
Original line number Diff line number Diff line
@@ -14,45 +14,33 @@
     See the License for the specific language governing permissions and
     limitations under the License.
-->
<com.android.wm.shell.sizecompatui.SizeCompatHintPopup
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content">

    <FrameLayout
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:clipToPadding="false"
        android:paddingBottom="5dp">

<LinearLayout
            android:id="@+id/size_compat_hint_popup"
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:orientation="vertical"
    android:clipToPadding="false"
    android:paddingEnd="@dimen/compat_hint_padding_end"
    android:paddingBottom="5dp"
    android:clickable="true">

    <TextView
        android:id="@+id/compat_mode_hint_text"
        android:layout_width="188dp"
        android:layout_height="wrap_content"
        android:lineSpacingExtra="4sp"
                android:background="@drawable/size_compat_hint_bubble"
        android:background="@drawable/compat_hint_bubble"
        android:padding="16dp"
                android:text="@string/restart_button_description"
        android:textAlignment="viewStart"
                android:textColor="@color/size_compat_text"
        android:textColor="@color/compat_controls_text"
        android:textSize="14sp"/>

    <ImageView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_gravity="end"
                android:src="@drawable/size_compat_hint_point"
                android:paddingHorizontal="@dimen/size_compat_hint_corner_radius"
        android:src="@drawable/compat_hint_point"
        android:paddingHorizontal="@dimen/compat_hint_corner_radius"
        android:contentDescription="@null"/>

</LinearLayout>

    </FrameLayout>

</com.android.wm.shell.sizecompatui.SizeCompatHintPopup>
+8 −3
Original line number Diff line number Diff line
@@ -14,10 +14,15 @@
  ~ See the License for the specific language governing permissions and
  ~ limitations under the License.
  -->
<com.android.wm.shell.sizecompatui.SizeCompatRestartButton
<com.android.wm.shell.compatui.CompatUILayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content">
    android:layout_height="wrap_content"
    android:orientation="vertical"
    android:gravity="bottom|end">

    <include android:id="@+id/size_compat_hint"
         layout="@layout/compat_mode_hint"/>

    <FrameLayout
        android:layout_width="@dimen/size_compat_button_width"
@@ -36,4 +41,4 @@

    </FrameLayout>

</com.android.wm.shell.sizecompatui.SizeCompatRestartButton>
</com.android.wm.shell.compatui.CompatUILayout>
Loading