1 /* 2 * Copyright (C) 2020 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.server.pm.permission; 18 19 import android.annotation.NonNull; 20 import android.annotation.Nullable; 21 import android.annotation.UserIdInt; 22 23 /** 24 * The internal interface for {@link LegacyPermissionManagerService}. 25 */ 26 public interface LegacyPermissionManagerInternal { 27 /** 28 * Reset the runtime permission state for all users and packages. 29 */ resetRuntimePermissions()30 void resetRuntimePermissions(); 31 32 /** 33 * Sets the dialer application packages provider. 34 * @param provider The provider. 35 */ setDialerAppPackagesProvider(PackagesProvider provider)36 void setDialerAppPackagesProvider(PackagesProvider provider); 37 38 /** 39 * Set the location extra packages provider. 40 * @param provider The packages provider. 41 */ setLocationExtraPackagesProvider(PackagesProvider provider)42 void setLocationExtraPackagesProvider(PackagesProvider provider); 43 44 /** 45 * Sets the location provider packages provider. 46 * @param provider The packages provider. 47 */ setLocationPackagesProvider(PackagesProvider provider)48 void setLocationPackagesProvider(PackagesProvider provider); 49 50 /** 51 * Sets the SIM call manager packages provider. 52 * @param provider The provider. 53 */ setSimCallManagerPackagesProvider(PackagesProvider provider)54 void setSimCallManagerPackagesProvider(PackagesProvider provider); 55 56 /** 57 * Sets the SMS application packages provider. 58 * @param provider The provider. 59 */ setSmsAppPackagesProvider(PackagesProvider provider)60 void setSmsAppPackagesProvider(PackagesProvider provider); 61 62 /** 63 * Sets the sync adapter packages provider. 64 * @param provider The provider. 65 */ setSyncAdapterPackagesProvider(SyncAdapterPackagesProvider provider)66 void setSyncAdapterPackagesProvider(SyncAdapterPackagesProvider provider); 67 68 /** 69 * Sets the Use Open Wifi packages provider. 70 * @param provider The packages provider. 71 */ setUseOpenWifiAppPackagesProvider(PackagesProvider provider)72 void setUseOpenWifiAppPackagesProvider(PackagesProvider provider); 73 74 /** 75 * Sets the voice interaction packages provider. 76 * @param provider The packages provider. 77 */ setVoiceInteractionPackagesProvider(PackagesProvider provider)78 void setVoiceInteractionPackagesProvider(PackagesProvider provider); 79 80 /** 81 * Requests granting of the default permissions to the current default Use Open Wifi app. 82 * @param packageName The default use open wifi package name. 83 * @param userId The user for which to grant the permissions. 84 */ grantDefaultPermissionsToDefaultSimCallManager(@onNull String packageName, @UserIdInt int userId)85 void grantDefaultPermissionsToDefaultSimCallManager(@NonNull String packageName, 86 @UserIdInt int userId); 87 88 /** 89 * Requests granting of the default permissions to the current default Use Open Wifi app. 90 * @param packageName The default use open wifi package name. 91 * @param userId The user for which to grant the permissions. 92 */ grantDefaultPermissionsToDefaultUseOpenWifiApp(@onNull String packageName, @UserIdInt int userId)93 void grantDefaultPermissionsToDefaultUseOpenWifiApp(@NonNull String packageName, 94 @UserIdInt int userId); 95 96 /** 97 * Grant the default permissions for a user. 98 * 99 * @param userId the user ID 100 */ grantDefaultPermissions(@serIdInt int userId)101 void grantDefaultPermissions(@UserIdInt int userId); 102 103 /** 104 * Schedule reading the default permission exceptions file. 105 */ scheduleReadDefaultPermissionExceptions()106 void scheduleReadDefaultPermissionExceptions(); 107 108 /** 109 * Check whether a particular package should have access to the microphone data from the 110 * SoundTrigger. 111 * 112 * @param uid the uid of the package you are checking against 113 * @param packageName the name of the package you are checking against 114 * @param attributionTag the attributionTag to attach to the app op transaction 115 * @param reason the reason to attach to the app op transaction 116 * @return {@code PERMISSION_GRANTED} if the permission is granted, 117 * or {@code PERMISSION_SOFT/HARD DENIED otherwise 118 */ checkSoundTriggerRecordAudioPermissionForDataDelivery(int uid, @NonNull String packageName, @Nullable String attributionTag, @NonNull String reason)119 int checkSoundTriggerRecordAudioPermissionForDataDelivery(int uid, 120 @NonNull String packageName, @Nullable String attributionTag, @NonNull String reason); 121 122 /** 123 * Provider for package names. 124 */ 125 interface PackagesProvider { 126 /** 127 * Gets the packages for a given user. 128 * @param userId The user id. 129 * @return The package names. 130 */ getPackages(int userId)131 String[] getPackages(int userId); 132 } 133 134 /** 135 * Provider for package names. 136 */ 137 interface SyncAdapterPackagesProvider { 138 /** 139 * Gets the sync adapter packages for given authority and user. 140 * @param authority The authority. 141 * @param userId The user id. 142 * @return The package names. 143 */ getPackages(String authority, int userId)144 String[] getPackages(String authority, int userId); 145 } 146 } 147