Return null instead of 0L from getApplicationInstalledTime when the install time is unavailable
Categories
(Firefox for Android :: Experimentation and Telemetry, task)
Tracking
()
| Tracking | Status | |
|---|---|---|
| firefox162 | --- | fixed |
People
(Reporter: towhite, Assigned: towhite)
References
(Blocks 1 open bug)
Details
(Whiteboard: [android-activation-trust] [fxdroid])
Attachments
(1 external file)
getApplicationInstalledTime() returns 0L when the PackageManager lookup fails with NameNotFoundException or UnsupportedOperationException. This represents an unknown install time as a timestamp in 1970, which callers can mistakenly use in date calculations.
The only current caller is the termsOfUseAcceptedTimeInMillis default in Settings, where 0L is the intended fallback. However, bug 2036436 will cache the install time in Settings and migrate MetricsStorage, GrowthDataWorker, and RecordedNimbusContext to use it. These callers currently throw on lookup failure. Returning 0L instead would silently produce incorrect results, including skipped growth events, a missing day-7 activation event, and an excessively large Nimbus days_since_install value.
Change getApplicationInstalledTime() to return Long?, using null when the lookup fails. This requires each caller to handle an unknown install time explicitly. Keep the 0L fallback in termsOfUseAcceptedTimeInMillis, preserving its existing behaviour.
Tests
- Verify that
getApplicationInstalledTime()returnsnullfor both exception types. - Verify that
termsOfUseAcceptedTimeInMillisfalls back to0Lwhen the lookup fails.
This blocks bug 2036436.
Updated•7 days ago
|
Comment 1•7 days ago
|
||
(via GitHub webhook, authenticated as shared-secret)
Comment 2•7 days ago
|
||
The Bugbug bot thinks this bug should belong to the 'Firefox for Android::Experimentation and Telemetry' component, and is moving the bug to that component. Please correct in case you think the bot is wrong.
Comment 4•7 days ago
|
||
| bugherder | ||
Updated•6 days ago
|
Description
•