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