summaryrefslogtreecommitdiffstats
path: root/services/sensorservice/SensorService.cpp
diff options
context:
space:
mode:
authorMathias Agopian <mathias@google.com>2011-06-27 16:05:52 -0700
committerMathias Agopian <mathias@google.com>2012-06-27 17:07:55 -0700
commit1cb13461a8cf62e3ba634e5965332f2d284f6d42 (patch)
tree63b64546b7de078632172b12e99616e3deaf5a2e /services/sensorservice/SensorService.cpp
parenteaf2d0bfe37415ba1e42a97608823e8dbef53220 (diff)
downloadframeworks_native-1cb13461a8cf62e3ba634e5965332f2d284f6d42.zip
frameworks_native-1cb13461a8cf62e3ba634e5965332f2d284f6d42.tar.gz
frameworks_native-1cb13461a8cf62e3ba634e5965332f2d284f6d42.tar.bz2
PermissionCache caches permission checks
This is intended to absorb the cost of the IPC to the permission controller. Cached permission checks cost about 3us, while full blown ones are two orders of magnitude slower. CAVEAT: PermissionCache can only handle system permissions safely for now, because the cache is not purged upon global permission changes. Change-Id: I8b8a5e71e191e3c01e8f792f253c379190eee62e
Diffstat (limited to 'services/sensorservice/SensorService.cpp')
-rw-r--r--services/sensorservice/SensorService.cpp8
1 files changed, 5 insertions, 3 deletions
diff --git a/services/sensorservice/SensorService.cpp b/services/sensorservice/SensorService.cpp
index 0ae7929..64d214b 100644
--- a/services/sensorservice/SensorService.cpp
+++ b/services/sensorservice/SensorService.cpp
@@ -31,6 +31,7 @@
#include <binder/BinderService.h>
#include <binder/IServiceManager.h>
+#include <binder/PermissionCache.h>
#include <gui/ISensorServer.h>
#include <gui/ISensorEventConnection.h>
@@ -58,8 +59,7 @@ namespace android {
*/
SensorService::SensorService()
- : mDump("android.permission.DUMP"),
- mInitCheck(NO_INIT)
+ : mInitCheck(NO_INIT)
{
}
@@ -166,12 +166,14 @@ SensorService::~SensorService()
delete mSensorMap.valueAt(i);
}
+static const String16 sDump("android.permission.DUMP");
+
status_t SensorService::dump(int fd, const Vector<String16>& args)
{
const size_t SIZE = 1024;
char buffer[SIZE];
String8 result;
- if (!mDump.checkCalling()) {
+ if (!PermissionCache::checkCallingPermission(sDump)) {
snprintf(buffer, SIZE, "Permission Denial: "
"can't dump SurfaceFlinger from pid=%d, uid=%d\n",
IPCThreadState::self()->getCallingPid(),