Merge "Add Wi-Fi connection functional tests." into gingerbread
diff --git a/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java b/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java
index a277bcb..43936a4 100755
--- a/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java
+++ b/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java
@@ -111,7 +111,6 @@
import android.media.IAudioService;
import android.media.AudioManager;
-import java.io.File;
import java.util.ArrayList;
/**
@@ -2115,12 +2114,8 @@
return getCurrentPortraitRotation(lastRotation);
}
- if (new File("/system/etc/allow_all_orientations").exists()) {
- mOrientationListener.setAllow180Rotation(true);
- } else {
- mOrientationListener.setAllow180Rotation(
- orientation == ActivityInfo.SCREEN_ORIENTATION_FULL_SENSOR);
- }
+ mOrientationListener.setAllow180Rotation(
+ orientation == ActivityInfo.SCREEN_ORIENTATION_FULL_SENSOR);
// case for nosensor meaning ignore sensor and consider only lid
// or orientation sensor disabled
diff --git a/services/sensorservice/SensorService.cpp b/services/sensorservice/SensorService.cpp
index b5e73ac..22a45df 100644
--- a/services/sensorservice/SensorService.cpp
+++ b/services/sensorservice/SensorService.cpp
@@ -464,6 +464,7 @@
}
bool SensorService::SensorEventConnection::addSensor(int32_t handle) {
+ Mutex::Autolock _l(mConnectionLock);
if (mSensorInfo.indexOfKey(handle) <= 0) {
SensorInfo info;
mSensorInfo.add(handle, info);
@@ -473,6 +474,7 @@
}
bool SensorService::SensorEventConnection::removeSensor(int32_t handle) {
+ Mutex::Autolock _l(mConnectionLock);
if (mSensorInfo.removeItem(handle) >= 0) {
return true;
}
@@ -480,16 +482,19 @@
}
bool SensorService::SensorEventConnection::hasSensor(int32_t handle) const {
+ Mutex::Autolock _l(mConnectionLock);
return mSensorInfo.indexOfKey(handle) >= 0;
}
bool SensorService::SensorEventConnection::hasAnySensor() const {
+ Mutex::Autolock _l(mConnectionLock);
return mSensorInfo.size() ? true : false;
}
status_t SensorService::SensorEventConnection::setEventRateLocked(
int handle, nsecs_t ns)
{
+ Mutex::Autolock _l(mConnectionLock);
ssize_t index = mSensorInfo.indexOfKey(handle);
if (index >= 0) {
SensorInfo& info = mSensorInfo.editValueFor(handle);
@@ -506,6 +511,7 @@
// filter out events not for this connection
size_t count = 0;
if (scratch) {
+ Mutex::Autolock _l(mConnectionLock);
size_t i=0;
while (i<numEvents) {
const int32_t curr = buffer[i].sensor;
diff --git a/services/sensorservice/SensorService.h b/services/sensorservice/SensorService.h
index b442779..c0922f5 100644
--- a/services/sensorservice/SensorService.h
+++ b/services/sensorservice/SensorService.h
@@ -75,8 +75,9 @@
sp<SensorService> const mService;
sp<SensorChannel> const mChannel;
+ mutable Mutex mConnectionLock;
- // protected by SensorService::mLock
+ // protected mConnectionLock
struct SensorInfo {
SensorInfo() : ns(DEFAULT_EVENTS_PERIOD) { }
nsecs_t ns;