blob: c4af4c797d374ee5f4931a3d59c652e9bf569951 [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;
Svet Ganov8455ba22019-01-02 13:05:56 -080020import android.app.AppOpsManager;
Svet Ganovad0a49b2018-10-29 10:07:08 -070021import android.content.pm.ParceledListSlice;
Jason Monk62062992014-05-06 09:55:28 -040022import android.os.Bundle;
Svet Ganov8455ba22019-01-02 13:05:56 -080023import android.os.RemoteCallback;
Dianne Hackbornc2293022013-02-06 23:14:49 -080024import com.android.internal.app.IAppOpsCallback;
Svetoslav Ganov2d20fb42018-02-08 15:52:10 -080025import com.android.internal.app.IAppOpsActiveCallback;
Svet Ganovb3d2ae22018-12-17 22:06:15 -080026import com.android.internal.app.IAppOpsNotedCallback;
Dianne Hackborn35654b62013-01-14 17:38:02 -080027
Dianne Hackborna06de0f2012-12-11 16:34:47 -080028interface IAppOpsService {
Dianne Hackbornd7d28e62013-02-12 14:59:53 -080029 // These first methods are also called by native code, so must
Peter Visontaycee76322017-09-05 11:43:36 +010030 // be kept in sync with frameworks/native/libs/binder/include/binder/IAppOpsService.h
Dianne Hackborn35654b62013-01-14 17:38:02 -080031 int checkOperation(int code, int uid, String packageName);
Dianne Hackborna06de0f2012-12-11 16:34:47 -080032 int noteOperation(int code, int uid, String packageName);
Svet Ganovf7b47252018-02-26 11:11:27 -080033 int startOperation(IBinder token, int code, int uid, String packageName,
34 boolean startIfModeDefault);
Andrei Oneafa152f92019-02-27 15:58:05 +000035 @UnsupportedAppUsage
Dianne Hackborne98f5db2013-07-17 17:23:25 -070036 void finishOperation(IBinder token, int code, int uid, String packageName);
Dianne Hackbornc2293022013-02-06 23:14:49 -080037 void startWatchingMode(int op, String packageName, IAppOpsCallback callback);
38 void stopWatchingMode(IAppOpsCallback callback);
Dianne Hackborne98f5db2013-07-17 17:23:25 -070039 IBinder getToken(IBinder clientToken);
Svet Ganovb9d71a62015-04-30 10:38:13 -070040 int permissionToOpCode(String permission);
Svet Ganovd873ae62018-06-25 16:39:23 -070041 int noteProxyOperation(int code, int proxyUid, String proxyPackageName,
Svet Ganov85be0c42015-07-03 16:22:26 -070042 int callingUid, String callingPackageName);
Dianne Hackbornd7d28e62013-02-12 14:59:53 -080043
44 // Remaining methods are only used in Java.
Dianne Hackbornd4a8b9d2013-09-06 13:36:57 -070045 int checkPackage(int uid, String packageName);
Andrei Oneafa152f92019-02-27 15:58:05 +000046 @UnsupportedAppUsage
Dianne Hackbornd7d28e62013-02-12 14:59:53 -080047 List<AppOpsManager.PackageOps> getPackagesForOps(in int[] ops);
Andrei Oneafa152f92019-02-27 15:58:05 +000048 @UnsupportedAppUsage
Dianne Hackbornd7d28e62013-02-12 14:59:53 -080049 List<AppOpsManager.PackageOps> getOpsForPackage(int uid, String packageName, in int[] ops);
Svet Ganov23c88db2019-01-22 20:38:11 -080050 void getHistoricalOps(int uid, String packageName, in List<String> ops, long beginTimeMillis,
Svet Ganovaf189e32019-02-15 18:45:29 -080051 long endTimeMillis, int flags, in RemoteCallback callback);
Svet Ganov23c88db2019-01-22 20:38:11 -080052 void getHistoricalOpsFromDiskRaw(int uid, String packageName, in List<String> ops,
Svet Ganovaf189e32019-02-15 18:45:29 -080053 long beginTimeMillis, long endTimeMillis, int flags, in RemoteCallback callback);
Svet Ganov8455ba22019-01-02 13:05:56 -080054 void offsetHistory(long duration);
55 void setHistoryParameters(int mode, long baseSnapshotInterval, int compressionStep);
56 void addHistoricalOps(in AppOpsManager.HistoricalOps ops);
57 void resetHistoryParameters();
58 void clearHistory();
Dianne Hackbornc7214a32017-04-11 13:32:47 -070059 List<AppOpsManager.PackageOps> getUidOps(int uid, in int[] ops);
Svet Ganov2af57082015-07-30 08:44:20 -070060 void setUidMode(int code, int uid, int mode);
Andrei Oneafa152f92019-02-27 15:58:05 +000061 @UnsupportedAppUsage
Dianne Hackbornd7d28e62013-02-12 14:59:53 -080062 void setMode(int code, int uid, String packageName, int mode);
Andrei Oneafa152f92019-02-27 15:58:05 +000063 @UnsupportedAppUsage
Dianne Hackborn7b7c58b2014-12-02 18:32:20 -080064 void resetAllModes(int reqUserId, String reqPackageName);
John Spurlock7b414672014-07-18 13:02:39 -040065 int checkAudioOperation(int code, int usage, int uid, String packageName);
66 void setAudioRestriction(int code, int usage, int uid, int mode, in String[] exceptionPackages);
Jason Monk62062992014-05-06 09:55:28 -040067
Svet Ganov9cea80cd2016-02-16 11:47:00 -080068 void setUserRestrictions(in Bundle restrictions, IBinder token, int userHandle);
Ruben Brunk29931bc2016-03-11 00:24:26 -080069 void setUserRestriction(int code, boolean restricted, IBinder token, int userHandle, in String[] exceptionPackages);
Jason Monk62062992014-05-06 09:55:28 -040070 void removeUser(int userHandle);
Jeff Sharkey35e46d22017-06-09 10:01:20 -060071
Svetoslav Ganov2d20fb42018-02-08 15:52:10 -080072 void startWatchingActive(in int[] ops, IAppOpsActiveCallback callback);
73 void stopWatchingActive(IAppOpsActiveCallback callback);
Jeff Sharkey35e46d22017-06-09 10:01:20 -060074 boolean isOperationActive(int code, int uid, String packageName);
Dianne Hackborn65a4f252018-05-08 17:30:48 -070075
76 void startWatchingModeWithFlags(int op, String packageName, int flags, IAppOpsCallback callback);
Svet Ganovb3d2ae22018-12-17 22:06:15 -080077
78 void startWatchingNoted(in int[] ops, IAppOpsNotedCallback callback);
79 void stopWatchingNoted(IAppOpsNotedCallback callback);
Svet Ganov9d528a12018-12-19 17:23:11 -080080
81 int checkOperationRaw(int code, int uid, String packageName);
Dianne Hackborna06de0f2012-12-11 16:34:47 -080082}