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