OLD | NEW |
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 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.base; | 5 package org.chromium.base; |
6 | 6 |
7 import android.content.Context; | 7 import android.content.Context; |
8 import android.content.Intent; | 8 import android.content.Intent; |
9 import android.content.IntentFilter; | 9 import android.content.IntentFilter; |
10 import android.os.BatteryManager; | 10 import android.os.BatteryManager; |
11 import android.os.Handler; | 11 import android.os.Handler; |
12 import android.os.Looper; | 12 import android.os.Looper; |
13 | 13 |
| 14 import org.chromium.base.annotations.CalledByNative; |
| 15 import org.chromium.base.annotations.JNINamespace; |
| 16 |
14 | 17 |
15 /** | 18 /** |
16 * Integrates native PowerMonitor with the java side. | 19 * Integrates native PowerMonitor with the java side. |
17 */ | 20 */ |
18 @JNINamespace("base::android") | 21 @JNINamespace("base::android") |
19 public class PowerMonitor implements ApplicationStatus.ApplicationStateListener
{ | 22 public class PowerMonitor implements ApplicationStatus.ApplicationStateListener
{ |
20 private static final long SUSPEND_DELAY_MS = 1 * 60 * 1000; // 1 minute. | 23 private static final long SUSPEND_DELAY_MS = 1 * 60 * 1000; // 1 minute. |
21 private static class LazyHolder { | 24 private static class LazyHolder { |
22 private static final PowerMonitor INSTANCE = new PowerMonitor(); | 25 private static final PowerMonitor INSTANCE = new PowerMonitor(); |
23 } | 26 } |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
89 | 92 |
90 @CalledByNative | 93 @CalledByNative |
91 private static boolean isBatteryPower() { | 94 private static boolean isBatteryPower() { |
92 return sInstance.mIsBatteryPower; | 95 return sInstance.mIsBatteryPower; |
93 } | 96 } |
94 | 97 |
95 private static native void nativeOnBatteryChargingChanged(); | 98 private static native void nativeOnBatteryChargingChanged(); |
96 private static native void nativeOnMainActivitySuspended(); | 99 private static native void nativeOnMainActivitySuspended(); |
97 private static native void nativeOnMainActivityResumed(); | 100 private static native void nativeOnMainActivityResumed(); |
98 } | 101 } |
OLD | NEW |