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