diff options
author | LuK1337 <priv.luk@gmail.com> | 2022-02-25 20:32:59 +0100 |
---|---|---|
committer | alk3pInjection <webmaster@raspii.tech> | 2022-05-02 09:56:20 +0800 |
commit | e7c439da85f956342f68c617af8a724f7c24dee0 (patch) | |
tree | db12a8e321dd2ca96953189f6820c58a1b5978f8 | |
parent | 0f6396e814a1dd97ed04fc89ebb271a2329c34ae (diff) |
Remove navbar inset for UDFPS BiometricPrompt
This is not necessary because BiometricPrompt is not drawn above the
navigation bar.
Change-Id: I7a00a0d6f1b2b68d6c642be03e23849029f8faa1
-rw-r--r-- | packages/SystemUI/src/com/android/systemui/biometrics/UdfpsDialogMeasureAdapter.java | 37 |
1 files changed, 9 insertions, 28 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/biometrics/UdfpsDialogMeasureAdapter.java b/packages/SystemUI/src/com/android/systemui/biometrics/UdfpsDialogMeasureAdapter.java index 1624d5f68c35..e5f2310c81d1 100644 --- a/packages/SystemUI/src/com/android/systemui/biometrics/UdfpsDialogMeasureAdapter.java +++ b/packages/SystemUI/src/com/android/systemui/biometrics/UdfpsDialogMeasureAdapter.java @@ -97,10 +97,9 @@ public class UdfpsDialogMeasureAdapter { // Navbar + dialogMargin + buttonBar + textIndicator + spacerHeight = sensorDistFromBottom final int dialogMargin = getDialogMarginPx(); final int displayHeight = getWindowBounds().height(); - final Insets navbarInsets = getNavbarInsets(); mBottomSpacerHeight = calculateBottomSpacerHeightForPortrait( mSensorProps, displayHeight, textIndicatorHeight, buttonBarHeight, - dialogMargin, navbarInsets.bottom); + dialogMargin); // Go through each of the children and do the custom measurement. int totalHeight = 0; @@ -161,17 +160,15 @@ public class UdfpsDialogMeasureAdapter { final int topSpacerHeight = getViewHeightPx(R.id.space_above_icon); final int textIndicatorHeight = getViewHeightPx(R.id.indicator); final int buttonBarHeight = getViewHeightPx(R.id.button_bar); - final Insets navbarInsets = getNavbarInsets(); final int bottomSpacerHeight = calculateBottomSpacerHeightForLandscape(titleHeight, subtitleHeight, descriptionHeight, topSpacerHeight, textIndicatorHeight, - buttonBarHeight, navbarInsets.bottom); + buttonBarHeight); // Find the spacer width needed to horizontally align the icon with the sensor. final int displayWidth = getWindowBounds().width(); final int dialogMargin = getDialogMarginPx(); - final int horizontalInset = navbarInsets.left + navbarInsets.right; final int horizontalSpacerWidth = calculateHorizontalSpacerWidthForLandscape( - mSensorProps, displayWidth, dialogMargin, horizontalInset); + mSensorProps, displayWidth, dialogMargin); final int sensorDiameter = mSensorProps.getLocation().sensorRadius * 2; final int remeasuredWidth = sensorDiameter + 2 * horizontalSpacerWidth; @@ -237,15 +234,6 @@ public class UdfpsDialogMeasureAdapter { } @NonNull - private Insets getNavbarInsets() { - final WindowManager windowManager = getWindowManager(); - return windowManager != null && windowManager.getCurrentWindowMetrics() != null - ? windowManager.getCurrentWindowMetrics().getWindowInsets() - .getInsets(WindowInsets.Type.navigationBars()) - : Insets.NONE; - } - - @NonNull private Rect getWindowBounds() { final WindowManager windowManager = getWindowManager(); return windowManager != null && windowManager.getCurrentWindowMetrics() != null @@ -268,8 +256,7 @@ public class UdfpsDialogMeasureAdapter { @VisibleForTesting static int calculateBottomSpacerHeightForPortrait( @NonNull FingerprintSensorPropertiesInternal sensorProperties, int displayHeightPx, - int textIndicatorHeightPx, int buttonBarHeightPx, int dialogMarginPx, - int navbarBottomInsetPx) { + int textIndicatorHeightPx, int buttonBarHeightPx, int dialogMarginPx) { final SensorLocationInternal location = sensorProperties.getLocation(); final int sensorDistanceFromBottom = displayHeightPx - location.sensorLocationY @@ -278,13 +265,11 @@ public class UdfpsDialogMeasureAdapter { final int spacerHeight = sensorDistanceFromBottom - textIndicatorHeightPx - buttonBarHeightPx - - dialogMarginPx - - navbarBottomInsetPx; + - dialogMarginPx; Log.d(TAG, "Display height: " + displayHeightPx + ", Distance from bottom: " + sensorDistanceFromBottom + ", Bottom margin: " + dialogMarginPx - + ", Navbar bottom inset: " + navbarBottomInsetPx + ", Bottom spacer height (portrait): " + spacerHeight); return spacerHeight; @@ -297,7 +282,7 @@ public class UdfpsDialogMeasureAdapter { @VisibleForTesting static int calculateBottomSpacerHeightForLandscape(int titleHeightPx, int subtitleHeightPx, int descriptionHeightPx, int topSpacerHeightPx, int textIndicatorHeightPx, - int buttonBarHeightPx, int navbarBottomInsetPx) { + int buttonBarHeightPx) { final int dialogHeightAboveIcon = titleHeightPx + subtitleHeightPx @@ -307,8 +292,7 @@ public class UdfpsDialogMeasureAdapter { final int dialogHeightBelowIcon = textIndicatorHeightPx + buttonBarHeightPx; final int bottomSpacerHeight = dialogHeightAboveIcon - - dialogHeightBelowIcon - - navbarBottomInsetPx; + - dialogHeightBelowIcon; Log.d(TAG, "Title height: " + titleHeightPx + ", Subtitle height: " + subtitleHeightPx @@ -316,7 +300,6 @@ public class UdfpsDialogMeasureAdapter { + ", Top spacer height: " + topSpacerHeightPx + ", Text indicator height: " + textIndicatorHeightPx + ", Button bar height: " + buttonBarHeightPx - + ", Navbar bottom inset: " + navbarBottomInsetPx + ", Bottom spacer height (landscape): " + bottomSpacerHeight); return bottomSpacerHeight; @@ -330,20 +313,18 @@ public class UdfpsDialogMeasureAdapter { @VisibleForTesting static int calculateHorizontalSpacerWidthForLandscape( @NonNull FingerprintSensorPropertiesInternal sensorProperties, int displayWidthPx, - int dialogMarginPx, int navbarHorizontalInsetPx) { + int dialogMarginPx) { final SensorLocationInternal location = sensorProperties.getLocation(); final int sensorDistanceFromEdge = displayWidthPx - location.sensorLocationY - location.sensorRadius; final int horizontalPadding = sensorDistanceFromEdge - - dialogMarginPx - - navbarHorizontalInsetPx; + - dialogMarginPx; Log.d(TAG, "Display width: " + displayWidthPx + ", Distance from edge: " + sensorDistanceFromEdge + ", Dialog margin: " + dialogMarginPx - + ", Navbar horizontal inset: " + navbarHorizontalInsetPx + ", Horizontal spacer width (landscape): " + horizontalPadding); return horizontalPadding; |