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

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

Issue 2807213002: [Android O] Initialize channels on first launch/upgrade (Closed)
Patch Set: Some more minor things Created 3 years, 8 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
« no previous file with comments | « no previous file | chrome/android/java/src/org/chromium/chrome/browser/notifications/ChannelsInitializer.java » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 package org.chromium.chrome.browser; 5 package org.chromium.chrome.browser;
6 6
7 import android.content.Context; 7 import android.content.Context;
8 import android.content.SharedPreferences; 8 import android.content.SharedPreferences;
9 import android.os.AsyncTask; 9 import android.os.AsyncTask;
10 import android.os.Looper; 10 import android.os.Looper;
(...skipping 14 matching lines...) Expand all
25 import org.chromium.base.VisibleForTesting; 25 import org.chromium.base.VisibleForTesting;
26 import org.chromium.base.metrics.RecordHistogram; 26 import org.chromium.base.metrics.RecordHistogram;
27 import org.chromium.chrome.browser.bookmarkswidget.BookmarkWidgetProvider; 27 import org.chromium.chrome.browser.bookmarkswidget.BookmarkWidgetProvider;
28 import org.chromium.chrome.browser.crash.LogcatExtractionRunnable; 28 import org.chromium.chrome.browser.crash.LogcatExtractionRunnable;
29 import org.chromium.chrome.browser.crash.MinidumpUploadService; 29 import org.chromium.chrome.browser.crash.MinidumpUploadService;
30 import org.chromium.chrome.browser.init.ProcessInitializationHandler; 30 import org.chromium.chrome.browser.init.ProcessInitializationHandler;
31 import org.chromium.chrome.browser.locale.LocaleManager; 31 import org.chromium.chrome.browser.locale.LocaleManager;
32 import org.chromium.chrome.browser.media.MediaCaptureNotificationService; 32 import org.chromium.chrome.browser.media.MediaCaptureNotificationService;
33 import org.chromium.chrome.browser.metrics.LaunchMetrics; 33 import org.chromium.chrome.browser.metrics.LaunchMetrics;
34 import org.chromium.chrome.browser.metrics.UmaUtils; 34 import org.chromium.chrome.browser.metrics.UmaUtils;
35 import org.chromium.chrome.browser.notifications.ChannelsUpdater;
35 import org.chromium.chrome.browser.ntp.NewTabPage; 36 import org.chromium.chrome.browser.ntp.NewTabPage;
36 import org.chromium.chrome.browser.offlinepages.OfflinePageUtils; 37 import org.chromium.chrome.browser.offlinepages.OfflinePageUtils;
37 import org.chromium.chrome.browser.partnerbookmarks.PartnerBookmarksShim; 38 import org.chromium.chrome.browser.partnerbookmarks.PartnerBookmarksShim;
38 import org.chromium.chrome.browser.partnercustomizations.HomepageManager; 39 import org.chromium.chrome.browser.partnercustomizations.HomepageManager;
39 import org.chromium.chrome.browser.partnercustomizations.PartnerBrowserCustomiza tions; 40 import org.chromium.chrome.browser.partnercustomizations.PartnerBrowserCustomiza tions;
40 import org.chromium.chrome.browser.physicalweb.PhysicalWeb; 41 import org.chromium.chrome.browser.physicalweb.PhysicalWeb;
41 import org.chromium.chrome.browser.precache.PrecacheLauncher; 42 import org.chromium.chrome.browser.precache.PrecacheLauncher;
42 import org.chromium.chrome.browser.preferences.ChromePreferenceManager; 43 import org.chromium.chrome.browser.preferences.ChromePreferenceManager;
43 import org.chromium.chrome.browser.share.ShareHelper; 44 import org.chromium.chrome.browser.share.ShareHelper;
44 import org.chromium.chrome.browser.webapps.ChromeWebApkHost; 45 import org.chromium.chrome.browser.webapps.ChromeWebApkHost;
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after
193 } 194 }
194 }); 195 });
195 196
196 PartnerBookmarksShim.kickOffReading(mAppContext); 197 PartnerBookmarksShim.kickOffReading(mAppContext);
197 198
198 PowerMonitor.create(); 199 PowerMonitor.create();
199 200
200 ShareHelper.clearSharedImages(); 201 ShareHelper.clearSharedImages();
201 202
202 OfflinePageUtils.clearSharedOfflineFiles(mAppContext); 203 OfflinePageUtils.clearSharedOfflineFiles(mAppContext);
204
205 if (ChannelsUpdater.getInstance().shouldUpdateChannels()) {
206 initChannelsAsync();
207 }
203 } 208 }
204 }); 209 });
205 210
206 mDeferredTasks.add(new Runnable() { 211 mDeferredTasks.add(new Runnable() {
207 @Override 212 @Override
208 public void run() { 213 public void run() {
209 // Clear any media notifications that existed when Chrome was la st killed. 214 // Clear any media notifications that existed when Chrome was la st killed.
210 MediaCaptureNotificationService.clearMediaNotifications(mAppCont ext); 215 MediaCaptureNotificationService.clearMediaNotifications(mAppCont ext);
211 216
212 startModerateBindingManagementIfNeeded(); 217 startModerateBindingManagementIfNeeded();
(...skipping 29 matching lines...) Expand all
242 @Override 247 @Override
243 public void run() { 248 public void run() {
244 // Record the saved restore state in a histogram 249 // Record the saved restore state in a histogram
245 ChromeBackupAgent.recordRestoreHistogram(); 250 ChromeBackupAgent.recordRestoreHistogram();
246 } 251 }
247 }); 252 });
248 253
249 ProcessInitializationHandler.getInstance().initializeDeferredStartupTask s(); 254 ProcessInitializationHandler.getInstance().initializeDeferredStartupTask s();
250 } 255 }
251 256
257 private void initChannelsAsync() {
258 new AsyncTask<Void, Void, Void>() {
259 @Override
260 protected Void doInBackground(Void... params) {
261 ChannelsUpdater.getInstance().updateChannels();
262 return null;
263 }
264
265 }
266 .executeOnExecutor(AsyncTask.SERIAL_EXECUTOR);
267 }
268
252 private void initAsyncDiskTask() { 269 private void initAsyncDiskTask() {
253 new AsyncTask<Void, Void, Void>() { 270 new AsyncTask<Void, Void, Void>() {
254 /** 271 /**
255 * The threshold after which it's no longer appropriate to try to at tach logcat output 272 * The threshold after which it's no longer appropriate to try to at tach logcat output
256 * to a minidump file. 273 * to a minidump file.
257 * Note: This threshold of 12 hours was chosen fairly imprecisely, b ased on the 274 * Note: This threshold of 12 hours was chosen fairly imprecisely, b ased on the
258 * following intuition: On the one hand, Chrome can only access its own logcat output, 275 * following intuition: On the one hand, Chrome can only access its own logcat output,
259 * so the most recent lines should be relevant when available. On a typical device, 276 * so the most recent lines should be relevant when available. On a typical device,
260 * multiple hours of logcat output are available. On the other hand, it's important to 277 * multiple hours of logcat output are available. On the other hand, it's important to
261 * provide an escape hatch in case the logcat extraction code itself crashes, as 278 * provide an escape hatch in case the logcat extraction code itself crashes, as
(...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after
457 } 474 }
458 475
459 /** 476 /**
460 * @return Whether deferred startup has been completed. 477 * @return Whether deferred startup has been completed.
461 */ 478 */
462 @VisibleForTesting 479 @VisibleForTesting
463 public boolean isDeferredStartupCompleteForApp() { 480 public boolean isDeferredStartupCompleteForApp() {
464 return mDeferredStartupCompletedForApp; 481 return mDeferredStartupCompletedForApp;
465 } 482 }
466 } 483 }
OLDNEW
« no previous file with comments | « no previous file | chrome/android/java/src/org/chromium/chrome/browser/notifications/ChannelsInitializer.java » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698