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