diff options
author | bulach@chromium.org <bulach@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-10-16 11:58:08 +0000 |
---|---|---|
committer | bulach@chromium.org <bulach@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-10-16 11:58:08 +0000 |
commit | a614f15662de81caafbf02c7afc6beb0026fb827 (patch) | |
tree | 3ab396cb558b73c1719c08a7946414a8972056dc /base/system_monitor | |
parent | 8a429d0f0a8300776fc65eeec0831c3b3840a5a3 (diff) | |
download | chromium_src-a614f15662de81caafbf02c7afc6beb0026fb827.zip chromium_src-a614f15662de81caafbf02c7afc6beb0026fb827.tar.gz chromium_src-a614f15662de81caafbf02c7afc6beb0026fb827.tar.bz2 |
Android: Integrates native and java SystemMonitor.
BUG=154293
Review URL: https://chromiumcodereview.appspot.com/11027024
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@162124 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base/system_monitor')
-rw-r--r-- | base/system_monitor/system_monitor_android.cc | 19 | ||||
-rw-r--r-- | base/system_monitor/system_monitor_android.h | 17 |
2 files changed, 34 insertions, 2 deletions
diff --git a/base/system_monitor/system_monitor_android.cc b/base/system_monitor/system_monitor_android.cc index c86076d..4e1a16b 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 { + +// Native implementation of SystemMonitor.java. +void OnBatteryChargingChanged(JNIEnv* env, + jclass clazz) { + SystemMonitor::Get()->ProcessPowerMessage(SystemMonitor::POWER_STATE_EVENT); +} + +} // namespace android + bool SystemMonitor::IsBatteryPower() { - NOTIMPLEMENTED(); - return true; + JNIEnv* env = base::android::AttachCurrentThread(); + return base::android::Java_SystemMonitor_isBatteryPower(env); +} + +bool RegisterSystemMonitor(JNIEnv* env) { + return base::android::RegisterNativesImpl(env); } } // namespace base diff --git a/base/system_monitor/system_monitor_android.h b/base/system_monitor/system_monitor_android.h new file mode 100644 index 0000000..9f60560 --- /dev/null +++ b/base/system_monitor/system_monitor_android.h @@ -0,0 +1,17 @@ +// Copyright (c) 2012 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef BASE_SYSTEM_MONITOR_SYSTEM_MONITOR_ANDROID_H_ +#define BASE_SYSTEM_MONITOR_SYSTEM_MONITOR_ANDROID_H_ + +#include <jni.h> + +namespace base { + +// Registers the JNI bindings for SystemMonitor. +bool RegisterSystemMonitor(JNIEnv* env); + +} // namespace base + +#endif // BASE_SYSTEM_MONITOR_SYSTEM_MONITOR_ANDROID_H_ |