Merge "[BiometricsV2] Fix fingerprint add another fail" into udc-dev

This commit is contained in:
TreeHugger Robot
2023-04-20 03:34:29 +00:00
committed by Android (Google) Code Review
2 changed files with 158 additions and 57 deletions

View File

@@ -66,7 +66,6 @@ import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentActivity;
import androidx.fragment.app.FragmentManager;
import androidx.lifecycle.Observer;
import androidx.lifecycle.ViewModelProvider;
import androidx.lifecycle.viewmodel.CreationExtras;
@@ -194,11 +193,13 @@ public class FingerprintEnrollmentActivity extends FragmentActivity {
// fragment
setContentView(R.layout.biometric_enrollment_container);
final Fragment fragment = getSupportFragmentManager().findFragmentById(
R.id.fragment_container_view);
if (DEBUG) {
Log.e(TAG, "onCreate() has savedInstance:" + (savedInstanceState != null));
Log.d(TAG, "onCreate() has savedInstance:" + (savedInstanceState != null)
+ ", fragment:" + fragment);
}
if (savedInstanceState == null) {
Log.d(TAG, "onCreate()"); // Use to differentiate biometrics v2
if (fragment == null) {
checkCredential();
final EnrollmentRequest request = mViewModel.getRequest();
if (request.isSkipFindSensor()) {
@@ -209,42 +210,26 @@ public class FingerprintEnrollmentActivity extends FragmentActivity {
startIntroFragment();
}
} else {
final FragmentManager manager = getSupportFragmentManager();
String[] tags = new String[] {
FINISH_TAG,
ENROLLING_UDFPS_TAG,
ENROLLING_SFPS_TAG,
ENROLLING_RFPS_TAG,
FIND_UDFPS_TAG,
FIND_SFPS_TAG,
FIND_RFPS_TAG,
INTRO_TAG
};
for (String tag: tags) {
final Fragment fragment = manager.findFragmentByTag(tag);
if (fragment == null) {
continue;
}
if (DEBUG) {
Log.e(TAG, "onCreate() currentFragment:" + tag);
}
if (tag.equals(INTRO_TAG)) {
attachIntroViewModel();
} else if (tag.equals(FIND_UDFPS_TAG) || tag.equals(FIND_SFPS_TAG)
|| tag.equals(FIND_RFPS_TAG)) {
attachFindSensorViewModel();
attachIntroViewModel();
} else if (tag.equals(ENROLLING_UDFPS_TAG) || tag.equals(ENROLLING_SFPS_TAG)
|| tag.equals(ENROLLING_RFPS_TAG)) {
attachEnrollingViewModel();
attachFindSensorViewModel();
attachIntroViewModel();
} else { // FINISH_TAG
attachFinishViewModel();
attachFindSensorViewModel();
attachIntroViewModel();
}
break;
final String tag = fragment.getTag();
if (INTRO_TAG.equals(tag)) {
attachIntroViewModel();
} else if (FIND_UDFPS_TAG.equals(tag) || FIND_SFPS_TAG.equals(tag)
|| FIND_RFPS_TAG.equals(tag)) {
attachFindSensorViewModel();
attachIntroViewModel();
} else if (ENROLLING_UDFPS_TAG.equals(tag) || ENROLLING_SFPS_TAG.equals(tag)
|| ENROLLING_RFPS_TAG.equals(tag)) {
attachEnrollingViewModel();
attachFindSensorViewModel();
attachIntroViewModel();
} else if (FINISH_TAG.equals(tag)) {
attachFinishViewModel();
attachFindSensorViewModel();
attachIntroViewModel();
} else {
Log.e(TAG, "fragment tag " + tag + " not found");
finish();
return;
}
}