• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
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 
17 #include <cutils/multiuser.h>
18 #include <private/android_filesystem_config.h>
19 #include <unistd.h>
20 
21 #include <binder/PermissionController.h>
22 
23 namespace android {
24 
25 // 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.
isServiceUid(uid_t uid)28 static inline bool isServiceUid(uid_t uid) {
29     return multiuser_get_app_id(uid) < AID_APP_START;
30 }
31 
32 extern pid_t getpid_cached;
33 bool isTrustedCallingUid(uid_t uid);
34 bool recordingAllowed(const String16& opPackageName, pid_t pid, uid_t uid);
35 bool startRecording(const String16& opPackageName, pid_t pid, uid_t uid);
36 void finishRecording(const String16& opPackageName, uid_t uid);
37 bool captureAudioOutputAllowed(pid_t pid, uid_t uid);
38 bool captureHotwordAllowed(pid_t pid, uid_t uid);
39 bool settingsAllowed();
40 bool modifyAudioRoutingAllowed();
41 bool dumpAllowed();
42 bool modifyPhoneStateAllowed(pid_t pid, uid_t uid);
43 }
44