IPackageManager.aidl revision 2d7576b082b84068fb9d68419b710b9bec49139b
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.IPackageInstallObserver2; 28import android.content.pm.IPackageInstaller; 29import android.content.pm.IPackageDeleteObserver; 30import android.content.pm.IPackageDeleteObserver2; 31import android.content.pm.IPackageDataObserver; 32import android.content.pm.IPackageMoveObserver; 33import android.content.pm.IPackageStatsObserver; 34import android.content.pm.InstrumentationInfo; 35import android.content.pm.KeySet; 36import android.content.pm.PackageInfo; 37import android.content.pm.ManifestDigest; 38import android.content.pm.PackageCleanItem; 39import android.content.pm.ParceledListSlice; 40import android.content.pm.ProviderInfo; 41import android.content.pm.PermissionGroupInfo; 42import android.content.pm.PermissionInfo; 43import android.content.pm.ResolveInfo; 44import android.content.pm.ServiceInfo; 45import android.content.pm.UserInfo; 46import android.content.pm.VerificationParams; 47import android.content.pm.VerifierDeviceIdentity; 48import android.net.Uri; 49import android.os.ParcelFileDescriptor; 50import android.content.IntentSender; 51 52/** 53 * See {@link PackageManager} for documentation on most of the APIs 54 * here. 55 * 56 * {@hide} 57 */ 58interface IPackageManager { 59 boolean isPackageAvailable(String packageName, int userId); 60 PackageInfo getPackageInfo(String packageName, int flags, int userId); 61 int getPackageUid(String packageName, int userId); 62 int[] getPackageGids(String packageName); 63 64 String[] currentToCanonicalPackageNames(in String[] names); 65 String[] canonicalToCurrentPackageNames(in String[] names); 66 67 PermissionInfo getPermissionInfo(String name, int flags); 68 69 List<PermissionInfo> queryPermissionsByGroup(String group, int flags); 70 71 PermissionGroupInfo getPermissionGroupInfo(String name, int flags); 72 73 List<PermissionGroupInfo> getAllPermissionGroups(int flags); 74 75 ApplicationInfo getApplicationInfo(String packageName, int flags ,int userId); 76 77 ActivityInfo getActivityInfo(in ComponentName className, int flags, int userId); 78 79 boolean activitySupportsIntent(in ComponentName className, in Intent intent, 80 String resolvedType); 81 82 ActivityInfo getReceiverInfo(in ComponentName className, int flags, int userId); 83 84 ServiceInfo getServiceInfo(in ComponentName className, int flags, int userId); 85 86 ProviderInfo getProviderInfo(in ComponentName className, int flags, int userId); 87 88 int checkPermission(String permName, String pkgName); 89 90 int checkUidPermission(String permName, int uid); 91 92 boolean addPermission(in PermissionInfo info); 93 94 void removePermission(String name); 95 96 void grantPermission(String packageName, String permissionName); 97 98 void revokePermission(String packageName, String permissionName); 99 100 boolean isProtectedBroadcast(String actionName); 101 102 int checkSignatures(String pkg1, String pkg2); 103 104 int checkUidSignatures(int uid1, int uid2); 105 106 String[] getPackagesForUid(int uid); 107 108 String getNameForUid(int uid); 109 110 int getUidForSharedUser(String sharedUserName); 111 112 int getFlagsForUid(int uid); 113 114 boolean isUidPrivileged(int uid); 115 116 String[] getAppOpPermissionPackages(String permissionName); 117 118 ResolveInfo resolveIntent(in Intent intent, String resolvedType, int flags, int userId); 119 120 boolean canForwardTo(in Intent intent, String resolvedType, int sourceUserId, int targetUserId); 121 122 List<ResolveInfo> queryIntentActivities(in Intent intent, 123 String resolvedType, int flags, int userId); 124 125 List<ResolveInfo> queryIntentActivityOptions( 126 in ComponentName caller, in Intent[] specifics, 127 in String[] specificTypes, in Intent intent, 128 String resolvedType, int flags, int userId); 129 130 List<ResolveInfo> queryIntentReceivers(in Intent intent, 131 String resolvedType, int flags, int userId); 132 133 ResolveInfo resolveService(in Intent intent, 134 String resolvedType, int flags, int userId); 135 136 List<ResolveInfo> queryIntentServices(in Intent intent, 137 String resolvedType, int flags, int userId); 138 139 List<ResolveInfo> queryIntentContentProviders(in Intent intent, 140 String resolvedType, int flags, int userId); 141 142 /** 143 * This implements getInstalledPackages via a "last returned row" 144 * mechanism that is not exposed in the API. This is to get around the IPC 145 * limit that kicks in when flags are included that bloat up the data 146 * returned. 147 */ 148 ParceledListSlice getInstalledPackages(int flags, in int userId); 149 150 /** 151 * This implements getPackagesHoldingPermissions via a "last returned row" 152 * mechanism that is not exposed in the API. This is to get around the IPC 153 * limit that kicks in when flags are included that bloat up the data 154 * returned. 155 */ 156 ParceledListSlice getPackagesHoldingPermissions(in String[] permissions, 157 int flags, int userId); 158 159 /** 160 * This implements getInstalledApplications via a "last returned row" 161 * mechanism that is not exposed in the API. This is to get around the IPC 162 * limit that kicks in when flags are included that bloat up the data 163 * returned. 164 */ 165 ParceledListSlice getInstalledApplications(int flags, int userId); 166 167 /** 168 * Retrieve all applications that are marked as persistent. 169 * 170 * @return A List<applicationInfo> containing one entry for each persistent 171 * application. 172 */ 173 List<ApplicationInfo> getPersistentApplications(int flags); 174 175 ProviderInfo resolveContentProvider(String name, int flags, int userId); 176 177 /** 178 * Retrieve sync information for all content providers. 179 * 180 * @param outNames Filled in with a list of the root names of the content 181 * providers that can sync. 182 * @param outInfo Filled in with a list of the ProviderInfo for each 183 * name in 'outNames'. 184 */ 185 void querySyncProviders(inout List<String> outNames, 186 inout List<ProviderInfo> outInfo); 187 188 List<ProviderInfo> queryContentProviders( 189 String processName, int uid, int flags); 190 191 InstrumentationInfo getInstrumentationInfo( 192 in ComponentName className, int flags); 193 194 List<InstrumentationInfo> queryInstrumentation( 195 String targetPackage, int flags); 196 197 void installPackage(in String originPath, 198 in IPackageInstallObserver2 observer, 199 int flags, 200 in String installerPackageName, 201 in VerificationParams verificationParams, 202 in String packageAbiOverride); 203 204 void installPackageAsUser(in String originPath, 205 in IPackageInstallObserver2 observer, 206 int flags, 207 in String installerPackageName, 208 in VerificationParams verificationParams, 209 in String packageAbiOverride, 210 int userId); 211 212 void finishPackageInstall(int token); 213 214 void setInstallerPackageName(in String targetPackage, in String installerPackageName); 215 216 /** @deprecated rawr, don't call AIDL methods directly! */ 217 void deletePackageAsUser(in String packageName, IPackageDeleteObserver observer, 218 int userId, int flags); 219 220 /** 221 * Delete a package for a specific user. 222 * 223 * @param packageName The fully qualified name of the package to delete. 224 * @param observer a callback to use to notify when the package deletion in finished. 225 * @param userId the id of the user for whom to delete the package 226 * @param flags - possible values: {@link #DONT_DELETE_DATA} 227 */ 228 void deletePackage(in String packageName, IPackageDeleteObserver2 observer, int userId, int flags); 229 230 String getInstallerPackageName(in String packageName); 231 232 void addPackageToPreferred(String packageName); 233 234 void removePackageFromPreferred(String packageName); 235 236 List<PackageInfo> getPreferredPackages(int flags); 237 238 void resetPreferredActivities(int userId); 239 240 ResolveInfo getLastChosenActivity(in Intent intent, 241 String resolvedType, int flags); 242 243 void setLastChosenActivity(in Intent intent, String resolvedType, int flags, 244 in IntentFilter filter, int match, in ComponentName activity); 245 246 void addPreferredActivity(in IntentFilter filter, int match, 247 in ComponentName[] set, in ComponentName activity, int userId); 248 249 void replacePreferredActivity(in IntentFilter filter, int match, 250 in ComponentName[] set, in ComponentName activity, int userId); 251 252 void clearPackagePreferredActivities(String packageName); 253 254 int getPreferredActivities(out List<IntentFilter> outFilters, 255 out List<ComponentName> outActivities, String packageName); 256 257 void addPersistentPreferredActivity(in IntentFilter filter, in ComponentName activity, int userId); 258 259 void clearPackagePersistentPreferredActivities(String packageName, int userId); 260 261 void addCrossProfileIntentFilter(in IntentFilter intentFilter, String ownerPackage, 262 int ownerUserId, int sourceUserId, int targetUserId, int flags); 263 264 void clearCrossProfileIntentFilters(int sourceUserId, String ownerPackage, int ownerUserId); 265 266 /** 267 * Report the set of 'Home' activity candidates, plus (if any) which of them 268 * is the current "always use this one" setting. 269 */ 270 ComponentName getHomeActivities(out List<ResolveInfo> outHomeCandidates); 271 272 /** 273 * As per {@link android.content.pm.PackageManager#setComponentEnabledSetting}. 274 */ 275 void setComponentEnabledSetting(in ComponentName componentName, 276 in int newState, in int flags, int userId); 277 278 /** 279 * As per {@link android.content.pm.PackageManager#getComponentEnabledSetting}. 280 */ 281 int getComponentEnabledSetting(in ComponentName componentName, int userId); 282 283 /** 284 * As per {@link android.content.pm.PackageManager#setApplicationEnabledSetting}. 285 */ 286 void setApplicationEnabledSetting(in String packageName, in int newState, int flags, 287 int userId, String callingPackage); 288 289 /** 290 * As per {@link android.content.pm.PackageManager#getApplicationEnabledSetting}. 291 */ 292 int getApplicationEnabledSetting(in String packageName, int userId); 293 294 /** 295 * Set whether the given package should be considered stopped, making 296 * it not visible to implicit intents that filter out stopped packages. 297 */ 298 void setPackageStoppedState(String packageName, boolean stopped, int userId); 299 300 /** 301 * Free storage by deleting LRU sorted list of cache files across 302 * all applications. If the currently available free storage 303 * on the device is greater than or equal to the requested 304 * free storage, no cache files are cleared. If the currently 305 * available storage on the device is less than the requested 306 * free storage, some or all of the cache files across 307 * all applications are deleted (based on last accessed time) 308 * to increase the free storage space on the device to 309 * the requested value. There is no guarantee that clearing all 310 * the cache files from all applications will clear up 311 * enough storage to achieve the desired value. 312 * @param freeStorageSize The number of bytes of storage to be 313 * freed by the system. Say if freeStorageSize is XX, 314 * and the current free storage is YY, 315 * if XX is less than YY, just return. if not free XX-YY number 316 * of bytes if possible. 317 * @param observer call back used to notify when 318 * the operation is completed 319 */ 320 void freeStorageAndNotify(in long freeStorageSize, 321 IPackageDataObserver observer); 322 323 /** 324 * Free storage by deleting LRU sorted list of cache files across 325 * all applications. If the currently available free storage 326 * on the device is greater than or equal to the requested 327 * free storage, no cache files are cleared. If the currently 328 * available storage on the device is less than the requested 329 * free storage, some or all of the cache files across 330 * all applications are deleted (based on last accessed time) 331 * to increase the free storage space on the device to 332 * the requested value. There is no guarantee that clearing all 333 * the cache files from all applications will clear up 334 * enough storage to achieve the desired value. 335 * @param freeStorageSize The number of bytes of storage to be 336 * freed by the system. Say if freeStorageSize is XX, 337 * and the current free storage is YY, 338 * if XX is less than YY, just return. if not free XX-YY number 339 * of bytes if possible. 340 * @param pi IntentSender call back used to 341 * notify when the operation is completed.May be null 342 * to indicate that no call back is desired. 343 */ 344 void freeStorage(in long freeStorageSize, 345 in IntentSender pi); 346 347 /** 348 * Delete all the cache files in an applications cache directory 349 * @param packageName The package name of the application whose cache 350 * files need to be deleted 351 * @param observer a callback used to notify when the deletion is finished. 352 */ 353 void deleteApplicationCacheFiles(in String packageName, IPackageDataObserver observer); 354 355 /** 356 * Clear the user data directory of an application. 357 * @param packageName The package name of the application whose cache 358 * files need to be deleted 359 * @param observer a callback used to notify when the operation is completed. 360 */ 361 void clearApplicationUserData(in String packageName, IPackageDataObserver observer, int userId); 362 363 /** 364 * Get package statistics including the code, data and cache size for 365 * an already installed package 366 * @param packageName The package name of the application 367 * @param userHandle Which user the size should be retrieved for 368 * @param observer a callback to use to notify when the asynchronous 369 * retrieval of information is complete. 370 */ 371 void getPackageSizeInfo(in String packageName, int userHandle, IPackageStatsObserver observer); 372 373 /** 374 * Get a list of shared libraries that are available on the 375 * system. 376 */ 377 String[] getSystemSharedLibraryNames(); 378 379 /** 380 * Get a list of features that are available on the 381 * system. 382 */ 383 FeatureInfo[] getSystemAvailableFeatures(); 384 385 boolean hasSystemFeature(String name); 386 387 void enterSafeMode(); 388 boolean isSafeMode(); 389 void systemReady(); 390 boolean hasSystemUidErrors(); 391 392 /** 393 * Ask the package manager to perform boot-time dex-opt of all 394 * existing packages. 395 */ 396 void performBootDexOpt(); 397 398 /** 399 * Ask the package manager to perform dex-opt (if needed) on the given 400 * package and for the given instruction set if it already hasn't done 401 * so. 402 * 403 * If the supplied instructionSet is null, the package manager will use 404 * the packages default instruction set. 405 * 406 * In most cases, apps are dexopted in advance and this function will 407 * be a no-op. 408 */ 409 boolean performDexOptIfNeeded(String packageName, String instructionSet); 410 411 void forceDexOpt(String packageName); 412 413 /** 414 * Update status of external media on the package manager to scan and 415 * install packages installed on the external media. Like say the 416 * MountService uses this to call into the package manager to update 417 * status of sdcard. 418 */ 419 void updateExternalMediaStatus(boolean mounted, boolean reportStatus); 420 421 PackageCleanItem nextPackageToClean(in PackageCleanItem lastPackage); 422 423 void movePackage(String packageName, IPackageMoveObserver observer, int flags); 424 425 boolean addPermissionAsync(in PermissionInfo info); 426 427 boolean setInstallLocation(int loc); 428 int getInstallLocation(); 429 430 int installExistingPackageAsUser(String packageName, int userId); 431 432 void verifyPendingInstall(int id, int verificationCode); 433 void extendVerificationTimeout(int id, int verificationCodeAtTimeout, long millisecondsToDelay); 434 435 VerifierDeviceIdentity getVerifierDeviceIdentity(); 436 437 boolean isFirstBoot(); 438 boolean isOnlyCoreApps(); 439 440 void setPermissionEnforced(String permission, boolean enforced); 441 boolean isPermissionEnforced(String permission); 442 443 /** Reflects current DeviceStorageMonitorService state */ 444 boolean isStorageLow(); 445 446 boolean setApplicationHiddenSettingAsUser(String packageName, boolean hidden, int userId); 447 boolean getApplicationHiddenSettingAsUser(String packageName, int userId); 448 449 IPackageInstaller getPackageInstaller(); 450 451 boolean setBlockUninstallForUser(String packageName, boolean blockUninstall, int userId); 452 boolean getBlockUninstallForUser(String packageName, int userId); 453 454 KeySet getKeySetByAlias(String packageName, String alias); 455 KeySet getSigningKeySet(String packageName); 456 boolean isPackageSignedByKeySet(String packageName, in KeySet ks); 457 boolean isPackageSignedByKeySetExactly(String packageName, in KeySet ks); 458} 459