Component Updater Should use GcmNetworkManager on Android |
|||||||||
Issue descriptionComponent Updater currently uses in-app timers to schedule update checks. This is not ideal on Android because it would be better to do such checks during OS maintenance windows. References: CrxUpdateService::Start() https://cs.chromium.org/chromium/src/components/component_updater/component_updater_service.cc https://developers.google.com/android/reference/com/google/android/gms/gcm/GcmNetworkManager
,
Jan 13 2017
If GcmNetworkManager does not fit, see if we want to use JobScheduler instead, which is available on Android L+.
,
Jan 13 2017
,
Jan 13 2017
See issue 680757 for some extra information.
,
Jan 13 2017
I only glanced at this request but it seems to me that Chrome needs to be redesigned to allow for these background services and have the component updater somehow subscribe to some kind of notification that it is appropriate to initiate an update check. I think that having the component updater invoke or depend on Android features directly would be a non-starter.
,
Jan 17 2017
"I think that having the component updater invoke or depend on Android features directly would be a non-starter." I disagree. Tons of chrome on android functionality depends directly on Android features (e.g. sync, invalidations, push message just to name a few that involve background data/triggering). In this case it's about reasonable battery, network and resource utilization on a constrained device and that's something we should prioritize.
,
Jan 17 2017
In reply to #6, the component updater code lives inside the Chrome browser process. Could you please suggest a concrete way of triggering an update check or an example we could follow? Thank you!
,
Jan 17 2017
Best article I could find: https://www.bignerdranch.com/blog/optimize-battery-life-with-androids-gcm-network-manager/ There's a few usages of it already: https://cs.chromium.org/search/?q=gcmnetworkmanager&sq=package:chromium&type=cs The best example I could find was from downloads: https://cs.chromium.org/chromium/src/chrome/android/java/src/org/chromium/chrome/browser/download/DownloadResumptionScheduler.java?q=gcmnetworkmanager&sq=package:chromium&l=57&dr=C Although only service workers background api implements onInitializeTasks(): https://cs.chromium.org/chromium/src/chrome/android/java/src/org/chromium/chrome/browser/ChromeBackgroundService.java?q=onInitializeTasks&sq=package:chromium&l=229&dr=CSs Also note that the calls will fail if play services is missing or too old. No other usages I could find implement a fallback though :/.
,
Jan 17 2017
If you want to target Android L+ as a special case, you could also depend directly on JobScheduler. See https://codereview.chromium.org/2611333002/ for an example for such a conversion from startService() to JobScheduler.
,
Jan 23 2017
+gab We agree that this feature is desirable and we would look for a way to make it happen. Gab, would it be possible to extend the new Lucky Luke task scheduler to support triggering execution on JobScheduler or equivalent? As I said above, in the component updater we prefer to depend on abstractions instead of specific platform APIs. The Chrome component updater is mostly a platform neutral component, and we like it this way.
,
Jan 23 2017
It should be possible to abstract something relatively generic, like "call me back in X seconds" and have that be implemented with a base::Timer on desktop and GcmNetworkManager / JobScheduler on Android. Zine (Content Suggestions) lives in a platform-independent component but calls out to Android for scheduling its updates in the background. Also, +jkrcal, as this seems relevant to his interests :)
,
Jan 23 2017
Note that for JobScheduler, it would be more appropriate to have Component Update request: "call me after a minimum of 10 minutes, and only when there is network connectivity and device is charging. If the device does not get plugged in within 5 hours, call me back regardless (but still only while there's a network connection." It's also the case that to use JobScheduler, you have to be able to survive a process restart, so you can't just use a regular callback as the interface.
,
Jan 23 2017
Having TaskTraits that allows posting delayed tasks with such level of detail would be a great fit for base/task_scheduler/post_task.h. Any idea how prominent such tasks are and how having a generic base API for this could help improve power and data usage across platforms?
,
Jan 23 2017
I don't know how common such tasks are, and it's hard to estimate how much power would be saved - sorry, no guesses.
,
Dec 6 2017
,
Aug 1
|
|||||||||
►
Sign in to add a comment |
|||||||||
Comment 1 by bauerb@chromium.org
, Jan 13 2017