summaryrefslogtreecommitdiffstats
path: root/services
diff options
context:
space:
mode:
authorMathias Agopian <mathias@google.com>2012-09-18 17:02:43 -0700
committerMathias Agopian <mathias@google.com>2012-09-18 23:33:36 -0700
commit5307d17fe33fc26eeeacd6339a9fbfe96cf56873 (patch)
treeaf7824d54e0ca94596bea6f370361edc45001aa7 /services
parent3cdccc6f852be345c43bdfbc2466aa17c1173c9c (diff)
downloadframeworks_native-5307d17fe33fc26eeeacd6339a9fbfe96cf56873.zip
frameworks_native-5307d17fe33fc26eeeacd6339a9fbfe96cf56873.tar.gz
frameworks_native-5307d17fe33fc26eeeacd6339a9fbfe96cf56873.tar.bz2
track UID with connections
Change-Id: Id4865f3cd27a95acdbbfdff1f2bb4123f312a13b
Diffstat (limited to 'services')
-rw-r--r--services/sensorservice/SensorService.cpp7
-rw-r--r--services/sensorservice/SensorService.h5
2 files changed, 8 insertions, 4 deletions
diff --git a/services/sensorservice/SensorService.cpp b/services/sensorservice/SensorService.cpp
index c9b0f7c..cc2f745 100644
--- a/services/sensorservice/SensorService.cpp
+++ b/services/sensorservice/SensorService.cpp
@@ -383,7 +383,8 @@ Vector<Sensor> SensorService::getSensorList()
sp<ISensorEventConnection> SensorService::createSensorEventConnection()
{
- sp<SensorEventConnection> result(new SensorEventConnection(this));
+ uid_t uid = IPCThreadState::self()->getCallingUid();
+ sp<SensorEventConnection> result(new SensorEventConnection(this, uid));
return result;
}
@@ -553,8 +554,8 @@ bool SensorService::SensorRecord::removeConnection(
// ---------------------------------------------------------------------------
SensorService::SensorEventConnection::SensorEventConnection(
- const sp<SensorService>& service)
- : mService(service), mChannel(new BitTube())
+ const sp<SensorService>& service, uid_t uid)
+ : mService(service), mChannel(new BitTube()), mUid(uid)
{
}
diff --git a/services/sensorservice/SensorService.h b/services/sensorservice/SensorService.h
index 54a76e8..18591bf 100644
--- a/services/sensorservice/SensorService.h
+++ b/services/sensorservice/SensorService.h
@@ -77,13 +77,14 @@ class SensorService :
sp<SensorService> const mService;
sp<BitTube> const mChannel;
+ uid_t mUid;
mutable Mutex mConnectionLock;
// protected by SensorService::mLock
SortedVector<int> mSensorInfo;
public:
- SensorEventConnection(const sp<SensorService>& service);
+ SensorEventConnection(const sp<SensorService>& service, uid_t uid);
status_t sendEvents(sensors_event_t const* buffer, size_t count,
sensors_event_t* scratch = NULL);
@@ -91,6 +92,8 @@ class SensorService :
bool hasAnySensor() const;
bool addSensor(int32_t handle);
bool removeSensor(int32_t handle);
+
+ uid_t getUid() const { return mUid; }
};
class SensorRecord {