Use JobIntentService for other background work

RESOLVED FIXED in Firefox 63

Status

()

enhancement
RESOLVED FIXED
a year ago
10 months ago

People

(Reporter: petru, Assigned: petru)

Tracking

unspecified
Firefox 63
All
Android
Points:
---
Dependency tree / graph

Firefox Tracking Flags

(firefox63 fixed)

Details

Attachments

(2 attachments, 2 obsolete attachments)

GeckoService is a simple Android Service [1] which can be started while in background.

After starting to target Oreo a service can be started in background only if [2]:
- is started as a foreground service (with a notification visible to the user)
- is a JobIntentService
Otherwise the app would crash.

[1] https://dxr.mozilla.org/mozilla-central/source/mobile/android/base/java/org/mozilla/gecko/GeckoService.java#26
[2] https://developer.android.com/about/versions/oreo/background
Assignee

Updated

a year ago
Assignee: nobody → petru.lingurar
Assignee

Updated

a year ago
Blocks: 1465323
Comment hidden (mozreview-request)

Updated

a year ago
Attachment #8984521 - Flags: review?(sdaswani) → review?(jh+bugzilla)

Comment 2

a year ago
mozreview-review
Comment on attachment 8984521 [details]
Bug 1467840 - Migrate GeckoService to JobIntentService;

https://reviewboard.mozilla.org/r/250388/#review256918

Looks reasonable, just the jobId issues need resolving like in all the other JobIntentService conversion patches.

::: mobile/android/services/src/main/java/org/mozilla/gecko/background/JobIdsConstants.java:11
(Diff revision 1)
> + * To try and mitigate this situations we will use IDs with negative values in our code.
> + *
> + * @see <a href="https://developer.android.com/reference/android/app/job/JobInfo.Builder#JobInfo.Builder(int, android.content.ComponentName)">
> + *     JobId importance</a>
> + */
> +public class JobIdsConstants {

This needs rebasing onto whatever other patches will land first, but I guess you already know that.
Mentioning it just so this doesn't get accidentally landed like this.

::: mobile/android/services/src/main/java/org/mozilla/gecko/background/JobIdsConstants.java:36
(Diff revision 1)
> +    // Our package is unavailable to org.mozilla.gecko classes.
> +    // Currently used in org.mozilla.gecko classes.CrashReporterService
> +    // The id is kept here to ensure unicity between all job ids.
> +    private static final int JOB_ID_CRASH_REPORTER = -14;
> +
> +    public static final int JOB_ID_GECKO_STARTER = -15;

Also as mentioned elsewhere, the ID offset configurable through the build config needs to be done first.
Attachment #8984521 - Flags: review?(jh+bugzilla) → review+
Comment hidden (mozreview-request)
Comment hidden (mozreview-request)
Assignee

Updated

11 months ago
Summary: Migrate GeckoService to JobIntentService → Use JobIntentService for other background work
Assignee

Comment 5

11 months ago
- rebased the initial patch with the latest version of `JobIdsConstants` to be ready for landing.
- added a new commit for a JobIntentService used for background refresh of the GCM token as suggested in bug 1465323 comment 15.
- renamed to ticket accordingly.

Updated

11 months ago
Attachment #8987863 - Flags: review?(sdaswani) → review?(snorp)
Comment on attachment 8987863 [details]
Bug 1467840 - Use a JobIntentService for GCM token refresh;

https://reviewboard.mozilla.org/r/253138/#review260034
Attachment #8987863 - Flags: review?(snorp) → review+

Updated

11 months ago
Keywords: checkin-needed
Comment hidden (mozreview-request)
Assignee

Updated

11 months ago
Attachment #8987863 - Attachment is obsolete: true
Comment hidden (mozreview-request)
Assignee

Updated

11 months ago
Attachment #8984521 - Attachment is obsolete: true
Assignee

Updated

11 months ago
Attachment #8992028 - Attachment is obsolete: true
Attachment #8992028 - Flags: review?(sdaswani)
Assignee

Updated

11 months ago
Attachment #8987863 - Attachment is obsolete: false
Assignee

Updated

11 months ago
Attachment #8984521 - Attachment is obsolete: false
Comment hidden (mozreview-request)
Comment hidden (mozreview-request)
Assignee

Updated

11 months ago
Attachment #8987863 - Attachment is obsolete: true
Assignee

Updated

11 months ago
Attachment #8984521 - Attachment is obsolete: true

Comment 11

11 months ago
Pushed by archaeopteryx@coole-files.de:
https://hg.mozilla.org/integration/mozilla-inbound/rev/90f3740655ea
Migrate GeckoService to JobIntentService; r=snorp
https://hg.mozilla.org/integration/mozilla-inbound/rev/e16e23725134
Use a JobIntentService for GCM token refresh; r=JanH

Comment 12

11 months ago
bugherder
https://hg.mozilla.org/mozilla-central/rev/90f3740655ea
https://hg.mozilla.org/mozilla-central/rev/e16e23725134
Status: NEW → RESOLVED
Last Resolved: 11 months ago
Resolution: --- → FIXED
Target Milestone: --- → Firefox 63

Updated

10 months ago
Attachment #8992028 - Flags: review?(sdaswani) → review?(nchen)
You need to log in before you can comment on or make changes to this bug.