summaryrefslogtreecommitdiffstats
path: root/libs
diff options
context:
space:
mode:
authorAravind Akella <aakella@google.com>2015-02-11 15:54:35 -0800
committerAravind Akella <aakella@google.com>2015-03-24 15:41:35 -0700
commit4949c50372de4c7fdb57de1dc0c1f5bb3ac463eb (patch)
tree148645ba076e211e0c8679eba6d5d5d18e3d8a8f /libs
parent5b20fd0882e6a1754cad7342f7ceda3753e8f567 (diff)
downloadframeworks_native-4949c50372de4c7fdb57de1dc0c1f5bb3ac463eb.zip
frameworks_native-4949c50372de4c7fdb57de1dc0c1f5bb3ac463eb.tar.gz
frameworks_native-4949c50372de4c7fdb57de1dc0c1f5bb3ac463eb.tar.bz2
Support restricted mode in SensorService.
In restricted mode, only CTS tests can register for sensors or call flush() on them. The requests from other applications will be ignored. Change-Id: Ieb923df3e0cfe3390fe2d052af776da79589744b
Diffstat (limited to 'libs')
-rw-r--r--libs/gui/ISensorServer.cpp6
-rw-r--r--libs/gui/SensorManager.cpp4
2 files changed, 6 insertions, 4 deletions
diff --git a/libs/gui/ISensorServer.cpp b/libs/gui/ISensorServer.cpp
index 8e09e7c..3c85ec0 100644
--- a/libs/gui/ISensorServer.cpp
+++ b/libs/gui/ISensorServer.cpp
@@ -63,10 +63,11 @@ public:
return v;
}
- virtual sp<ISensorEventConnection> createSensorEventConnection()
+ virtual sp<ISensorEventConnection> createSensorEventConnection(const String8& packageName)
{
Parcel data, reply;
data.writeInterfaceToken(ISensorServer::getInterfaceDescriptor());
+ data.writeString8(packageName);
remote()->transact(CREATE_SENSOR_EVENT_CONNECTION, data, &reply);
return interface_cast<ISensorEventConnection>(reply.readStrongBinder());
}
@@ -96,7 +97,8 @@ status_t BnSensorServer::onTransact(
}
case CREATE_SENSOR_EVENT_CONNECTION: {
CHECK_INTERFACE(ISensorServer, data, reply);
- sp<ISensorEventConnection> connection(createSensorEventConnection());
+ String8 packageName = data.readString8();
+ sp<ISensorEventConnection> connection(createSensorEventConnection(packageName));
reply->writeStrongBinder(IInterface::asBinder(connection));
return NO_ERROR;
}
diff --git a/libs/gui/SensorManager.cpp b/libs/gui/SensorManager.cpp
index d6df404..142c6ec 100644
--- a/libs/gui/SensorManager.cpp
+++ b/libs/gui/SensorManager.cpp
@@ -139,14 +139,14 @@ Sensor const* SensorManager::getDefaultSensor(int type)
return NULL;
}
-sp<SensorEventQueue> SensorManager::createEventQueue()
+sp<SensorEventQueue> SensorManager::createEventQueue(String8 packageName)
{
sp<SensorEventQueue> queue;
Mutex::Autolock _l(mLock);
while (assertStateLocked() == NO_ERROR) {
sp<ISensorEventConnection> connection =
- mSensorServer->createSensorEventConnection();
+ mSensorServer->createSensorEventConnection(packageName);
if (connection == NULL) {
// SensorService just died.
ALOGE("createEventQueue: connection is NULL. SensorService died.");