am a29db50c
: Merge "Revert "Bug fix in SensorManager."" into mnc-dev
* commit 'a29db50c448f8d00a544b925544f3dee725f7750': Revert "Bug fix in SensorManager."
This commit is contained in:
commit
65f1d44cd8
@ -101,6 +101,7 @@ public:
|
|||||||
return *sensorManager;
|
return *sensorManager;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
SensorManager(const String16& opPackageName);
|
||||||
~SensorManager();
|
~SensorManager();
|
||||||
|
|
||||||
ssize_t getSensorList(Sensor const* const** list) const;
|
ssize_t getSensorList(Sensor const* const** list) const;
|
||||||
@ -112,7 +113,6 @@ private:
|
|||||||
// DeathRecipient interface
|
// DeathRecipient interface
|
||||||
void sensorManagerDied();
|
void sensorManagerDied();
|
||||||
|
|
||||||
SensorManager(const String16& opPackageName);
|
|
||||||
status_t assertStateLocked() const;
|
status_t assertStateLocked() const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
@ -127,8 +127,6 @@ private:
|
|||||||
const String16 mOpPackageName;
|
const String16 mOpPackageName;
|
||||||
};
|
};
|
||||||
|
|
||||||
android::Mutex android::SensorManager::sLock;
|
|
||||||
std::map<String16, SensorManager*> android::SensorManager::sPackageInstances;
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
}; // namespace android
|
}; // namespace android
|
||||||
|
|
||||||
|
@ -59,13 +59,12 @@ void SensorManager::sensorManagerDied()
|
|||||||
|
|
||||||
status_t SensorManager::assertStateLocked() const {
|
status_t SensorManager::assertStateLocked() const {
|
||||||
if (mSensorServer == NULL) {
|
if (mSensorServer == NULL) {
|
||||||
|
// try for one second
|
||||||
const String16 name("sensorservice");
|
const String16 name("sensorservice");
|
||||||
// try 10 times before giving up ...
|
for (int i=0 ; i<4 ; i++) {
|
||||||
for (int i = 0; i < 10; ++i) {
|
|
||||||
status_t err = getService(name, &mSensorServer);
|
status_t err = getService(name, &mSensorServer);
|
||||||
if (err == NAME_NOT_FOUND) {
|
if (err == NAME_NOT_FOUND) {
|
||||||
// Sleep for 1 second before retrying.
|
usleep(250000);
|
||||||
sleep(1);
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (err != NO_ERROR) {
|
if (err != NO_ERROR) {
|
||||||
@ -74,10 +73,6 @@ status_t SensorManager::assertStateLocked() const {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mSensorServer == NULL) {
|
|
||||||
ALOGE("FATAL getsensorservice returned` NULL");
|
|
||||||
}
|
|
||||||
|
|
||||||
class DeathObserver : public IBinder::DeathRecipient {
|
class DeathObserver : public IBinder::DeathRecipient {
|
||||||
SensorManager& mSensorManger;
|
SensorManager& mSensorManger;
|
||||||
virtual void binderDied(const wp<IBinder>& who) {
|
virtual void binderDied(const wp<IBinder>& who) {
|
||||||
|
Loading…
Reference in New Issue
Block a user