[Crashlytics][2.4] AgePickerDialog ArrayIndexOutOfBoundsException when Years/Months change, still crashing in 2.3 (85 events / 58 users in 30 days)

XMLWordPrintable

      Summary

      AgePickerDialog crashes with ArrayIndexOutOfBoundsException (length=30; index=30) when the Years/Months value changes. The crash still occurs in release 2.3. Fix is required in 2.4.

      Background / Context

      • Source: Firebase Crashlytics, project stoptb-8e404, app org.piramalswasthya.stoptb, 30-day crash view (Oct 12 – Nov 10, 2026).
      • Existing ticket: STOP-782 (RCA-02, Medium, fix version 2.5). This ticket tracks the 2.4 fix. Priority is set to High because the crash is in the new beneficiary registration flow and affects 58 users.

      Problem Statement

      Changing the Years or Months value in the age dialog makes the app crash.

      Current Behaviour (Actual)

      • Crash: java.lang.ArrayIndexOutOfBoundsException - length=30; index=30 at AgePickerDialog.kt:107 (AgePickerDialog$show$1$syncDaysMin$1.invoke), in the new_ben_registration screen.
      • 85 events / 58 users in 30 days. Affected versions: 2.0 – 2.3.
      • RCA-02 (Probable Root Cause, not reproduced on device): NumberPicker.minValue is set in syncDaysMin while displayedValues still holds 30 entries. resolveDaysMin returns 1 only when years and months are 0, so the range flips between 30 and 31 values. minValue is changed before displayedValues is cleared and rebuilt (hypothesis H5).

      Expected Behaviour / Requirement

      • Changing Years or Months in the age dialog never crashes, regardless of the Days picker range.
      • The Days picker displays the correct range for the selected Years/Months. [TBD/CLARIFICATION REQUIRED: confirm intended Days range rules]

      User Story

      As a health worker registering a beneficiary, I want to change the age values freely, so that I can complete registration without the app closing.

      Acceptance Criteria

      • Given the age dialog is open, When Years or Months is toggled between 0 and a non-zero value, Then the app does not crash.
      • Given Years and Months are both 0, When the Days picker is shown, Then it shows a valid range with no out-of-bounds access.
      • Given the 2.4 build is released, When Crashlytics is checked, Then AgePickerDialog.syncDaysMin shows no new events on 2.4.

      Business Rules / Validations

      • Existing minimum rule: Days minimum is 1 only when Years and Months are both 0 (per resolveDaysMin). Keep unchanged unless clarified.

      Dependencies

      • Related: STOP-782 (RCA-02). Sibling issue: STOP-788 (AgePicker NumberFormatException), both in AgePickerDialog.
      • Proposed action CAPA-08: set displayedValues = null before changing minValue, then re-apply forceLatinDigits after.

      Impact / Affected Areas

      • AgePickerDialog and new beneficiary registration (new_ben_registration).

      Out of Scope

      • The empty-input NumberFormatException on the OK button (STOP-788).

      QA / Testing Considerations

      • Toggle Years and Months between 0 and non-zero on a device; confirm no crash (CAPA-08 validation).
      • Test on tablets and slow devices.
      • Verify in Crashlytics after the 2.4 rollout.

       

              Assignee:
              Ashutosh Gupta
              Reporter:
              Shivani Garg
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Created:
                Updated: