summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNarayan Kamath <narayan@google.com>2015-07-29 10:08:04 +0000
committerAndroid Git Automerger <android-git-automerger@android.com>2015-07-29 10:08:04 +0000
commitff01fcecf5843104ba5ce835d70aae2ae8483616 (patch)
treeb3a80cb93723098e56add2b8264f4413b080b8d6
parentc16fd06ae462f79d3f13eb5e29db3227c0e64985 (diff)
parent7157c2ca81cb2c942a1e94cf1a0344babf6a8bd6 (diff)
downloadframeworks_base-ff01fcecf5843104ba5ce835d70aae2ae8483616.zip
frameworks_base-ff01fcecf5843104ba5ce835d70aae2ae8483616.tar.gz
frameworks_base-ff01fcecf5843104ba5ce835d70aae2ae8483616.tar.bz2
am 7157c2ca: Merge "Revert "Call getInstanceForPackage instead of creating a new SensorManager instance."" into mnc-dev
* commit '7157c2ca81cb2c942a1e94cf1a0344babf6a8bd6': Revert "Call getInstanceForPackage instead of creating a new SensorManager instance."
-rw-r--r--core/jni/android_hardware_SensorManager.cpp2
-rw-r--r--native/android/sensor.cpp5
2 files changed, 5 insertions, 2 deletions
diff --git a/core/jni/android_hardware_SensorManager.cpp b/core/jni/android_hardware_SensorManager.cpp
index 7d0afdc..ec56507 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) &SensorManager::getInstanceForPackage(String16(opPackageNameUtf.c_str()));
+ return (jlong) new SensorManager(String16(opPackageNameUtf.c_str()));
}
static jboolean
diff --git a/native/android/sensor.cpp b/native/android/sensor.cpp
index ca49476..26b41e8 100644
--- a/native/android/sensor.cpp
+++ b/native/android/sensor.cpp
@@ -39,6 +39,9 @@ using android::String16;
/*****************************************************************************/
+android::Mutex android::SensorManager::sLock;
+std::map<String16, SensorManager*> android::SensorManager::sPackageInstances;
+
ASensorManager* ASensorManager_getInstance()
{
return ASensorManager_getInstanceForPackage(NULL);
@@ -203,4 +206,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