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 18 package android.content.pm; 19 20 import android.content.ComponentName; 21 import android.content.Intent; 22 import android.content.IntentFilter; 23 import android.content.pm.ActivityInfo; 24 import android.content.pm.ApplicationInfo; 25 import android.content.pm.ChangedPackages; 26 import android.content.pm.InstantAppInfo; 27 import android.content.pm.FeatureInfo; 28 import android.content.pm.IDexModuleRegisterCallback; 29 import android.content.pm.IPackageInstaller; 30 import android.content.pm.IPackageDeleteObserver; 31 import android.content.pm.IPackageDeleteObserver2; 32 import android.content.pm.IPackageDataObserver; 33 import android.content.pm.IPackageMoveObserver; 34 import android.content.pm.IPackageStatsObserver; 35 import android.content.pm.IOnPermissionsChangeListener; 36 import android.content.pm.IntentFilterVerificationInfo; 37 import android.content.pm.InstrumentationInfo; 38 import android.content.pm.KeySet; 39 import android.content.pm.ModuleInfo; 40 import android.content.pm.PackageInfo; 41 import android.content.pm.ParceledListSlice; 42 import android.content.pm.ProviderInfo; 43 import android.content.pm.PermissionGroupInfo; 44 import android.content.pm.PermissionInfo; 45 import android.content.pm.ResolveInfo; 46 import android.content.pm.ServiceInfo; 47 import android.content.pm.SuspendDialogInfo; 48 import android.content.pm.UserInfo; 49 import android.content.pm.VerifierDeviceIdentity; 50 import android.content.pm.VersionedPackage; 51 import android.content.pm.dex.IArtManager; 52 import android.graphics.Bitmap; 53 import android.net.Uri; 54 import android.os.ParcelFileDescriptor; 55 import android.os.PersistableBundle; 56 import android.content.IntentSender; 57 58 /** 59 * See {@link PackageManager} for documentation on most of the APIs 60 * here. 61 * 62 * {@hide} 63 */ 64 interface IPackageManager { checkPackageStartable(String packageName, int userId)65 void checkPackageStartable(String packageName, int userId); 66 @UnsupportedAppUsage isPackageAvailable(String packageName, int userId)67 boolean isPackageAvailable(String packageName, int userId); 68 @UnsupportedAppUsage getPackageInfo(String packageName, int flags, int userId)69 PackageInfo getPackageInfo(String packageName, int flags, int userId); getPackageInfoVersioned(in VersionedPackage versionedPackage, int flags, int userId)70 PackageInfo getPackageInfoVersioned(in VersionedPackage versionedPackage, 71 int flags, int userId); 72 @UnsupportedAppUsage getPackageUid(String packageName, int flags, int userId)73 int getPackageUid(String packageName, int flags, int userId); getPackageGids(String packageName, int flags, int userId)74 int[] getPackageGids(String packageName, int flags, int userId); 75 76 @UnsupportedAppUsage currentToCanonicalPackageNames(in String[] names)77 String[] currentToCanonicalPackageNames(in String[] names); 78 @UnsupportedAppUsage canonicalToCurrentPackageNames(in String[] names)79 String[] canonicalToCurrentPackageNames(in String[] names); 80 getPermissionInfo(String name, String packageName, int flags)81 PermissionInfo getPermissionInfo(String name, String packageName, int flags); 82 queryPermissionsByGroup(String group, int flags)83 ParceledListSlice queryPermissionsByGroup(String group, int flags); 84 85 @UnsupportedAppUsage getPermissionGroupInfo(String name, int flags)86 PermissionGroupInfo getPermissionGroupInfo(String name, int flags); 87 getAllPermissionGroups(int flags)88 ParceledListSlice getAllPermissionGroups(int flags); 89 90 @UnsupportedAppUsage getApplicationInfo(String packageName, int flags ,int userId)91 ApplicationInfo getApplicationInfo(String packageName, int flags ,int userId); 92 93 @UnsupportedAppUsage getActivityInfo(in ComponentName className, int flags, int userId)94 ActivityInfo getActivityInfo(in ComponentName className, int flags, int userId); 95 activitySupportsIntent(in ComponentName className, in Intent intent, String resolvedType)96 boolean activitySupportsIntent(in ComponentName className, in Intent intent, 97 String resolvedType); 98 99 @UnsupportedAppUsage getReceiverInfo(in ComponentName className, int flags, int userId)100 ActivityInfo getReceiverInfo(in ComponentName className, int flags, int userId); 101 102 @UnsupportedAppUsage getServiceInfo(in ComponentName className, int flags, int userId)103 ServiceInfo getServiceInfo(in ComponentName className, int flags, int userId); 104 105 @UnsupportedAppUsage getProviderInfo(in ComponentName className, int flags, int userId)106 ProviderInfo getProviderInfo(in ComponentName className, int flags, int userId); 107 108 @UnsupportedAppUsage checkPermission(String permName, String pkgName, int userId)109 int checkPermission(String permName, String pkgName, int userId); 110 checkUidPermission(String permName, int uid)111 int checkUidPermission(String permName, int uid); 112 113 @UnsupportedAppUsage addPermission(in PermissionInfo info)114 boolean addPermission(in PermissionInfo info); 115 116 @UnsupportedAppUsage removePermission(String name)117 void removePermission(String name); 118 119 @UnsupportedAppUsage grantRuntimePermission(String packageName, String permissionName, int userId)120 void grantRuntimePermission(String packageName, String permissionName, int userId); 121 revokeRuntimePermission(String packageName, String permissionName, int userId)122 void revokeRuntimePermission(String packageName, String permissionName, int userId); 123 resetRuntimePermissions()124 void resetRuntimePermissions(); 125 getPermissionFlags(String permissionName, String packageName, int userId)126 int getPermissionFlags(String permissionName, String packageName, int userId); 127 updatePermissionFlags(String permissionName, String packageName, int flagMask, int flagValues, boolean checkAdjustPolicyFlagPermission, int userId)128 void updatePermissionFlags(String permissionName, String packageName, int flagMask, 129 int flagValues, boolean checkAdjustPolicyFlagPermission, int userId); 130 updatePermissionFlagsForAllApps(int flagMask, int flagValues, int userId)131 void updatePermissionFlagsForAllApps(int flagMask, int flagValues, int userId); 132 getWhitelistedRestrictedPermissions(String packageName, int flags, int userId)133 List<String> getWhitelistedRestrictedPermissions(String packageName, int flags, 134 int userId); 135 addWhitelistedRestrictedPermission(String packageName, String permission, int whitelistFlags, int userId)136 boolean addWhitelistedRestrictedPermission(String packageName, String permission, 137 int whitelistFlags, int userId); 138 removeWhitelistedRestrictedPermission(String packageName, String permission, int whitelistFlags, int userId)139 boolean removeWhitelistedRestrictedPermission(String packageName, String permission, 140 int whitelistFlags, int userId); 141 shouldShowRequestPermissionRationale(String permissionName, String packageName, int userId)142 boolean shouldShowRequestPermissionRationale(String permissionName, 143 String packageName, int userId); 144 isProtectedBroadcast(String actionName)145 boolean isProtectedBroadcast(String actionName); 146 147 @UnsupportedAppUsage checkSignatures(String pkg1, String pkg2)148 int checkSignatures(String pkg1, String pkg2); 149 150 @UnsupportedAppUsage checkUidSignatures(int uid1, int uid2)151 int checkUidSignatures(int uid1, int uid2); 152 getAllPackages()153 List<String> getAllPackages(); 154 155 @UnsupportedAppUsage getPackagesForUid(int uid)156 String[] getPackagesForUid(int uid); 157 158 @UnsupportedAppUsage getNameForUid(int uid)159 String getNameForUid(int uid); getNamesForUids(in int[] uids)160 String[] getNamesForUids(in int[] uids); 161 162 @UnsupportedAppUsage getUidForSharedUser(String sharedUserName)163 int getUidForSharedUser(String sharedUserName); 164 165 @UnsupportedAppUsage getFlagsForUid(int uid)166 int getFlagsForUid(int uid); 167 getPrivateFlagsForUid(int uid)168 int getPrivateFlagsForUid(int uid); 169 170 @UnsupportedAppUsage isUidPrivileged(int uid)171 boolean isUidPrivileged(int uid); 172 173 @UnsupportedAppUsage getAppOpPermissionPackages(String permissionName)174 String[] getAppOpPermissionPackages(String permissionName); 175 176 @UnsupportedAppUsage resolveIntent(in Intent intent, String resolvedType, int flags, int userId)177 ResolveInfo resolveIntent(in Intent intent, String resolvedType, int flags, int userId); 178 findPersistentPreferredActivity(in Intent intent, int userId)179 ResolveInfo findPersistentPreferredActivity(in Intent intent, int userId); 180 canForwardTo(in Intent intent, String resolvedType, int sourceUserId, int targetUserId)181 boolean canForwardTo(in Intent intent, String resolvedType, int sourceUserId, int targetUserId); 182 183 @UnsupportedAppUsage queryIntentActivities(in Intent intent, String resolvedType, int flags, int userId)184 ParceledListSlice queryIntentActivities(in Intent intent, 185 String resolvedType, int flags, int userId); 186 queryIntentActivityOptions( in ComponentName caller, in Intent[] specifics, in String[] specificTypes, in Intent intent, String resolvedType, int flags, int userId)187 ParceledListSlice queryIntentActivityOptions( 188 in ComponentName caller, in Intent[] specifics, 189 in String[] specificTypes, in Intent intent, 190 String resolvedType, int flags, int userId); 191 queryIntentReceivers(in Intent intent, String resolvedType, int flags, int userId)192 ParceledListSlice queryIntentReceivers(in Intent intent, 193 String resolvedType, int flags, int userId); 194 resolveService(in Intent intent, String resolvedType, int flags, int userId)195 ResolveInfo resolveService(in Intent intent, 196 String resolvedType, int flags, int userId); 197 queryIntentServices(in Intent intent, String resolvedType, int flags, int userId)198 ParceledListSlice queryIntentServices(in Intent intent, 199 String resolvedType, int flags, int userId); 200 queryIntentContentProviders(in Intent intent, String resolvedType, int flags, int userId)201 ParceledListSlice queryIntentContentProviders(in Intent intent, 202 String resolvedType, int flags, int userId); 203 204 /** 205 * This implements getInstalledPackages via a "last returned row" 206 * mechanism that is not exposed in the API. This is to get around the IPC 207 * limit that kicks in when flags are included that bloat up the data 208 * returned. 209 */ 210 @UnsupportedAppUsage getInstalledPackages(int flags, in int userId)211 ParceledListSlice getInstalledPackages(int flags, in int userId); 212 213 /** 214 * This implements getPackagesHoldingPermissions via a "last returned row" 215 * mechanism that is not exposed in the API. This is to get around the IPC 216 * limit that kicks in when flags are included that bloat up the data 217 * returned. 218 */ getPackagesHoldingPermissions(in String[] permissions, int flags, int userId)219 ParceledListSlice getPackagesHoldingPermissions(in String[] permissions, 220 int flags, int userId); 221 222 /** 223 * This implements getInstalledApplications via a "last returned row" 224 * mechanism that is not exposed in the API. This is to get around the IPC 225 * limit that kicks in when flags are included that bloat up the data 226 * returned. 227 */ 228 @UnsupportedAppUsage getInstalledApplications(int flags, int userId)229 ParceledListSlice getInstalledApplications(int flags, int userId); 230 231 /** 232 * Retrieve all applications that are marked as persistent. 233 * 234 * @return A List<applicationInfo> containing one entry for each persistent 235 * application. 236 */ getPersistentApplications(int flags)237 ParceledListSlice getPersistentApplications(int flags); 238 resolveContentProvider(String name, int flags, int userId)239 ProviderInfo resolveContentProvider(String name, int flags, int userId); 240 241 /** 242 * Retrieve sync information for all content providers. 243 * 244 * @param outNames Filled in with a list of the root names of the content 245 * providers that can sync. 246 * @param outInfo Filled in with a list of the ProviderInfo for each 247 * name in 'outNames'. 248 */ 249 @UnsupportedAppUsage querySyncProviders(inout List<String> outNames, inout List<ProviderInfo> outInfo)250 void querySyncProviders(inout List<String> outNames, 251 inout List<ProviderInfo> outInfo); 252 queryContentProviders( String processName, int uid, int flags, String metaDataKey)253 ParceledListSlice queryContentProviders( 254 String processName, int uid, int flags, String metaDataKey); 255 256 @UnsupportedAppUsage getInstrumentationInfo( in ComponentName className, int flags)257 InstrumentationInfo getInstrumentationInfo( 258 in ComponentName className, int flags); 259 260 @UnsupportedAppUsage queryInstrumentation( String targetPackage, int flags)261 ParceledListSlice queryInstrumentation( 262 String targetPackage, int flags); 263 finishPackageInstall(int token, boolean didLaunch)264 void finishPackageInstall(int token, boolean didLaunch); 265 266 @UnsupportedAppUsage setInstallerPackageName(in String targetPackage, in String installerPackageName)267 void setInstallerPackageName(in String targetPackage, in String installerPackageName); 268 setApplicationCategoryHint(String packageName, int categoryHint, String callerPackageName)269 void setApplicationCategoryHint(String packageName, int categoryHint, String callerPackageName); 270 271 /** @deprecated rawr, don't call AIDL methods directly! */ deletePackageAsUser(in String packageName, int versionCode, IPackageDeleteObserver observer, int userId, int flags)272 void deletePackageAsUser(in String packageName, int versionCode, 273 IPackageDeleteObserver observer, int userId, int flags); 274 275 /** 276 * Delete a package for a specific user. 277 * 278 * @param versionedPackage The package to delete. 279 * @param observer a callback to use to notify when the package deletion in finished. 280 * @param userId the id of the user for whom to delete the package 281 * @param flags - possible values: {@link #DONT_DELETE_DATA} 282 */ deletePackageVersioned(in VersionedPackage versionedPackage, IPackageDeleteObserver2 observer, int userId, int flags)283 void deletePackageVersioned(in VersionedPackage versionedPackage, 284 IPackageDeleteObserver2 observer, int userId, int flags); 285 286 @UnsupportedAppUsage getInstallerPackageName(in String packageName)287 String getInstallerPackageName(in String packageName); 288 resetApplicationPreferences(int userId)289 void resetApplicationPreferences(int userId); 290 291 @UnsupportedAppUsage getLastChosenActivity(in Intent intent, String resolvedType, int flags)292 ResolveInfo getLastChosenActivity(in Intent intent, 293 String resolvedType, int flags); 294 295 @UnsupportedAppUsage setLastChosenActivity(in Intent intent, String resolvedType, int flags, in IntentFilter filter, int match, in ComponentName activity)296 void setLastChosenActivity(in Intent intent, String resolvedType, int flags, 297 in IntentFilter filter, int match, in ComponentName activity); 298 addPreferredActivity(in IntentFilter filter, int match, in ComponentName[] set, in ComponentName activity, int userId)299 void addPreferredActivity(in IntentFilter filter, int match, 300 in ComponentName[] set, in ComponentName activity, int userId); 301 302 @UnsupportedAppUsage replacePreferredActivity(in IntentFilter filter, int match, in ComponentName[] set, in ComponentName activity, int userId)303 void replacePreferredActivity(in IntentFilter filter, int match, 304 in ComponentName[] set, in ComponentName activity, int userId); 305 306 @UnsupportedAppUsage clearPackagePreferredActivities(String packageName)307 void clearPackagePreferredActivities(String packageName); 308 309 @UnsupportedAppUsage getPreferredActivities(out List<IntentFilter> outFilters, out List<ComponentName> outActivities, String packageName)310 int getPreferredActivities(out List<IntentFilter> outFilters, 311 out List<ComponentName> outActivities, String packageName); 312 addPersistentPreferredActivity(in IntentFilter filter, in ComponentName activity, int userId)313 void addPersistentPreferredActivity(in IntentFilter filter, in ComponentName activity, int userId); 314 clearPackagePersistentPreferredActivities(String packageName, int userId)315 void clearPackagePersistentPreferredActivities(String packageName, int userId); 316 addCrossProfileIntentFilter(in IntentFilter intentFilter, String ownerPackage, int sourceUserId, int targetUserId, int flags)317 void addCrossProfileIntentFilter(in IntentFilter intentFilter, String ownerPackage, 318 int sourceUserId, int targetUserId, int flags); 319 clearCrossProfileIntentFilters(int sourceUserId, String ownerPackage)320 void clearCrossProfileIntentFilters(int sourceUserId, String ownerPackage); 321 setDistractingPackageRestrictionsAsUser(in String[] packageNames, int restrictionFlags, int userId)322 String[] setDistractingPackageRestrictionsAsUser(in String[] packageNames, int restrictionFlags, 323 int userId); 324 setPackagesSuspendedAsUser(in String[] packageNames, boolean suspended, in PersistableBundle appExtras, in PersistableBundle launcherExtras, in SuspendDialogInfo dialogInfo, String callingPackage, int userId)325 String[] setPackagesSuspendedAsUser(in String[] packageNames, boolean suspended, 326 in PersistableBundle appExtras, in PersistableBundle launcherExtras, 327 in SuspendDialogInfo dialogInfo, String callingPackage, int userId); 328 getUnsuspendablePackagesForUser(in String[] packageNames, int userId)329 String[] getUnsuspendablePackagesForUser(in String[] packageNames, int userId); 330 isPackageSuspendedForUser(String packageName, int userId)331 boolean isPackageSuspendedForUser(String packageName, int userId); 332 getSuspendedPackageAppExtras(String packageName, int userId)333 PersistableBundle getSuspendedPackageAppExtras(String packageName, int userId); 334 335 /** 336 * Backup/restore support - only the system uid may use these. 337 */ getPreferredActivityBackup(int userId)338 byte[] getPreferredActivityBackup(int userId); restorePreferredActivities(in byte[] backup, int userId)339 void restorePreferredActivities(in byte[] backup, int userId); getDefaultAppsBackup(int userId)340 byte[] getDefaultAppsBackup(int userId); restoreDefaultApps(in byte[] backup, int userId)341 void restoreDefaultApps(in byte[] backup, int userId); getIntentFilterVerificationBackup(int userId)342 byte[] getIntentFilterVerificationBackup(int userId); restoreIntentFilterVerification(in byte[] backup, int userId)343 void restoreIntentFilterVerification(in byte[] backup, int userId); 344 345 /** 346 * Report the set of 'Home' activity candidates, plus (if any) which of them 347 * is the current "always use this one" setting. 348 */ 349 @UnsupportedAppUsage getHomeActivities(out List<ResolveInfo> outHomeCandidates)350 ComponentName getHomeActivities(out List<ResolveInfo> outHomeCandidates); 351 setHomeActivity(in ComponentName className, int userId)352 void setHomeActivity(in ComponentName className, int userId); 353 354 /** 355 * As per {@link android.content.pm.PackageManager#setComponentEnabledSetting}. 356 */ 357 @UnsupportedAppUsage setComponentEnabledSetting(in ComponentName componentName, in int newState, in int flags, int userId)358 void setComponentEnabledSetting(in ComponentName componentName, 359 in int newState, in int flags, int userId); 360 361 /** 362 * As per {@link android.content.pm.PackageManager#getComponentEnabledSetting}. 363 */ 364 @UnsupportedAppUsage getComponentEnabledSetting(in ComponentName componentName, int userId)365 int getComponentEnabledSetting(in ComponentName componentName, int userId); 366 367 /** 368 * As per {@link android.content.pm.PackageManager#setApplicationEnabledSetting}. 369 */ 370 @UnsupportedAppUsage setApplicationEnabledSetting(in String packageName, in int newState, int flags, int userId, String callingPackage)371 void setApplicationEnabledSetting(in String packageName, in int newState, int flags, 372 int userId, String callingPackage); 373 374 /** 375 * As per {@link android.content.pm.PackageManager#getApplicationEnabledSetting}. 376 */ 377 @UnsupportedAppUsage getApplicationEnabledSetting(in String packageName, int userId)378 int getApplicationEnabledSetting(in String packageName, int userId); 379 380 /** 381 * Logs process start information (including APK hash) to the security log. 382 */ logAppProcessStartIfNeeded(String processName, int uid, String seinfo, String apkFile, int pid)383 void logAppProcessStartIfNeeded(String processName, int uid, String seinfo, String apkFile, 384 int pid); 385 386 /** 387 * As per {@link android.content.pm.PackageManager#flushPackageRestrictionsAsUser}. 388 */ flushPackageRestrictionsAsUser(in int userId)389 void flushPackageRestrictionsAsUser(in int userId); 390 391 /** 392 * Set whether the given package should be considered stopped, making 393 * it not visible to implicit intents that filter out stopped packages. 394 */ 395 @UnsupportedAppUsage setPackageStoppedState(String packageName, boolean stopped, int userId)396 void setPackageStoppedState(String packageName, boolean stopped, int userId); 397 398 /** 399 * Free storage by deleting LRU sorted list of cache files across 400 * all applications. If the currently available free storage 401 * on the device is greater than or equal to the requested 402 * free storage, no cache files are cleared. If the currently 403 * available storage on the device is less than the requested 404 * free storage, some or all of the cache files across 405 * all applications are deleted (based on last accessed time) 406 * to increase the free storage space on the device to 407 * the requested value. There is no guarantee that clearing all 408 * the cache files from all applications will clear up 409 * enough storage to achieve the desired value. 410 * @param freeStorageSize The number of bytes of storage to be 411 * freed by the system. Say if freeStorageSize is XX, 412 * and the current free storage is YY, 413 * if XX is less than YY, just return. if not free XX-YY number 414 * of bytes if possible. 415 * @param observer call back used to notify when 416 * the operation is completed 417 */ freeStorageAndNotify(in String volumeUuid, in long freeStorageSize, int storageFlags, IPackageDataObserver observer)418 void freeStorageAndNotify(in String volumeUuid, in long freeStorageSize, 419 int storageFlags, IPackageDataObserver observer); 420 421 /** 422 * Free storage by deleting LRU sorted list of cache files across 423 * all applications. If the currently available free storage 424 * on the device is greater than or equal to the requested 425 * free storage, no cache files are cleared. If the currently 426 * available storage on the device is less than the requested 427 * free storage, some or all of the cache files across 428 * all applications are deleted (based on last accessed time) 429 * to increase the free storage space on the device to 430 * the requested value. There is no guarantee that clearing all 431 * the cache files from all applications will clear up 432 * enough storage to achieve the desired value. 433 * @param freeStorageSize The number of bytes of storage to be 434 * freed by the system. Say if freeStorageSize is XX, 435 * and the current free storage is YY, 436 * if XX is less than YY, just return. if not free XX-YY number 437 * of bytes if possible. 438 * @param pi IntentSender call back used to 439 * notify when the operation is completed.May be null 440 * to indicate that no call back is desired. 441 */ freeStorage(in String volumeUuid, in long freeStorageSize, int storageFlags, in IntentSender pi)442 void freeStorage(in String volumeUuid, in long freeStorageSize, 443 int storageFlags, in IntentSender pi); 444 445 /** 446 * Delete all the cache files in an applications cache directory 447 * @param packageName The package name of the application whose cache 448 * files need to be deleted 449 * @param observer a callback used to notify when the deletion is finished. 450 */ 451 @UnsupportedAppUsage deleteApplicationCacheFiles(in String packageName, IPackageDataObserver observer)452 void deleteApplicationCacheFiles(in String packageName, IPackageDataObserver observer); 453 454 /** 455 * Delete all the cache files in an applications cache directory 456 * @param packageName The package name of the application whose cache 457 * files need to be deleted 458 * @param userId the user to delete application cache for 459 * @param observer a callback used to notify when the deletion is finished. 460 */ deleteApplicationCacheFilesAsUser(in String packageName, int userId, IPackageDataObserver observer)461 void deleteApplicationCacheFilesAsUser(in String packageName, int userId, IPackageDataObserver observer); 462 463 /** 464 * Clear the user data directory of an application. 465 * @param packageName The package name of the application whose cache 466 * files need to be deleted 467 * @param observer a callback used to notify when the operation is completed. 468 */ clearApplicationUserData(in String packageName, IPackageDataObserver observer, int userId)469 void clearApplicationUserData(in String packageName, IPackageDataObserver observer, int userId); 470 471 /** 472 * Clear the profile data of an application. 473 * @param packageName The package name of the application whose profile data 474 * need to be deleted 475 */ clearApplicationProfileData(in String packageName)476 void clearApplicationProfileData(in String packageName); 477 478 /** 479 * Get package statistics including the code, data and cache size for 480 * an already installed package 481 * @param packageName The package name of the application 482 * @param userHandle Which user the size should be retrieved for 483 * @param observer a callback to use to notify when the asynchronous 484 * retrieval of information is complete. 485 */ getPackageSizeInfo(in String packageName, int userHandle, IPackageStatsObserver observer)486 void getPackageSizeInfo(in String packageName, int userHandle, IPackageStatsObserver observer); 487 488 /** 489 * Get a list of shared libraries that are available on the 490 * system. 491 */ 492 @UnsupportedAppUsage getSystemSharedLibraryNames()493 String[] getSystemSharedLibraryNames(); 494 495 /** 496 * Get a list of features that are available on the 497 * system. 498 */ getSystemAvailableFeatures()499 ParceledListSlice getSystemAvailableFeatures(); 500 hasSystemFeature(String name, int version)501 boolean hasSystemFeature(String name, int version); 502 enterSafeMode()503 void enterSafeMode(); 504 @UnsupportedAppUsage isSafeMode()505 boolean isSafeMode(); systemReady()506 void systemReady(); 507 @UnsupportedAppUsage hasSystemUidErrors()508 boolean hasSystemUidErrors(); 509 510 /** 511 * Ask the package manager to fstrim the disk if needed. 512 */ performFstrimIfNeeded()513 void performFstrimIfNeeded(); 514 515 /** 516 * Ask the package manager to update packages if needed. 517 */ updatePackagesIfNeeded()518 void updatePackagesIfNeeded(); 519 520 /** 521 * Notify the package manager that a package is going to be used and why. 522 * 523 * See PackageManager.NOTIFY_PACKAGE_USE_* for reasons. 524 */ notifyPackageUse(String packageName, int reason)525 oneway void notifyPackageUse(String packageName, int reason); 526 527 /** 528 * Notify the package manager that a list of dex files have been loaded. 529 * 530 * @param loadingPackageName the name of the package who performs the load 531 * @param classLoadersNames the names of the class loaders present in the loading chain. The 532 * list encodes the class loader chain in the natural order. The first class loader has 533 * the second one as its parent and so on. The dex files present in the class path of the 534 * first class loader will be recorded in the usage file. 535 * @param classPaths the class paths corresponding to the class loaders names from 536 * {@param classLoadersNames}. The the first element corresponds to the first class loader 537 * and so on. A classpath is represented as a list of dex files separated by 538 * {@code File.pathSeparator}, or null if the class loader's classpath is not known. 539 * The dex files found in the first class path will be recorded in the usage file. 540 * @param loaderIsa the ISA of the loader process 541 */ notifyDexLoad(String loadingPackageName, in List<String> classLoadersNames, in List<String> classPaths, String loaderIsa)542 oneway void notifyDexLoad(String loadingPackageName, in List<String> classLoadersNames, 543 in List<String> classPaths, String loaderIsa); 544 545 /** 546 * Register an application dex module with the package manager. 547 * The package manager will keep track of the given module for future optimizations. 548 * 549 * Dex module optimizations will disable the classpath checking at runtime. The client bares 550 * the responsibility to ensure that the static assumptions on classes in the optimized code 551 * hold at runtime (e.g. there's no duplicate classes in the classpath). 552 * 553 * Note that the package manager already keeps track of dex modules loaded with 554 * {@link dalvik.system.DexClassLoader} and {@link dalvik.system.PathClassLoader}. 555 * This can be called for an eager registration. 556 * 557 * The call might take a while and the results will be posted on the main thread, using 558 * the given callback. 559 * 560 * If the module is intended to be shared with other apps, make sure that the file 561 * permissions allow for it. 562 * If at registration time the permissions allow for others to read it, the module would 563 * be marked as a shared module which might undergo a different optimization strategy. 564 * (usually shared modules will generated larger optimizations artifacts, 565 * taking more disk space). 566 * 567 * @param packageName the package name to which the dex module belongs 568 * @param dexModulePath the absolute path of the dex module. 569 * @param isSharedModule whether or not the module is intended to be used by other apps. 570 * @param callback if not null, 571 * {@link android.content.pm.IDexModuleRegisterCallback.IDexModuleRegisterCallback#onDexModuleRegistered} 572 * will be called once the registration finishes. 573 */ registerDexModule(in String packageName, in String dexModulePath, in boolean isSharedModule, IDexModuleRegisterCallback callback)574 oneway void registerDexModule(in String packageName, in String dexModulePath, 575 in boolean isSharedModule, IDexModuleRegisterCallback callback); 576 577 /** 578 * Ask the package manager to perform a dex-opt with the given compiler filter. 579 * 580 * Note: exposed only for the shell command to allow moving packages explicitly to a 581 * definite state. 582 */ performDexOptMode(String packageName, boolean checkProfiles, String targetCompilerFilter, boolean force, boolean bootComplete, String splitName)583 boolean performDexOptMode(String packageName, boolean checkProfiles, 584 String targetCompilerFilter, boolean force, boolean bootComplete, String splitName); 585 586 /** 587 * Ask the package manager to perform a dex-opt with the given compiler filter on the 588 * secondary dex files belonging to the given package. 589 * 590 * Note: exposed only for the shell command to allow moving packages explicitly to a 591 * definite state. 592 */ performDexOptSecondary(String packageName, String targetCompilerFilter, boolean force)593 boolean performDexOptSecondary(String packageName, 594 String targetCompilerFilter, boolean force); 595 596 /** 597 * Ask the package manager to compile layouts in the given package. 598 */ compileLayouts(String packageName)599 boolean compileLayouts(String packageName); 600 601 /** 602 * Ask the package manager to dump profiles associated with a package. 603 */ dumpProfiles(String packageName)604 void dumpProfiles(String packageName); 605 forceDexOpt(String packageName)606 void forceDexOpt(String packageName); 607 608 /** 609 * Execute the background dexopt job immediately on packages in packageNames. 610 * If null, then execute on all packages. 611 */ runBackgroundDexoptJob(in List<String> packageNames)612 boolean runBackgroundDexoptJob(in List<String> packageNames); 613 614 /** 615 * Reconcile the information we have about the secondary dex files belonging to 616 * {@code packagName} and the actual dex files. For all dex files that were 617 * deleted, update the internal records and delete the generated oat files. 618 */ reconcileSecondaryDexFiles(String packageName)619 void reconcileSecondaryDexFiles(String packageName); 620 getMoveStatus(int moveId)621 int getMoveStatus(int moveId); 622 registerMoveCallback(in IPackageMoveObserver callback)623 void registerMoveCallback(in IPackageMoveObserver callback); unregisterMoveCallback(in IPackageMoveObserver callback)624 void unregisterMoveCallback(in IPackageMoveObserver callback); 625 movePackage(in String packageName, in String volumeUuid)626 int movePackage(in String packageName, in String volumeUuid); movePrimaryStorage(in String volumeUuid)627 int movePrimaryStorage(in String volumeUuid); 628 629 @UnsupportedAppUsage addPermissionAsync(in PermissionInfo info)630 boolean addPermissionAsync(in PermissionInfo info); 631 setInstallLocation(int loc)632 boolean setInstallLocation(int loc); 633 @UnsupportedAppUsage getInstallLocation()634 int getInstallLocation(); 635 installExistingPackageAsUser(String packageName, int userId, int installFlags, int installReason, in List<String> whiteListedPermissions)636 int installExistingPackageAsUser(String packageName, int userId, int installFlags, 637 int installReason, in List<String> whiteListedPermissions); 638 verifyPendingInstall(int id, int verificationCode)639 void verifyPendingInstall(int id, int verificationCode); extendVerificationTimeout(int id, int verificationCodeAtTimeout, long millisecondsToDelay)640 void extendVerificationTimeout(int id, int verificationCodeAtTimeout, long millisecondsToDelay); 641 verifyIntentFilter(int id, int verificationCode, in List<String> failedDomains)642 void verifyIntentFilter(int id, int verificationCode, in List<String> failedDomains); getIntentVerificationStatus(String packageName, int userId)643 int getIntentVerificationStatus(String packageName, int userId); updateIntentVerificationStatus(String packageName, int status, int userId)644 boolean updateIntentVerificationStatus(String packageName, int status, int userId); getIntentFilterVerifications(String packageName)645 ParceledListSlice getIntentFilterVerifications(String packageName); getAllIntentFilters(String packageName)646 ParceledListSlice getAllIntentFilters(String packageName); 647 setDefaultBrowserPackageName(String packageName, int userId)648 boolean setDefaultBrowserPackageName(String packageName, int userId); getDefaultBrowserPackageName(int userId)649 String getDefaultBrowserPackageName(int userId); 650 getVerifierDeviceIdentity()651 VerifierDeviceIdentity getVerifierDeviceIdentity(); 652 isFirstBoot()653 boolean isFirstBoot(); isOnlyCoreApps()654 boolean isOnlyCoreApps(); isDeviceUpgrading()655 boolean isDeviceUpgrading(); 656 setPermissionEnforced(String permission, boolean enforced)657 void setPermissionEnforced(String permission, boolean enforced); isPermissionEnforced(String permission)658 boolean isPermissionEnforced(String permission); 659 660 /** Reflects current DeviceStorageMonitorService state */ 661 @UnsupportedAppUsage isStorageLow()662 boolean isStorageLow(); 663 664 @UnsupportedAppUsage setApplicationHiddenSettingAsUser(String packageName, boolean hidden, int userId)665 boolean setApplicationHiddenSettingAsUser(String packageName, boolean hidden, int userId); getApplicationHiddenSettingAsUser(String packageName, int userId)666 boolean getApplicationHiddenSettingAsUser(String packageName, int userId); 667 setSystemAppHiddenUntilInstalled(String packageName, boolean hidden)668 void setSystemAppHiddenUntilInstalled(String packageName, boolean hidden); setSystemAppInstallState(String packageName, boolean installed, int userId)669 boolean setSystemAppInstallState(String packageName, boolean installed, int userId); 670 671 @UnsupportedAppUsage getPackageInstaller()672 IPackageInstaller getPackageInstaller(); 673 setBlockUninstallForUser(String packageName, boolean blockUninstall, int userId)674 boolean setBlockUninstallForUser(String packageName, boolean blockUninstall, int userId); 675 @UnsupportedAppUsage getBlockUninstallForUser(String packageName, int userId)676 boolean getBlockUninstallForUser(String packageName, int userId); 677 getKeySetByAlias(String packageName, String alias)678 KeySet getKeySetByAlias(String packageName, String alias); getSigningKeySet(String packageName)679 KeySet getSigningKeySet(String packageName); isPackageSignedByKeySet(String packageName, in KeySet ks)680 boolean isPackageSignedByKeySet(String packageName, in KeySet ks); isPackageSignedByKeySetExactly(String packageName, in KeySet ks)681 boolean isPackageSignedByKeySetExactly(String packageName, in KeySet ks); 682 addOnPermissionsChangeListener(in IOnPermissionsChangeListener listener)683 void addOnPermissionsChangeListener(in IOnPermissionsChangeListener listener); removeOnPermissionsChangeListener(in IOnPermissionsChangeListener listener)684 void removeOnPermissionsChangeListener(in IOnPermissionsChangeListener listener); grantDefaultPermissionsToEnabledCarrierApps(in String[] packageNames, int userId)685 void grantDefaultPermissionsToEnabledCarrierApps(in String[] packageNames, int userId); grantDefaultPermissionsToEnabledImsServices(in String[] packageNames, int userId)686 void grantDefaultPermissionsToEnabledImsServices(in String[] packageNames, int userId); grantDefaultPermissionsToEnabledTelephonyDataServices( in String[] packageNames, int userId)687 void grantDefaultPermissionsToEnabledTelephonyDataServices( 688 in String[] packageNames, int userId); revokeDefaultPermissionsFromDisabledTelephonyDataServices( in String[] packageNames, int userId)689 void revokeDefaultPermissionsFromDisabledTelephonyDataServices( 690 in String[] packageNames, int userId); grantDefaultPermissionsToActiveLuiApp(in String packageName, int userId)691 void grantDefaultPermissionsToActiveLuiApp(in String packageName, int userId); revokeDefaultPermissionsFromLuiApps(in String[] packageNames, int userId)692 void revokeDefaultPermissionsFromLuiApps(in String[] packageNames, int userId); 693 isPermissionRevokedByPolicy(String permission, String packageName, int userId)694 boolean isPermissionRevokedByPolicy(String permission, String packageName, int userId); 695 696 @UnsupportedAppUsage getPermissionControllerPackageName()697 String getPermissionControllerPackageName(); 698 getInstantApps(int userId)699 ParceledListSlice getInstantApps(int userId); getInstantAppCookie(String packageName, int userId)700 byte[] getInstantAppCookie(String packageName, int userId); setInstantAppCookie(String packageName, in byte[] cookie, int userId)701 boolean setInstantAppCookie(String packageName, in byte[] cookie, int userId); getInstantAppIcon(String packageName, int userId)702 Bitmap getInstantAppIcon(String packageName, int userId); isInstantApp(String packageName, int userId)703 boolean isInstantApp(String packageName, int userId); 704 setRequiredForSystemUser(String packageName, boolean systemUserApp)705 boolean setRequiredForSystemUser(String packageName, boolean systemUserApp); 706 707 /** 708 * Sets whether or not an update is available. Ostensibly for instant apps 709 * to force exteranl resolution. 710 */ setUpdateAvailable(String packageName, boolean updateAvaialble)711 void setUpdateAvailable(String packageName, boolean updateAvaialble); 712 713 @UnsupportedAppUsage getServicesSystemSharedLibraryPackageName()714 String getServicesSystemSharedLibraryPackageName(); 715 @UnsupportedAppUsage getSharedSystemSharedLibraryPackageName()716 String getSharedSystemSharedLibraryPackageName(); 717 getChangedPackages(int sequenceNumber, int userId)718 ChangedPackages getChangedPackages(int sequenceNumber, int userId); 719 isPackageDeviceAdminOnAnyUser(String packageName)720 boolean isPackageDeviceAdminOnAnyUser(String packageName); 721 getInstallReason(String packageName, int userId)722 int getInstallReason(String packageName, int userId); 723 getSharedLibraries(in String packageName, int flags, int userId)724 ParceledListSlice getSharedLibraries(in String packageName, int flags, int userId); 725 getDeclaredSharedLibraries(in String packageName, int flags, int userId)726 ParceledListSlice getDeclaredSharedLibraries(in String packageName, int flags, int userId); 727 canRequestPackageInstalls(String packageName, int userId)728 boolean canRequestPackageInstalls(String packageName, int userId); 729 deletePreloadsFileCache()730 void deletePreloadsFileCache(); 731 getInstantAppResolverComponent()732 ComponentName getInstantAppResolverComponent(); 733 getInstantAppResolverSettingsComponent()734 ComponentName getInstantAppResolverSettingsComponent(); 735 getInstantAppInstallerComponent()736 ComponentName getInstantAppInstallerComponent(); 737 getInstantAppAndroidId(String packageName, int userId)738 String getInstantAppAndroidId(String packageName, int userId); 739 getArtManager()740 IArtManager getArtManager(); 741 setHarmfulAppWarning(String packageName, CharSequence warning, int userId)742 void setHarmfulAppWarning(String packageName, CharSequence warning, int userId); 743 getHarmfulAppWarning(String packageName, int userId)744 CharSequence getHarmfulAppWarning(String packageName, int userId); 745 hasSigningCertificate(String packageName, in byte[] signingCertificate, int flags)746 boolean hasSigningCertificate(String packageName, in byte[] signingCertificate, int flags); 747 hasUidSigningCertificate(int uid, in byte[] signingCertificate, int flags)748 boolean hasUidSigningCertificate(int uid, in byte[] signingCertificate, int flags); 749 getSystemTextClassifierPackageName()750 String getSystemTextClassifierPackageName(); 751 getAttentionServicePackageName()752 String getAttentionServicePackageName(); 753 getWellbeingPackageName()754 String getWellbeingPackageName(); 755 getAppPredictionServicePackageName()756 String getAppPredictionServicePackageName(); 757 getSystemCaptionsServicePackageName()758 String getSystemCaptionsServicePackageName(); 759 getIncidentReportApproverPackageName()760 String getIncidentReportApproverPackageName(); 761 isPackageStateProtected(String packageName, int userId)762 boolean isPackageStateProtected(String packageName, int userId); 763 sendDeviceCustomizationReadyBroadcast()764 void sendDeviceCustomizationReadyBroadcast(); 765 getInstalledModules(int flags)766 List<ModuleInfo> getInstalledModules(int flags); 767 getModuleInfo(String packageName, int flags)768 ModuleInfo getModuleInfo(String packageName, int flags); 769 getRuntimePermissionsVersion(int userId)770 int getRuntimePermissionsVersion(int userId); 771 setRuntimePermissionsVersion(int version, int userId)772 void setRuntimePermissionsVersion(int version, int userId); 773 notifyPackagesReplacedReceived(in String[] packages)774 void notifyPackagesReplacedReceived(in String[] packages); 775 } 776