From 7f569944475d59c5229e1c7032ded518834921c8 Mon Sep 17 00:00:00 2001 From: Kevin Chyn Date: Thu, 7 Oct 2021 19:34:52 +0000 Subject: [PATCH 1/2] Revert "Update BiometricPrompt UI for large displays" This reverts commit f30f327d5bc0e353281377adfefa9d8ac3d41548. Reason for revert: Regression on existing devices Change-Id: I0ec61e1113c50257ab52f93be1efc5a9ef0b7b4c --- .../biometrics/AuthBiometricView.java | 20 +------------------ .../biometrics/AuthPanelController.java | 18 +++++++++++++++++ 2 files changed, 19 insertions(+), 19 deletions(-) diff --git a/packages/SystemUI/src/com/android/systemui/biometrics/AuthBiometricView.java b/packages/SystemUI/src/com/android/systemui/biometrics/AuthBiometricView.java index da69f4556547c..60b06378a61a1 100644 --- a/packages/SystemUI/src/com/android/systemui/biometrics/AuthBiometricView.java +++ b/packages/SystemUI/src/com/android/systemui/biometrics/AuthBiometricView.java @@ -824,29 +824,11 @@ public abstract class AuthBiometricView extends LinearLayout { return new AuthDialog.LayoutParams(width, totalHeight); } - /** - * Simple heuristic which should return true displays that are larger than a normal phone. - * For example, tablet displays, or the unfolded display for foldables. - */ - private boolean isLargeDisplay(int width, int height) { - return width > 1200 && height > 1200; - } - @Override protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { final int width = MeasureSpec.getSize(widthMeasureSpec); final int height = MeasureSpec.getSize(heightMeasureSpec); - - Log.d(TAG, "Width: " + width + ", height: " + height); - - final int newWidth; - if (isLargeDisplay(width, height)) { - // TODO: Unless we can come up with a one-size-fits-all equation, we may want to - // consider moving this to an overlay. - newWidth = 2 * Math.min(width, height) / 3; - } else { - newWidth = Math.min(width, height); - } + final int newWidth = Math.min(width, height); // Use "newWidth" instead, so the landscape dialog width is the same as the portrait // width. diff --git a/packages/SystemUI/src/com/android/systemui/biometrics/AuthPanelController.java b/packages/SystemUI/src/com/android/systemui/biometrics/AuthPanelController.java index f1e42e0c54548..fa50f895f83ec 100644 --- a/packages/SystemUI/src/com/android/systemui/biometrics/AuthPanelController.java +++ b/packages/SystemUI/src/com/android/systemui/biometrics/AuthPanelController.java @@ -117,6 +117,24 @@ public class AuthPanelController extends ViewOutlineProvider { mUseFullScreen = fullScreen; } + public ValueAnimator getTranslationAnimator(float relativeTranslationY) { + final ValueAnimator animator = ValueAnimator.ofFloat( + mPanelView.getY(), mPanelView.getY() - relativeTranslationY); + animator.addUpdateListener(animation -> { + final float translation = (float) animation.getAnimatedValue(); + mPanelView.setTranslationY(translation); + }); + return animator; + } + + public ValueAnimator getAlphaAnimator(float alpha) { + final ValueAnimator animator = ValueAnimator.ofFloat(mPanelView.getAlpha(), alpha); + animator.addUpdateListener(animation -> { + mPanelView.setAlpha((float) animation.getAnimatedValue()); + }); + return animator; + } + public void updateForContentDimensions(int contentWidth, int contentHeight, int animateDurationMs) { if (DEBUG) { From ee350b65411e0e2ed12be584e8b2a1af731cdcb3 Mon Sep 17 00:00:00 2001 From: Kevin Chyn Date: Thu, 7 Oct 2021 14:28:41 -0700 Subject: [PATCH 2/2] Update BiometricPrompt UI for large displays Piggy backs on existing SystemUI Util method that determines when split notification shade, lockscreen, etc should be shown. Bug: 201811580 Test: manual Change-Id: I59089884992018e183d15c47e07967b91d27f935 --- .../systemui/biometrics/AuthBiometricView.java | 16 +++++++++++++++- .../biometrics/AuthPanelController.java | 18 ------------------ 2 files changed, 15 insertions(+), 19 deletions(-) diff --git a/packages/SystemUI/src/com/android/systemui/biometrics/AuthBiometricView.java b/packages/SystemUI/src/com/android/systemui/biometrics/AuthBiometricView.java index 60b06378a61a1..f11dc93138524 100644 --- a/packages/SystemUI/src/com/android/systemui/biometrics/AuthBiometricView.java +++ b/packages/SystemUI/src/com/android/systemui/biometrics/AuthBiometricView.java @@ -824,11 +824,25 @@ public abstract class AuthBiometricView extends LinearLayout { return new AuthDialog.LayoutParams(width, totalHeight); } + private boolean isLargeDisplay() { + return com.android.systemui.util.Utils.shouldUseSplitNotificationShade(getResources()); + } + @Override protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { final int width = MeasureSpec.getSize(widthMeasureSpec); final int height = MeasureSpec.getSize(heightMeasureSpec); - final int newWidth = Math.min(width, height); + + final boolean isLargeDisplay = isLargeDisplay(); + + final int newWidth; + if (isLargeDisplay) { + // TODO(b/201811580): Unless we can come up with a one-size-fits-all equation, we may + // want to consider moving this to an overlay. + newWidth = 2 * Math.min(width, height) / 3; + } else { + newWidth = Math.min(width, height); + } // Use "newWidth" instead, so the landscape dialog width is the same as the portrait // width. diff --git a/packages/SystemUI/src/com/android/systemui/biometrics/AuthPanelController.java b/packages/SystemUI/src/com/android/systemui/biometrics/AuthPanelController.java index fa50f895f83ec..f1e42e0c54548 100644 --- a/packages/SystemUI/src/com/android/systemui/biometrics/AuthPanelController.java +++ b/packages/SystemUI/src/com/android/systemui/biometrics/AuthPanelController.java @@ -117,24 +117,6 @@ public class AuthPanelController extends ViewOutlineProvider { mUseFullScreen = fullScreen; } - public ValueAnimator getTranslationAnimator(float relativeTranslationY) { - final ValueAnimator animator = ValueAnimator.ofFloat( - mPanelView.getY(), mPanelView.getY() - relativeTranslationY); - animator.addUpdateListener(animation -> { - final float translation = (float) animation.getAnimatedValue(); - mPanelView.setTranslationY(translation); - }); - return animator; - } - - public ValueAnimator getAlphaAnimator(float alpha) { - final ValueAnimator animator = ValueAnimator.ofFloat(mPanelView.getAlpha(), alpha); - animator.addUpdateListener(animation -> { - mPanelView.setAlpha((float) animation.getAnimatedValue()); - }); - return animator; - } - public void updateForContentDimensions(int contentWidth, int contentHeight, int animateDurationMs) { if (DEBUG) {