Merge "Adds null-check on finger animation in enrollment" into tm-qpr-dev
This commit is contained in:
@@ -767,11 +767,13 @@ public class FingerprintEnrollEnrolling extends BiometricsEnrollEnrolling {
|
||||
public void onEnrollmentProgressChange(int steps, int remaining) {
|
||||
updateProgress(true /* animate */);
|
||||
final int percent = (int) (((float) (steps - remaining) / (float) steps) * 100);
|
||||
if (mCanAssumeSfps) {
|
||||
if (mIsAccessibilityEnabled) {
|
||||
CharSequence announcement = getString(
|
||||
R.string.security_settings_sfps_enroll_progress_a11y_message, percent);
|
||||
announceEnrollmentProgress(announcement);
|
||||
if (mCanAssumeSfps && mIsAccessibilityEnabled) {
|
||||
CharSequence announcement = getString(
|
||||
R.string.security_settings_sfps_enroll_progress_a11y_message, percent);
|
||||
announceEnrollmentProgress(announcement);
|
||||
// mIllustrationLottie is only shown when current display density = default density,
|
||||
// to prevent overlap with the settings header text.
|
||||
if (mIllustrationLottie != null) {
|
||||
mIllustrationLottie.setContentDescription(
|
||||
getString(
|
||||
R.string.security_settings_sfps_animation_a11y_label,
|
||||
@@ -837,7 +839,7 @@ public class FingerprintEnrollEnrolling extends BiometricsEnrollEnrolling {
|
||||
// Show nothing for subtitle when getting an error message.
|
||||
setDescriptionText("");
|
||||
if (mCanAssumeSfps) {
|
||||
applySfpsErrorDynamicColors(getApplicationContext(), mIllustrationLottie, true);
|
||||
applySfpsErrorDynamicColors(getApplicationContext(), true);
|
||||
}
|
||||
} else {
|
||||
mErrorText.setText(error);
|
||||
@@ -867,7 +869,7 @@ public class FingerprintEnrollEnrolling extends BiometricsEnrollEnrolling {
|
||||
|
||||
private void clearError() {
|
||||
if (mCanAssumeSfps) {
|
||||
applySfpsErrorDynamicColors(getApplicationContext(), mIllustrationLottie, false);
|
||||
applySfpsErrorDynamicColors(getApplicationContext(), false);
|
||||
}
|
||||
if ((!(mCanAssumeUdfps || mCanAssumeSfps)) && mErrorText.getVisibility() == View.VISIBLE) {
|
||||
mErrorText.animate()
|
||||
@@ -885,10 +887,11 @@ public class FingerprintEnrollEnrolling extends BiometricsEnrollEnrolling {
|
||||
* Applies dynamic colors corresponding to showing or clearing errors on the progress bar
|
||||
* and finger lottie for SFPS
|
||||
*/
|
||||
private void applySfpsErrorDynamicColors(Context context, LottieAnimationView composition,
|
||||
boolean isError) {
|
||||
private void applySfpsErrorDynamicColors(Context context, boolean isError) {
|
||||
applyProgressBarDynamicColor(context, isError);
|
||||
applyLottieDynamicColor(context, composition, isError);
|
||||
if (mIllustrationLottie != null) {
|
||||
applyLottieDynamicColor(context, isError);
|
||||
}
|
||||
}
|
||||
|
||||
private void applyProgressBarDynamicColor(Context context, boolean isError) {
|
||||
@@ -904,19 +907,16 @@ public class FingerprintEnrollEnrolling extends BiometricsEnrollEnrolling {
|
||||
}
|
||||
}
|
||||
|
||||
private void applyLottieDynamicColor(Context context, LottieAnimationView composition,
|
||||
boolean isError) {
|
||||
if (composition != null) {
|
||||
int error_color = context.getColor(R.color.sfps_enrollment_fp_error_color);
|
||||
int fp_captured_color = context.getColor(R.color.sfps_enrollment_fp_captured_color);
|
||||
int color = isError ? error_color : fp_captured_color;
|
||||
composition.addValueCallback(
|
||||
new KeyPath(".blue100", "**"),
|
||||
LottieProperty.COLOR_FILTER,
|
||||
frameInfo -> new PorterDuffColorFilter(color, PorterDuff.Mode.SRC_ATOP)
|
||||
);
|
||||
composition.invalidate();
|
||||
}
|
||||
private void applyLottieDynamicColor(Context context, boolean isError) {
|
||||
int error_color = context.getColor(R.color.sfps_enrollment_fp_error_color);
|
||||
int fp_captured_color = context.getColor(R.color.sfps_enrollment_fp_captured_color);
|
||||
int color = isError ? error_color : fp_captured_color;
|
||||
mIllustrationLottie.addValueCallback(
|
||||
new KeyPath(".blue100", "**"),
|
||||
LottieProperty.COLOR_FILTER,
|
||||
frameInfo -> new PorterDuffColorFilter(color, PorterDuff.Mode.SRC_ATOP)
|
||||
);
|
||||
mIllustrationLottie.invalidate();
|
||||
}
|
||||
|
||||
private void listenOrientationEvent() {
|
||||
@@ -1018,8 +1018,10 @@ public class FingerprintEnrollEnrolling extends BiometricsEnrollEnrolling {
|
||||
}
|
||||
|
||||
private void updateOrientation(int orientation) {
|
||||
if (mCanAssumeSfps && mShouldShowLottie) {
|
||||
mIllustrationLottie = findViewById(R.id.illustration_lottie);
|
||||
if (mCanAssumeSfps) {
|
||||
if (mShouldShowLottie) {
|
||||
mIllustrationLottie = findViewById(R.id.illustration_lottie);
|
||||
}
|
||||
} else {
|
||||
switch(orientation) {
|
||||
case Configuration.ORIENTATION_LANDSCAPE: {
|
||||
|
Reference in New Issue
Block a user