New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 771802 link

Starred by 1 user

Issue metadata

Status: Fixed
Owner:
Last visit > 30 days ago
Closed: Oct 2017
Cc:
EstimatedDays: ----
NextAction: ----
OS: ----
Pri: 3
Type: Bug


Participants' hotlists:
Downloads-Foreground-Service


Sign in to add a comment

[Downloads Foreground Service] Figure out flicker

Project Member Reported by jming@chromium.org, Oct 4 2017

Issue description

Currently the notifications are flickering every time:
- The notification is paused.
- The notification is completed.

This is a hack to get around the fact that we can't detach notifications from the foreground gracefully pre-N. Is there a configuration that has less switching?
 

Comment 1 by jming@chromium.org, Oct 5 2017

Cc: dah...@chromium.org dtrainor@chromium.org
Video for context: https://drive.google.com/a/google.com/file/d/0BwltPzKKkOFqQVBYN0xIc3U3MWM/view?usp=sharing

This video shows what is currently happening: The notification will flicker in most cases when it's paused and successful (specifically if there's no other downloads). The annoying part is wrt pausing downloads, because that should happen fairly frequently.

The tricky part is that we can either:
- keep the download in the foreground at all times if it's in progress, including paused (but this seems like a strange use of resources)
- fix it so that it flickers only when there are other downloads, but the paused notification disappears when Chrome Activity is swiped away/dies (what Play Music does right now)
- fix it so that it flickers only when there are other downloads and have a tracking system for displayed notifications (could run into other corner cases?)
- ??? figure something else out???

Corner cases to check for any solution:
- pause -> swipe away notification
- pause -> swipe away Chrome
- pause -> chrome://inducebrowsercrashforrealz
- alternating pause with multiple downloads
Thanks for the video. That is pretty bad. Why does this happen for downloads, but not for media play/pause interactions, which also uses a foreground notification?

Comment 3 by jming@chromium.org, Oct 5 2017

My guesses:
- There aren't multiple notifications
- If you pause and then kill music, it kills the notification with it (whereas we have been keeping the notification around)
The first could be true, but with the second, you are playing an pausing the media file just like a download (e.g., you need to change the state of the button, but the notification still sticks around). It might be worth checking with mlamouri@ when he gets back from vacation next week.

Comment 5 by jming@chromium.org, Oct 5 2017

This is what I mean by when you pause and kill music the notification disappears:
https://drive.google.com/a/google.com/file/d/0BwltPzKKkOFqMnM4cDVIZ0g3Sk0/view?usp=sharing

Though even if we decide on this behavior, this will be hard to do for multiple notification.
so does this flicker behavior only happens when Chrome gets killed or it happens as a result of the fact that we want the notification to stick around even if Chrome gets killed?

Comment 7 by jming@chromium.org, Oct 5 2017

Currently, The notification will flicker in most cases when it's paused and successful (specifically if there's no other downloads).

One solution might have the tradeoff of having the notification die with Chrome, like it does with Play Music :(

Comment 8 by jming@chromium.org, Oct 13 2017

Adding a doc of the different things I've tried so far/logic, still thinking through this: https://docs.google.com/document/d/1pQed3gm-Q_lAzGL9lWV1Arsni2vN7J1kXd-nLuIOaBw/edit#
Project Member

Comment 9 by bugdroid1@chromium.org, Oct 26 2017

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/431b1802ce6bbce1994a8b67f173530cba914b9b

commit 431b1802ce6bbce1994a8b67f173530cba914b9b
Author: Joy Ming <jming@chromium.org>
Date: Thu Oct 26 00:22:58 2017

Make flicker less frequent.

This is part of a larger refactor to make downloads a foreground
service on all versions of Android. Before this CL, on Android API <= 24
the downloads notification would flicker on pause and on completion as a
hack to disassociate the notification from the foreground service.
However, this leads to a lot of flickering. This CL reduces the amount
of flickering to be only in the cases of completion and when the
notification that is pinned to the foreground is switched. Basically,
this means that the notification will flicker in all cases of completion
(which is the same as before) and fewer cases of pause, only when the
user has another download running, which is less likely anyways.

Bug:  771802 , 747563 
Change-Id: Ic0d30cb7d91726a7015a6db9b0dc6e113140fd54
Reviewed-on: https://chromium-review.googlesource.com/703486
Commit-Queue: Joy Ming <jming@chromium.org>
Reviewed-by: David Trainor <dtrainor@chromium.org>
Cr-Commit-Position: refs/heads/master@{#511660}
[modify] https://crrev.com/431b1802ce6bbce1994a8b67f173530cba914b9b/chrome/android/java/src/org/chromium/chrome/browser/download/DownloadBroadcastManager.java
[modify] https://crrev.com/431b1802ce6bbce1994a8b67f173530cba914b9b/chrome/android/java/src/org/chromium/chrome/browser/download/DownloadForegroundService.java
[modify] https://crrev.com/431b1802ce6bbce1994a8b67f173530cba914b9b/chrome/android/java/src/org/chromium/chrome/browser/download/DownloadForegroundServiceManager.java
[modify] https://crrev.com/431b1802ce6bbce1994a8b67f173530cba914b9b/chrome/android/java/src/org/chromium/chrome/browser/download/DownloadForegroundServiceObservers.java
[modify] https://crrev.com/431b1802ce6bbce1994a8b67f173530cba914b9b/chrome/android/java/src/org/chromium/chrome/browser/download/DownloadNotificationService2.java
[modify] https://crrev.com/431b1802ce6bbce1994a8b67f173530cba914b9b/chrome/android/java/src/org/chromium/chrome/browser/download/DownloadNotificationServiceObserver.java
[modify] https://crrev.com/431b1802ce6bbce1994a8b67f173530cba914b9b/chrome/android/java/src/org/chromium/chrome/browser/download/SystemDownloadNotifier2.java
[modify] https://crrev.com/431b1802ce6bbce1994a8b67f173530cba914b9b/chrome/android/java_sources.gni
[modify] https://crrev.com/431b1802ce6bbce1994a8b67f173530cba914b9b/chrome/android/javatests/src/org/chromium/chrome/browser/download/DownloadForegroundServiceManagerTest.java
[add] https://crrev.com/431b1802ce6bbce1994a8b67f173530cba914b9b/chrome/android/javatests/src/org/chromium/chrome/browser/download/DownloadForegroundServiceTest.java
[modify] https://crrev.com/431b1802ce6bbce1994a8b67f173530cba914b9b/chrome/android/javatests/src/org/chromium/chrome/browser/download/DownloadNotificationServiceTest2.java
[modify] https://crrev.com/431b1802ce6bbce1994a8b67f173530cba914b9b/chrome/android/javatests/src/org/chromium/chrome/browser/download/MockDownloadNotificationService2.java

Comment 10 by jming@chromium.org, Oct 26 2017

Status: Fixed (was: Assigned)

Sign in to add a comment