IPackageManager.aidl revision e1d7c711df3e3a2d2f195457882aa4ddb5626167
1/* 2** 3** Copyright 2007, The Android Open Source Project 4** 5** Licensed under the Apache License, Version 2.0 (the "License"); 6** you may not use this file except in compliance with the License. 7** You may obtain a copy of the License at 8** 9** http://www.apache.org/licenses/LICENSE-2.0 10** 11** Unless required by applicable law or agreed to in writing, software 12** distributed under the License is distributed on an "AS IS" BASIS, 13** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14** See the License for the specific language governing permissions and 15** limitations under the License. 16*/ 17 18package android.content.pm; 19 20import android.content.ComponentName; 21import android.content.Intent; 22import android.content.IntentFilter; 23import android.content.pm.ActivityInfo; 24import android.content.pm.ApplicationInfo; 25import android.content.pm.ContainerEncryptionParams; 26import android.content.pm.FeatureInfo; 27import android.content.pm.IPackageInstallObserver; 28import android.content.pm.IPackageDeleteObserver; 29import android.content.pm.IPackageDataObserver; 30import android.content.pm.IPackageMoveObserver; 31import android.content.pm.IPackageStatsObserver; 32import android.content.pm.InstrumentationInfo; 33import android.content.pm.PackageInfo; 34import android.content.pm.ManifestDigest; 35import android.content.pm.ParceledListSlice; 36import android.content.pm.ProviderInfo; 37import android.content.pm.PermissionGroupInfo; 38import android.content.pm.PermissionInfo; 39import android.content.pm.ResolveInfo; 40import android.content.pm.ServiceInfo; 41import android.content.pm.UserInfo; 42import android.content.pm.VerifierDeviceIdentity; 43import android.net.Uri; 44import android.os.ParcelFileDescriptor; 45import android.content.IntentSender; 46 47/** 48 * See {@link PackageManager} for documentation on most of the APIs 49 * here. 50 * 51 * {@hide} 52 */ 53interface IPackageManager { 54 PackageInfo getPackageInfo(String packageName, int flags, int userId); 55 int getPackageUid(String packageName, int userId); 56 int[] getPackageGids(String packageName); 57 58 String[] currentToCanonicalPackageNames(in String[] names); 59 String[] canonicalToCurrentPackageNames(in String[] names); 60 61 PermissionInfo getPermissionInfo(String name, int flags); 62 63 List<PermissionInfo> queryPermissionsByGroup(String group, int flags); 64 65 PermissionGroupInfo getPermissionGroupInfo(String name, int flags); 66 67 List<PermissionGroupInfo> getAllPermissionGroups(int flags); 68 69 ApplicationInfo getApplicationInfo(String packageName, int flags ,int userId); 70 71 ActivityInfo getActivityInfo(in ComponentName className, int flags, int userId); 72 73 ActivityInfo getReceiverInfo(in ComponentName className, int flags, int userId); 74 75 ServiceInfo getServiceInfo(in ComponentName className, int flags, int userId); 76 77 ProviderInfo getProviderInfo(in ComponentName className, int flags, int userId); 78 79 int checkPermission(String permName, String pkgName); 80 81 int checkUidPermission(String permName, int uid); 82 83 boolean addPermission(in PermissionInfo info); 84 85 void removePermission(String name); 86 87 void grantPermission(String packageName, String permissionName); 88 89 void revokePermission(String packageName, String permissionName); 90 91 boolean isProtectedBroadcast(String actionName); 92 93 int checkSignatures(String pkg1, String pkg2); 94 95 int checkUidSignatures(int uid1, int uid2); 96 97 String[] getPackagesForUid(int uid); 98 99 String getNameForUid(int uid); 100 101 int getUidForSharedUser(String sharedUserName); 102 103 ResolveInfo resolveIntent(in Intent intent, String resolvedType, int flags, int userId); 104 105 List<ResolveInfo> queryIntentActivities(in Intent intent, 106 String resolvedType, int flags, int userId); 107 108 List<ResolveInfo> queryIntentActivityOptions( 109 in ComponentName caller, in Intent[] specifics, 110 in String[] specificTypes, in Intent intent, 111 String resolvedType, int flags, int userId); 112 113 List<ResolveInfo> queryIntentReceivers(in Intent intent, 114 String resolvedType, int flags, int userId); 115 116 ResolveInfo resolveService(in Intent intent, 117 String resolvedType, int flags, int userId); 118 119 List<ResolveInfo> queryIntentServices(in Intent intent, 120 String resolvedType, int flags, int userId); 121 122 /** 123 * This implements getInstalledPackages via a "last returned row" 124 * mechanism that is not exposed in the API. This is to get around the IPC 125 * limit that kicks in when flags are included that bloat up the data 126 * returned. 127 */ 128 ParceledListSlice getInstalledPackages(int flags, in String lastRead); 129 130 /** 131 * This implements getInstalledApplications via a "last returned row" 132 * mechanism that is not exposed in the API. This is to get around the IPC 133 * limit that kicks in when flags are included that bloat up the data 134 * returned. 135 */ 136 ParceledListSlice getInstalledApplications(int flags, in String lastRead, int userId); 137 138 /** 139 * Retrieve all applications that are marked as persistent. 140 * 141 * @return A List<applicationInfo> containing one entry for each persistent 142 * application. 143 */ 144 List<ApplicationInfo> getPersistentApplications(int flags); 145 146 ProviderInfo resolveContentProvider(String name, int flags, int userId); 147 148 /** 149 * Retrieve sync information for all content providers. 150 * 151 * @param outNames Filled in with a list of the root names of the content 152 * providers that can sync. 153 * @param outInfo Filled in with a list of the ProviderInfo for each 154 * name in 'outNames'. 155 */ 156 void querySyncProviders(inout List<String> outNames, 157 inout List<ProviderInfo> outInfo); 158 159 List<ProviderInfo> queryContentProviders( 160 String processName, int uid, int flags); 161 162 InstrumentationInfo getInstrumentationInfo( 163 in ComponentName className, int flags); 164 165 List<InstrumentationInfo> queryInstrumentation( 166 String targetPackage, int flags); 167 168 /** 169 * Install a package. 170 * 171 * @param packageURI The location of the package file to install. 172 * @param observer a callback to use to notify when the package installation in finished. 173 * @param flags - possible values: {@link #FORWARD_LOCK_PACKAGE}, 174 * {@link #REPLACE_EXISITING_PACKAGE} 175 * @param installerPackageName Optional package name of the application that is performing the 176 * installation. This identifies which market the package came from. 177 */ 178 void installPackage(in Uri packageURI, IPackageInstallObserver observer, int flags, 179 in String installerPackageName); 180 181 void finishPackageInstall(int token); 182 183 void setInstallerPackageName(in String targetPackage, in String installerPackageName); 184 185 /** 186 * Delete a package. 187 * 188 * @param packageName The fully qualified name of the package to delete. 189 * @param observer a callback to use to notify when the package deletion in finished. 190 * @param flags - possible values: {@link #DONT_DELETE_DATA} 191 */ 192 void deletePackage(in String packageName, IPackageDeleteObserver observer, int flags); 193 194 String getInstallerPackageName(in String packageName); 195 196 void addPackageToPreferred(String packageName); 197 198 void removePackageFromPreferred(String packageName); 199 200 List<PackageInfo> getPreferredPackages(int flags); 201 202 void addPreferredActivity(in IntentFilter filter, int match, 203 in ComponentName[] set, in ComponentName activity); 204 205 void replacePreferredActivity(in IntentFilter filter, int match, 206 in ComponentName[] set, in ComponentName activity); 207 208 void clearPackagePreferredActivities(String packageName); 209 210 int getPreferredActivities(out List<IntentFilter> outFilters, 211 out List<ComponentName> outActivities, String packageName); 212 213 /** 214 * As per {@link android.content.pm.PackageManager#setComponentEnabledSetting}. 215 */ 216 void setComponentEnabledSetting(in ComponentName componentName, 217 in int newState, in int flags, int userId); 218 219 /** 220 * As per {@link android.content.pm.PackageManager#getComponentEnabledSetting}. 221 */ 222 int getComponentEnabledSetting(in ComponentName componentName, int userId); 223 224 /** 225 * As per {@link android.content.pm.PackageManager#setApplicationEnabledSetting}. 226 */ 227 void setApplicationEnabledSetting(in String packageName, in int newState, int flags, int userId); 228 229 /** 230 * As per {@link android.content.pm.PackageManager#getApplicationEnabledSetting}. 231 */ 232 int getApplicationEnabledSetting(in String packageName, int userId); 233 234 /** 235 * Set whether the given package should be considered stopped, making 236 * it not visible to implicit intents that filter out stopped packages. 237 */ 238 void setPackageStoppedState(String packageName, boolean stopped, int userId); 239 240 /** 241 * Free storage by deleting LRU sorted list of cache files across 242 * all applications. If the currently available free storage 243 * on the device is greater than or equal to the requested 244 * free storage, no cache files are cleared. If the currently 245 * available storage on the device is less than the requested 246 * free storage, some or all of the cache files across 247 * all applications are deleted (based on last accessed time) 248 * to increase the free storage space on the device to 249 * the requested value. There is no guarantee that clearing all 250 * the cache files from all applications will clear up 251 * enough storage to achieve the desired value. 252 * @param freeStorageSize The number of bytes of storage to be 253 * freed by the system. Say if freeStorageSize is XX, 254 * and the current free storage is YY, 255 * if XX is less than YY, just return. if not free XX-YY number 256 * of bytes if possible. 257 * @param observer call back used to notify when 258 * the operation is completed 259 */ 260 void freeStorageAndNotify(in long freeStorageSize, 261 IPackageDataObserver observer); 262 263 /** 264 * Free storage by deleting LRU sorted list of cache files across 265 * all applications. If the currently available free storage 266 * on the device is greater than or equal to the requested 267 * free storage, no cache files are cleared. If the currently 268 * available storage on the device is less than the requested 269 * free storage, some or all of the cache files across 270 * all applications are deleted (based on last accessed time) 271 * to increase the free storage space on the device to 272 * the requested value. There is no guarantee that clearing all 273 * the cache files from all applications will clear up 274 * enough storage to achieve the desired value. 275 * @param freeStorageSize The number of bytes of storage to be 276 * freed by the system. Say if freeStorageSize is XX, 277 * and the current free storage is YY, 278 * if XX is less than YY, just return. if not free XX-YY number 279 * of bytes if possible. 280 * @param pi IntentSender call back used to 281 * notify when the operation is completed.May be null 282 * to indicate that no call back is desired. 283 */ 284 void freeStorage(in long freeStorageSize, 285 in IntentSender pi); 286 287 /** 288 * Delete all the cache files in an applications cache directory 289 * @param packageName The package name of the application whose cache 290 * files need to be deleted 291 * @param observer a callback used to notify when the deletion is finished. 292 */ 293 void deleteApplicationCacheFiles(in String packageName, IPackageDataObserver observer); 294 295 /** 296 * Clear the user data directory of an application. 297 * @param packageName The package name of the application whose cache 298 * files need to be deleted 299 * @param observer a callback used to notify when the operation is completed. 300 */ 301 void clearApplicationUserData(in String packageName, IPackageDataObserver observer, int userId); 302 303 /** 304 * Get package statistics including the code, data and cache size for 305 * an already installed package 306 * @param packageName The package name of the application 307 * @param observer a callback to use to notify when the asynchronous 308 * retrieval of information is complete. 309 */ 310 void getPackageSizeInfo(in String packageName, IPackageStatsObserver observer); 311 312 /** 313 * Get a list of shared libraries that are available on the 314 * system. 315 */ 316 String[] getSystemSharedLibraryNames(); 317 318 /** 319 * Get a list of features that are available on the 320 * system. 321 */ 322 FeatureInfo[] getSystemAvailableFeatures(); 323 324 boolean hasSystemFeature(String name); 325 326 void enterSafeMode(); 327 boolean isSafeMode(); 328 void systemReady(); 329 boolean hasSystemUidErrors(); 330 331 /** 332 * Ask the package manager to perform boot-time dex-opt of all 333 * existing packages. 334 */ 335 void performBootDexOpt(); 336 337 /** 338 * Ask the package manager to perform dex-opt (if needed) on the given 339 * package, if it already hasn't done mode. Only does this if running 340 * in the special development "no pre-dexopt" mode. 341 */ 342 boolean performDexOpt(String packageName); 343 344 /** 345 * Update status of external media on the package manager to scan and 346 * install packages installed on the external media. Like say the 347 * MountService uses this to call into the package manager to update 348 * status of sdcard. 349 */ 350 void updateExternalMediaStatus(boolean mounted, boolean reportStatus); 351 352 String nextPackageToClean(String lastPackage); 353 354 void movePackage(String packageName, IPackageMoveObserver observer, int flags); 355 356 boolean addPermissionAsync(in PermissionInfo info); 357 358 boolean setInstallLocation(int loc); 359 int getInstallLocation(); 360 361 UserInfo createUser(in String name, int flags); 362 boolean removeUser(int userId); 363 void setUserName(int userId, String name); 364 ParcelFileDescriptor setUserIcon(int userId); 365 366 void installPackageWithVerification(in Uri packageURI, in IPackageInstallObserver observer, 367 int flags, in String installerPackageName, in Uri verificationURI, 368 in ManifestDigest manifestDigest, in ContainerEncryptionParams encryptionParams); 369 370 void verifyPendingInstall(int id, int verificationCode); 371 372 VerifierDeviceIdentity getVerifierDeviceIdentity(); 373 374 boolean isFirstBoot(); 375 376 List<UserInfo> getUsers(); 377 UserInfo getUser(int userId); 378 379 void setPermissionEnforced(String permission, boolean enforced); 380 boolean isPermissionEnforced(String permission); 381 382 /** Reflects current DeviceStorageMonitorService state */ 383 boolean isStorageLow(); 384} 385