Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(559)

Side by Side Diff: chrome/android/java/src/org/chromium/chrome/browser/upgrade/BootCompletedBroadcastReceiver.java

Issue 2840843003: [Android O] Initialize notification channels on OS upgrade (Closed)
Patch Set: Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 package org.chromium.chrome.browser.upgrade;
6
7 import android.content.BroadcastReceiver;
8 import android.content.Context;
9 import android.content.Intent;
10
11 import org.chromium.chrome.browser.notifications.ChannelsUpdater;
12
13 /**
14 * A broadcast receiver for scheduling tasks that should run on device startup.
15 * See {@link Intent#ACTION_BOOT_COMPLETED}.
16 *
17 * This can also be used for tasks that should happen on OS upgrade (since there is no "OS_UPGRADED"
18 * broadcast, the recommendation is to listen for this one and check whether the OS upgraded).
19 *
20 * Currently it is just used to initialize notification channels on upgrade to O .
21 */
22 public final class BootCompletedBroadcastReceiver extends BroadcastReceiver {
23 @Override
24 public void onReceive(final Context context, Intent intent) {
25 if (!Intent.ACTION_BOOT_COMPLETED.equals(intent.getAction())) return;
26 updateChannelsIfNecessary();
27 }
28
29 private void updateChannelsIfNecessary() {
30 if (!ChannelsUpdater.getInstance().shouldUpdateChannels()) return;
31 ChannelsUpdater.getInstance().updateChannelsInBackground(goAsync());
32 }
33 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698