Loading packages/SystemUI/res/values/colors.xml +2 −1 Original line number Original line Diff line number Diff line Loading @@ -187,7 +187,8 @@ <!-- UDFPS colors --> <!-- UDFPS colors --> <color name="udfps_enroll_icon">#000000</color> <!-- 100% black --> <color name="udfps_enroll_icon">#000000</color> <!-- 100% black --> <color name="udfps_moving_target_fill">#cc4285f4</color> <!-- 80% blue --> <color name="udfps_moving_target_fill">#cc4285f4</color> <!-- 80% blue --> <color name="udfps_enroll_progress">#ff669DF6</color> <!-- 100% blue --> <color name="udfps_enroll_progress">#ff669DF6</color> <!-- blue 400 --> <color name="udfps_enroll_progress_help">#ffEE675C</color> <!-- red 400 --> <!-- Logout button --> <!-- Logout button --> <color name="logout_button_bg_color">#ccffffff</color> <color name="logout_button_bg_color">#ccffffff</color> Loading packages/SystemUI/src/com/android/systemui/biometrics/UdfpsEnrollDrawable.java +4 −0 Original line number Original line Diff line number Diff line Loading @@ -143,6 +143,10 @@ public class UdfpsEnrollDrawable extends UdfpsDrawable { mProgressDrawable.onLastStepAcquired(); mProgressDrawable.onLastStepAcquired(); } } void onEnrollmentHelp() { mProgressDrawable.onEnrollmentHelp(); } @Override @Override public void draw(@NonNull Canvas canvas) { public void draw(@NonNull Canvas canvas) { mProgressDrawable.draw(canvas); mProgressDrawable.draw(canvas); Loading packages/SystemUI/src/com/android/systemui/biometrics/UdfpsEnrollHelper.java +4 −1 Original line number Original line Diff line number Diff line Loading @@ -50,6 +50,7 @@ public class UdfpsEnrollHelper { interface Listener { interface Listener { void onEnrollmentProgress(int remaining, int totalSteps); void onEnrollmentProgress(int remaining, int totalSteps); void onLastStepAcquired(); void onLastStepAcquired(); void onEnrollmentHelp(); } } @NonNull private final Context mContext; @NonNull private final Context mContext; Loading Loading @@ -138,7 +139,9 @@ public class UdfpsEnrollHelper { } } void onEnrollmentHelp() { void onEnrollmentHelp() { if (mListener != null) { mListener.onEnrollmentHelp(); } } } void setListener(Listener listener) { void setListener(Listener listener) { Loading packages/SystemUI/src/com/android/systemui/biometrics/UdfpsEnrollProgressBarDrawable.java +57 −2 Original line number Original line Diff line number Diff line Loading @@ -16,7 +16,9 @@ package com.android.systemui.biometrics; package com.android.systemui.biometrics; import android.animation.ArgbEvaluator; import android.animation.ValueAnimator; import android.animation.ValueAnimator; import android.annotation.ColorInt; import android.content.Context; import android.content.Context; import android.content.res.TypedArray; import android.content.res.TypedArray; import android.graphics.Canvas; import android.graphics.Canvas; Loading Loading @@ -46,6 +48,11 @@ public class UdfpsEnrollProgressBarDrawable extends Drawable { @NonNull private final Paint mProgressPaint; @NonNull private final Paint mProgressPaint; @Nullable private ValueAnimator mProgressAnimator; @Nullable private ValueAnimator mProgressAnimator; @Nullable private ValueAnimator mProgressShowingHelpAnimator; @Nullable private ValueAnimator mProgressHidingHelpAnimator; @ColorInt private final int mProgressColor; @ColorInt private final int mProgressHelpColor; private final int mShortAnimationDuration; private float mProgress; private float mProgress; private int mRotation; // After last step, rotate the progress bar once private int mRotation; // After last step, rotate the progress bar once private boolean mLastStepAcquired; private boolean mLastStepAcquired; Loading @@ -55,6 +62,11 @@ public class UdfpsEnrollProgressBarDrawable extends Drawable { mContext = context; mContext = context; mParent = parent; mParent = parent; mShortAnimationDuration = context.getResources() .getInteger(com.android.internal.R.integer.config_shortAnimTime); mProgressColor = context.getColor(R.color.udfps_enroll_progress); mProgressHelpColor = context.getColor(R.color.udfps_enroll_progress_help); mBackgroundCirclePaint = new Paint(); mBackgroundCirclePaint = new Paint(); mBackgroundCirclePaint.setStrokeWidth(Utils.dpToPixels(context, PROGRESS_BAR_THICKNESS_DP)); mBackgroundCirclePaint.setStrokeWidth(Utils.dpToPixels(context, PROGRESS_BAR_THICKNESS_DP)); mBackgroundCirclePaint.setColor(context.getColor(R.color.white_disabled)); mBackgroundCirclePaint.setColor(context.getColor(R.color.white_disabled)); Loading @@ -74,7 +86,7 @@ public class UdfpsEnrollProgressBarDrawable extends Drawable { // Progress should not be color extracted // Progress should not be color extracted mProgressPaint = new Paint(); mProgressPaint = new Paint(); mProgressPaint.setStrokeWidth(Utils.dpToPixels(context, PROGRESS_BAR_THICKNESS_DP)); mProgressPaint.setStrokeWidth(Utils.dpToPixels(context, PROGRESS_BAR_THICKNESS_DP)); mProgressPaint.setColor(context.getColor(R.color.udfps_enroll_progress)); mProgressPaint.setColor(mProgressColor); mProgressPaint.setAntiAlias(true); mProgressPaint.setAntiAlias(true); mProgressPaint.setStyle(Paint.Style.STROKE); mProgressPaint.setStyle(Paint.Style.STROKE); mProgressPaint.setStrokeCap(Paint.Cap.ROUND); mProgressPaint.setStrokeCap(Paint.Cap.ROUND); Loading @@ -92,7 +104,9 @@ public class UdfpsEnrollProgressBarDrawable extends Drawable { return; return; } } long animationDuration = 150; long animationDuration = mShortAnimationDuration; hideEnrollmentHelp(); if (progress == 1.f) { if (progress == 1.f) { animationDuration = 400; animationDuration = 400; Loading Loading @@ -128,6 +142,47 @@ public class UdfpsEnrollProgressBarDrawable extends Drawable { mLastStepAcquired = true; mLastStepAcquired = true; } } void onEnrollmentHelp() { if (mProgressShowingHelpAnimator != null || mProgressAnimator == null) { return; // already showing or at 0% (no progress bar visible) } if (mProgressHidingHelpAnimator != null && mProgressHidingHelpAnimator.isRunning()) { mProgressHidingHelpAnimator.cancel(); } mProgressHidingHelpAnimator = null; mProgressShowingHelpAnimator = getProgressColorAnimator( mProgressPaint.getColor(), mProgressHelpColor); mProgressShowingHelpAnimator.start(); } private void hideEnrollmentHelp() { if (mProgressHidingHelpAnimator != null || mProgressShowingHelpAnimator == null) { return; // already hidden or help never shown } if (mProgressShowingHelpAnimator != null && mProgressShowingHelpAnimator.isRunning()) { mProgressShowingHelpAnimator.cancel(); } mProgressShowingHelpAnimator = null; mProgressHidingHelpAnimator = getProgressColorAnimator( mProgressPaint.getColor(), mProgressColor); mProgressHidingHelpAnimator.start(); } private ValueAnimator getProgressColorAnimator(@ColorInt int from, @ColorInt int to) { final ValueAnimator animator = ValueAnimator.ofObject( ArgbEvaluator.getInstance(), from, to); animator.setDuration(mShortAnimationDuration); animator.addUpdateListener(animation -> { mProgressPaint.setColor((int) animation.getAnimatedValue()); mParent.invalidateSelf(); }); return animator; } @Override @Override public void draw(@NonNull Canvas canvas) { public void draw(@NonNull Canvas canvas) { canvas.save(); canvas.save(); Loading packages/SystemUI/src/com/android/systemui/biometrics/UdfpsEnrollView.java +4 −0 Original line number Original line Diff line number Diff line Loading @@ -64,4 +64,8 @@ public class UdfpsEnrollView extends UdfpsAnimationView { void onLastStepAcquired() { void onLastStepAcquired() { mHandler.post(mFingerprintDrawable::onLastStepAcquired); mHandler.post(mFingerprintDrawable::onLastStepAcquired); } } void onEnrollmentHelp() { mHandler.post(mFingerprintDrawable::onEnrollmentHelp); } } } Loading
packages/SystemUI/res/values/colors.xml +2 −1 Original line number Original line Diff line number Diff line Loading @@ -187,7 +187,8 @@ <!-- UDFPS colors --> <!-- UDFPS colors --> <color name="udfps_enroll_icon">#000000</color> <!-- 100% black --> <color name="udfps_enroll_icon">#000000</color> <!-- 100% black --> <color name="udfps_moving_target_fill">#cc4285f4</color> <!-- 80% blue --> <color name="udfps_moving_target_fill">#cc4285f4</color> <!-- 80% blue --> <color name="udfps_enroll_progress">#ff669DF6</color> <!-- 100% blue --> <color name="udfps_enroll_progress">#ff669DF6</color> <!-- blue 400 --> <color name="udfps_enroll_progress_help">#ffEE675C</color> <!-- red 400 --> <!-- Logout button --> <!-- Logout button --> <color name="logout_button_bg_color">#ccffffff</color> <color name="logout_button_bg_color">#ccffffff</color> Loading
packages/SystemUI/src/com/android/systemui/biometrics/UdfpsEnrollDrawable.java +4 −0 Original line number Original line Diff line number Diff line Loading @@ -143,6 +143,10 @@ public class UdfpsEnrollDrawable extends UdfpsDrawable { mProgressDrawable.onLastStepAcquired(); mProgressDrawable.onLastStepAcquired(); } } void onEnrollmentHelp() { mProgressDrawable.onEnrollmentHelp(); } @Override @Override public void draw(@NonNull Canvas canvas) { public void draw(@NonNull Canvas canvas) { mProgressDrawable.draw(canvas); mProgressDrawable.draw(canvas); Loading
packages/SystemUI/src/com/android/systemui/biometrics/UdfpsEnrollHelper.java +4 −1 Original line number Original line Diff line number Diff line Loading @@ -50,6 +50,7 @@ public class UdfpsEnrollHelper { interface Listener { interface Listener { void onEnrollmentProgress(int remaining, int totalSteps); void onEnrollmentProgress(int remaining, int totalSteps); void onLastStepAcquired(); void onLastStepAcquired(); void onEnrollmentHelp(); } } @NonNull private final Context mContext; @NonNull private final Context mContext; Loading Loading @@ -138,7 +139,9 @@ public class UdfpsEnrollHelper { } } void onEnrollmentHelp() { void onEnrollmentHelp() { if (mListener != null) { mListener.onEnrollmentHelp(); } } } void setListener(Listener listener) { void setListener(Listener listener) { Loading
packages/SystemUI/src/com/android/systemui/biometrics/UdfpsEnrollProgressBarDrawable.java +57 −2 Original line number Original line Diff line number Diff line Loading @@ -16,7 +16,9 @@ package com.android.systemui.biometrics; package com.android.systemui.biometrics; import android.animation.ArgbEvaluator; import android.animation.ValueAnimator; import android.animation.ValueAnimator; import android.annotation.ColorInt; import android.content.Context; import android.content.Context; import android.content.res.TypedArray; import android.content.res.TypedArray; import android.graphics.Canvas; import android.graphics.Canvas; Loading Loading @@ -46,6 +48,11 @@ public class UdfpsEnrollProgressBarDrawable extends Drawable { @NonNull private final Paint mProgressPaint; @NonNull private final Paint mProgressPaint; @Nullable private ValueAnimator mProgressAnimator; @Nullable private ValueAnimator mProgressAnimator; @Nullable private ValueAnimator mProgressShowingHelpAnimator; @Nullable private ValueAnimator mProgressHidingHelpAnimator; @ColorInt private final int mProgressColor; @ColorInt private final int mProgressHelpColor; private final int mShortAnimationDuration; private float mProgress; private float mProgress; private int mRotation; // After last step, rotate the progress bar once private int mRotation; // After last step, rotate the progress bar once private boolean mLastStepAcquired; private boolean mLastStepAcquired; Loading @@ -55,6 +62,11 @@ public class UdfpsEnrollProgressBarDrawable extends Drawable { mContext = context; mContext = context; mParent = parent; mParent = parent; mShortAnimationDuration = context.getResources() .getInteger(com.android.internal.R.integer.config_shortAnimTime); mProgressColor = context.getColor(R.color.udfps_enroll_progress); mProgressHelpColor = context.getColor(R.color.udfps_enroll_progress_help); mBackgroundCirclePaint = new Paint(); mBackgroundCirclePaint = new Paint(); mBackgroundCirclePaint.setStrokeWidth(Utils.dpToPixels(context, PROGRESS_BAR_THICKNESS_DP)); mBackgroundCirclePaint.setStrokeWidth(Utils.dpToPixels(context, PROGRESS_BAR_THICKNESS_DP)); mBackgroundCirclePaint.setColor(context.getColor(R.color.white_disabled)); mBackgroundCirclePaint.setColor(context.getColor(R.color.white_disabled)); Loading @@ -74,7 +86,7 @@ public class UdfpsEnrollProgressBarDrawable extends Drawable { // Progress should not be color extracted // Progress should not be color extracted mProgressPaint = new Paint(); mProgressPaint = new Paint(); mProgressPaint.setStrokeWidth(Utils.dpToPixels(context, PROGRESS_BAR_THICKNESS_DP)); mProgressPaint.setStrokeWidth(Utils.dpToPixels(context, PROGRESS_BAR_THICKNESS_DP)); mProgressPaint.setColor(context.getColor(R.color.udfps_enroll_progress)); mProgressPaint.setColor(mProgressColor); mProgressPaint.setAntiAlias(true); mProgressPaint.setAntiAlias(true); mProgressPaint.setStyle(Paint.Style.STROKE); mProgressPaint.setStyle(Paint.Style.STROKE); mProgressPaint.setStrokeCap(Paint.Cap.ROUND); mProgressPaint.setStrokeCap(Paint.Cap.ROUND); Loading @@ -92,7 +104,9 @@ public class UdfpsEnrollProgressBarDrawable extends Drawable { return; return; } } long animationDuration = 150; long animationDuration = mShortAnimationDuration; hideEnrollmentHelp(); if (progress == 1.f) { if (progress == 1.f) { animationDuration = 400; animationDuration = 400; Loading Loading @@ -128,6 +142,47 @@ public class UdfpsEnrollProgressBarDrawable extends Drawable { mLastStepAcquired = true; mLastStepAcquired = true; } } void onEnrollmentHelp() { if (mProgressShowingHelpAnimator != null || mProgressAnimator == null) { return; // already showing or at 0% (no progress bar visible) } if (mProgressHidingHelpAnimator != null && mProgressHidingHelpAnimator.isRunning()) { mProgressHidingHelpAnimator.cancel(); } mProgressHidingHelpAnimator = null; mProgressShowingHelpAnimator = getProgressColorAnimator( mProgressPaint.getColor(), mProgressHelpColor); mProgressShowingHelpAnimator.start(); } private void hideEnrollmentHelp() { if (mProgressHidingHelpAnimator != null || mProgressShowingHelpAnimator == null) { return; // already hidden or help never shown } if (mProgressShowingHelpAnimator != null && mProgressShowingHelpAnimator.isRunning()) { mProgressShowingHelpAnimator.cancel(); } mProgressShowingHelpAnimator = null; mProgressHidingHelpAnimator = getProgressColorAnimator( mProgressPaint.getColor(), mProgressColor); mProgressHidingHelpAnimator.start(); } private ValueAnimator getProgressColorAnimator(@ColorInt int from, @ColorInt int to) { final ValueAnimator animator = ValueAnimator.ofObject( ArgbEvaluator.getInstance(), from, to); animator.setDuration(mShortAnimationDuration); animator.addUpdateListener(animation -> { mProgressPaint.setColor((int) animation.getAnimatedValue()); mParent.invalidateSelf(); }); return animator; } @Override @Override public void draw(@NonNull Canvas canvas) { public void draw(@NonNull Canvas canvas) { canvas.save(); canvas.save(); Loading
packages/SystemUI/src/com/android/systemui/biometrics/UdfpsEnrollView.java +4 −0 Original line number Original line Diff line number Diff line Loading @@ -64,4 +64,8 @@ public class UdfpsEnrollView extends UdfpsAnimationView { void onLastStepAcquired() { void onLastStepAcquired() { mHandler.post(mFingerprintDrawable::onLastStepAcquired); mHandler.post(mFingerprintDrawable::onLastStepAcquired); } } void onEnrollmentHelp() { mHandler.post(mFingerprintDrawable::onEnrollmentHelp); } } }