Closed Bug 1467840 Opened 6 years ago Closed 6 years ago

Use JobIntentService for other background work

Categories

(Firefox for Android Graveyard :: General, enhancement)

All
Android
enhancement
Not set
normal

Tracking

(firefox63 fixed)

RESOLVED FIXED
Firefox 63
Tracking Status
firefox63 --- fixed

People

(Reporter: petru, Assigned: petru)

References

Details

Attachments

(2 files, 2 obsolete files)

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: nobody → petru.lingurar
Blocks: 1465323
Attachment #8984521 - Flags: review?(sdaswani) → review?(jh+bugzilla)
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+
Summary: Migrate GeckoService to JobIntentService → Use JobIntentService for other background work
- 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.
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+
Keywords: checkin-needed
Attachment #8987863 - Attachment is obsolete: true
Attachment #8984521 - Attachment is obsolete: true
Attachment #8992028 - Attachment is obsolete: true
Attachment #8992028 - Flags: review?(sdaswani)
Attachment #8987863 - Attachment is obsolete: false
Attachment #8984521 - Attachment is obsolete: false
Attachment #8987863 - Attachment is obsolete: true
Attachment #8984521 - Attachment is obsolete: true
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
https://hg.mozilla.org/mozilla-central/rev/90f3740655ea
https://hg.mozilla.org/mozilla-central/rev/e16e23725134
Status: NEW → RESOLVED
Closed: 6 years ago
Resolution: --- → FIXED
Target Milestone: --- → Firefox 63
Attachment #8992028 - Flags: review?(sdaswani) → review?(nchen)
Regressions: 1583357
Product: Firefox for Android → Firefox for Android Graveyard
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: