From bebd1dede871e547b17c806744eb0fa4757e3fd9 Mon Sep 17 00:00:00 2001 From: Beverly Date: Mon, 3 May 2021 07:53:27 -0400 Subject: [PATCH] Keyguard Wallet activity can request udfps - Setup ability to request udfps from a SystemUI activity occluding the keyguard - Hookup keyguard wallet activity to request udfps - Update UdfpsKeyguardView logic so that the udfps icon won't show if the bouncer is visible. Add check for bouncer visibility to check whether the bouncer view is visible - sometimes the bouncer expansion can report visible even though the view itself is not visibile. Test: atest SystemUITest Bug: 183024921 Change-Id: I2aa922149586a8a6319e884442c21b74607e5017 --- .../UdfpsAnimationViewController.java | 2 +- .../biometrics/UdfpsKeyguardView.java | 41 ++++++++++++++----- .../UdfpsKeyguardViewController.java | 29 ++++++++++++- .../statusbar/phone/KeyguardBouncer.java | 30 +++++++++++--- .../phone/StatusBarKeyguardViewManager.java | 33 +++++++++++++++ .../systemui/wallet/ui/WalletActivity.java | 14 ++++++- 6 files changed, 129 insertions(+), 20 deletions(-) diff --git a/packages/SystemUI/src/com/android/systemui/biometrics/UdfpsAnimationViewController.java b/packages/SystemUI/src/com/android/systemui/biometrics/UdfpsAnimationViewController.java index 195d006066933..b7344fbc6ddad 100644 --- a/packages/SystemUI/src/com/android/systemui/biometrics/UdfpsAnimationViewController.java +++ b/packages/SystemUI/src/com/android/systemui/biometrics/UdfpsAnimationViewController.java @@ -45,7 +45,7 @@ abstract class UdfpsAnimationViewController @NonNull final StatusBar mStatusBar; @NonNull final DumpManager mDumpManger; - private boolean mNotificationShadeExpanded; + boolean mNotificationShadeExpanded; protected UdfpsAnimationViewController( T view, diff --git a/packages/SystemUI/src/com/android/systemui/biometrics/UdfpsKeyguardView.java b/packages/SystemUI/src/com/android/systemui/biometrics/UdfpsKeyguardView.java index 37ea251c08b8f..52576a7cd4e3d 100644 --- a/packages/SystemUI/src/com/android/systemui/biometrics/UdfpsKeyguardView.java +++ b/packages/SystemUI/src/com/android/systemui/biometrics/UdfpsKeyguardView.java @@ -40,12 +40,14 @@ import com.android.systemui.statusbar.StatusBarState; public class UdfpsKeyguardView extends UdfpsAnimationView { private final UdfpsKeyguardDrawable mFingerprintDrawable; private ImageView mFingerprintView; - private int mWallpaperTexColor; + private int mWallpaperTextColor; private int mStatusBarState; // used when highlighting fp icon: private int mTextColorPrimary; private ImageView mBgProtection; + boolean mUdfpsRequested; + int mUdfpsRequestedColor; private AnimatorSet mAnimatorSet; private int mAlpha; // 0-255 @@ -63,10 +65,11 @@ public class UdfpsKeyguardView extends UdfpsAnimationView { mBgProtection = findViewById(R.id.udfps_keyguard_fp_bg); - mWallpaperTexColor = Utils.getColorAttrDefaultColor(mContext, + mWallpaperTextColor = Utils.getColorAttrDefaultColor(mContext, R.attr.wallpaperTextColorAccent); mTextColorPrimary = Utils.getColorAttrDefaultColor(mContext, android.R.attr.textColorPrimary); + mUdfpsRequested = false; } @Override @@ -90,11 +93,31 @@ public class UdfpsKeyguardView extends UdfpsAnimationView { return true; } + void requestUdfps(boolean request, int color) { + if (request) { + mUdfpsRequestedColor = color; + } else { + mUdfpsRequestedColor = -1; + } + mUdfpsRequested = request; + updateColor(); + } + void setStatusBarState(int statusBarState) { mStatusBarState = statusBarState; - if (!isShadeLocked()) { - mFingerprintView.setAlpha(1f); - mFingerprintDrawable.setLockScreenColor(mWallpaperTexColor); + updateColor(); + } + + void updateColor() { + mFingerprintView.setAlpha(1f); + mFingerprintDrawable.setLockScreenColor(getColor()); + } + + private int getColor() { + if (mUdfpsRequested && mUdfpsRequestedColor != -1) { + return mUdfpsRequestedColor; + } else { + return mWallpaperTextColor; } } @@ -142,7 +165,7 @@ public class UdfpsKeyguardView extends UdfpsAnimationView { } else { // update icon color fpIconAnim = new ValueAnimator(); - fpIconAnim.setIntValues(mWallpaperTexColor, mTextColorPrimary); + fpIconAnim.setIntValues(getColor(), mTextColorPrimary); fpIconAnim.setEvaluator(new ArgbEvaluator()); fpIconAnim.addUpdateListener(valueAnimator -> mFingerprintDrawable.setLockScreenColor( (Integer) valueAnimator.getAnimatedValue())); @@ -170,10 +193,6 @@ public class UdfpsKeyguardView extends UdfpsAnimationView { return mStatusBarState == StatusBarState.SHADE_LOCKED; } - boolean isHome() { - return mStatusBarState == StatusBarState.SHADE; - } - /** * Animates out the bg protection circle behind the fp icon to unhighlight the icon. */ @@ -193,7 +212,7 @@ public class UdfpsKeyguardView extends UdfpsAnimationView { } else { // update icon color fpIconAnim = new ValueAnimator(); - fpIconAnim.setIntValues(mTextColorPrimary, mWallpaperTexColor); + fpIconAnim.setIntValues(mTextColorPrimary, getColor()); fpIconAnim.setEvaluator(new ArgbEvaluator()); fpIconAnim.addUpdateListener(valueAnimator -> mFingerprintDrawable.setLockScreenColor( (Integer) valueAnimator.getAnimatedValue())); diff --git a/packages/SystemUI/src/com/android/systemui/biometrics/UdfpsKeyguardViewController.java b/packages/SystemUI/src/com/android/systemui/biometrics/UdfpsKeyguardViewController.java index 4d2f809531fdd..33d0d0c5b5ffd 100644 --- a/packages/SystemUI/src/com/android/systemui/biometrics/UdfpsKeyguardViewController.java +++ b/packages/SystemUI/src/com/android/systemui/biometrics/UdfpsKeyguardViewController.java @@ -57,6 +57,7 @@ public class UdfpsKeyguardViewController extends UdfpsAnimationViewController