Skip to content

Conversation

@OrangeAndGreen
Copy link
Contributor

https://dimagi.atlassian.net/browse/QA-8145

Product Description

Fingerprint option will never be displayed on the Biometric Config page if the device doesn't have a fingerprint scanner.

Technical Summary

Rearranged logic for showing fingerprint/PIN option on biometric config page.
Fixed issue where fingerprint option could be shown when device doesn't have a fingerprint scanner.

Feature Flag

PersonalID

Safety Assurance

Safety story

Tested manually by dev

Automated test coverage

None

QA Plan

Test the Biometric Config page under various scenarios of fingerprint/PIN being available and/or configured and Connect vs. non-Connect user. Make sure the appropriate options are shown to the user in every case.

…ig page.

Fixed issue where fingerprint option could be shown when device doesn't have a fingerprint scanner.
@OrangeAndGreen OrangeAndGreen added this to the 2.60 milestone Oct 16, 2025
@OrangeAndGreen OrangeAndGreen added the skip-integration-tests Skip android tests. label Oct 16, 2025
@coderabbitai
Copy link

coderabbitai bot commented Oct 16, 2025

📝 Walkthrough

Walkthrough

This PR refactors the updateUiBasedOnMinSecurityRequired method in PersonalIdBiometricConfigFragment.java to improve control flow and UI state management. The changes reorganize the logic to initialize the fingerprint button to null, defer title and message assignment until after computing button visibility, simplify multi-branch conditional logic, and centralize error handling for missing biometric hardware. The refactored flow now determines which buttons (fingerprint, PIN) should be visible based on hardware availability and security requirements, then sets the appropriate title and message based on available verification options.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

The refactoring involves reorganized control flow with interdependent logic across button visibility determination, title/message assignment, and error handling within a single method. Understanding the interaction between these deferred operations and verifying edge cases around biometric hardware availability and PIN configuration requires careful analysis of the complete method behavior.

Possibly related PRs

Suggested reviewers

  • shubham1g5
  • Jignesh-dimagi

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (2 passed)
Check name Status Explanation
Title Check ✅ Passed The title clearly and concisely summarizes the primary change by indicating that biometric configuration options are corrected for devices without a fingerprint scanner, making it specific and directly related to the code changes.
Description Check ✅ Passed The description adheres to the repository template by including a ticket link, a Product Description, a Technical Summary, the relevant Feature Flag, and a detailed Safety Assurance section with safety story, automated test coverage, and QA plan, providing a comprehensive overview of the change.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch no_fingerprint_fix

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (2)
app/src/org/commcare/fragments/personalId/PersonalIdBiometricConfigFragment.java (2)

141-149: Gate "Configure fingerprint" to NotConfigured; avoid showing it for NeedsUpdate/NotAvailable.

Currently any status except NoHardware shows the configure button, which can mislead when the state is NeedsUpdate/NotAvailable. Prefer restricting to NotConfigured.

Apply this diff:

-            if(hasFingerprintHardware) {
-                fingerprintButton = getString(R.string.connect_verify_configure_fingerprint);
-            }
+            if (fingerprintStatus == BiometricsHelper.ConfigurationStatus.NotConfigured) {
+                fingerprintButton = getString(R.string.connect_verify_configure_fingerprint);
+            }

Based on relevant code snippets (status enums).


145-149: Minor: cache requiredLock locally to avoid repeated lookups.

Read requiredLock once into a local variable at method start and reuse.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 91732a0 and 7cfc5a0.

📒 Files selected for processing (1)
  • app/src/org/commcare/fragments/personalId/PersonalIdBiometricConfigFragment.java (1 hunks)
🧰 Additional context used
🧬 Code graph analysis (1)
app/src/org/commcare/fragments/personalId/PersonalIdBiometricConfigFragment.java (2)
app/src/org/commcare/utils/BiometricsHelper.java (1)
  • BiometricsHelper (33-258)
app/src/org/commcare/android/database/connect/models/PersonalIdSessionData.kt (1)
  • PIN (33-35)
🔇 Additional comments (2)
app/src/org/commcare/fragments/personalId/PersonalIdBiometricConfigFragment.java (2)

137-149: Confirm intent: hide PIN option when fingerprint is configured even if PIN is required.

With this logic, when requiredLock == PIN and fingerprint is Configured, the PIN button is never shown. Is this a product decision? If not, consider also showing PIN when it’s configured/available.


141-142: Verify copy for PIN-only scenarios.

When only PIN is visible, message uses connect_verify_message (generic). Ensure this string doesn’t reference fingerprint. If it does, set a PIN-specific message when fingerprintButton is null.

Also applies to: 169-171

Comment on lines +158 to +167
if(fingerprintButton != null && pinButton != null) {
title = getString(R.string.connect_verify_title);
} else if (fingerprintButton != null) {
title = getString(R.string.connect_verify_use_fingerprint_long);
} else if (pinButton != null) {
title = getString(R.string.connect_verify_use_pin_long);
} else {
showNoBiometricHardwareError();
return;
}
Copy link

@coderabbitai coderabbitai bot Oct 16, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

Route PIN-specific errors when no options are available (wrong error today).

If requiredLock is PIN and neither button is shown, current code surfaces "No biometric hardware" which is incorrect. Show PIN-specific errors based on pinStatus instead.

Apply this diff:

-        } else {
-            showNoBiometricHardwareError();
-            return;
-        }
+        } else {
+            String requiredLock = personalIdSessionDataViewModel.getPersonalIdSessionData().getRequiredLock();
+            if (PIN.equals(requiredLock)) {
+                if (pinStatus == BiometricsHelper.ConfigurationStatus.NeedsUpdate) {
+                    showPinNeedsUpdateError();
+                } else {
+                    showPinNotAvailableError();
+                }
+            } else {
+                showNoBiometricHardwareError();
+            }
+            return;
+        }

Based on relevant code snippets (BiometricsHelper.checkStatus mappings).

Committable suggestion skipped: line range outside the PR's diff.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we're okay with the error message being as is in this special case

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@OrangeAndGreen, understood! I'll defer to your judgment on this. The current error message is acceptable for this edge case.

// Need at least Fingerprint configuration for BIOMETRIC_TYPE
} else {
message = getString(R.string.connect_verify_message);
if(hasFingerprintHardware) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hasFingerprintHardware should check for other scenario also i.e. for NotAvailable and NeedsUpdate?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the idea is to show the option as long as the hardware exists on the device, and then when the user clicks the button for fingerprint we'll show an error message if there's an issue (see switch around line 194).

The key here is that if the device doesn't physically have a fingerprint sensor, we don't even want to show it as an option.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's good flow but what I have observed is that even user has PIN as required lock, app is trying to configure the malformed finger print and at the end its giving error but actually user should have been able to move ahead by PIN only.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Jignesh-dimagi Do you mean user gets blocked on using pin if fingerprint errors while doing a setup step ? If so, I agree that's not the behaviour we would want.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@shubham1g5 Yes that's correct

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Jignesh-dimagi I don't see how this PR is changing that behaviour though, is it something you think already happens and we should change OR is it something you think is introduced by this PR ?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@shubham1g5 Not with PR exactly but seen configuring the malfunctioning fingerprint is blocking the users from moving ahead. I am fine if we want to take it separately.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

got it, lets take it separately in that case so that we don't block the release. Curious if you had seen it as part of an interrupt ticket or just on your phone ? It might be cruicial to know the exact failure mode here for us to take actions.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@shubham1g5 I am not able to reproduce it but seen in some interrupt tickets where there was error saying update the play service and another with message that not able to use your hardware or unavailable at this moment. I am not able to find that ticket now, will search for it.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

got it, no worries if you can't. I am sure it will surface again someway if it's not fixed :)

… to user based on whether fingerprint and/or PIN are options.
@shubham1g5
Copy link
Contributor

@OrangeAndGreen seems like build is not compiling here.

@shubham1g5 shubham1g5 merged commit 0be4d61 into commcare_2.60 Oct 17, 2025
2 checks passed
@shubham1g5 shubham1g5 deleted the no_fingerprint_fix branch October 17, 2025 08:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

skip-integration-tests Skip android tests.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants