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