-
Type:
Bug
-
Resolution: Done
-
Priority:
Medium
-
Affects Version/s: None
-
STOP TB Sprint 12
Summary
ArrayIndexOutOfBoundsException (length=30; index=30) in the AgePicker dialog when the Years/Months value changes and the Days picker range changes size.
Background / Context
Source: StopTB Android Crashlytics RCA (Oct 15–21 2026, release 2.2.3). RCA ref RCA-02, status: Probable Root Cause (H5 supported by code reasoning; not reproduced on device). Priority: P2. 19 events / 11 users, first seen 2.0, still occurring in 2.2.3. Evidence: code only.
Problem Statement
When the user changes Years or Months such that the days minimum flips between 1 and 0, the Days NumberPicker crashes.
Current Behaviour (Actual)
- NumberPicker.minValue is set in syncDaysMin (AgePickerDialog.kt:107) while displayedValues still holds 30 entries; the range 0..30 needs 31.
- forceLatinDigits() builds displayedValues from min..max at call time, and syncDaysMin calls it after changing minValue instead of before (ordering defect).
- resolveDaysMin returns 1 only when years and months are 0, so the range size flips between 30 and 31.
Expected Behaviour / Requirement
Changing Years or Months (including to/from 0) updates the Days picker without crashing.
User Story
As a field user entering a beneficiary's age, I want to change years and months freely, so that the form does not crash.
Acceptance Criteria
- Given the age dialog, When Years/Months are toggled between 0 and non-zero values, Then the Days picker updates correctly and no crash occurs (CAPA-08).
- Given syncDaysMin, When minValue changes, Then displayedValues is set to null first, then forceLatinDigits is re-applied after.
Business Rules / Validations
Existing rule: days minimum is 1 only when years and months are both 0 (resolveDaysMin); otherwise 0. Any change to this rule is out of scope.
Dependencies
None identified. Related: RCA-03 (same dialog, STOP ticket for empty input).
Impact / Affected Areas
AgePickerDialog.kt (forceLatinDigits, resolveDaysMin, syncDaysMin) — all forms using the age picker.
Out of Scope
Empty-input parsing (covered in separate ticket for RCA-03).
QA / Testing Considerations
On device, toggle years/months between 0 and non-zero repeatedly; confirm Days values render in Latin digits; check no new AIOOBE events after release.
Open Questions / Clarifications
- Not reproduced on device; confirm reproduction steps before/after fix [TBD].
Source: StopTB_Crashlytics_RCA.xlsx (RCA-02, CAPA-08).
- relates to
-
STOP-787 [Crashlytics][2.4] AgePickerDialog ArrayIndexOutOfBoundsException when Years/Months change, still crashing in 2.3 (85 events / 58 users in 30 days)
-
- Pending QA
-