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

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

Issue 2659813006: Always get device conditions from Java for every attempt. (Closed)
Patch Set: fixes per DewittJ Created 3 years, 10 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/offlinepages/BackgroundSchedulerBridge.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 2016 The Chromium Authors. All rights reserved. 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 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.offlinepages; 5 package org.chromium.chrome.browser.offlinepages;
6 6
7 import android.content.Context; 7 import android.content.Context;
8 import android.os.Bundle; 8 import android.os.Bundle;
9 9
10 import com.google.android.gms.gcm.GcmNetworkManager; 10 import com.google.android.gms.gcm.GcmNetworkManager;
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
69 .setUpdateCurrent(overwrite) 69 .setUpdateCurrent(overwrite)
70 .setRequiredNetwork(triggerConditions.requireUnmeter edNetwork() 70 .setRequiredNetwork(triggerConditions.requireUnmeter edNetwork()
71 ? Task.NETWORK_STATE_UNMETERED 71 ? Task.NETWORK_STATE_UNMETERED
72 : Task.NETWORK_STATE_CONNECTED) 72 : Task.NETWORK_STATE_CONNECTED)
73 .setRequiresCharging(triggerConditions.requirePowerC onnected()) 73 .setRequiresCharging(triggerConditions.requirePowerC onnected())
74 .setExtras(taskExtras) 74 .setExtras(taskExtras)
75 .build(); 75 .build();
76 76
77 gcmNetworkManager.schedule(task); 77 gcmNetworkManager.schedule(task);
78 } 78 }
79
80 /**
81 * Get the latest power conditions from the android APIs.
82 */
83 public static boolean getPowerConditions(Context context) {
84 return OfflinePageUtils.getPowerConditions(context);
85 }
86
87 /**
88 * Get the latest battery conditions from the android APIs.
89 */
90 public static int getBatteryConditions(Context context) {
91 return OfflinePageUtils.getBatteryConditions(context);
92 }
93
94 /**
95 * Get the latest network conditions from the android APIs.
96 */
97 public static int getNetworkConditions(Context context) {
98 return OfflinePageUtils.getNetworkConditions(context);
99 }
79 } 100 }
OLDNEW
« no previous file with comments | « no previous file | chrome/android/java/src/org/chromium/chrome/browser/offlinepages/BackgroundSchedulerBridge.java » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698