Merge "Added custom bp size." into tm-qpr-dev

This commit is contained in:
Lucas Dupin
2022-09-14 01:58:42 +00:00
committed by Android (Google) Code Review
3 changed files with 21 additions and 6 deletions

View File

@@ -18,4 +18,6 @@
<resources> <resources>
<!-- Whether to show the user switcher in quick settings when only a single user is present. --> <!-- Whether to show the user switcher in quick settings when only a single user is present. -->
<bool name="qs_show_user_switcher_for_single_user">false</bool> <bool name="qs_show_user_switcher_for_single_user">false</bool>
<!-- Whether to show a custom biometric prompt size-->
<bool name="use_custom_bp_size">false</bool>
</resources> </resources>

View File

@@ -945,6 +945,8 @@
<dimen name="biometric_dialog_medium_to_large_translation_offset">100dp</dimen> <dimen name="biometric_dialog_medium_to_large_translation_offset">100dp</dimen>
<!-- Y translation for credential contents when animating in --> <!-- Y translation for credential contents when animating in -->
<dimen name="biometric_dialog_credential_translation_offset">60dp</dimen> <dimen name="biometric_dialog_credential_translation_offset">60dp</dimen>
<dimen name="biometric_dialog_width">240dp</dimen>
<dimen name="biometric_dialog_height">240dp</dimen>
<!-- Starting text size in sp of batteryLevel for wireless charging animation --> <!-- Starting text size in sp of batteryLevel for wireless charging animation -->
<item name="wireless_charging_anim_battery_level_text_size_start" format="float" type="dimen"> <item name="wireless_charging_anim_battery_level_text_size_start" format="float" type="dimen">

View File

@@ -169,6 +169,10 @@ public abstract class AuthBiometricView extends LinearLayout {
private Animator.AnimatorListener mJankListener; private Animator.AnimatorListener mJankListener;
private final boolean mUseCustomBpSize;
private final int mCustomBpWidth;
private final int mCustomBpHeight;
private final OnClickListener mBackgroundClickListener = (view) -> { private final OnClickListener mBackgroundClickListener = (view) -> {
if (mState == STATE_AUTHENTICATED) { if (mState == STATE_AUTHENTICATED) {
Log.w(TAG, "Ignoring background click after authenticated"); Log.w(TAG, "Ignoring background click after authenticated");
@@ -209,6 +213,10 @@ public abstract class AuthBiometricView extends LinearLayout {
handleResetAfterHelp(); handleResetAfterHelp();
Utils.notifyAccessibilityContentChanged(mAccessibilityManager, this); Utils.notifyAccessibilityContentChanged(mAccessibilityManager, this);
}; };
mUseCustomBpSize = getResources().getBoolean(R.bool.use_custom_bp_size);
mCustomBpWidth = getResources().getDimensionPixelSize(R.dimen.biometric_dialog_width);
mCustomBpHeight = getResources().getDimensionPixelSize(R.dimen.biometric_dialog_height);
} }
/** Delay after authentication is confirmed, before the dialog should be animated away. */ /** Delay after authentication is confirmed, before the dialog should be animated away. */
@@ -834,14 +842,17 @@ public abstract class AuthBiometricView extends LinearLayout {
@Override @Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
final int width = MeasureSpec.getSize(widthMeasureSpec); int width = MeasureSpec.getSize(widthMeasureSpec);
final int height = MeasureSpec.getSize(heightMeasureSpec); int height = MeasureSpec.getSize(heightMeasureSpec);
final int newWidth = Math.min(width, height); if (mUseCustomBpSize) {
width = mCustomBpWidth;
height = mCustomBpHeight;
} else {
width = Math.min(width, height);
}
// Use "newWidth" instead, so the landscape dialog width is the same as the portrait mLayoutParams = onMeasureInternal(width, height);
// width.
mLayoutParams = onMeasureInternal(newWidth, height);
setMeasuredDimension(mLayoutParams.mMediumWidth, mLayoutParams.mMediumHeight); setMeasuredDimension(mLayoutParams.mMediumWidth, mLayoutParams.mMediumHeight);
} }