blob: 03756b34d044dc95e7038492474ed70bd1899188 [file] [log] [blame]
Glenn Kasten44deb052012-02-05 18:09:08 -08001/*
2 * Copyright (C) 2012 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
Jean-Michel Trivi43def762019-08-20 15:42:04 -070017#include <cutils/multiuser.h>
18#include <private/android_filesystem_config.h>
Glenn Kasten44deb052012-02-05 18:09:08 -080019#include <unistd.h>
20
Svet Ganov6e641372018-03-02 09:21:30 -080021#include <binder/PermissionController.h>
22
Glenn Kasten44deb052012-02-05 18:09:08 -080023namespace android {
24
Jean-Michel Trivi43def762019-08-20 15:42:04 -070025// Used for calls that should originate from system services.
26// We allow that some services might have separate processes to
27// handle multiple users, e.g. u10_system, u10_bluetooth, u10_radio.
28static inline bool isServiceUid(uid_t uid) {
29 return multiuser_get_app_id(uid) < AID_APP_START;
30}
31
Glenn Kasten949a9262013-04-16 12:35:20 -070032extern pid_t getpid_cached;
Marco Nelissendcb346b2015-09-09 10:47:29 -070033bool isTrustedCallingUid(uid_t uid);
34bool recordingAllowed(const String16& opPackageName, pid_t pid, uid_t uid);
Svet Ganov6e641372018-03-02 09:21:30 -080035bool startRecording(const String16& opPackageName, pid_t pid, uid_t uid);
36void finishRecording(const String16& opPackageName, uid_t uid);
Eric Laurentb2379ba2016-05-23 17:42:12 -070037bool captureAudioOutputAllowed(pid_t pid, uid_t uid);
Eric Laurent7504b9e2017-08-15 18:17:26 -070038bool captureHotwordAllowed(pid_t pid, uid_t uid);
Glenn Kasten44deb052012-02-05 18:09:08 -080039bool settingsAllowed();
Eric Laurent5284ed52014-05-29 14:37:38 -070040bool modifyAudioRoutingAllowed();
Glenn Kasten44deb052012-02-05 18:09:08 -080041bool dumpAllowed();
Nadav Bar766fb022018-01-07 12:18:03 +020042bool modifyPhoneStateAllowed(pid_t pid, uid_t uid);
Glenn Kasten44deb052012-02-05 18:09:08 -080043}