1/*
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
17package com.android.internal.app;
18
19import android.app.AppOpsManager;
20import android.os.Bundle;
21import com.android.internal.app.IAppOpsCallback;
22
23interface IAppOpsService {
24    // These first methods are also called by native code, so must
25    // be kept in sync with frameworks/native/include/binder/IAppOpsService.h
26    int checkOperation(int code, int uid, String packageName);
27    int noteOperation(int code, int uid, String packageName);
28    int startOperation(IBinder token, int code, int uid, String packageName);
29    void finishOperation(IBinder token, int code, int uid, String packageName);
30    void startWatchingMode(int op, String packageName, IAppOpsCallback callback);
31    void stopWatchingMode(IAppOpsCallback callback);
32    IBinder getToken(IBinder clientToken);
33
34    // Remaining methods are only used in Java.
35    int checkPackage(int uid, String packageName);
36    List<AppOpsManager.PackageOps> getPackagesForOps(in int[] ops);
37    List<AppOpsManager.PackageOps> getOpsForPackage(int uid, String packageName, in int[] ops);
38    void setMode(int code, int uid, String packageName, int mode);
39    void resetAllModes(int reqUserId, String reqPackageName);
40    int checkAudioOperation(int code, int usage, int uid, String packageName);
41    void setAudioRestriction(int code, int usage, int uid, int mode, in String[] exceptionPackages);
42
43    void setUserRestrictions(in Bundle restrictions, int userHandle);
44    void removeUser(int userHandle);
45
46}
47