blob: 7cb55e5dab520ce03138cf13b805b083b26d2df2 [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:
31 DECLARE_META_INTERFACE(AppOpsService);
32
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;
35 virtual int32_t startOperation(int32_t code, int32_t uid, const String16& packageName) = 0;
36 virtual void finishOperation(int32_t code, int32_t uid, const String16& packageName) = 0;
37 virtual void startWatchingMode(int32_t op, const String16& packageName,
38 const sp<IAppOpsCallback>& callback) = 0;
39 virtual void stopWatchingMode(const sp<IAppOpsCallback>& callback) = 0;
40
41 enum {
42 CHECK_OPERATION_TRANSACTION = IBinder::FIRST_CALL_TRANSACTION,
43 NOTE_OPERATION_TRANSACTION = IBinder::FIRST_CALL_TRANSACTION+1,
44 START_OPERATION_TRANSACTION = IBinder::FIRST_CALL_TRANSACTION+2,
45 FINISH_OPERATION_TRANSACTION = IBinder::FIRST_CALL_TRANSACTION+3,
46 START_WATCHING_MODE_TRANSACTION = IBinder::FIRST_CALL_TRANSACTION+4,
47 STOP_WATCHING_MODE_TRANSACTION = IBinder::FIRST_CALL_TRANSACTION+5
48 };
Eino-Ville Talvalae88a85e2013-02-19 12:54:57 -080049
50 enum {
51 MODE_ALLOWED = 0,
52 MODE_IGNORED = 1,
53 MODE_ERRORED = 2
54 };
Dianne Hackborn5da5ca52013-02-12 15:12:21 -080055};
56
57// ----------------------------------------------------------------------
58
59class BnAppOpsService : public BnInterface<IAppOpsService>
60{
61public:
62 virtual status_t onTransact( uint32_t code,
63 const Parcel& data,
64 Parcel* reply,
65 uint32_t flags = 0);
66};
67
68// ----------------------------------------------------------------------
69
70}; // namespace android
71
72#endif // ANDROID_IAPP_OPS_SERVICE_H