summaryrefslogtreecommitdiffstats
path: root/services/audioflinger/ServiceUtilities.h
diff options
context:
space:
mode:
authorGlenn Kasten <gkasten@google.com>2012-02-05 18:09:08 -0800
committerGlenn Kasten <gkasten@google.com>2012-02-13 10:30:23 -0800
commit44deb053252a3bd2f57a007ab9560f4924f62394 (patch)
tree57fac6fb14c9f7897409b54b360afebef59c2e70 /services/audioflinger/ServiceUtilities.h
parent860936d780d98a5968f40e66ca6ae800c67adbc3 (diff)
downloadframeworks_av-44deb053252a3bd2f57a007ab9560f4924f62394.zip
frameworks_av-44deb053252a3bd2f57a007ab9560f4924f62394.tar.gz
frameworks_av-44deb053252a3bd2f57a007ab9560f4924f62394.tar.bz2
Factor out and speed up permission-checking code
Use the caching permission check for dump to save IPC. Cache getpid() to save kernel call for other permission checks. The C runtime library getpid() can't cache due to a fork race condition, but we know that mediaserver doesn't fork. Don't construct String16 on the stack. Change-Id: I6be6161dae5155d39ba6ed6228e7683e67be34ed
Diffstat (limited to 'services/audioflinger/ServiceUtilities.h')
-rw-r--r--services/audioflinger/ServiceUtilities.h27
1 files changed, 27 insertions, 0 deletions
diff --git a/services/audioflinger/ServiceUtilities.h b/services/audioflinger/ServiceUtilities.h
new file mode 100644
index 0000000..f77ec5b
--- /dev/null
+++ b/services/audioflinger/ServiceUtilities.h
@@ -0,0 +1,27 @@
+/*
+ * Copyright (C) 2012 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <unistd.h>
+
+namespace android {
+
+extern const pid_t getpid_cached;
+
+bool recordingAllowed();
+bool settingsAllowed();
+bool dumpAllowed();
+
+}