Closed
Bug 1246816
Opened 9 years ago
Closed 9 years ago
Get ProfileCreationDate from system if times.json could not be read
Categories
(Firefox for Android Graveyard :: General, defect)
Tracking
(firefox47 fixed, firefox48 fixed, fennec47+)
RESOLVED
FIXED
Firefox 48
People
(Reporter: mcomella, Assigned: mcomella)
References
Details
Attachments
(4 files, 2 obsolete files)
|
58 bytes,
text/x-review-board-request
|
sebastian
:
review+
ritu
:
approval-mozilla-aurora+
|
Details |
|
58 bytes,
text/x-review-board-request
|
sebastian
:
review+
ritu
:
approval-mozilla-aurora+
|
Details |
|
58 bytes,
text/x-review-board-request
|
sebastian
:
review+
ritu
:
approval-mozilla-aurora+
|
Details |
|
58 bytes,
text/x-review-board-request
|
gfritzsche
:
review+
ritu
:
approval-mozilla-aurora+
|
Details |
In bug 1246209, we try to read times.json, which should be created by the GeckoProfile init code to get the profile creation date. However, in the case of error, we should try to implement the algo in ProfileAge.jsm - getOldestProfileTimestamp [1] which walks the file system to find the oldest file age and uses that instead. Then we should persist the data to times.json.
It's not strictly necessary as times.json should be written eventually by the Gecko side of things if it fails to write on profile creation, but it's more accurate than the solution we have now.
[1]: https://mxr.mozilla.org/mozilla-central/source/toolkit/modules/ProfileAge.jsm#122
| Assignee | ||
Comment 1•9 years ago
|
||
Remove the "optional" argument work-around in TelemetryPingGenerator.createCorePingPayload too.
| Assignee | ||
Updated•9 years ago
|
Blocks: ut-android
| Assignee | ||
Comment 2•9 years ago
|
||
And remove the work-around in TelemetryUploadService.getProfileCreationDate.
Comment 3•9 years ago
|
||
Oh hey, I wrote that code!
http://hg.mozilla.org/mozilla-central/annotate/94b360f64761/services/healthreport/profile.jsm
But maybe don't over-think this…
http://developer.android.com/reference/android/content/pm/PackageInfo.html#firstInstallTime
Comment 4•9 years ago
|
||
(In reply to Richard Newman [:rnewman] from comment #3)
> But maybe don't over-think this…
>
> http://developer.android.com/reference/android/content/pm/PackageInfo.
> html#firstInstallTime
Awesome simplification
Updated•9 years ago
|
| Assignee | ||
Comment 5•9 years ago
|
||
Georg, there is still the (unlikely) possibility of throwing errors and being unable to read the profile creation date. In this case, should we return -1 or null? I'd think -1 to keep the types consistent.
Flags: needinfo?(gfritzsche)
| Assignee | ||
Updated•9 years ago
|
Summary: Implement getAndPersistProfileCreationDateFromFilesystem → Get ProfileCreationDate from system if times.json could not be read
| Assignee | ||
Comment 6•9 years ago
|
||
Georg, our simplified algorithm uses the Android system's package install time for our application, rather than walking the filesystem like JS. I persist this value to times.json so we always return a consistent times.json value.
Could using this time, as opposed to the actual profile creation time, break any existing systems you are aware of? Should I not persist to disk and let Gecko eventually write to times.json instead?
Comment 7•9 years ago
|
||
On desktop we used |null| to signal failure/missing/etc. for fields, i think it's good to be able to tell this apart.
I think null instead of -1 is a clearer signal, both would affect the semantics (negative vs. positive number or null vs. positive number).
Flags: needinfo?(gfritzsche)
Comment 8•9 years ago
|
||
(In reply to Michael Comella (:mcomella) from comment #6)
> Georg, our simplified algorithm uses the Android system's package install
> time for our application, rather than walking the filesystem like JS. I
> persist this value to times.json so we always return a consistent times.json
> value.
>
> Could using this time, as opposed to the actual profile creation time, break
> any existing systems you are aware of? Should I not persist to disk and let
> Gecko eventually write to times.json instead?
I don't think this should break anything, but i'm not sure if this can affect semantics.
Could we have different profile creation vs. installation times?
And would we care?
Comment 9•9 years ago
|
||
(In reply to Georg Fritzsche [:gfritzsche] from comment #8)
> Could we have different profile creation vs. installation times?
Yes: the profile is created on first launch, which will always be later (seconds, hours, months…) than installation time.
> And would we care?
It would make a user appear to have been retained for longer.
| Assignee | ||
Comment 10•9 years ago
|
||
Finkle, in comment 9, Newman brought up some good points about the ways using "install time" could affect retention & usage numbers – do we care?
We could also simplify this by writing to times.json with System.currentTimeMillis if we suspect that this isn't a really old profile (e.g. use the timestamp from 2016-03-25), otherwise fall-back to installTime in the worst case.
Flags: needinfo?(mark.finkle)
Comment 11•9 years ago
|
||
(In reply to Michael Comella (:mcomella) from comment #10)
> Finkle, in comment 9, Newman brought up some good points about the ways
> using "install time" could affect retention & usage numbers – do we care?
Yeah. I think we should care. We have enough noise in the system, adding another potential source (installing but not using) should be avoided, if possible.
That said, this bug is about situations where we have an existing profile, not a new profile, without a times.json file. This should not be a problem for new installs, just old installs.
Therefore:
I could live using the "install time" as a fallback for "profile creation" since it's better than NULL and should give a ballpark. This problem will work itself out in the long run.
> We could also simplify this by writing to times.json with
> System.currentTimeMillis if we suspect that this isn't a really old profile
> (e.g. use the timestamp from 2016-03-25), otherwise fall-back to installTime
> in the worst case.
Let's not do that.
Flags: needinfo?(mark.finkle)
| Assignee | ||
Updated•9 years ago
|
Assignee: nobody → michael.l.comella
| Assignee | ||
Comment 12•9 years ago
|
||
Review commit: https://reviewboard.mozilla.org/r/43611/diff/#index_header
See other reviews: https://reviewboard.mozilla.org/r/43611/
Attachment #8736976 -
Flags: review?(s.kaspari)
Attachment #8736977 -
Flags: review?(s.kaspari)
Attachment #8736978 -
Flags: review?(s.kaspari)
Attachment #8736980 -
Flags: review?(gfritzsche)
| Assignee | ||
Comment 13•9 years ago
|
||
Review commit: https://reviewboard.mozilla.org/r/43613/diff/#index_header
See other reviews: https://reviewboard.mozilla.org/r/43613/
| Assignee | ||
Comment 14•9 years ago
|
||
Review commit: https://reviewboard.mozilla.org/r/43615/diff/#index_header
See other reviews: https://reviewboard.mozilla.org/r/43615/
| Assignee | ||
Comment 15•9 years ago
|
||
Review commit: https://reviewboard.mozilla.org/r/43617/diff/#index_header
See other reviews: https://reviewboard.mozilla.org/r/43617/
| Assignee | ||
Comment 16•9 years ago
|
||
Review commit: https://reviewboard.mozilla.org/r/43619/diff/#index_header
See other reviews: https://reviewboard.mozilla.org/r/43619/
| Assignee | ||
Comment 17•9 years ago
|
||
Comment on attachment 8736977 [details]
MozReview Request: Bug 1246816 - Get core ping profile creation date from application install time. r=sebastian
Review request updated; see interdiff: https://reviewboard.mozilla.org/r/43613/diff/1-2/
| Assignee | ||
Comment 18•9 years ago
|
||
Comment on attachment 8736978 [details]
MozReview Request: Bug 1246816 - Add unit tests for profile creation date. r=sebastian
Review request updated; see interdiff: https://reviewboard.mozilla.org/r/43615/diff/1-2/
| Assignee | ||
Comment 19•9 years ago
|
||
Comment on attachment 8736980 [details]
MozReview Request: Bug 1246816 - Add docs for profileDate. r=gfritzsche
Review request updated; see interdiff: https://reviewboard.mozilla.org/r/43619/diff/1-2/
| Assignee | ||
Updated•9 years ago
|
Attachment #8736979 -
Attachment is obsolete: true
| Assignee | ||
Comment 20•9 years ago
|
||
Georg, I should increment the ping version number for each change to the ping format, right? So I should increment again here?
Flags: needinfo?(gfritzsche)
Comment 21•9 years ago
|
||
This is not strictly a new addition, but it is a format change for validation/schema purposes.
Let's bump the version so we can actually tell those pings apart.
Flags: needinfo?(gfritzsche)
Comment 22•9 years ago
|
||
Comment on attachment 8736980 [details]
MozReview Request: Bug 1246816 - Add docs for profileDate. r=gfritzsche
https://reviewboard.mozilla.org/r/43619/#review40395
Let's bump the version and add it to the version history, so we can clearly tell this apart from previous pings.
Let's also merge this with the doc changes from bug 1257595 to preserve the history.
Attachment #8736980 -
Flags: review?(gfritzsche)
Updated•9 years ago
|
Attachment #8736976 -
Flags: review?(s.kaspari) → review+
Comment 23•9 years ago
|
||
Comment on attachment 8736976 [details]
MozReview Request: Bug 1246816 - Add ContextUtils.getPackageInstallTime. r=sebastian
https://reviewboard.mozilla.org/r/43611/#review40623
::: mobile/android/base/java/org/mozilla/gecko/util/ContextUtils.java:21
(Diff revision 1)
> + * @return {@link android.content.pm.PackageInfo#firstInstallTime} for the context's package.
> + * @throws PackageManager.NameNotFoundException Unexpected - we get the package name from the context so
> + * it's expected to be found.
> + */
> + public static long getPackageInstallTime(final Context context) throws PackageManager.NameNotFoundException {
> + return context.getPackageManager().getPackageInfo(context.getPackageName(), 0).firstInstallTime;
Should we handle NameNotFoundException inside this method and return -1 from here?
My assumption is that this should never fail for the current package. I throw an AssertionError in this case here:
https://dxr.mozilla.org/mozilla-central/source/mobile/android/base/java/org/mozilla/gecko/dlc/StudyAction.java#73-75
Comment 24•9 years ago
|
||
Comment on attachment 8736977 [details]
MozReview Request: Bug 1246816 - Get core ping profile creation date from application install time. r=sebastian
https://reviewboard.mozilla.org/r/43613/#review40627
Attachment #8736977 -
Flags: review?(s.kaspari) → review+
Updated•9 years ago
|
Attachment #8736978 -
Flags: review?(s.kaspari) → review+
Comment 25•9 years ago
|
||
Comment on attachment 8736978 [details]
MozReview Request: Bug 1246816 - Add unit tests for profile creation date. r=sebastian
https://reviewboard.mozilla.org/r/43615/#review40629
| Assignee | ||
Comment 26•9 years ago
|
||
https://reviewboard.mozilla.org/r/43611/#review40623
> Should we handle NameNotFoundException inside this method and return -1 from here?
>
> My assumption is that this should never fail for the current package. I throw an AssertionError in this case here:
> https://dxr.mozilla.org/mozilla-central/source/mobile/android/base/java/org/mozilla/gecko/dlc/StudyAction.java#73-75
I like this – I decided to throw `AssertionError` instead (because yes, it is unexpected).
| Assignee | ||
Comment 27•9 years ago
|
||
Review commit: https://reviewboard.mozilla.org/r/44425/diff/#index_header
See other reviews: https://reviewboard.mozilla.org/r/44425/
Attachment #8738301 -
Flags: review?(s.kaspari)
Attachment #8736980 -
Flags: review?(gfritzsche)
| Assignee | ||
Comment 28•9 years ago
|
||
Comment on attachment 8736976 [details]
MozReview Request: Bug 1246816 - Add ContextUtils.getPackageInstallTime. r=sebastian
Review request updated; see interdiff: https://reviewboard.mozilla.org/r/43611/diff/1-2/
| Assignee | ||
Comment 29•9 years ago
|
||
Comment on attachment 8736977 [details]
MozReview Request: Bug 1246816 - Get core ping profile creation date from application install time. r=sebastian
Review request updated; see interdiff: https://reviewboard.mozilla.org/r/43613/diff/2-3/
| Assignee | ||
Comment 30•9 years ago
|
||
Comment on attachment 8736978 [details]
MozReview Request: Bug 1246816 - Add unit tests for profile creation date. r=sebastian
Review request updated; see interdiff: https://reviewboard.mozilla.org/r/43615/diff/2-3/
| Assignee | ||
Comment 31•9 years ago
|
||
Comment on attachment 8736980 [details]
MozReview Request: Bug 1246816 - Add docs for profileDate. r=gfritzsche
Review request updated; see interdiff: https://reviewboard.mozilla.org/r/43619/diff/2-3/
| Assignee | ||
Comment 32•9 years ago
|
||
Comment on attachment 8736977 [details]
MozReview Request: Bug 1246816 - Get core ping profile creation date from application install time. r=sebastian
Review request updated; see interdiff: https://reviewboard.mozilla.org/r/43613/diff/3-4/
| Assignee | ||
Comment 33•9 years ago
|
||
Comment on attachment 8736978 [details]
MozReview Request: Bug 1246816 - Add unit tests for profile creation date. r=sebastian
Review request updated; see interdiff: https://reviewboard.mozilla.org/r/43615/diff/3-4/
| Assignee | ||
Comment 34•9 years ago
|
||
Comment on attachment 8736980 [details]
MozReview Request: Bug 1246816 - Add docs for profileDate. r=gfritzsche
Review request updated; see interdiff: https://reviewboard.mozilla.org/r/43619/diff/3-4/
| Assignee | ||
Updated•9 years ago
|
Attachment #8738301 -
Attachment is obsolete: true
Attachment #8738301 -
Flags: review?(s.kaspari)
Comment 35•9 years ago
|
||
Comment on attachment 8736980 [details]
MozReview Request: Bug 1246816 - Add docs for profileDate. r=gfritzsche
https://reviewboard.mozilla.org/r/43619/#review41335
This looks good.
Attachment #8736980 -
Flags: review?(gfritzsche) → review+
| Assignee | ||
Comment 36•9 years ago
|
||
https://hg.mozilla.org/integration/fx-team/rev/7fc39b90861d0a2d0fcc9dc7ad46b47c6204514f
Bug 1246816 - Add ContextUtils.getPackageInstallTime. r=sebastian
https://hg.mozilla.org/integration/fx-team/rev/6653113a8093393a68ce21899a0ab698e89a8d1c
Bug 1246816 - Get core ping profile creation date from application install time. r=sebastian
https://hg.mozilla.org/integration/fx-team/rev/0bdc00213180d671c58bd10e2e7e79853d481532
Bug 1246816 - Add unit tests for profile creation date. r=sebastian
https://hg.mozilla.org/integration/fx-team/rev/163ec1ec0f25e482a9c5156581887744f1f3fbb7
Bug 1246816 - Add docs for profileDate. r=gfritzsche
Comment 37•9 years ago
|
||
| bugherder | ||
https://hg.mozilla.org/mozilla-central/rev/7fc39b90861d
https://hg.mozilla.org/mozilla-central/rev/6653113a8093
https://hg.mozilla.org/mozilla-central/rev/0bdc00213180
https://hg.mozilla.org/mozilla-central/rev/163ec1ec0f25
Status: NEW → RESOLVED
Closed: 9 years ago
status-firefox48:
--- → fixed
Resolution: --- → FIXED
Target Milestone: --- → Firefox 48
Comment 38•9 years ago
|
||
This looks good on Nightly so far, i'm not seeing any missing profileDate values:
https://gist.github.com/georgf/59af52c55cea0e88d6a2e39895da296b
We should check this more once its on beta/release (probably just together with other validations).
| Assignee | ||
Comment 39•9 years ago
|
||
Comment on attachment 8736976 [details]
MozReview Request: Bug 1246816 - Add ContextUtils.getPackageInstallTime. r=sebastian
While not strictly necessary, bug 1249288 should get uplifted first. It bumps a version number which will conflict if this patch is uplifted first.
This request applies to all commits in this patch. However, the last commit is a doc update. If it fails to apply, it's okay to leave it out.
Approval Request Comment
[Feature/regressing bug #]: Profile creation date added to core ping (bug 1246209)
[User impact if declined]: We'll have less useful (i.e. many null) values for the profile creation date
[Describe test coverage new/current, TreeHerder]: Tested locally, on Nightly for a week, server-side validated, TH unit tests landed with patch
[Risks and why]: Low. We do some file IO, which is verbose and error prone in Java, however, the unit tests cover this. Otherwise, the patch is pretty simple – just calling out to existing APIs.
[String/UUID change made/needed]: None
Attachment #8736976 -
Flags: approval-mozilla-aurora?
| Assignee | ||
Updated•9 years ago
|
tracking-fennec: --- → 47+
status-firefox47:
--- → affected
Comment on attachment 8736976 [details]
MozReview Request: Bug 1246816 - Add ContextUtils.getPackageInstallTime. r=sebastian
Improves telemetry data quality, baked and validated on Nightly, Aurora47+
Attachment #8736976 -
Flags: approval-mozilla-aurora? → approval-mozilla-aurora+
Attachment #8736977 -
Flags: approval-mozilla-aurora+
Attachment #8736978 -
Flags: approval-mozilla-aurora+
Attachment #8736980 -
Flags: approval-mozilla-aurora+
Comment 41•9 years ago
|
||
has problems to apply:
grafting 338188:7fc39b90861d "Bug 1246816 - Add ContextUtils.getPackageInstallTime. r=sebastian"
merging mobile/android/base/moz.build
warning: conflicts while merging mobile/android/base/moz.build! (edit, then use 'hg resolve --mark')
abort: unresolved conflicts, can't continue
Flags: needinfo?(michael.l.comella)
| Assignee | ||
Comment 42•9 years ago
|
||
remote: https://hg.mozilla.org/releases/mozilla-aurora/rev/940fa79188fc
remote: https://hg.mozilla.org/releases/mozilla-aurora/rev/6eb56cc6d62f
remote: https://hg.mozilla.org/releases/mozilla-aurora/rev/f96dd0b45c03
I dropped the docs commit because it doesn't need to be up-to-date on aurora.
Flags: needinfo?(michael.l.comella)
Updated•4 years ago
|
Product: Firefox for Android → Firefox for Android Graveyard
You need to log in
before you can comment on or make changes to this bug.
Description
•