Extend SfpsEnrollmentFeature for text updating when progress changes
Bug: 341693248 Test: atest SfpsEnrollmentFeatureImplTest Change-Id: I63576f129f4453d4db088adfaa472df797823514
This commit is contained in:
@@ -264,7 +264,7 @@ public class FingerprintEnrollEnrolling extends BiometricsEnrollEnrolling {
|
|||||||
|
|
||||||
mIsSetupWizard = WizardManagerHelper.isAnySetupWizard(getIntent());
|
mIsSetupWizard = WizardManagerHelper.isAnySetupWizard(getIntent());
|
||||||
if (mCanAssumeUdfps || mCanAssumeSfps) {
|
if (mCanAssumeUdfps || mCanAssumeSfps) {
|
||||||
updateTitleAndDescription();
|
updateTitleAndDescription(true);
|
||||||
} else {
|
} else {
|
||||||
setHeaderText(R.string.security_settings_fingerprint_enroll_repeat_title);
|
setHeaderText(R.string.security_settings_fingerprint_enroll_repeat_title);
|
||||||
}
|
}
|
||||||
@@ -387,7 +387,7 @@ public class FingerprintEnrollEnrolling extends BiometricsEnrollEnrolling {
|
|||||||
protected void onStart() {
|
protected void onStart() {
|
||||||
super.onStart();
|
super.onStart();
|
||||||
updateProgress(false /* animate */);
|
updateProgress(false /* animate */);
|
||||||
updateTitleAndDescription();
|
updateTitleAndDescription(true);
|
||||||
if (mRestoring) {
|
if (mRestoring) {
|
||||||
startIconAnimation();
|
startIconAnimation();
|
||||||
}
|
}
|
||||||
@@ -491,12 +491,14 @@ public class FingerprintEnrollEnrolling extends BiometricsEnrollEnrolling {
|
|||||||
return new Intent(this, FingerprintEnrollFinish.class);
|
return new Intent(this, FingerprintEnrollFinish.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateTitleAndDescription() {
|
private void updateTitleAndDescription(boolean force) {
|
||||||
if (mCanAssumeUdfps) {
|
if (mCanAssumeUdfps) {
|
||||||
updateTitleAndDescriptionForUdfps();
|
updateTitleAndDescriptionForUdfps();
|
||||||
return;
|
return;
|
||||||
} else if (mCanAssumeSfps) {
|
} else if (mCanAssumeSfps) {
|
||||||
|
if (force || mSfpsEnrollmentFeature.shouldUpdateTitleAndDescription()) {
|
||||||
updateTitleAndDescriptionForSfps();
|
updateTitleAndDescriptionForSfps();
|
||||||
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -814,12 +816,15 @@ 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 && mIsAccessibilityEnabled) {
|
if (mCanAssumeSfps) {
|
||||||
|
mSfpsEnrollmentFeature.handleOnEnrollmentProgressChange(steps, remaining);
|
||||||
|
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);
|
||||||
}
|
}
|
||||||
updateTitleAndDescription();
|
}
|
||||||
|
updateTitleAndDescription(false);
|
||||||
animateFlash();
|
animateFlash();
|
||||||
if (mCanAssumeUdfps) {
|
if (mCanAssumeUdfps) {
|
||||||
if (mIsAccessibilityEnabled) {
|
if (mIsAccessibilityEnabled) {
|
||||||
@@ -850,6 +855,9 @@ public class FingerprintEnrollEnrolling extends BiometricsEnrollEnrolling {
|
|||||||
if (mUdfpsEnrollHelper != null) {
|
if (mUdfpsEnrollHelper != null) {
|
||||||
mUdfpsEnrollHelper.onAcquired(isAcquiredGood);
|
mUdfpsEnrollHelper.onAcquired(isAcquiredGood);
|
||||||
}
|
}
|
||||||
|
if (mCanAssumeSfps) {
|
||||||
|
mSfpsEnrollmentFeature.handleOnAcquired(isAcquiredGood);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -177,6 +177,11 @@ public class MessageDisplayController extends FingerprintManager.EnrollmentCallb
|
|||||||
mEnrollmentCallback.onEnrollmentError(errMsgId, errString);
|
mEnrollmentCallback.onEnrollmentError(errMsgId, errString);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onAcquired(boolean isAcquiredGood) {
|
||||||
|
mEnrollmentCallback.onAcquired(isAcquiredGood);
|
||||||
|
}
|
||||||
|
|
||||||
private Message getMessageToDisplay(long timeStamp) {
|
private Message getMessageToDisplay(long timeStamp) {
|
||||||
ProgressMessage progressMessageToDisplay = getProgressMessageToDisplay(timeStamp);
|
ProgressMessage progressMessageToDisplay = getProgressMessageToDisplay(timeStamp);
|
||||||
if (mMustDisplayProgress) {
|
if (mMustDisplayProgress) {
|
||||||
|
|||||||
@@ -93,4 +93,25 @@ public interface SfpsEnrollmentFeature {
|
|||||||
* @param lottieView the view related to the lottie
|
* @param lottieView the view related to the lottie
|
||||||
*/
|
*/
|
||||||
default void handleOnEnrollmentLottieComposition(LottieAnimationView lottieView) {}
|
default void handleOnEnrollmentLottieComposition(LottieAnimationView lottieView) {}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Indicates if the title and description should be updated.
|
||||||
|
* @return true to update the title and description; false otherwise.
|
||||||
|
*/
|
||||||
|
default boolean shouldUpdateTitleAndDescription() {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Notifies an acquisition happens.
|
||||||
|
* @param isAcquiredGood isAcquiredGood
|
||||||
|
*/
|
||||||
|
default void handleOnAcquired(boolean isAcquiredGood) {}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Notifies an enrollment progress changes event.
|
||||||
|
* @param steps steps
|
||||||
|
* @param remaining remaining
|
||||||
|
*/
|
||||||
|
default void handleOnEnrollmentProgressChange(int steps, int remaining) {}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user