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 17 package com.android.internal.app; 18 19 import android.app.AppOpsManager; 20 import android.os.Bundle; 21 import com.android.internal.app.IAppOpsCallback; 22 import com.android.internal.app.IAppOpsActiveCallback; 23 24 interface IAppOpsService { 25 // These first methods are also called by native code, so must 26 // be kept in sync with frameworks/native/libs/binder/include/binder/IAppOpsService.h checkOperation(int code, int uid, String packageName)27 int checkOperation(int code, int uid, String packageName); noteOperation(int code, int uid, String packageName)28 int noteOperation(int code, int uid, String packageName); startOperation(IBinder token, int code, int uid, String packageName, boolean startIfModeDefault)29 int startOperation(IBinder token, int code, int uid, String packageName, 30 boolean startIfModeDefault); finishOperation(IBinder token, int code, int uid, String packageName)31 void finishOperation(IBinder token, int code, int uid, String packageName); startWatchingMode(int op, String packageName, IAppOpsCallback callback)32 void startWatchingMode(int op, String packageName, IAppOpsCallback callback); stopWatchingMode(IAppOpsCallback callback)33 void stopWatchingMode(IAppOpsCallback callback); getToken(IBinder clientToken)34 IBinder getToken(IBinder clientToken); permissionToOpCode(String permission)35 int permissionToOpCode(String permission); noteProxyOperation(int code, String proxyPackageName, int callingUid, String callingPackageName)36 int noteProxyOperation(int code, String proxyPackageName, 37 int callingUid, String callingPackageName); 38 39 // Remaining methods are only used in Java. checkPackage(int uid, String packageName)40 int checkPackage(int uid, String packageName); getPackagesForOps(in int[] ops)41 List<AppOpsManager.PackageOps> getPackagesForOps(in int[] ops); getOpsForPackage(int uid, String packageName, in int[] ops)42 List<AppOpsManager.PackageOps> getOpsForPackage(int uid, String packageName, in int[] ops); getUidOps(int uid, in int[] ops)43 List<AppOpsManager.PackageOps> getUidOps(int uid, in int[] ops); setUidMode(int code, int uid, int mode)44 void setUidMode(int code, int uid, int mode); setMode(int code, int uid, String packageName, int mode)45 void setMode(int code, int uid, String packageName, int mode); resetAllModes(int reqUserId, String reqPackageName)46 void resetAllModes(int reqUserId, String reqPackageName); checkAudioOperation(int code, int usage, int uid, String packageName)47 int checkAudioOperation(int code, int usage, int uid, String packageName); setAudioRestriction(int code, int usage, int uid, int mode, in String[] exceptionPackages)48 void setAudioRestriction(int code, int usage, int uid, int mode, in String[] exceptionPackages); 49 setUserRestrictions(in Bundle restrictions, IBinder token, int userHandle)50 void setUserRestrictions(in Bundle restrictions, IBinder token, int userHandle); setUserRestriction(int code, boolean restricted, IBinder token, int userHandle, in String[] exceptionPackages)51 void setUserRestriction(int code, boolean restricted, IBinder token, int userHandle, in String[] exceptionPackages); removeUser(int userHandle)52 void removeUser(int userHandle); 53 startWatchingActive(in int[] ops, IAppOpsActiveCallback callback)54 void startWatchingActive(in int[] ops, IAppOpsActiveCallback callback); stopWatchingActive(IAppOpsActiveCallback callback)55 void stopWatchingActive(IAppOpsActiveCallback callback); isOperationActive(int code, int uid, String packageName)56 boolean isOperationActive(int code, int uid, String packageName); 57 startWatchingModeWithFlags(int op, String packageName, int flags, IAppOpsCallback callback)58 void startWatchingModeWithFlags(int op, String packageName, int flags, IAppOpsCallback callback); 59 } 60