From e99a269f2e3b30d185e3f5155ac21684f44ea0ae Mon Sep 17 00:00:00 2001 From: Vincent Wang Date: Mon, 25 Apr 2022 14:08:10 +0800 Subject: [PATCH] Fix circle is cut off in BiometricPrompt View parent's measure process will measure all child, so change the order of measure sequence to keep correct measure height BUG: 230136200 Test: 1. Set display size and text size to max 2. Check if the circle is cut off in BiometricPrompt Change-Id: I32e87399042acf3bea7501275f625b9b68790da0 --- .../biometrics/UdfpsDialogMeasureAdapter.java | 20 +++++++++---------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/packages/SystemUI/src/com/android/systemui/biometrics/UdfpsDialogMeasureAdapter.java b/packages/SystemUI/src/com/android/systemui/biometrics/UdfpsDialogMeasureAdapter.java index dbfce2ed2532b..2f097924817e9 100644 --- a/packages/SystemUI/src/com/android/systemui/biometrics/UdfpsDialogMeasureAdapter.java +++ b/packages/SystemUI/src/com/android/systemui/biometrics/UdfpsDialogMeasureAdapter.java @@ -112,17 +112,16 @@ public class UdfpsDialogMeasureAdapter { if (child.getId() == R.id.biometric_icon_frame) { final FrameLayout iconFrame = (FrameLayout) child; final View icon = iconFrame.getChildAt(0); - - // Ensure that the icon is never larger than the sensor. - icon.measure( - MeasureSpec.makeMeasureSpec(sensorDiameter, MeasureSpec.AT_MOST), - MeasureSpec.makeMeasureSpec(sensorDiameter, MeasureSpec.AT_MOST)); - // Create a frame that's exactly the height of the sensor circle. iconFrame.measure( MeasureSpec.makeMeasureSpec( child.getLayoutParams().width, MeasureSpec.EXACTLY), MeasureSpec.makeMeasureSpec(sensorDiameter, MeasureSpec.EXACTLY)); + + // Ensure that the icon is never larger than the sensor. + icon.measure( + MeasureSpec.makeMeasureSpec(sensorDiameter, MeasureSpec.AT_MOST), + MeasureSpec.makeMeasureSpec(sensorDiameter, MeasureSpec.AT_MOST)); } else if (child.getId() == R.id.space_above_icon) { child.measure( MeasureSpec.makeMeasureSpec(width, MeasureSpec.EXACTLY), @@ -208,16 +207,15 @@ public class UdfpsDialogMeasureAdapter { if (child.getId() == R.id.biometric_icon_frame) { final FrameLayout iconFrame = (FrameLayout) child; final View icon = iconFrame.getChildAt(0); + // Create a frame that's exactly the height of the sensor circle. + iconFrame.measure( + MeasureSpec.makeMeasureSpec(remeasuredWidth, MeasureSpec.EXACTLY), + MeasureSpec.makeMeasureSpec(sensorDiameter, MeasureSpec.EXACTLY)); // Ensure that the icon is never larger than the sensor. icon.measure( MeasureSpec.makeMeasureSpec(sensorDiameter, MeasureSpec.AT_MOST), MeasureSpec.makeMeasureSpec(sensorDiameter, MeasureSpec.AT_MOST)); - - // Create a frame that's exactly the height of the sensor circle. - iconFrame.measure( - MeasureSpec.makeMeasureSpec(remeasuredWidth, MeasureSpec.EXACTLY), - MeasureSpec.makeMeasureSpec(sensorDiameter, MeasureSpec.EXACTLY)); } else if (child.getId() == R.id.space_above_icon) { // Adjust the width and height of the top spacer if necessary. final int newTopSpacerHeight = child.getLayoutParams().height