Skip to content
This repository has been archived by the owner on Nov 1, 2022. It is now read-only.

Fulfill the foreground service contract on AbstractFetchDownloadService #6893

Closed
Amejia481 opened this issue May 7, 2020 · 0 comments
Closed
Assignees
Labels
🐞 bug Something isn't working <download> Component: feature-download E13 Estimation points: 13
Milestone

Comments

@Amejia481
Copy link
Contributor

Amejia481 commented May 7, 2020

For AbstractFetchDownloadService to be considered as a foreground service it needs to call startForeground() and provides an ongoing notification this signal Android that this task isn't a candidate for the system to kill when low on memory, avoiding issues like mozilla-mobile/fenix#9884

┆Issue is synchronized with this Jira Task

@Amejia481 Amejia481 added 🐞 bug Something isn't working <download> Component: feature-download labels May 7, 2020
@Amejia481 Amejia481 self-assigned this May 7, 2020
@Amejia481 Amejia481 added the E8 Estimation points: 8 label May 11, 2020
Amejia481 added a commit to Amejia481/android-components that referenced this issue May 12, 2020
Amejia481 added a commit to Amejia481/android-components that referenced this issue May 18, 2020
Amejia481 added a commit to Amejia481/android-components that referenced this issue May 18, 2020
Amejia481 added a commit to Amejia481/android-components that referenced this issue May 18, 2020
Amejia481 added a commit to Amejia481/android-components that referenced this issue May 18, 2020
@Amejia481 Amejia481 added E13 Estimation points: 13 and removed E8 Estimation points: 8 labels May 19, 2020
bors bot pushed a commit that referenced this issue May 26, 2020
6954: Closes #6893 Fulfill the foreground service contract on AbstractFetchDownloadService r=notWoods,pocmo a=Amejia481

For fulfilling the Android foreground service api, we need to provide a notification, this notification will be marked as ongoing by the OS, and we won't be able to remove it until we are not longer a foreground a service by calling `stopForeground`. For this reason, I used two approaches:

**Devices that support notification group:**  [Demo 🎮 ](https://drive.google.com/file/d/1xaGh4qx_3913t4s1GenvIJphRFWNQvWP/view?usp=sharing)

A separate notification (a summary of all notification) which will be the foreground notification, it will be always present until we don't have more active downloads.

**Devices that DO NOT support notification group:**  [Demo 🎮  (Tested on Android 5.1.1) ](https://drive.google.com/file/d/10f26Ggh5uXVn5gCbrCBp3o5s2eNoAbzU/view?usp=sharing)

Set the latest active notification as the foreground notification and  keep changing it to the latest active download.

**Note:**
To reduce battery consumption when all the downloads notifications have been dismissed we stop the service.

Related issues #4910



Co-authored-by: Arturo Mejia <arturomejiamarmol@gmail.com>
bors bot pushed a commit that referenced this issue May 26, 2020
6954: Closes #6893 Fulfill the foreground service contract on AbstractFetchDownloadService r=notWoods,pocmo a=Amejia481

For fulfilling the Android foreground service api, we need to provide a notification, this notification will be marked as ongoing by the OS, and we won't be able to remove it until we are not longer a foreground a service by calling `stopForeground`. For this reason, I used two approaches:

**Devices that support notification group:**  [Demo 🎮 ](https://drive.google.com/file/d/1xaGh4qx_3913t4s1GenvIJphRFWNQvWP/view?usp=sharing)

A separate notification (a summary of all notification) which will be the foreground notification, it will be always present until we don't have more active downloads.

**Devices that DO NOT support notification group:**  [Demo 🎮  (Tested on Android 5.1.1) ](https://drive.google.com/file/d/10f26Ggh5uXVn5gCbrCBp3o5s2eNoAbzU/view?usp=sharing)

Set the latest active notification as the foreground notification and  keep changing it to the latest active download.

**Note:**
To reduce battery consumption when all the downloads notifications have been dismissed we stop the service.

Related issues #4910



Co-authored-by: Arturo Mejia <arturomejiamarmol@gmail.com>
@bors bors bot closed this as completed in fd18d39 May 26, 2020
@pocmo pocmo added this to the 43.0.0 milestone May 27, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
🐞 bug Something isn't working <download> Component: feature-download E13 Estimation points: 13
Projects
None yet
Development

No branches or pull requests

2 participants