return *sensorManager;
}
+ SensorManager(const String16& opPackageName);
~SensorManager();
ssize_t getSensorList(Sensor const* const** list) const;
// DeathRecipient interface
void sensorManagerDied();
- SensorManager(const String16& opPackageName);
status_t assertStateLocked() const;
private:
const String16 mOpPackageName;
};
-android::Mutex android::SensorManager::sLock;
-std::map<String16, SensorManager*> android::SensorManager::sPackageInstances;
// ----------------------------------------------------------------------------
}; // namespace android
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) {
break;
}
- if (mSensorServer == NULL) {
- ALOGE("FATAL getsensorservice returned` NULL");
- }
-
class DeathObserver : public IBinder::DeathRecipient {
SensorManager& mSensorManger;
virtual void binderDied(const wp<IBinder>& who) {