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

Commit 69482617 authored by Anton Potapov's avatar Anton Potapov
Browse files

Improve Volume Dialog measurement performance

Rework nested MotionLayout to ConstraintLayout + MotionLayout. Removing
ConstraintLayout would be problematic, but this saves us around 3ms on
the first measure which brings it to a parity with the previous
implementation.

This CL also marks the UI coroutins for tracibility.

Flag: com.android.systemui.volume_redesign
Bug: 369993959
Test: atest VolumeDialogScreenshotTest
Test: manual on foldable. Fold device when showing volume dialog
Change-Id: Idd7c0c45e88c121d3d9f2379ac5711ba346c3d46
parent c26379f2
Loading
Loading
Loading
Loading
+14 −5
Original line number Diff line number Diff line
@@ -13,14 +13,13 @@
     See the License for the specific language governing permissions and
     limitations under the License.
-->
<androidx.constraintlayout.motion.widget.MotionLayout xmlns:android="http://schemas.android.com/apk/res/android"
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:id="@+id/volume_dialog"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:alpha="0"
    android:clipChildren="false"
    app:layoutDescription="@xml/volume_dialog_scene">
    android:clipChildren="false">

    <View
        android:id="@+id/volume_dialog_background"
@@ -52,7 +51,17 @@

    <include
        android:id="@+id/volume_dialog_main_slider_container"
        layout="@layout/volume_dialog_slider" />
        layout="@layout/volume_dialog_slider"
        android:layout_width="@dimen/volume_dialog_slider_width"
        android:layout_height="0dp"
        android:layout_marginTop="@dimen/volume_dialog_slider_vertical_margin"
        android:layout_marginEnd="@dimen/volume_dialog_window_margin"
        android:layout_marginBottom="@dimen/volume_dialog_slider_vertical_margin"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintHeight_max="@dimen/volume_dialog_slider_height"
        app:layout_constraintTop_toTopOf="parent"
        app:layout_constraintVertical_bias="0.5" />

    <FrameLayout
        android:id="@+id/volume_dialog_bottom_section_container"
@@ -88,4 +97,4 @@
        app:layout_constraintEnd_toStartOf="@id/volume_dialog_background"
        app:layout_constraintTop_toTopOf="@id/volume_dialog_main_slider_container" />

</androidx.constraintlayout.motion.widget.MotionLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
+1 −3
Original line number Diff line number Diff line
@@ -2166,9 +2166,7 @@
        orientation when the vertical space is limited
    -->
    <dimen name="volume_dialog_slider_vertical_margin">124dp</dimen>

    <fraction name="volume_dialog_half_opened_bias">0.2</fraction>

    <dimen name="volume_dialog_half_opened_offset">-128dp</dimen>
    <dimen name="volume_dialog_slider_max_deviation">56dp</dimen>

    <dimen name="volume_dialog_background_square_corner_radius">12dp</dimen>
+0 −18
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>
<ConstraintSet xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:id="@+id/volume_dialog_constraint_set">

    <Constraint
        android:id="@id/volume_dialog_main_slider_container"
        android:layout_width="@dimen/volume_dialog_slider_width"
        android:layout_height="0dp"
        android:layout_marginTop="@dimen/volume_dialog_slider_vertical_margin"
        android:layout_marginEnd="@dimen/volume_dialog_window_margin"
        android:layout_marginBottom="@dimen/volume_dialog_slider_vertical_margin"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintHeight_max="@dimen/volume_dialog_slider_height"
        app:layout_constraintTop_toTopOf="parent"
        app:layout_constraintVertical_bias="0.5" />
</ConstraintSet>
 No newline at end of file
+0 −18
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>
<ConstraintSet xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:id="@+id/volume_dialog_half_folded_constraint_set">

    <Constraint
        android:id="@id/volume_dialog_main_slider_container"
        android:layout_width="@dimen/volume_dialog_slider_width"
        android:layout_height="0dp"
        android:layout_marginTop="@dimen/volume_dialog_slider_vertical_margin"
        android:layout_marginEnd="@dimen/volume_dialog_window_margin"
        android:layout_marginBottom="@dimen/volume_dialog_slider_vertical_margin"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintHeight_max="@dimen/volume_dialog_slider_height"
        app:layout_constraintTop_toTopOf="parent"
        app:layout_constraintVertical_bias="@fraction/volume_dialog_half_opened_bias" />
</ConstraintSet>
 No newline at end of file
+0 −27
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?><!--
  ~ Copyright (C) 2024 The Android Open Source Project
  ~
  ~ Licensed under the Apache License, Version 2.0 (the "License");
  ~ you may not use this file except in compliance with the License.
  ~ You may obtain a copy of the License at
  ~
  ~      http://www.apache.org/licenses/LICENSE-2.0
  ~
  ~ Unless required by applicable law or agreed to in writing, software
  ~ distributed under the License is distributed on an "AS IS" BASIS,
  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  ~ See the License for the specific language governing permissions and
  ~ limitations under the License.
  -->

<MotionScene xmlns:motion="http://schemas.android.com/apk/res-auto">

    <Transition
        motion:autoTransition="none"
        motion:constraintSetEnd="@id/volume_dialog_half_folded_constraint_set"
        motion:constraintSetStart="@id/volume_dialog_constraint_set"
        motion:duration="150" />

    <Include motion:constraintSet="@xml/volume_dialog_constraint_set" />
    <Include motion:constraintSet="@xml/volume_dialog_half_folded_constraint_set" />
</MotionScene>
 No newline at end of file
Loading