Closed Bug 2091371 Opened 7 days ago Closed 7 days ago

Return null instead of 0L from getApplicationInstalledTime when the install time is unavailable

Categories

(Firefox for Android :: Experimentation and Telemetry, task)

All
Android
task
Points:
2

Tracking

()

RESOLVED FIXED
162 Branch
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() returns null for both exception types.
  • Verify that termsOfUseAcceptedTimeInMillis falls back to 0L when the lookup fails.

This blocks bug 2036436.

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.

Component: General → Experimentation and Telemetry
Pushed by icedicedcoffee@proton.me: https://github.com/mozilla-firefox/firefox/commit/42df48926329 https://hg.mozilla.org/integration/autoland/rev/46ecbc6d0c93 Return null instead of 0L from getApplicationInstalledTime when the application install time is unavailable. r=sfamisa
Points: --- → 2
Status: NEW → RESOLVED
Closed: 7 days ago
Resolution: --- → FIXED
Target Milestone: --- → 162 Branch
Assignee: nobody → towhite
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: