1 /*
2  * Copyright (C) 2016 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 #pragma once
18 
19 #ifndef __ANDROID_VNDK__
20 
21 #include <binder/IUidObserver.h>
22 #include <binder/IInterface.h>
23 
24 namespace android {
25 
26 // ------------------------------------------------------------------------------------
27 
28 class IActivityManager : public IInterface
29 {
30 public:
31     DECLARE_META_INTERFACE(ActivityManager)
32 
33     virtual int openContentUri(const String16& stringUri) = 0;
34     virtual status_t registerUidObserver(const sp<IUidObserver>& observer,
35                                      const int32_t event,
36                                      const int32_t cutpoint,
37                                      const String16& callingPackage) = 0;
38     virtual status_t registerUidObserverForUids(const sp<IUidObserver>& observer,
39                                                 const int32_t event, const int32_t cutpoint,
40                                                 const String16& callingPackage,
41                                                 const int32_t uids[], size_t nUids,
42                                                 /*out*/ sp<IBinder>& observerToken) = 0;
43     virtual status_t unregisterUidObserver(const sp<IUidObserver>& observer) = 0;
44     virtual status_t addUidToObserver(const sp<IBinder>& observerToken,
45                                       const String16& callingPackage, int32_t uid) = 0;
46     virtual status_t removeUidFromObserver(const sp<IBinder>& observerToken,
47                                            const String16& callingPackage, int32_t uid) = 0;
48     virtual bool isUidActive(const uid_t uid, const String16& callingPackage) = 0;
49     virtual int32_t getUidProcessState(const uid_t uid, const String16& callingPackage) = 0;
50     virtual status_t checkPermission(const String16& permission,
51                                     const pid_t pid,
52                                     const uid_t uid,
53                                     int32_t* outResult) = 0;
54     virtual status_t logFgsApiBegin(int32_t apiType, int32_t appUid, int32_t appPid) = 0;
55     virtual status_t logFgsApiEnd(int32_t apiType, int32_t appUid, int32_t appPid) = 0;
56     virtual status_t logFgsApiStateChanged(int32_t apiType, int32_t state, int32_t appUid,
57                                            int32_t appPid) = 0;
58 
59     enum {
60         OPEN_CONTENT_URI_TRANSACTION = IBinder::FIRST_CALL_TRANSACTION,
61         REGISTER_UID_OBSERVER_TRANSACTION,
62         UNREGISTER_UID_OBSERVER_TRANSACTION,
63         REGISTER_UID_OBSERVER_FOR_UIDS_TRANSACTION,
64         ADD_UID_TO_OBSERVER_TRANSACTION,
65         REMOVE_UID_FROM_OBSERVER_TRANSACTION,
66         IS_UID_ACTIVE_TRANSACTION,
67         GET_UID_PROCESS_STATE_TRANSACTION,
68         CHECK_PERMISSION_TRANSACTION,
69         LOG_FGS_API_BEGIN_TRANSACTION,
70         LOG_FGS_API_END_TRANSACTION,
71         LOG_FGS_API_STATE_CHANGED_TRANSACTION
72     };
73 };
74 
75 // ------------------------------------------------------------------------------------
76 
77 } // namespace android
78 
79 #else // __ANDROID_VNDK__
80 #error "This header is not visible to vendors"
81 #endif // __ANDROID_VNDK__
82