diff options
Diffstat (limited to 'packages/SystemUI/src/com/android/keyguard/LockIconViewController.java')
-rw-r--r-- | packages/SystemUI/src/com/android/keyguard/LockIconViewController.java | 52 |
1 files changed, 37 insertions, 15 deletions
diff --git a/packages/SystemUI/src/com/android/keyguard/LockIconViewController.java b/packages/SystemUI/src/com/android/keyguard/LockIconViewController.java index 62cb4b9a33f5..afea27222fbb 100644 --- a/packages/SystemUI/src/com/android/keyguard/LockIconViewController.java +++ b/packages/SystemUI/src/com/android/keyguard/LockIconViewController.java @@ -24,8 +24,8 @@ import android.content.Context; import android.content.res.Configuration; import android.graphics.PointF; import android.graphics.Rect; +import android.graphics.drawable.AnimatedVectorDrawable; import android.graphics.drawable.Drawable; -import android.graphics.drawable.InsetDrawable; import android.hardware.biometrics.BiometricSourceType; import android.hardware.fingerprint.FingerprintSensorPropertiesInternal; import android.util.DisplayMetrics; @@ -79,7 +79,8 @@ public class LockIconViewController extends ViewController<LockIconView> impleme @NonNull private final DelayableExecutor mExecutor; private boolean mUdfpsEnrolled; - @NonNull private final Drawable mUnlockIcon; + @NonNull private final AnimatedVectorDrawable mFpToUnlockIcon; + @NonNull private final AnimatedVectorDrawable mLockToUnlockIcon; @NonNull private final Drawable mLockIcon; @NonNull private final CharSequence mUnlockedLabel; @NonNull private final CharSequence mLockedLabel; @@ -98,7 +99,8 @@ public class LockIconViewController extends ViewController<LockIconView> impleme private float mHeightPixels; private float mWidthPixels; private float mDensity; - private int mKgBottomAreaHeight; + private int mAmbientIndicationHeight; // in pixels + private int mKgIndicationHeight; // in pixels private boolean mShowUnlockIcon; private boolean mShowLockIcon; @@ -132,14 +134,14 @@ public class LockIconViewController extends ViewController<LockIconView> impleme mExecutor = executor; final Context context = view.getContext(); - mUnlockIcon = new InsetDrawable(context.getResources().getDrawable( - com.android.internal.R.drawable.ic_lock_open, context.getTheme()), - context.getResources().getDimensionPixelSize( - com.android.systemui.R.dimen.udfps_unlock_icon_inset)); - mLockIcon = new InsetDrawable(context.getResources().getDrawable( - com.android.internal.R.drawable.ic_lock, context.getTheme()), - context.getResources().getDimensionPixelSize( - com.android.systemui.R.dimen.udfps_unlock_icon_inset)); + mLockIcon = mView.getContext().getResources().getDrawable( + R.anim.lock_to_unlock, + mView.getContext().getTheme()); + mFpToUnlockIcon = (AnimatedVectorDrawable) mView.getContext().getResources().getDrawable( + R.anim.fp_to_unlock, mView.getContext().getTheme()); + mLockToUnlockIcon = (AnimatedVectorDrawable) mView.getContext().getResources().getDrawable( + R.anim.lock_to_unlock, + mView.getContext().getTheme()); mUnlockedLabel = context.getResources().getString(R.string.accessibility_unlock_button); mLockedLabel = context.getResources().getString(R.string.accessibility_lock_icon); dumpManager.registerDumpable("LockIconViewController", this); @@ -211,6 +213,8 @@ public class LockIconViewController extends ViewController<LockIconView> impleme return; } + boolean wasShowingFpIcon = mHasUdfps && !mShowUnlockIcon && !mShowLockIcon; + boolean wasShowingLockIcon = mShowLockIcon; mShowLockIcon = !mCanDismissLockScreen && !mUserUnlockedWithBiometric && isLockScreen() && (!mUdfpsEnrolled || !mRunningFPS); mShowUnlockIcon = mCanDismissLockScreen && isLockScreen(); @@ -221,7 +225,15 @@ public class LockIconViewController extends ViewController<LockIconView> impleme mView.setVisibility(View.VISIBLE); mView.setContentDescription(mLockedLabel); } else if (mShowUnlockIcon) { - mView.setImageDrawable(mUnlockIcon); + if (wasShowingFpIcon) { + mView.setImageDrawable(mFpToUnlockIcon); + mFpToUnlockIcon.forceAnimationOnUI(); + mFpToUnlockIcon.start(); + } else if (wasShowingLockIcon) { + mView.setImageDrawable(mLockToUnlockIcon); + mLockToUnlockIcon.forceAnimationOnUI(); + mLockToUnlockIcon.start(); + } mView.setVisibility(View.VISIBLE); mView.setContentDescription(mUnlockedLabel); } else { @@ -271,7 +283,8 @@ public class LockIconViewController extends ViewController<LockIconView> impleme private void updateColors() { final int color = Utils.getColorAttrDefaultColor(mView.getContext(), R.attr.wallpaperTextColorAccent); - mUnlockIcon.setTint(color); + mFpToUnlockIcon.setTint(color); + mLockToUnlockIcon.setTint(color); mLockIcon.setTint(color); } @@ -280,7 +293,7 @@ public class LockIconViewController extends ViewController<LockIconView> impleme mWidthPixels = metrics.widthPixels; mHeightPixels = metrics.heightPixels; mDensity = metrics.density; - mKgBottomAreaHeight = mView.getContext().getResources().getDimensionPixelSize( + mKgIndicationHeight = mView.getContext().getResources().getDimensionPixelSize( R.dimen.keyguard_indication_margin_bottom) + mView.getContext().getResources().getDimensionPixelSize( R.dimen.keyguard_indication_bottom_padding); @@ -295,15 +308,24 @@ public class LockIconViewController extends ViewController<LockIconView> impleme } else { final float distAboveKgBottomArea = 12 * mDensity; final float radius = 36 * mDensity; + final int kgBottomAreaHeight = Math.max(mKgIndicationHeight, mAmbientIndicationHeight); mView.setCenterLocation( new PointF(mWidthPixels / 2, - mHeightPixels - mKgBottomAreaHeight - distAboveKgBottomArea + mHeightPixels - kgBottomAreaHeight - distAboveKgBottomArea - radius / 2), (int) radius); } mView.getHitRect(mSensorTouchLocation); } + /** + * Set the location of ambient indication if showing (ie: now playing) + */ + public void setAmbientIndicationBottomPadding(int ambientIndicationBottomPadding) { + mAmbientIndicationHeight = ambientIndicationBottomPadding; + updateLockIconLocation(); + } + @Override public void dump(@NonNull FileDescriptor fd, @NonNull PrintWriter pw, @NonNull String[] args) { pw.println("mUdfpsEnrolled: " + mUdfpsEnrolled); |