For devices with udfps, always show bg on udfps
Also show background on lock icon and unlock icons if the device supports udfps. This is to help indicate the affordance is tappable. Test: manually test with and w/o udfps - AOD <=> Lock screen - gpay wallet affordance on LS that requests udfps - slowly swipe up to show bouncer => udfps fades - slowly swipe down to expand notification shade => udfps fades - tap notification on ls, no bg animation - tap notification on locked shade, there is a bg animation - toggle on/off dark mode from lock screen Fixes: 192403524 Change-Id: I5a19d3cd45c51af78a49d46126fc0678a3df6d6c
This commit is contained in:
@@ -14,10 +14,11 @@
|
||||
-->
|
||||
<shape
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:androidprv="http://schemas.android.com/apk/prv/res/android"
|
||||
android:shape="oval">
|
||||
|
||||
<solid
|
||||
android:color="?android:attr/colorBackground"/>
|
||||
android:color="?androidprv:attr/colorSurface"/>
|
||||
|
||||
<size
|
||||
android:width="64dp"
|
||||
|
||||
42
packages/SystemUI/res/drawable/ic_unlock.xml
Normal file
42
packages/SystemUI/res/drawable/ic_unlock.xml
Normal file
@@ -0,0 +1,42 @@
|
||||
<!--
|
||||
Copyright (C) 2021 The Android Open Source Project
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
-->
|
||||
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:height="65dp" android:width="46dp" android:viewportHeight="65" android:viewportWidth="46">
|
||||
<group android:translateX="8.625" android:translateY="13.625">
|
||||
<path
|
||||
android:strokeColor="#FF000000"
|
||||
android:strokeLineCap="round"
|
||||
android:strokeLineJoin="round"
|
||||
android:strokeWidth="2.5"
|
||||
android:pathData="M4.75 15 C4.75,15 23.25,15 23.25,15 C24.35,15 25.25,15.9 25.25,17 C25.25,17 25.25,33 25.25,33 C25.25,34.1 24.35,35 23.25,35 C23.25,35 4.75,35 4.75,35 C3.65,35 2.75,34.1 2.75,33 C2.75,33 2.75,17 2.75,17 C2.75,15.9 3.65,15 4.75,15c " />
|
||||
</group>
|
||||
<group android:translateX="14" android:translateY="13.5">
|
||||
<path
|
||||
android:strokeColor="#FF000000"
|
||||
android:strokeLineCap="round"
|
||||
android:strokeLineJoin="round"
|
||||
android:strokeWidth="2.5"
|
||||
android:pathData="M27.19 14.81 C27.19,14.81 27.19,8.3 27.19,8.3 C27.19,4.92 24.44,2.88 21.19,2.75 C17.74,2.62 15,4.74 15,8.11 C15,8.11 15,15 15,15 " />
|
||||
</group>
|
||||
<group android:translateX="20" android:translateY="35.75">
|
||||
<path
|
||||
android:fillColor="#FF000000"
|
||||
android:fillAlpha="1"
|
||||
android:fillType="nonZero"
|
||||
android:pathData=" M2.75 5.25 C4.13,5.25 5.25,4.13 5.25,2.75 C5.25,1.37 4.13,0.25 2.75,0.25 C1.37,0.25 0.25,1.37 0.25,2.75 C0.25,4.13 1.37,5.25 2.75,5.25c " />
|
||||
</group>
|
||||
</vector>
|
||||
@@ -55,9 +55,23 @@
|
||||
android:id="@+id/lock_icon_view"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:padding="48px"
|
||||
android:layout_gravity="center"
|
||||
android:scaleType="centerCrop"/>
|
||||
android:layout_gravity="center">
|
||||
<!-- Background protection -->
|
||||
<ImageView
|
||||
android:id="@+id/lock_icon_bg"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@drawable/fingerprint_bg"
|
||||
android:visibility="invisible"/>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/lock_icon"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:padding="48px"
|
||||
android:layout_gravity="center"
|
||||
android:scaleType="centerCrop"/>
|
||||
</com.android.keyguard.LockIconView>
|
||||
|
||||
<com.android.systemui.statusbar.phone.NotificationsQuickSettingsContainer
|
||||
android:layout_width="match_parent"
|
||||
|
||||
@@ -26,8 +26,7 @@
|
||||
android:id="@+id/udfps_keyguard_fp_bg"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@drawable/fingerprint_bg"
|
||||
android:visibility="gone"/>
|
||||
android:src="@drawable/fingerprint_bg"/>
|
||||
|
||||
<!-- Fingerprint -->
|
||||
<!-- AOD dashed fingerprint icon with moving dashes -->
|
||||
|
||||
@@ -17,15 +17,20 @@
|
||||
package com.android.keyguard;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.res.ColorStateList;
|
||||
import android.graphics.PointF;
|
||||
import android.graphics.RectF;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.util.AttributeSet;
|
||||
import android.view.View;
|
||||
import android.widget.FrameLayout;
|
||||
import android.widget.ImageView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
import com.android.settingslib.Utils;
|
||||
import com.android.systemui.Dumpable;
|
||||
import com.android.systemui.R;
|
||||
|
||||
import java.io.FileDescriptor;
|
||||
import java.io.PrintWriter;
|
||||
@@ -33,16 +38,47 @@ import java.io.PrintWriter;
|
||||
/**
|
||||
* A view positioned under the notification shade.
|
||||
*/
|
||||
public class LockIconView extends ImageView implements Dumpable {
|
||||
public class LockIconView extends FrameLayout implements Dumpable {
|
||||
@NonNull private final RectF mSensorRect;
|
||||
@NonNull private PointF mLockIconCenter = new PointF(0f, 0f);
|
||||
private int mRadius;
|
||||
|
||||
private ImageView mLockIcon;
|
||||
private ImageView mUnlockBgView;
|
||||
|
||||
private int mLockIconColor;
|
||||
|
||||
public LockIconView(Context context, AttributeSet attrs) {
|
||||
super(context, attrs);
|
||||
mSensorRect = new RectF();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFinishInflate() {
|
||||
super.onFinishInflate();
|
||||
mLockIcon = findViewById(R.id.lock_icon);
|
||||
mUnlockBgView = findViewById(R.id.lock_icon_bg);
|
||||
}
|
||||
|
||||
void updateColorAndBackgroundVisibility(boolean useBackground) {
|
||||
if (useBackground) {
|
||||
mLockIconColor = Utils.getColorAttrDefaultColor(getContext(),
|
||||
android.R.attr.textColorPrimary);
|
||||
mUnlockBgView.setBackground(getContext().getDrawable(R.drawable.fingerprint_bg));
|
||||
mUnlockBgView.setVisibility(View.VISIBLE);
|
||||
} else {
|
||||
mLockIconColor = Utils.getColorAttrDefaultColor(getContext(),
|
||||
R.attr.wallpaperTextColorAccent);
|
||||
mUnlockBgView.setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
mLockIcon.setImageTintList(ColorStateList.valueOf(mLockIconColor));
|
||||
}
|
||||
|
||||
void setImageDrawable(Drawable drawable) {
|
||||
mLockIcon.setImageDrawable(drawable);
|
||||
}
|
||||
|
||||
void setCenterLocation(@NonNull PointF center, int radius) {
|
||||
mLockIconCenter = center;
|
||||
mRadius = radius;
|
||||
@@ -70,7 +106,6 @@ public class LockIconView extends ImageView implements Dumpable {
|
||||
return mLockIconCenter.y - mRadius;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void dump(@NonNull FileDescriptor fd, @NonNull PrintWriter pw, @NonNull String[] args) {
|
||||
pw.println("Center in px (x, y)= (" + mLockIconCenter.x + ", " + mLockIconCenter.y + ")");
|
||||
|
||||
@@ -43,7 +43,6 @@ import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.core.view.accessibility.AccessibilityNodeInfoCompat;
|
||||
|
||||
import com.android.settingslib.Utils;
|
||||
import com.android.systemui.Dumpable;
|
||||
import com.android.systemui.R;
|
||||
import com.android.systemui.biometrics.AuthController;
|
||||
@@ -111,7 +110,7 @@ public class LockIconViewController extends ViewController<LockIconView> impleme
|
||||
private boolean mUserUnlockedWithBiometric;
|
||||
private Runnable mCancelDelayedUpdateVisibilityRunnable;
|
||||
|
||||
private boolean mHasUdfps;
|
||||
private boolean mUdfpsSupported;
|
||||
private float mHeightPixels;
|
||||
private float mWidthPixels;
|
||||
private int mBottomPadding; // in pixels
|
||||
@@ -152,9 +151,8 @@ public class LockIconViewController extends ViewController<LockIconView> impleme
|
||||
|
||||
final Context context = view.getContext();
|
||||
mUnlockIcon = mView.getContext().getResources().getDrawable(
|
||||
R.anim.lock_to_unlock,
|
||||
R.drawable.ic_unlock,
|
||||
mView.getContext().getTheme());
|
||||
((AnimatedVectorDrawable) mUnlockIcon).start();
|
||||
mLockIcon = mView.getContext().getResources().getDrawable(
|
||||
R.anim.lock_to_unlock,
|
||||
mView.getContext().getTheme());
|
||||
@@ -177,7 +175,7 @@ public class LockIconViewController extends ViewController<LockIconView> impleme
|
||||
protected void onViewAttached() {
|
||||
// we check this here instead of onInit since the FingerprintManager + FaceManager may not
|
||||
// have started up yet onInit
|
||||
mHasUdfps = mAuthController.getUdfpsSensorLocation() != null;
|
||||
mUdfpsSupported = mAuthController.getUdfpsSensorLocation() != null;
|
||||
|
||||
updateConfiguration();
|
||||
updateKeyguardShowing();
|
||||
@@ -307,12 +305,7 @@ public class LockIconViewController extends ViewController<LockIconView> impleme
|
||||
}
|
||||
|
||||
private void updateColors() {
|
||||
final int color = Utils.getColorAttrDefaultColor(mView.getContext(),
|
||||
R.attr.wallpaperTextColorAccent);
|
||||
mFpToUnlockIcon.setTint(color);
|
||||
mLockToUnlockIcon.setTint(color);
|
||||
mLockIcon.setTint(color);
|
||||
mUnlockIcon.setTint(color);
|
||||
mView.updateColorAndBackgroundVisibility(mUdfpsSupported);
|
||||
}
|
||||
|
||||
private void updateConfiguration() {
|
||||
@@ -325,7 +318,7 @@ public class LockIconViewController extends ViewController<LockIconView> impleme
|
||||
}
|
||||
|
||||
private void updateLockIconLocation() {
|
||||
if (mHasUdfps) {
|
||||
if (mUdfpsSupported) {
|
||||
FingerprintSensorPropertiesInternal props = mAuthController.getUdfpsProps().get(0);
|
||||
mView.setCenterLocation(new PointF(props.sensorLocationX, props.sensorLocationY),
|
||||
props.sensorRadius);
|
||||
@@ -467,6 +460,7 @@ public class LockIconViewController extends ViewController<LockIconView> impleme
|
||||
@Override
|
||||
public void onConfigChanged(Configuration newConfig) {
|
||||
updateConfiguration();
|
||||
updateColors();
|
||||
}
|
||||
};
|
||||
|
||||
@@ -560,7 +554,7 @@ public class LockIconViewController extends ViewController<LockIconView> impleme
|
||||
}
|
||||
|
||||
private boolean isClickable() {
|
||||
return mUdfpsEnrolled || mShowUnlockIcon;
|
||||
return mUdfpsSupported || mShowUnlockIcon;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -72,6 +72,7 @@ import com.android.systemui.statusbar.LockscreenShadeTransitionController;
|
||||
import com.android.systemui.statusbar.phone.KeyguardBypassController;
|
||||
import com.android.systemui.statusbar.phone.StatusBar;
|
||||
import com.android.systemui.statusbar.phone.StatusBarKeyguardViewManager;
|
||||
import com.android.systemui.statusbar.policy.ConfigurationController;
|
||||
import com.android.systemui.statusbar.policy.KeyguardStateController;
|
||||
import com.android.systemui.util.concurrency.DelayableExecutor;
|
||||
import com.android.systemui.util.concurrency.Execution;
|
||||
@@ -123,6 +124,7 @@ public class UdfpsController implements DozeReceiver {
|
||||
@NonNull private final LockscreenShadeTransitionController mLockscreenShadeTransitionController;
|
||||
@Nullable private final UdfpsHbmProvider mHbmProvider;
|
||||
@NonNull private final KeyguardBypassController mKeyguardBypassController;
|
||||
@NonNull private final ConfigurationController mConfigurationController;
|
||||
@VisibleForTesting @NonNull final BiometricOrientationEventListener mOrientationListener;
|
||||
// Currently the UdfpsController supports a single UDFPS sensor. If devices have multiple
|
||||
// sensors, this, in addition to a lot of the code here, will be updated.
|
||||
@@ -522,7 +524,8 @@ public class UdfpsController implements DozeReceiver {
|
||||
@NonNull KeyguardStateController keyguardStateController,
|
||||
@NonNull KeyguardBypassController keyguardBypassController,
|
||||
@NonNull DisplayManager displayManager,
|
||||
@Main Handler mainHandler) {
|
||||
@Main Handler mainHandler,
|
||||
@NonNull ConfigurationController configurationController) {
|
||||
mContext = context;
|
||||
mExecution = execution;
|
||||
// TODO (b/185124905): inject main handler and vibrator once done prototyping
|
||||
@@ -557,6 +560,7 @@ public class UdfpsController implements DozeReceiver {
|
||||
displayManager,
|
||||
mainHandler);
|
||||
mKeyguardBypassController = keyguardBypassController;
|
||||
mConfigurationController = configurationController;
|
||||
|
||||
mSensorProps = findFirstUdfps();
|
||||
// At least one UDFPS sensor exists
|
||||
@@ -776,6 +780,7 @@ public class UdfpsController implements DozeReceiver {
|
||||
mDumpManager,
|
||||
mKeyguardViewMediator,
|
||||
mLockscreenShadeTransitionController,
|
||||
mConfigurationController,
|
||||
this
|
||||
);
|
||||
case IUdfpsOverlayController.REASON_AUTH_BP:
|
||||
|
||||
@@ -22,7 +22,6 @@ import static com.android.systemui.doze.util.BurnInHelperKt.getBurnInProgressOff
|
||||
import android.animation.Animator;
|
||||
import android.animation.AnimatorListenerAdapter;
|
||||
import android.animation.AnimatorSet;
|
||||
import android.animation.ArgbEvaluator;
|
||||
import android.animation.ObjectAnimator;
|
||||
import android.animation.ValueAnimator;
|
||||
import android.content.Context;
|
||||
@@ -51,17 +50,14 @@ public class UdfpsKeyguardView extends UdfpsAnimationView {
|
||||
private UdfpsDrawable mFingerprintDrawable; // placeholder
|
||||
private LottieAnimationView mAodFp;
|
||||
private LottieAnimationView mLockScreenFp;
|
||||
private int mUdfpsBouncerColor;
|
||||
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 AnimatorSet mBackgroundInAnimator = new AnimatorSet();
|
||||
private int mAlpha; // 0-255
|
||||
|
||||
// AOD anti-burn-in offsets
|
||||
@@ -89,20 +85,15 @@ public class UdfpsKeyguardView extends UdfpsAnimationView {
|
||||
super.onFinishInflate();
|
||||
mAodFp = findViewById(R.id.udfps_aod_fp);
|
||||
mLockScreenFp = findViewById(R.id.udfps_lockscreen_fp);
|
||||
|
||||
mBgProtection = findViewById(R.id.udfps_keyguard_fp_bg);
|
||||
|
||||
mWallpaperTextColor = Utils.getColorAttrDefaultColor(mContext,
|
||||
R.attr.wallpaperTextColorAccent);
|
||||
mTextColorPrimary = Utils.getColorAttrDefaultColor(mContext,
|
||||
android.R.attr.textColorPrimary);
|
||||
updateColor();
|
||||
|
||||
// requires call to invalidate to update the color (see #updateColor)
|
||||
// requires call to invalidate to update the color
|
||||
mLockScreenFp.addValueCallback(
|
||||
new KeyPath("**"), LottieProperty.COLOR_FILTER,
|
||||
frameInfo -> new PorterDuffColorFilter(getColor(), PorterDuff.Mode.SRC_ATOP)
|
||||
frameInfo -> new PorterDuffColorFilter(mTextColorPrimary, PorterDuff.Mode.SRC_ATOP)
|
||||
);
|
||||
mUdfpsRequested = false;
|
||||
|
||||
mHintAnimator = ObjectAnimator.ofFloat(mLockScreenFp, "progress", 1f, 0f, 1f);
|
||||
mHintAnimator.setDuration(4000);
|
||||
@@ -148,13 +139,7 @@ public class UdfpsKeyguardView extends UdfpsAnimationView {
|
||||
}
|
||||
|
||||
void requestUdfps(boolean request, int color) {
|
||||
if (request) {
|
||||
mUdfpsRequestedColor = color;
|
||||
} else {
|
||||
mUdfpsRequestedColor = -1;
|
||||
}
|
||||
mUdfpsRequested = request;
|
||||
updateColor();
|
||||
}
|
||||
|
||||
void setStatusBarState(int statusBarState) {
|
||||
@@ -162,31 +147,10 @@ public class UdfpsKeyguardView extends UdfpsAnimationView {
|
||||
}
|
||||
|
||||
void updateColor() {
|
||||
mWallpaperTextColor = Utils.getColorAttrDefaultColor(mContext,
|
||||
R.attr.wallpaperTextColorAccent);
|
||||
mTextColorPrimary = Utils.getColorAttrDefaultColor(mContext,
|
||||
android.R.attr.textColorPrimary);
|
||||
mLockScreenFp.invalidate();
|
||||
mBgProtection.setBackground(getContext().getDrawable(R.drawable.fingerprint_bg));
|
||||
}
|
||||
|
||||
private boolean showingUdfpsBouncer() {
|
||||
return mBgProtection.getVisibility() == View.VISIBLE;
|
||||
}
|
||||
|
||||
|
||||
private int getColor() {
|
||||
if (isUdfpsColorRequested()) {
|
||||
return mUdfpsRequestedColor;
|
||||
} else if (showingUdfpsBouncer()) {
|
||||
return mUdfpsBouncerColor;
|
||||
} else {
|
||||
return mWallpaperTextColor;
|
||||
}
|
||||
}
|
||||
|
||||
private boolean isUdfpsColorRequested() {
|
||||
return mUdfpsRequested && mUdfpsRequestedColor != -1;
|
||||
mBgProtection.setImageDrawable(getContext().getDrawable(R.drawable.fingerprint_bg));
|
||||
mLockScreenFp.invalidate(); // updated with a valueCallback
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -200,7 +164,13 @@ public class UdfpsKeyguardView extends UdfpsAnimationView {
|
||||
@Override
|
||||
protected int updateAlpha() {
|
||||
int alpha = super.updateAlpha();
|
||||
mLockScreenFp.setImageAlpha(alpha);
|
||||
mLockScreenFp.setAlpha(alpha / 255f);
|
||||
if (mInterpolatedDarkAmount != 0f) {
|
||||
mBgProtection.setAlpha(1f - mInterpolatedDarkAmount);
|
||||
} else {
|
||||
mBgProtection.setAlpha(alpha / 255f);
|
||||
}
|
||||
|
||||
return alpha;
|
||||
}
|
||||
|
||||
@@ -215,6 +185,7 @@ public class UdfpsKeyguardView extends UdfpsAnimationView {
|
||||
void onDozeAmountChanged(float linear, float eased) {
|
||||
mHintAnimator.cancel();
|
||||
mInterpolatedDarkAmount = eased;
|
||||
updateAlpha();
|
||||
updateBurnInOffsets();
|
||||
}
|
||||
|
||||
@@ -228,52 +199,21 @@ public class UdfpsKeyguardView extends UdfpsAnimationView {
|
||||
/**
|
||||
* Animates in the bg protection circle behind the fp icon to highlight the icon.
|
||||
*/
|
||||
void animateUdfpsBouncer(Runnable onEndAnimation) {
|
||||
if (showingUdfpsBouncer() && mBgProtection.getAlpha() == 1f) {
|
||||
// already fully highlighted, don't re-animate
|
||||
void animateInUdfpsBouncer(Runnable onEndAnimation) {
|
||||
if (mBackgroundInAnimator.isRunning()) {
|
||||
// already animating in
|
||||
return;
|
||||
}
|
||||
|
||||
if (mAnimatorSet != null) {
|
||||
mAnimatorSet.cancel();
|
||||
}
|
||||
|
||||
mAnimatorSet = new AnimatorSet();
|
||||
mAnimatorSet.setInterpolator(Interpolators.FAST_OUT_SLOW_IN);
|
||||
mAnimatorSet.setDuration(500);
|
||||
mAnimatorSet.addListener(new AnimatorListenerAdapter() {
|
||||
@Override
|
||||
public void onAnimationStart(Animator animation) {
|
||||
mBgProtection.setVisibility(View.VISIBLE);
|
||||
}
|
||||
});
|
||||
|
||||
ValueAnimator fpIconColorAnim;
|
||||
if (isShadeLocked()) {
|
||||
// set color and fade in since we weren't showing before
|
||||
mUdfpsBouncerColor = mTextColorPrimary;
|
||||
fpIconColorAnim = ValueAnimator.ofInt(0, 255);
|
||||
fpIconColorAnim.addUpdateListener(valueAnimator ->
|
||||
mLockScreenFp.setImageAlpha((int) valueAnimator.getAnimatedValue()));
|
||||
} else {
|
||||
// update icon color
|
||||
fpIconColorAnim = new ValueAnimator();
|
||||
fpIconColorAnim.setIntValues(
|
||||
isUdfpsColorRequested() ? mUdfpsRequestedColor : mWallpaperTextColor,
|
||||
mTextColorPrimary);
|
||||
fpIconColorAnim.setEvaluator(ArgbEvaluator.getInstance());
|
||||
fpIconColorAnim.addUpdateListener(valueAnimator -> {
|
||||
mUdfpsBouncerColor = (int) valueAnimator.getAnimatedValue();
|
||||
updateColor();
|
||||
});
|
||||
}
|
||||
|
||||
mAnimatorSet.playTogether(
|
||||
// fade in and scale up
|
||||
mBackgroundInAnimator = new AnimatorSet();
|
||||
mBackgroundInAnimator.playTogether(
|
||||
ObjectAnimator.ofFloat(mBgProtection, View.ALPHA, 0f, 1f),
|
||||
ObjectAnimator.ofFloat(mBgProtection, View.SCALE_X, 0f, 1f),
|
||||
ObjectAnimator.ofFloat(mBgProtection, View.SCALE_Y, 0f, 1f),
|
||||
fpIconColorAnim);
|
||||
mAnimatorSet.addListener(new AnimatorListenerAdapter() {
|
||||
ObjectAnimator.ofFloat(mBgProtection, View.SCALE_Y, 0f, 1f));
|
||||
mBackgroundInAnimator.setInterpolator(Interpolators.FAST_OUT_SLOW_IN);
|
||||
mBackgroundInAnimator.setDuration(500);
|
||||
mBackgroundInAnimator.addListener(new AnimatorListenerAdapter() {
|
||||
@Override
|
||||
public void onAnimationEnd(Animator animation) {
|
||||
if (onEndAnimation != null) {
|
||||
@@ -281,66 +221,7 @@ public class UdfpsKeyguardView extends UdfpsAnimationView {
|
||||
}
|
||||
}
|
||||
});
|
||||
mAnimatorSet.start();
|
||||
}
|
||||
|
||||
/**
|
||||
* Animates out the bg protection circle behind the fp icon to unhighlight the icon.
|
||||
*/
|
||||
void animateAwayUdfpsBouncer(@Nullable Runnable onEndAnimation) {
|
||||
if (!showingUdfpsBouncer()) {
|
||||
// already hidden
|
||||
return;
|
||||
}
|
||||
|
||||
if (mAnimatorSet != null) {
|
||||
mAnimatorSet.cancel();
|
||||
}
|
||||
|
||||
ValueAnimator fpIconColorAnim;
|
||||
if (isShadeLocked()) {
|
||||
// fade out
|
||||
mUdfpsBouncerColor = mTextColorPrimary;
|
||||
fpIconColorAnim = ValueAnimator.ofInt(255, 0);
|
||||
fpIconColorAnim.addUpdateListener(valueAnimator ->
|
||||
mLockScreenFp.setImageAlpha((int) valueAnimator.getAnimatedValue()));
|
||||
} else {
|
||||
// update icon color
|
||||
fpIconColorAnim = new ValueAnimator();
|
||||
fpIconColorAnim.setIntValues(
|
||||
mTextColorPrimary,
|
||||
isUdfpsColorRequested() ? mUdfpsRequestedColor : mWallpaperTextColor);
|
||||
fpIconColorAnim.setEvaluator(ArgbEvaluator.getInstance());
|
||||
fpIconColorAnim.addUpdateListener(valueAnimator -> {
|
||||
mUdfpsBouncerColor = (int) valueAnimator.getAnimatedValue();
|
||||
updateColor();
|
||||
});
|
||||
}
|
||||
|
||||
mAnimatorSet = new AnimatorSet();
|
||||
mAnimatorSet.playTogether(
|
||||
ObjectAnimator.ofFloat(mBgProtection, View.ALPHA, 1f, 0f),
|
||||
ObjectAnimator.ofFloat(mBgProtection, View.SCALE_X, 1f, 0f),
|
||||
ObjectAnimator.ofFloat(mBgProtection, View.SCALE_Y, 1f, 0f),
|
||||
fpIconColorAnim);
|
||||
mAnimatorSet.setInterpolator(Interpolators.FAST_OUT_SLOW_IN);
|
||||
mAnimatorSet.setDuration(500);
|
||||
|
||||
mAnimatorSet.addListener(new AnimatorListenerAdapter() {
|
||||
@Override
|
||||
public void onAnimationEnd(Animator animation) {
|
||||
mBgProtection.setVisibility(View.GONE);
|
||||
if (onEndAnimation != null) {
|
||||
onEndAnimation.run();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
mAnimatorSet.start();
|
||||
}
|
||||
|
||||
boolean isAnimating() {
|
||||
return mAnimatorSet != null && mAnimatorSet.isRunning();
|
||||
mBackgroundInAnimator.start();
|
||||
}
|
||||
|
||||
private boolean isShadeLocked() {
|
||||
|
||||
@@ -19,6 +19,7 @@ package com.android.systemui.biometrics;
|
||||
import static com.android.systemui.statusbar.StatusBarState.KEYGUARD;
|
||||
|
||||
import android.annotation.NonNull;
|
||||
import android.content.res.Configuration;
|
||||
import android.hardware.biometrics.BiometricSourceType;
|
||||
import android.util.MathUtils;
|
||||
import android.view.MotionEvent;
|
||||
@@ -36,6 +37,7 @@ import com.android.systemui.statusbar.StatusBarState;
|
||||
import com.android.systemui.statusbar.phone.KeyguardBouncer;
|
||||
import com.android.systemui.statusbar.phone.StatusBar;
|
||||
import com.android.systemui.statusbar.phone.StatusBarKeyguardViewManager;
|
||||
import com.android.systemui.statusbar.policy.ConfigurationController;
|
||||
import com.android.systemui.util.concurrency.DelayableExecutor;
|
||||
|
||||
import java.io.FileDescriptor;
|
||||
@@ -57,6 +59,7 @@ public class UdfpsKeyguardViewController extends UdfpsAnimationViewController<Ud
|
||||
@NonNull private final DelayableExecutor mExecutor;
|
||||
@NonNull private final KeyguardViewMediator mKeyguardViewMediator;
|
||||
@NonNull private final LockscreenShadeTransitionController mLockScreenShadeTransitionController;
|
||||
@NonNull private final ConfigurationController mConfigurationController;
|
||||
@NonNull private final UdfpsController mUdfpsController;
|
||||
|
||||
@Nullable private Runnable mCancelDelayedHintRunnable;
|
||||
@@ -87,6 +90,7 @@ public class UdfpsKeyguardViewController extends UdfpsAnimationViewController<Ud
|
||||
@NonNull DumpManager dumpManager,
|
||||
@NonNull KeyguardViewMediator keyguardViewMediator,
|
||||
@NonNull LockscreenShadeTransitionController transitionController,
|
||||
@NonNull ConfigurationController configurationController,
|
||||
@NonNull UdfpsController udfpsController) {
|
||||
super(view, statusBarStateController, statusBar, dumpManager);
|
||||
mKeyguardViewManager = statusBarKeyguardViewManager;
|
||||
@@ -94,6 +98,7 @@ public class UdfpsKeyguardViewController extends UdfpsAnimationViewController<Ud
|
||||
mExecutor = mainDelayableExecutor;
|
||||
mKeyguardViewMediator = keyguardViewMediator;
|
||||
mLockScreenShadeTransitionController = transitionController;
|
||||
mConfigurationController = configurationController;
|
||||
mUdfpsController = udfpsController;
|
||||
}
|
||||
|
||||
@@ -120,6 +125,7 @@ public class UdfpsKeyguardViewController extends UdfpsAnimationViewController<Ud
|
||||
mQsExpanded = mKeyguardViewManager.isQsExpanded();
|
||||
mInputBouncerHiddenAmount = KeyguardBouncer.EXPANSION_HIDDEN;
|
||||
mIsBouncerVisible = mKeyguardViewManager.bouncerIsOrWillBeShowing();
|
||||
mConfigurationController.addCallback(mConfigurationListener);
|
||||
updateAlpha();
|
||||
updatePauseAuth();
|
||||
|
||||
@@ -136,6 +142,7 @@ public class UdfpsKeyguardViewController extends UdfpsAnimationViewController<Ud
|
||||
mStatusBarStateController.removeCallback(mStateListener);
|
||||
mKeyguardViewManager.removeAlternateAuthInterceptor(mAlternateAuthInterceptor);
|
||||
mKeyguardUpdateMonitor.requestFaceAuthOnOccludingApp(false);
|
||||
mConfigurationController.removeCallback(mConfigurationListener);
|
||||
if (mLockScreenShadeTransitionController.getUdfpsKeyguardViewController() == this) {
|
||||
mLockScreenShadeTransitionController.setUdfpsKeyguardViewController(null);
|
||||
}
|
||||
@@ -158,7 +165,6 @@ public class UdfpsKeyguardViewController extends UdfpsAnimationViewController<Ud
|
||||
pw.println("mAlpha=" + mView.getAlpha());
|
||||
pw.println("mUdfpsRequested=" + mUdfpsRequested);
|
||||
pw.println("mView.mUdfpsRequested=" + mView.mUdfpsRequested);
|
||||
pw.println("mView.mUdfpsRequestedColor=" + mView.mUdfpsRequestedColor);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -173,12 +179,17 @@ public class UdfpsKeyguardViewController extends UdfpsAnimationViewController<Ud
|
||||
mShowingUdfpsBouncer = show;
|
||||
updatePauseAuth();
|
||||
if (mShowingUdfpsBouncer) {
|
||||
mView.animateUdfpsBouncer(() ->
|
||||
mKeyguardUpdateMonitor.requestFaceAuthOnOccludingApp(true));
|
||||
if (mStatusBarState == StatusBarState.SHADE_LOCKED) {
|
||||
mView.animateInUdfpsBouncer(null);
|
||||
}
|
||||
|
||||
if (mKeyguardViewManager.isOccluded()) {
|
||||
mKeyguardUpdateMonitor.requestFaceAuthOnOccludingApp(true);
|
||||
}
|
||||
|
||||
mView.announceForAccessibility(mView.getContext().getString(
|
||||
R.string.accessibility_fingerprint_bouncer));
|
||||
} else {
|
||||
mView.animateAwayUdfpsBouncer(null);
|
||||
mKeyguardUpdateMonitor.requestFaceAuthOnOccludingApp(false);
|
||||
}
|
||||
return true;
|
||||
@@ -366,7 +377,7 @@ public class UdfpsKeyguardViewController extends UdfpsAnimationViewController<Ud
|
||||
|
||||
@Override
|
||||
public boolean isAnimating() {
|
||||
return mView.isAnimating();
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -407,4 +418,27 @@ public class UdfpsKeyguardViewController extends UdfpsAnimationViewController<Ud
|
||||
pw.println(getTag());
|
||||
}
|
||||
};
|
||||
|
||||
private final ConfigurationController.ConfigurationListener mConfigurationListener =
|
||||
new ConfigurationController.ConfigurationListener() {
|
||||
@Override
|
||||
public void onUiModeChanged() {
|
||||
mView.updateColor();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onThemeChanged() {
|
||||
mView.updateColor();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onOverlayChanged() {
|
||||
mView.updateColor();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onConfigChanged(Configuration newConfig) {
|
||||
mView.updateColor();
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@@ -63,6 +63,7 @@ import com.android.systemui.statusbar.LockscreenShadeTransitionController;
|
||||
import com.android.systemui.statusbar.phone.KeyguardBypassController;
|
||||
import com.android.systemui.statusbar.phone.StatusBar;
|
||||
import com.android.systemui.statusbar.phone.StatusBarKeyguardViewManager;
|
||||
import com.android.systemui.statusbar.policy.ConfigurationController;
|
||||
import com.android.systemui.statusbar.policy.KeyguardStateController;
|
||||
import com.android.systemui.util.concurrency.Execution;
|
||||
import com.android.systemui.util.concurrency.FakeExecution;
|
||||
@@ -144,6 +145,8 @@ public class UdfpsControllerTest extends SysuiTestCase {
|
||||
private DisplayManager mDisplayManager;
|
||||
@Mock
|
||||
private Handler mHandler;
|
||||
@Mock
|
||||
private ConfigurationController mConfigurationController;
|
||||
|
||||
private FakeExecutor mFgExecutor;
|
||||
|
||||
@@ -225,7 +228,8 @@ public class UdfpsControllerTest extends SysuiTestCase {
|
||||
mKeyguardStateController,
|
||||
mKeyguardBypassController,
|
||||
mDisplayManager,
|
||||
mHandler);
|
||||
mHandler,
|
||||
mConfigurationController);
|
||||
verify(mFingerprintManager).setUdfpsOverlayController(mOverlayCaptor.capture());
|
||||
mOverlayController = mOverlayCaptor.getValue();
|
||||
verify(mScreenLifecycle).addObserver(mScreenObserverCaptor.capture());
|
||||
|
||||
@@ -39,6 +39,7 @@ import com.android.systemui.statusbar.LockscreenShadeTransitionController;
|
||||
import com.android.systemui.statusbar.StatusBarState;
|
||||
import com.android.systemui.statusbar.phone.StatusBar;
|
||||
import com.android.systemui.statusbar.phone.StatusBarKeyguardViewManager;
|
||||
import com.android.systemui.statusbar.policy.ConfigurationController;
|
||||
import com.android.systemui.util.concurrency.DelayableExecutor;
|
||||
|
||||
import org.junit.Before;
|
||||
@@ -76,6 +77,8 @@ public class UdfpsKeyguardViewControllerTest extends SysuiTestCase {
|
||||
@Mock
|
||||
private KeyguardViewMediator mKeyguardViewMediator;
|
||||
@Mock
|
||||
private ConfigurationController mConfigurationController;
|
||||
@Mock
|
||||
private UdfpsController mUdfpsController;
|
||||
|
||||
private UdfpsKeyguardViewController mController;
|
||||
@@ -110,6 +113,7 @@ public class UdfpsKeyguardViewControllerTest extends SysuiTestCase {
|
||||
mDumpManager,
|
||||
mKeyguardViewMediator,
|
||||
mLockscreenShadeTransitionController,
|
||||
mConfigurationController,
|
||||
mUdfpsController);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user