blob: 35d4ba81bd697590fa8423ff5b7ce86a4d76e8af [file] [log] [blame]
Dianne Hackborna06de0f2012-12-11 16:34:47 -08001/*
Dianne Hackbornc2293022013-02-06 23:14:49 -08002 * Copyright (C) 2013 The Android Open Source Project
Dianne Hackborna06de0f2012-12-11 16:34:47 -08003 *
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
Dianne Hackborn35654b62013-01-14 17:38:02 -080019import android.app.AppOpsManager;
Jason Monk62062992014-05-06 09:55:28 -040020import android.os.Bundle;
Dianne Hackbornc2293022013-02-06 23:14:49 -080021import com.android.internal.app.IAppOpsCallback;
Dianne Hackborn35654b62013-01-14 17:38:02 -080022
Dianne Hackborna06de0f2012-12-11 16:34:47 -080023interface IAppOpsService {
Dianne Hackbornd7d28e62013-02-12 14:59:53 -080024 // These first methods are also called by native code, so must
25 // be kept in sync with frameworks/native/include/binder/IAppOpsService.h
Dianne Hackborn35654b62013-01-14 17:38:02 -080026 int checkOperation(int code, int uid, String packageName);
Dianne Hackborna06de0f2012-12-11 16:34:47 -080027 int noteOperation(int code, int uid, String packageName);
Dianne Hackborne98f5db2013-07-17 17:23:25 -070028 int startOperation(IBinder token, int code, int uid, String packageName);
29 void finishOperation(IBinder token, int code, int uid, String packageName);
Dianne Hackbornc2293022013-02-06 23:14:49 -080030 void startWatchingMode(int op, String packageName, IAppOpsCallback callback);
31 void stopWatchingMode(IAppOpsCallback callback);
Dianne Hackborne98f5db2013-07-17 17:23:25 -070032 IBinder getToken(IBinder clientToken);
Svet Ganovb9d71a62015-04-30 10:38:13 -070033 int permissionToOpCode(String permission);
Svet Ganov85be0c42015-07-03 16:22:26 -070034 int noteProxyOperation(int code, String proxyPackageName,
35 int callingUid, String callingPackageName);
Dianne Hackbornd7d28e62013-02-12 14:59:53 -080036
37 // Remaining methods are only used in Java.
Dianne Hackbornd4a8b9d2013-09-06 13:36:57 -070038 int checkPackage(int uid, String packageName);
Dianne Hackbornd7d28e62013-02-12 14:59:53 -080039 List<AppOpsManager.PackageOps> getPackagesForOps(in int[] ops);
40 List<AppOpsManager.PackageOps> getOpsForPackage(int uid, String packageName, in int[] ops);
Dianne Hackbornc7214a32017-04-11 13:32:47 -070041 List<AppOpsManager.PackageOps> getUidOps(int uid, in int[] ops);
Svet Ganov2af57082015-07-30 08:44:20 -070042 void setUidMode(int code, int uid, int mode);
Dianne Hackbornd7d28e62013-02-12 14:59:53 -080043 void setMode(int code, int uid, String packageName, int mode);
Dianne Hackborn7b7c58b2014-12-02 18:32:20 -080044 void resetAllModes(int reqUserId, String reqPackageName);
John Spurlock7b414672014-07-18 13:02:39 -040045 int checkAudioOperation(int code, int usage, int uid, String packageName);
46 void setAudioRestriction(int code, int usage, int uid, int mode, in String[] exceptionPackages);
Jason Monk62062992014-05-06 09:55:28 -040047
Svet Ganov9cea80cd2016-02-16 11:47:00 -080048 void setUserRestrictions(in Bundle restrictions, IBinder token, int userHandle);
Ruben Brunk29931bc2016-03-11 00:24:26 -080049 void setUserRestriction(int code, boolean restricted, IBinder token, int userHandle, in String[] exceptionPackages);
Jason Monk62062992014-05-06 09:55:28 -040050 void removeUser(int userHandle);
Dianne Hackborna06de0f2012-12-11 16:34:47 -080051}