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

Commit a02fbc79 authored by Austin Delgado's avatar Austin Delgado
Browse files

Fix Biometric Prompt with different display sizes

Bug: 335367342
Test: Verified display size differences manually
Test: atest com.android.systemui.biometrics
Flag: com.android.systemui.constraint_bp
Change-Id: Ie093ec011d2c43c5f28d3671b01fcd65e113d5ff
parent fc6ff5a9
Loading
Loading
Loading
Loading
+24 −8
Original line number Diff line number Diff line
@@ -29,10 +29,11 @@
        android:layout_gravity="center_vertical"
        android:layout_marginStart="24dp"
        android:layout_marginBottom="8dp"
        android:ellipsize="end"
        android:maxLines="2"
        android:visibility="invisible"
        app:layout_constrainedWidth="true"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintEnd_toEndOf="@id/button_center_guideline"
        app:layout_constraintHorizontal_bias="0.0"
        app:layout_constraintStart_toStartOf="parent" />

    <!-- Cancel Button, replaces negative button when biometric is accepted -->
@@ -46,7 +47,10 @@
        android:layout_marginBottom="8dp"
        android:text="@string/cancel"
        android:visibility="invisible"
        app:layout_constrainedWidth="true"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintEnd_toEndOf="@id/button_center_guideline"
        app:layout_constraintHorizontal_bias="0.0"
        app:layout_constraintStart_toStartOf="parent" />

    <!-- "Use Credential" Button, replaces if device credential is allowed -->
@@ -59,7 +63,10 @@
        android:layout_marginStart="24dp"
        android:layout_marginBottom="8dp"
        android:visibility="invisible"
        app:layout_constrainedWidth="true"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintEnd_toEndOf="@id/button_center_guideline"
        app:layout_constraintHorizontal_bias="0.0"
        app:layout_constraintStart_toStartOf="parent" />

    <!-- Positive Button -->
@@ -71,12 +78,13 @@
        android:layout_gravity="center_vertical"
        android:layout_marginEnd="24dp"
        android:layout_marginBottom="8dp"
        android:ellipsize="end"
        android:maxLines="2"
        android:text="@string/biometric_dialog_confirm"
        android:visibility="invisible"
        app:layout_constrainedWidth="true"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintEnd_toEndOf="parent" />
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintHorizontal_bias="1.0"
        app:layout_constraintStart_toStartOf="@id/button_center_guideline" />

    <!-- Try Again Button -->
    <Button
@@ -87,11 +95,19 @@
        android:layout_gravity="center_vertical"
        android:layout_marginEnd="24dp"
        android:layout_marginBottom="8dp"
        android:ellipsize="end"
        android:maxLines="2"
        android:text="@string/biometric_dialog_try_again"
        android:visibility="invisible"
        app:layout_constrainedWidth="true"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintEnd_toEndOf="parent" />
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintHorizontal_bias="1.0"
        app:layout_constraintStart_toStartOf="@id/button_center_guideline" />

    <androidx.constraintlayout.widget.Guideline
        android:id="@+id/button_center_guideline"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:orientation="vertical"
        app:layout_constraintGuide_percent="0.5" />

</androidx.constraintlayout.widget.ConstraintLayout>
+2 −2
Original line number Diff line number Diff line
@@ -27,7 +27,6 @@
        app:layout_constraintTop_toTopOf="@id/topBarrier"
        app:layout_constraintWidth_max="@dimen/biometric_prompt_panel_max_width" />


    <include
        android:id="@+id/button_bar"
        layout="@layout/biometric_prompt_button_bar"
@@ -148,9 +147,10 @@
    <TextView
        android:id="@+id/indicator"
        style="@style/TextAppearance.AuthCredential.Indicator"
        android:layout_width="wrap_content"
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        android:layout_marginTop="24dp"
        android:layout_marginHorizontal="24dp"
        android:accessibilityLiveRegion="assertive"
        android:fadingEdge="horizontal"
        android:gravity="center_horizontal"
+3 −1
Original line number Diff line number Diff line
@@ -179,11 +179,13 @@ android:layout_height="match_parent">
        android:fadingEdge="horizontal"
        android:gravity="center_horizontal"
        android:scrollHorizontally="true"
        android:maxLines="2"
        app:layout_constraintBottom_toTopOf="@+id/button_bar"
        app:layout_constraintEnd_toEndOf="@+id/biometric_icon"
        app:layout_constraintStart_toStartOf="@+id/biometric_icon"
        app:layout_constraintTop_toBottomOf="@+id/biometric_icon"
        app:layout_constraintVertical_bias="0.0" />
        app:layout_constraintVertical_bias="0.0"
        app:layout_constraintWidth_max="@dimen/biometric_dialog_indicator_max_width" />

    <include
        android:id="@+id/button_bar"
+1 −2
Original line number Diff line number Diff line
@@ -1101,6 +1101,7 @@
    <dimen name="biometric_dialog_button_negative_max_width">160dp</dimen>
    <dimen name="biometric_dialog_button_positive_max_width">136dp</dimen>
    <dimen name="biometric_dialog_corner_size">28dp</dimen>
    <dimen name="biometric_dialog_indicator_max_width">280dp</dimen>
    <!-- Y translation when showing/dismissing the dialog-->
    <dimen name="biometric_dialog_animation_translation_offset">350dp</dimen>
    <dimen name="biometric_dialog_border_padding">4dp</dimen>
@@ -1117,9 +1118,7 @@
    <dimen name="biometric_prompt_panel_max_width">640dp</dimen>
    <dimen name="biometric_prompt_land_small_horizontal_guideline_padding">344dp</dimen>
    <dimen name="biometric_prompt_two_pane_udfps_horizontal_guideline_padding">114dp</dimen>
    <dimen name="biometric_prompt_two_pane_udfps_mid_guideline_padding">409dp</dimen>
    <dimen name="biometric_prompt_two_pane_medium_horizontal_guideline_padding">640dp</dimen>
    <dimen name="biometric_prompt_two_pane_medium_mid_guideline_padding">330dp</dimen>
    <dimen name="biometric_prompt_one_pane_medium_top_guideline_padding">119dp</dimen>
    <dimen name="biometric_prompt_one_pane_medium_horizontal_guideline_padding">0dp</dimen>

+14 −14
Original line number Diff line number Diff line
@@ -367,21 +367,21 @@ object BiometricViewSizeBinder {
                                smallConstraintSet.setGuidelineEnd(topGuideline.id, abs(bounds.top))
                            }

                            // Use rect bottom to set mid guideline of two-pane.
                            if (midGuideline != null) {
                                if (bounds.bottom >= 0) {
                                    midGuideline.setGuidelineEnd(bounds.bottom)
                                    mediumConstraintSet.setGuidelineEnd(
                                        midGuideline.id,
                                        bounds.bottom
                                    )
                                } else if (bounds.bottom < 0) {
                                    midGuideline.setGuidelineBegin(abs(bounds.bottom))
                                    mediumConstraintSet.setGuidelineBegin(
                                        midGuideline.id,
                                        abs(bounds.bottom)
                                    )
                                val left =
                                    if (bounds.left >= 0) {
                                        bounds.left
                                    } else {
                                        view.width - abs(bounds.left)
                                    }
                                val right =
                                    if (bounds.right >= 0) {
                                        view.width - abs(bounds.right)
                                    } else {
                                        bounds.right
                                    }
                                val mid = (left + right) / 2
                                mediumConstraintSet.setGuidelineBegin(midGuideline.id, mid)
                            }
                        }
                    }
Loading