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