Index: base/system_monitor/system_monitor_android.cc |
diff --git a/base/system_monitor/system_monitor_android.cc b/base/system_monitor/system_monitor_android.cc |
index c86076d2a84baaaf1a20ec489ddbffdc46af7e7d..3ec6f24b83e2f5485275e5cd3520423812cd304e 100644 |
--- a/base/system_monitor/system_monitor_android.cc |
+++ b/base/system_monitor/system_monitor_android.cc |
@@ -3,12 +3,27 @@ |
// found in the LICENSE file. |
#include "base/system_monitor/system_monitor.h" |
+#include "jni/SystemMonitor_jni.h" |
namespace base { |
+namespace android { |
+ |
+static bool g_is_battery_charging = false; |
+void OnBatteryChargingChanged(JNIEnv* env, |
+ jclass clazz, |
+ jboolean is_charging) { |
+ g_is_battery_charging = is_charging; |
+ SystemMonitor::Get()->ProcessPowerMessage(SystemMonitor::POWER_STATE_EVENT); |
+} |
+ |
+} // namespace android |
bool SystemMonitor::IsBatteryPower() { |
- NOTIMPLEMENTED(); |
- return true; |
+ return base::android::g_is_battery_charging; |
Satish
2012/10/04 11:09:51
Since IsBatteryPower() is a querying API, I think
bulach
2012/10/04 11:16:32
hmm, I'm not sure if that would save us anything..
Satish
2012/10/04 11:31:07
Ah yes I missed the part about informing power sta
bulach
2012/10/04 13:58:50
Yes, good point about the global variable.
rather
|
+} |
+ |
+bool SystemMonitor::RegisterSystemMonitor(JNIEnv* env) { |
+ return base::android::RegisterNativesImpl(env); |
} |
} // namespace base |