1 /* 2 * Copyright (C) 2019 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 android.permission; 18 19 import android.content.AttributionSourceState; 20 import android.content.pm.ParceledListSlice; 21 import android.content.pm.PermissionGroupInfo; 22 import android.content.pm.PermissionInfo; 23 import android.content.pm.permission.SplitPermissionInfoParcelable; 24 import android.os.UserHandle; 25 import android.permission.IOnPermissionsChangeListener; 26 27 /** 28 * Interface to communicate directly with the permission manager service. 29 * @see PermissionManager 30 * @hide 31 */ 32 interface IPermissionManager { getAllPermissionGroups(int flags)33 ParceledListSlice getAllPermissionGroups(int flags); 34 getPermissionGroupInfo(String groupName, int flags)35 PermissionGroupInfo getPermissionGroupInfo(String groupName, int flags); 36 getPermissionInfo(String permissionName, String packageName, int flags)37 PermissionInfo getPermissionInfo(String permissionName, String packageName, int flags); 38 queryPermissionsByGroup(String groupName, int flags)39 ParceledListSlice queryPermissionsByGroup(String groupName, int flags); 40 addPermission(in PermissionInfo permissionInfo, boolean async)41 boolean addPermission(in PermissionInfo permissionInfo, boolean async); 42 removePermission(String permissionName)43 void removePermission(String permissionName); 44 getPermissionFlags(String packageName, String permissionName, int userId)45 int getPermissionFlags(String packageName, String permissionName, int userId); 46 updatePermissionFlags(String packageName, String permissionName, int flagMask, int flagValues, boolean checkAdjustPolicyFlagPermission, int userId)47 void updatePermissionFlags(String packageName, String permissionName, int flagMask, 48 int flagValues, boolean checkAdjustPolicyFlagPermission, int userId); 49 updatePermissionFlagsForAllApps(int flagMask, int flagValues, int userId)50 void updatePermissionFlagsForAllApps(int flagMask, int flagValues, int userId); 51 addOnPermissionsChangeListener(in IOnPermissionsChangeListener listener)52 void addOnPermissionsChangeListener(in IOnPermissionsChangeListener listener); 53 removeOnPermissionsChangeListener(in IOnPermissionsChangeListener listener)54 void removeOnPermissionsChangeListener(in IOnPermissionsChangeListener listener); 55 getAllowlistedRestrictedPermissions(String packageName, int flags, int userId)56 List<String> getAllowlistedRestrictedPermissions(String packageName, 57 int flags, int userId); 58 addAllowlistedRestrictedPermission(String packageName, String permissionName, int flags, int userId)59 boolean addAllowlistedRestrictedPermission(String packageName, String permissionName, 60 int flags, int userId); 61 removeAllowlistedRestrictedPermission(String packageName, String permissionName, int flags, int userId)62 boolean removeAllowlistedRestrictedPermission(String packageName, String permissionName, 63 int flags, int userId); 64 grantRuntimePermission(String packageName, String permissionName, int userId)65 void grantRuntimePermission(String packageName, String permissionName, int userId); 66 revokeRuntimePermission(String packageName, String permissionName, int userId, String reason)67 void revokeRuntimePermission(String packageName, String permissionName, int userId, 68 String reason); 69 revokePostNotificationPermissionWithoutKillForTest(String packageName, int userId)70 void revokePostNotificationPermissionWithoutKillForTest(String packageName, int userId); 71 shouldShowRequestPermissionRationale(String packageName, String permissionName, int userId)72 boolean shouldShowRequestPermissionRationale(String packageName, String permissionName, 73 int userId); 74 isPermissionRevokedByPolicy(String packageName, String permissionName, int userId)75 boolean isPermissionRevokedByPolicy(String packageName, String permissionName, int userId); 76 getSplitPermissions()77 List<SplitPermissionInfoParcelable> getSplitPermissions(); 78 startOneTimePermissionSession(String packageName, int userId, long timeout, long revokeAfterKilledDelay)79 void startOneTimePermissionSession(String packageName, int userId, long timeout, 80 long revokeAfterKilledDelay); 81 stopOneTimePermissionSession(String packageName, int userId)82 void stopOneTimePermissionSession(String packageName, int userId); 83 getAutoRevokeExemptionRequestedPackages(int userId)84 List<String> getAutoRevokeExemptionRequestedPackages(int userId); 85 getAutoRevokeExemptionGrantedPackages(int userId)86 List<String> getAutoRevokeExemptionGrantedPackages(int userId); 87 setAutoRevokeExempted(String packageName, boolean exempted, int userId)88 boolean setAutoRevokeExempted(String packageName, boolean exempted, int userId); 89 isAutoRevokeExempted(String packageName, int userId)90 boolean isAutoRevokeExempted(String packageName, int userId); 91 registerAttributionSource(in AttributionSourceState source)92 void registerAttributionSource(in AttributionSourceState source); 93 isRegisteredAttributionSource(in AttributionSourceState source)94 boolean isRegisteredAttributionSource(in AttributionSourceState source); 95 } 96