blob: dc1804597518da9054dd791e0f8d2517599bbd80 [file] [log] [blame]
Dianne Hackborn5da5ca52013-02-12 15:12:21 -08001/*
2 * Copyright (C) 2013 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//
18#ifndef ANDROID_IAPP_OPS_SERVICE_H
19#define ANDROID_IAPP_OPS_SERVICE_H
20
21#include <binder/IAppOpsCallback.h>
22#include <binder/IInterface.h>
23
24namespace android {
25
26// ----------------------------------------------------------------------
27
28class IAppOpsService : public IInterface
29{
30public:
Colin Cross17576de2016-09-26 13:07:06 -070031 DECLARE_META_INTERFACE(AppOpsService)
Dianne Hackborn5da5ca52013-02-12 15:12:21 -080032
33 virtual int32_t checkOperation(int32_t code, int32_t uid, const String16& packageName) = 0;
34 virtual int32_t noteOperation(int32_t code, int32_t uid, const String16& packageName) = 0;
Dianne Hackborn913b63d2013-07-17 17:26:15 -070035 virtual int32_t startOperation(const sp<IBinder>& token, int32_t code, int32_t uid,
36 const String16& packageName) = 0;
37 virtual void finishOperation(const sp<IBinder>& token, int32_t code, int32_t uid,
38 const String16& packageName) = 0;
Dianne Hackborn5da5ca52013-02-12 15:12:21 -080039 virtual void startWatchingMode(int32_t op, const String16& packageName,
40 const sp<IAppOpsCallback>& callback) = 0;
41 virtual void stopWatchingMode(const sp<IAppOpsCallback>& callback) = 0;
Dianne Hackborn913b63d2013-07-17 17:26:15 -070042 virtual sp<IBinder> getToken(const sp<IBinder>& clientToken) = 0;
Svetoslavb412f6e2015-04-29 16:50:41 -070043 virtual int32_t permissionToOpCode(const String16& permission) = 0;
Dianne Hackborn5da5ca52013-02-12 15:12:21 -080044
45 enum {
46 CHECK_OPERATION_TRANSACTION = IBinder::FIRST_CALL_TRANSACTION,
47 NOTE_OPERATION_TRANSACTION = IBinder::FIRST_CALL_TRANSACTION+1,
48 START_OPERATION_TRANSACTION = IBinder::FIRST_CALL_TRANSACTION+2,
49 FINISH_OPERATION_TRANSACTION = IBinder::FIRST_CALL_TRANSACTION+3,
50 START_WATCHING_MODE_TRANSACTION = IBinder::FIRST_CALL_TRANSACTION+4,
Dianne Hackborn913b63d2013-07-17 17:26:15 -070051 STOP_WATCHING_MODE_TRANSACTION = IBinder::FIRST_CALL_TRANSACTION+5,
52 GET_TOKEN_TRANSACTION = IBinder::FIRST_CALL_TRANSACTION+6,
Svetoslavb412f6e2015-04-29 16:50:41 -070053 PERMISSION_TO_OP_CODE_TRANSACTION = IBinder::FIRST_CALL_TRANSACTION+7,
Dianne Hackborn5da5ca52013-02-12 15:12:21 -080054 };
Eino-Ville Talvalae88a85e2013-02-19 12:54:57 -080055
56 enum {
57 MODE_ALLOWED = 0,
58 MODE_IGNORED = 1,
59 MODE_ERRORED = 2
60 };
Dianne Hackborn5da5ca52013-02-12 15:12:21 -080061};
62
63// ----------------------------------------------------------------------
64
65class BnAppOpsService : public BnInterface<IAppOpsService>
66{
67public:
68 virtual status_t onTransact( uint32_t code,
69 const Parcel& data,
70 Parcel* reply,
71 uint32_t flags = 0);
72};
73
74// ----------------------------------------------------------------------
75
76}; // namespace android
77
78#endif // ANDROID_IAPP_OPS_SERVICE_H