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

Unified Diff: base/android/java/src/org/chromium/base/PowerMonitor.java

Issue 159173002: Refactor ActivityStatus to not store current activity (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase Created 6 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 side-by-side diff with in-line comments
Download patch
Index: base/android/java/src/org/chromium/base/PowerMonitor.java
diff --git a/base/android/java/src/org/chromium/base/PowerMonitor.java b/base/android/java/src/org/chromium/base/PowerMonitor.java
index 39293981bb1325d905a97e4d286bbe8d9e422f38..b6d8cda53ef4a20190d93302488b6cc37322d02f 100644
--- a/base/android/java/src/org/chromium/base/PowerMonitor.java
+++ b/base/android/java/src/org/chromium/base/PowerMonitor.java
@@ -16,7 +16,7 @@ import android.os.Looper;
* Integrates native PowerMonitor with the java side.
*/
@JNINamespace("base::android")
-public class PowerMonitor implements ActivityStatus.StateListener {
+public class PowerMonitor implements ApplicationStatus.ApplicationStateListener {
private static final long SUSPEND_DELAY_MS = 1 * 60 * 1000; // 1 minute.
private static class LazyHolder {
private static final PowerMonitor INSTANCE = new PowerMonitor();
@@ -47,7 +47,7 @@ public class PowerMonitor implements ActivityStatus.StateListener {
public static void create(Context context) {
if (sInstance == null) {
sInstance = LazyHolder.INSTANCE;
- ActivityStatus.registerStateListener(sInstance);
+ ApplicationStatus.registerApplicationStateListener(sInstance);
IntentFilter ifilter = new IntentFilter(Intent.ACTION_BATTERY_CHANGED);
Intent batteryStatusIntent = context.registerReceiver(null, ifilter);
onBatteryChargingChanged(batteryStatusIntent);
@@ -71,12 +71,12 @@ public class PowerMonitor implements ActivityStatus.StateListener {
}
@Override
- public void onActivityStateChange(int newState) {
- if (newState == ActivityStatus.RESUMED) {
+ public void onApplicationStateChange(int newState) {
+ if (newState == ApplicationState.HAS_RUNNING_ACTIVITIES) {
// Remove the callback from the message loop in case it hasn't been executed yet.
mHandler.removeCallbacks(sSuspendTask);
nativeOnMainActivityResumed();
- } else if (newState == ActivityStatus.PAUSED) {
+ } else if (newState == ApplicationState.HAS_PAUSED_ACTIVITIES) {
mHandler.postDelayed(sSuspendTask, SUSPEND_DELAY_MS);
}
}

Powered by Google App Engine
This is Rietveld 408576698