From 88daa01da6f3ce246b25876d03927e1b5c38c2db Mon Sep 17 00:00:00 2001 From: Narayan Kamath Date: Wed, 29 Jul 2015 09:36:05 +0000 Subject: [PATCH] Revert "Bug fix in SensorManager." This reverts commit 869eb2089ec8a6286b944bfcff57e4cbe0c7e207. Change-Id: I4fb865e3b18bbb011fa4e4b4732336930c3a45ae --- include/gui/SensorManager.h | 4 +--- libs/gui/SensorManager.cpp | 11 +++-------- 2 files changed, 4 insertions(+), 11 deletions(-) diff --git a/include/gui/SensorManager.h b/include/gui/SensorManager.h index 9794d4e08..37960673c 100644 --- a/include/gui/SensorManager.h +++ b/include/gui/SensorManager.h @@ -101,6 +101,7 @@ public: return *sensorManager; } + SensorManager(const String16& opPackageName); ~SensorManager(); ssize_t getSensorList(Sensor const* const** list) const; @@ -112,7 +113,6 @@ private: // DeathRecipient interface void sensorManagerDied(); - SensorManager(const String16& opPackageName); status_t assertStateLocked() const; private: @@ -127,8 +127,6 @@ private: const String16 mOpPackageName; }; -android::Mutex android::SensorManager::sLock; -std::map android::SensorManager::sPackageInstances; // ---------------------------------------------------------------------------- }; // namespace android diff --git a/libs/gui/SensorManager.cpp b/libs/gui/SensorManager.cpp index ead535e63..dd3778137 100644 --- a/libs/gui/SensorManager.cpp +++ b/libs/gui/SensorManager.cpp @@ -59,13 +59,12 @@ void SensorManager::sensorManagerDied() status_t SensorManager::assertStateLocked() const { if (mSensorServer == NULL) { + // try for one second const String16 name("sensorservice"); - // try 10 times before giving up ... - for (int i = 0; i < 10; ++i) { + for (int i=0 ; i<4 ; i++) { status_t err = getService(name, &mSensorServer); if (err == NAME_NOT_FOUND) { - // Sleep for 1 second before retrying. - sleep(1); + usleep(250000); continue; } if (err != NO_ERROR) { @@ -74,10 +73,6 @@ status_t SensorManager::assertStateLocked() const { break; } - if (mSensorServer == NULL) { - ALOGE("FATAL getsensorservice returned` NULL"); - } - class DeathObserver : public IBinder::DeathRecipient { SensorManager& mSensorManger; virtual void binderDied(const wp& who) {