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