diff options
author | Aravind Akella <aakella@google.com> | 2015-07-24 17:35:31 -0700 |
---|---|---|
committer | Aravind Akella <aakella@google.com> | 2015-07-27 14:19:31 -0700 |
commit | 5967ddbf05f146bdb6744207e3daed1aa76fc637 (patch) | |
tree | f057920df521b0ba3a9597187c4bd48282ea67b3 | |
parent | 8924f23d3ecdcb2b1ce4dbc9bb4fbb9ddfa62710 (diff) | |
download | frameworks_base-5967ddbf05f146bdb6744207e3daed1aa76fc637.zip frameworks_base-5967ddbf05f146bdb6744207e3daed1aa76fc637.tar.gz frameworks_base-5967ddbf05f146bdb6744207e3daed1aa76fc637.tar.bz2 |
Call getInstanceForPackage instead of creating a new SensorManager instance.
Bug: 22529981
Change-Id: Id3adfbcf55d1268db1a555c72a06456a5219c086
-rw-r--r-- | core/jni/android_hardware_SensorManager.cpp | 2 | ||||
-rw-r--r-- | native/android/sensor.cpp | 5 |
2 files changed, 2 insertions, 5 deletions
diff --git a/core/jni/android_hardware_SensorManager.cpp b/core/jni/android_hardware_SensorManager.cpp index ec56507..7d0afdc 100644 --- a/core/jni/android_hardware_SensorManager.cpp +++ b/core/jni/android_hardware_SensorManager.cpp @@ -138,7 +138,7 @@ nativeCreate (JNIEnv *env, jclass clazz, jstring opPackageName) { ScopedUtfChars opPackageNameUtf(env, opPackageName); - return (jlong) new SensorManager(String16(opPackageNameUtf.c_str())); + return (jlong) &SensorManager::getInstanceForPackage(String16(opPackageNameUtf.c_str())); } static jboolean diff --git a/native/android/sensor.cpp b/native/android/sensor.cpp index 26b41e8..ca49476 100644 --- a/native/android/sensor.cpp +++ b/native/android/sensor.cpp @@ -39,9 +39,6 @@ using android::String16; /*****************************************************************************/ -android::Mutex android::SensorManager::sLock; -std::map<String16, SensorManager*> android::SensorManager::sPackageInstances; - ASensorManager* ASensorManager_getInstance() { return ASensorManager_getInstanceForPackage(NULL); @@ -206,4 +203,4 @@ int ASensor_getReportingMode(ASensor const* sensor) bool ASensor_isWakeUpSensor(ASensor const* sensor) { return static_cast<Sensor const*>(sensor)->isWakeUpSensor(); -}
\ No newline at end of file +} |