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.IPackageInstallObserver2;
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.PackageInfo;
40 import android.content.pm.PackageCleanItem;
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.UserInfo;
48 import android.content.pm.VerifierDeviceIdentity;
49 import android.content.pm.VersionedPackage;
50 import android.graphics.Bitmap;
51 import android.net.Uri;
52 import android.os.Bundle;
53 import android.os.ParcelFileDescriptor;
54 import android.content.IntentSender;
55 
56 /**
57  *  See {@link PackageManager} for documentation on most of the APIs
58  *  here.
59  *
60  *  {@hide}
61  */
62 interface IPackageManager {
checkPackageStartable(String packageName, int userId)63     void checkPackageStartable(String packageName, int userId);
isPackageAvailable(String packageName, int userId)64     boolean isPackageAvailable(String packageName, int userId);
getPackageInfo(String packageName, int flags, int userId)65     PackageInfo getPackageInfo(String packageName, int flags, int userId);
getPackageInfoVersioned(in VersionedPackage versionedPackage, int flags, int userId)66     PackageInfo getPackageInfoVersioned(in VersionedPackage versionedPackage,
67             int flags, int userId);
getPackageUid(String packageName, int flags, int userId)68     int getPackageUid(String packageName, int flags, int userId);
getPackageGids(String packageName, int flags, int userId)69     int[] getPackageGids(String packageName, int flags, int userId);
70 
currentToCanonicalPackageNames(in String[] names)71     String[] currentToCanonicalPackageNames(in String[] names);
canonicalToCurrentPackageNames(in String[] names)72     String[] canonicalToCurrentPackageNames(in String[] names);
73 
getPermissionInfo(String name, String packageName, int flags)74     PermissionInfo getPermissionInfo(String name, String packageName, int flags);
75 
queryPermissionsByGroup(String group, int flags)76     ParceledListSlice queryPermissionsByGroup(String group, int flags);
77 
getPermissionGroupInfo(String name, int flags)78     PermissionGroupInfo getPermissionGroupInfo(String name, int flags);
79 
getAllPermissionGroups(int flags)80     ParceledListSlice getAllPermissionGroups(int flags);
81 
getApplicationInfo(String packageName, int flags ,int userId)82     ApplicationInfo getApplicationInfo(String packageName, int flags ,int userId);
83 
getActivityInfo(in ComponentName className, int flags, int userId)84     ActivityInfo getActivityInfo(in ComponentName className, int flags, int userId);
85 
activitySupportsIntent(in ComponentName className, in Intent intent, String resolvedType)86     boolean activitySupportsIntent(in ComponentName className, in Intent intent,
87             String resolvedType);
88 
getReceiverInfo(in ComponentName className, int flags, int userId)89     ActivityInfo getReceiverInfo(in ComponentName className, int flags, int userId);
90 
getServiceInfo(in ComponentName className, int flags, int userId)91     ServiceInfo getServiceInfo(in ComponentName className, int flags, int userId);
92 
getProviderInfo(in ComponentName className, int flags, int userId)93     ProviderInfo getProviderInfo(in ComponentName className, int flags, int userId);
94 
checkPermission(String permName, String pkgName, int userId)95     int checkPermission(String permName, String pkgName, int userId);
96 
checkUidPermission(String permName, int uid)97     int checkUidPermission(String permName, int uid);
98 
addPermission(in PermissionInfo info)99     boolean addPermission(in PermissionInfo info);
100 
removePermission(String name)101     void removePermission(String name);
102 
grantRuntimePermission(String packageName, String permissionName, int userId)103     void grantRuntimePermission(String packageName, String permissionName, int userId);
104 
revokeRuntimePermission(String packageName, String permissionName, int userId)105     void revokeRuntimePermission(String packageName, String permissionName, int userId);
106 
resetRuntimePermissions()107     void resetRuntimePermissions();
108 
getPermissionFlags(String permissionName, String packageName, int userId)109     int getPermissionFlags(String permissionName, String packageName, int userId);
110 
updatePermissionFlags(String permissionName, String packageName, int flagMask, int flagValues, int userId)111     void updatePermissionFlags(String permissionName, String packageName, int flagMask,
112             int flagValues, int userId);
113 
updatePermissionFlagsForAllApps(int flagMask, int flagValues, int userId)114     void updatePermissionFlagsForAllApps(int flagMask, int flagValues, int userId);
115 
shouldShowRequestPermissionRationale(String permissionName, String packageName, int userId)116     boolean shouldShowRequestPermissionRationale(String permissionName,
117             String packageName, int userId);
118 
isProtectedBroadcast(String actionName)119     boolean isProtectedBroadcast(String actionName);
120 
checkSignatures(String pkg1, String pkg2)121     int checkSignatures(String pkg1, String pkg2);
122 
checkUidSignatures(int uid1, int uid2)123     int checkUidSignatures(int uid1, int uid2);
124 
getAllPackages()125     List<String> getAllPackages();
126 
getPackagesForUid(int uid)127     String[] getPackagesForUid(int uid);
128 
getNameForUid(int uid)129     String getNameForUid(int uid);
130 
getUidForSharedUser(String sharedUserName)131     int getUidForSharedUser(String sharedUserName);
132 
getFlagsForUid(int uid)133     int getFlagsForUid(int uid);
134 
getPrivateFlagsForUid(int uid)135     int getPrivateFlagsForUid(int uid);
136 
isUidPrivileged(int uid)137     boolean isUidPrivileged(int uid);
138 
getAppOpPermissionPackages(String permissionName)139     String[] getAppOpPermissionPackages(String permissionName);
140 
resolveIntent(in Intent intent, String resolvedType, int flags, int userId)141     ResolveInfo resolveIntent(in Intent intent, String resolvedType, int flags, int userId);
142 
findPersistentPreferredActivity(in Intent intent, int userId)143     ResolveInfo findPersistentPreferredActivity(in Intent intent, int userId);
144 
canForwardTo(in Intent intent, String resolvedType, int sourceUserId, int targetUserId)145     boolean canForwardTo(in Intent intent, String resolvedType, int sourceUserId, int targetUserId);
146 
queryIntentActivities(in Intent intent, String resolvedType, int flags, int userId)147     ParceledListSlice queryIntentActivities(in Intent intent,
148             String resolvedType, int flags, int userId);
149 
queryIntentActivityOptions( in ComponentName caller, in Intent[] specifics, in String[] specificTypes, in Intent intent, String resolvedType, int flags, int userId)150     ParceledListSlice queryIntentActivityOptions(
151             in ComponentName caller, in Intent[] specifics,
152             in String[] specificTypes, in Intent intent,
153             String resolvedType, int flags, int userId);
154 
queryIntentReceivers(in Intent intent, String resolvedType, int flags, int userId)155     ParceledListSlice queryIntentReceivers(in Intent intent,
156             String resolvedType, int flags, int userId);
157 
resolveService(in Intent intent, String resolvedType, int flags, int userId)158     ResolveInfo resolveService(in Intent intent,
159             String resolvedType, int flags, int userId);
160 
queryIntentServices(in Intent intent, String resolvedType, int flags, int userId)161     ParceledListSlice queryIntentServices(in Intent intent,
162             String resolvedType, int flags, int userId);
163 
queryIntentContentProviders(in Intent intent, String resolvedType, int flags, int userId)164     ParceledListSlice queryIntentContentProviders(in Intent intent,
165             String resolvedType, int flags, int userId);
166 
167     /**
168      * This implements getInstalledPackages via a "last returned row"
169      * mechanism that is not exposed in the API. This is to get around the IPC
170      * limit that kicks in when flags are included that bloat up the data
171      * returned.
172      */
getInstalledPackages(int flags, in int userId)173     ParceledListSlice getInstalledPackages(int flags, in int userId);
174 
175     /**
176      * This implements getPackagesHoldingPermissions via a "last returned row"
177      * mechanism that is not exposed in the API. This is to get around the IPC
178      * limit that kicks in when flags are included that bloat up the data
179      * returned.
180      */
getPackagesHoldingPermissions(in String[] permissions, int flags, int userId)181     ParceledListSlice getPackagesHoldingPermissions(in String[] permissions,
182             int flags, int userId);
183 
184     /**
185      * This implements getInstalledApplications via a "last returned row"
186      * mechanism that is not exposed in the API. This is to get around the IPC
187      * limit that kicks in when flags are included that bloat up the data
188      * returned.
189      */
getInstalledApplications(int flags, int userId)190     ParceledListSlice getInstalledApplications(int flags, int userId);
191 
192     /**
193      * Retrieve all applications that are marked as persistent.
194      *
195      * @return A List&lt;applicationInfo> containing one entry for each persistent
196      *         application.
197      */
getPersistentApplications(int flags)198     ParceledListSlice getPersistentApplications(int flags);
199 
resolveContentProvider(String name, int flags, int userId)200     ProviderInfo resolveContentProvider(String name, int flags, int userId);
201 
202     /**
203      * Retrieve sync information for all content providers.
204      *
205      * @param outNames Filled in with a list of the root names of the content
206      *                 providers that can sync.
207      * @param outInfo Filled in with a list of the ProviderInfo for each
208      *                name in 'outNames'.
209      */
querySyncProviders(inout List<String> outNames, inout List<ProviderInfo> outInfo)210     void querySyncProviders(inout List<String> outNames,
211             inout List<ProviderInfo> outInfo);
212 
queryContentProviders( String processName, int uid, int flags, String metaDataKey)213     ParceledListSlice queryContentProviders(
214             String processName, int uid, int flags, String metaDataKey);
215 
getInstrumentationInfo( in ComponentName className, int flags)216     InstrumentationInfo getInstrumentationInfo(
217             in ComponentName className, int flags);
218 
queryInstrumentation( String targetPackage, int flags)219     ParceledListSlice queryInstrumentation(
220             String targetPackage, int flags);
221 
222     /** @deprecated Use PackageInstaller instead */
installPackageAsUser(in String originPath, in IPackageInstallObserver2 observer, int flags, in String installerPackageName, int userId)223     void installPackageAsUser(in String originPath,
224             in IPackageInstallObserver2 observer,
225             int flags,
226             in String installerPackageName,
227             int userId);
228 
finishPackageInstall(int token, boolean didLaunch)229     void finishPackageInstall(int token, boolean didLaunch);
230 
setInstallerPackageName(in String targetPackage, in String installerPackageName)231     void setInstallerPackageName(in String targetPackage, in String installerPackageName);
232 
setApplicationCategoryHint(String packageName, int categoryHint, String callerPackageName)233     void setApplicationCategoryHint(String packageName, int categoryHint, String callerPackageName);
234 
235     /** @deprecated rawr, don't call AIDL methods directly! */
deletePackageAsUser(in String packageName, int versionCode, IPackageDeleteObserver observer, int userId, int flags)236     void deletePackageAsUser(in String packageName, int versionCode,
237             IPackageDeleteObserver observer, int userId, int flags);
238 
239     /**
240      * Delete a package for a specific user.
241      *
242      * @param versionedPackage The package to delete.
243      * @param observer a callback to use to notify when the package deletion in finished.
244      * @param userId the id of the user for whom to delete the package
245      * @param flags - possible values: {@link #DONT_DELETE_DATA}
246      */
deletePackageVersioned(in VersionedPackage versionedPackage, IPackageDeleteObserver2 observer, int userId, int flags)247     void deletePackageVersioned(in VersionedPackage versionedPackage,
248             IPackageDeleteObserver2 observer, int userId, int flags);
249 
getInstallerPackageName(in String packageName)250     String getInstallerPackageName(in String packageName);
251 
resetApplicationPreferences(int userId)252     void resetApplicationPreferences(int userId);
253 
getLastChosenActivity(in Intent intent, String resolvedType, int flags)254     ResolveInfo getLastChosenActivity(in Intent intent,
255             String resolvedType, int flags);
256 
setLastChosenActivity(in Intent intent, String resolvedType, int flags, in IntentFilter filter, int match, in ComponentName activity)257     void setLastChosenActivity(in Intent intent, String resolvedType, int flags,
258             in IntentFilter filter, int match, in ComponentName activity);
259 
addPreferredActivity(in IntentFilter filter, int match, in ComponentName[] set, in ComponentName activity, int userId)260     void addPreferredActivity(in IntentFilter filter, int match,
261             in ComponentName[] set, in ComponentName activity, int userId);
262 
replacePreferredActivity(in IntentFilter filter, int match, in ComponentName[] set, in ComponentName activity, int userId)263     void replacePreferredActivity(in IntentFilter filter, int match,
264             in ComponentName[] set, in ComponentName activity, int userId);
265 
clearPackagePreferredActivities(String packageName)266     void clearPackagePreferredActivities(String packageName);
267 
getPreferredActivities(out List<IntentFilter> outFilters, out List<ComponentName> outActivities, String packageName)268     int getPreferredActivities(out List<IntentFilter> outFilters,
269             out List<ComponentName> outActivities, String packageName);
270 
addPersistentPreferredActivity(in IntentFilter filter, in ComponentName activity, int userId)271     void addPersistentPreferredActivity(in IntentFilter filter, in ComponentName activity, int userId);
272 
clearPackagePersistentPreferredActivities(String packageName, int userId)273     void clearPackagePersistentPreferredActivities(String packageName, int userId);
274 
addCrossProfileIntentFilter(in IntentFilter intentFilter, String ownerPackage, int sourceUserId, int targetUserId, int flags)275     void addCrossProfileIntentFilter(in IntentFilter intentFilter, String ownerPackage,
276             int sourceUserId, int targetUserId, int flags);
277 
clearCrossProfileIntentFilters(int sourceUserId, String ownerPackage)278     void clearCrossProfileIntentFilters(int sourceUserId, String ownerPackage);
279 
setPackagesSuspendedAsUser(in String[] packageNames, boolean suspended, int userId)280     String[] setPackagesSuspendedAsUser(in String[] packageNames, boolean suspended, int userId);
isPackageSuspendedForUser(String packageName, int userId)281     boolean isPackageSuspendedForUser(String packageName, int userId);
282 
283     /**
284      * Backup/restore support - only the system uid may use these.
285      */
getPreferredActivityBackup(int userId)286     byte[] getPreferredActivityBackup(int userId);
restorePreferredActivities(in byte[] backup, int userId)287     void restorePreferredActivities(in byte[] backup, int userId);
getDefaultAppsBackup(int userId)288     byte[] getDefaultAppsBackup(int userId);
restoreDefaultApps(in byte[] backup, int userId)289     void restoreDefaultApps(in byte[] backup, int userId);
getIntentFilterVerificationBackup(int userId)290     byte[] getIntentFilterVerificationBackup(int userId);
restoreIntentFilterVerification(in byte[] backup, int userId)291     void restoreIntentFilterVerification(in byte[] backup, int userId);
getPermissionGrantBackup(int userId)292     byte[] getPermissionGrantBackup(int userId);
restorePermissionGrants(in byte[] backup, int userId)293     void restorePermissionGrants(in byte[] backup, int userId);
294 
295     /**
296      * Report the set of 'Home' activity candidates, plus (if any) which of them
297      * is the current "always use this one" setting.
298      */
getHomeActivities(out List<ResolveInfo> outHomeCandidates)299      ComponentName getHomeActivities(out List<ResolveInfo> outHomeCandidates);
300 
setHomeActivity(in ComponentName className, int userId)301     void setHomeActivity(in ComponentName className, int userId);
302 
303     /**
304      * As per {@link android.content.pm.PackageManager#setComponentEnabledSetting}.
305      */
setComponentEnabledSetting(in ComponentName componentName, in int newState, in int flags, int userId)306     void setComponentEnabledSetting(in ComponentName componentName,
307             in int newState, in int flags, int userId);
308 
309     /**
310      * As per {@link android.content.pm.PackageManager#getComponentEnabledSetting}.
311      */
getComponentEnabledSetting(in ComponentName componentName, int userId)312     int getComponentEnabledSetting(in ComponentName componentName, int userId);
313 
314     /**
315      * As per {@link android.content.pm.PackageManager#setApplicationEnabledSetting}.
316      */
setApplicationEnabledSetting(in String packageName, in int newState, int flags, int userId, String callingPackage)317     void setApplicationEnabledSetting(in String packageName, in int newState, int flags,
318             int userId, String callingPackage);
319 
320     /**
321      * As per {@link android.content.pm.PackageManager#getApplicationEnabledSetting}.
322      */
getApplicationEnabledSetting(in String packageName, int userId)323     int getApplicationEnabledSetting(in String packageName, int userId);
324 
325     /**
326      * Logs process start information (including APK hash) to the security log.
327      */
logAppProcessStartIfNeeded(String processName, int uid, String seinfo, String apkFile, int pid)328     void logAppProcessStartIfNeeded(String processName, int uid, String seinfo, String apkFile,
329             int pid);
330 
331     /**
332      * As per {@link android.content.pm.PackageManager#flushPackageRestrictionsAsUser}.
333      */
flushPackageRestrictionsAsUser(in int userId)334     void flushPackageRestrictionsAsUser(in int userId);
335 
336     /**
337      * Set whether the given package should be considered stopped, making
338      * it not visible to implicit intents that filter out stopped packages.
339      */
setPackageStoppedState(String packageName, boolean stopped, int userId)340     void setPackageStoppedState(String packageName, boolean stopped, int userId);
341 
342     /**
343      * Free storage by deleting LRU sorted list of cache files across
344      * all applications. If the currently available free storage
345      * on the device is greater than or equal to the requested
346      * free storage, no cache files are cleared. If the currently
347      * available storage on the device is less than the requested
348      * free storage, some or all of the cache files across
349      * all applications are deleted (based on last accessed time)
350      * to increase the free storage space on the device to
351      * the requested value. There is no guarantee that clearing all
352      * the cache files from all applications will clear up
353      * enough storage to achieve the desired value.
354      * @param freeStorageSize The number of bytes of storage to be
355      * freed by the system. Say if freeStorageSize is XX,
356      * and the current free storage is YY,
357      * if XX is less than YY, just return. if not free XX-YY number
358      * of bytes if possible.
359      * @param observer call back used to notify when
360      * the operation is completed
361      */
freeStorageAndNotify(in String volumeUuid, in long freeStorageSize, int storageFlags, IPackageDataObserver observer)362      void freeStorageAndNotify(in String volumeUuid, in long freeStorageSize,
363              int storageFlags, IPackageDataObserver observer);
364 
365     /**
366      * Free storage by deleting LRU sorted list of cache files across
367      * all applications. If the currently available free storage
368      * on the device is greater than or equal to the requested
369      * free storage, no cache files are cleared. If the currently
370      * available storage on the device is less than the requested
371      * free storage, some or all of the cache files across
372      * all applications are deleted (based on last accessed time)
373      * to increase the free storage space on the device to
374      * the requested value. There is no guarantee that clearing all
375      * the cache files from all applications will clear up
376      * enough storage to achieve the desired value.
377      * @param freeStorageSize The number of bytes of storage to be
378      * freed by the system. Say if freeStorageSize is XX,
379      * and the current free storage is YY,
380      * if XX is less than YY, just return. if not free XX-YY number
381      * of bytes if possible.
382      * @param pi IntentSender call back used to
383      * notify when the operation is completed.May be null
384      * to indicate that no call back is desired.
385      */
freeStorage(in String volumeUuid, in long freeStorageSize, int storageFlags, in IntentSender pi)386      void freeStorage(in String volumeUuid, in long freeStorageSize,
387              int storageFlags, in IntentSender pi);
388 
389     /**
390      * Delete all the cache files in an applications cache directory
391      * @param packageName The package name of the application whose cache
392      * files need to be deleted
393      * @param observer a callback used to notify when the deletion is finished.
394      */
deleteApplicationCacheFiles(in String packageName, IPackageDataObserver observer)395     void deleteApplicationCacheFiles(in String packageName, IPackageDataObserver observer);
396 
397     /**
398      * Delete all the cache files in an applications cache directory
399      * @param packageName The package name of the application whose cache
400      * files need to be deleted
401      * @param userId the user to delete application cache for
402      * @param observer a callback used to notify when the deletion is finished.
403      */
deleteApplicationCacheFilesAsUser(in String packageName, int userId, IPackageDataObserver observer)404     void deleteApplicationCacheFilesAsUser(in String packageName, int userId, IPackageDataObserver observer);
405 
406     /**
407      * Clear the user data directory of an application.
408      * @param packageName The package name of the application whose cache
409      * files need to be deleted
410      * @param observer a callback used to notify when the operation is completed.
411      */
clearApplicationUserData(in String packageName, IPackageDataObserver observer, int userId)412     void clearApplicationUserData(in String packageName, IPackageDataObserver observer, int userId);
413 
414     /**
415      * Clear the profile data of an application.
416      * @param packageName The package name of the application whose profile data
417      * need to be deleted
418      */
clearApplicationProfileData(in String packageName)419     void clearApplicationProfileData(in String packageName);
420 
421    /**
422      * Get package statistics including the code, data and cache size for
423      * an already installed package
424      * @param packageName The package name of the application
425      * @param userHandle Which user the size should be retrieved for
426      * @param observer a callback to use to notify when the asynchronous
427      * retrieval of information is complete.
428      */
getPackageSizeInfo(in String packageName, int userHandle, IPackageStatsObserver observer)429     void getPackageSizeInfo(in String packageName, int userHandle, IPackageStatsObserver observer);
430 
431     /**
432      * Get a list of shared libraries that are available on the
433      * system.
434      */
getSystemSharedLibraryNames()435     String[] getSystemSharedLibraryNames();
436 
437     /**
438      * Get a list of features that are available on the
439      * system.
440      */
getSystemAvailableFeatures()441     ParceledListSlice getSystemAvailableFeatures();
442 
hasSystemFeature(String name, int version)443     boolean hasSystemFeature(String name, int version);
444 
enterSafeMode()445     void enterSafeMode();
isSafeMode()446     boolean isSafeMode();
systemReady()447     void systemReady();
hasSystemUidErrors()448     boolean hasSystemUidErrors();
449 
450     /**
451      * Ask the package manager to fstrim the disk if needed.
452      */
performFstrimIfNeeded()453     void performFstrimIfNeeded();
454 
455     /**
456      * Ask the package manager to update packages if needed.
457      */
updatePackagesIfNeeded()458     void updatePackagesIfNeeded();
459 
460     /**
461      * Notify the package manager that a package is going to be used and why.
462      *
463      * See PackageManager.NOTIFY_PACKAGE_USE_* for reasons.
464      */
notifyPackageUse(String packageName, int reason)465     oneway void notifyPackageUse(String packageName, int reason);
466 
467     /**
468      * Notify the package manager that a list of dex files have been loaded.
469      *
470      * @param loadingPackageName the name of the package who performs the load
471      * @param dexPats the list of the dex files paths that have been loaded
472      * @param loaderIsa the ISA of the loader process
473      */
notifyDexLoad(String loadingPackageName, in List<String> dexPaths, String loaderIsa)474     oneway void notifyDexLoad(String loadingPackageName, in List<String> dexPaths,
475             String loaderIsa);
476 
477     /**
478      * Ask the package manager to perform a dex-opt for the given reason. The package
479      * manager will map the reason to a compiler filter according to the current system
480      * configuration.
481      */
performDexOpt(String packageName, boolean checkProfiles, int compileReason, boolean force)482     boolean performDexOpt(String packageName, boolean checkProfiles,
483             int compileReason, boolean force);
484 
485     /**
486      * Ask the package manager to perform a dex-opt with the given compiler filter.
487      *
488      * Note: exposed only for the shell command to allow moving packages explicitly to a
489      *       definite state.
490      */
performDexOptMode(String packageName, boolean checkProfiles, String targetCompilerFilter, boolean force)491     boolean performDexOptMode(String packageName, boolean checkProfiles,
492             String targetCompilerFilter, boolean force);
493 
494     /**
495      * Ask the package manager to perform a dex-opt with the given compiler filter on the
496      * secondary dex files belonging to the given package.
497      *
498      * Note: exposed only for the shell command to allow moving packages explicitly to a
499      *       definite state.
500      */
performDexOptSecondary(String packageName, String targetCompilerFilter, boolean force)501     boolean performDexOptSecondary(String packageName,
502             String targetCompilerFilter, boolean force);
503 
504     /**
505      * Ask the package manager to dump profiles associated with a package.
506      */
dumpProfiles(String packageName)507     void dumpProfiles(String packageName);
508 
forceDexOpt(String packageName)509     void forceDexOpt(String packageName);
510 
511     /**
512      * Execute the background dexopt job immediately.
513      */
runBackgroundDexoptJob()514     boolean runBackgroundDexoptJob();
515 
516     /**
517      * Reconcile the information we have about the secondary dex files belonging to
518      * {@code packagName} and the actual dex files. For all dex files that were
519      * deleted, update the internal records and delete the generated oat files.
520      */
reconcileSecondaryDexFiles(String packageName)521     void reconcileSecondaryDexFiles(String packageName);
522 
523     /**
524      * Update status of external media on the package manager to scan and
525      * install packages installed on the external media. Like say the
526      * StorageManagerService uses this to call into the package manager to update
527      * status of sdcard.
528      */
updateExternalMediaStatus(boolean mounted, boolean reportStatus)529     void updateExternalMediaStatus(boolean mounted, boolean reportStatus);
530 
nextPackageToClean(in PackageCleanItem lastPackage)531     PackageCleanItem nextPackageToClean(in PackageCleanItem lastPackage);
532 
getMoveStatus(int moveId)533     int getMoveStatus(int moveId);
534 
registerMoveCallback(in IPackageMoveObserver callback)535     void registerMoveCallback(in IPackageMoveObserver callback);
unregisterMoveCallback(in IPackageMoveObserver callback)536     void unregisterMoveCallback(in IPackageMoveObserver callback);
537 
movePackage(in String packageName, in String volumeUuid)538     int movePackage(in String packageName, in String volumeUuid);
movePrimaryStorage(in String volumeUuid)539     int movePrimaryStorage(in String volumeUuid);
540 
addPermissionAsync(in PermissionInfo info)541     boolean addPermissionAsync(in PermissionInfo info);
542 
setInstallLocation(int loc)543     boolean setInstallLocation(int loc);
getInstallLocation()544     int getInstallLocation();
545 
installExistingPackageAsUser(String packageName, int userId, int installFlags, int installReason)546     int installExistingPackageAsUser(String packageName, int userId, int installFlags,
547             int installReason);
548 
verifyPendingInstall(int id, int verificationCode)549     void verifyPendingInstall(int id, int verificationCode);
extendVerificationTimeout(int id, int verificationCodeAtTimeout, long millisecondsToDelay)550     void extendVerificationTimeout(int id, int verificationCodeAtTimeout, long millisecondsToDelay);
551 
verifyIntentFilter(int id, int verificationCode, in List<String> failedDomains)552     void verifyIntentFilter(int id, int verificationCode, in List<String> failedDomains);
getIntentVerificationStatus(String packageName, int userId)553     int getIntentVerificationStatus(String packageName, int userId);
updateIntentVerificationStatus(String packageName, int status, int userId)554     boolean updateIntentVerificationStatus(String packageName, int status, int userId);
getIntentFilterVerifications(String packageName)555     ParceledListSlice getIntentFilterVerifications(String packageName);
getAllIntentFilters(String packageName)556     ParceledListSlice getAllIntentFilters(String packageName);
557 
setDefaultBrowserPackageName(String packageName, int userId)558     boolean setDefaultBrowserPackageName(String packageName, int userId);
getDefaultBrowserPackageName(int userId)559     String getDefaultBrowserPackageName(int userId);
560 
getVerifierDeviceIdentity()561     VerifierDeviceIdentity getVerifierDeviceIdentity();
562 
isFirstBoot()563     boolean isFirstBoot();
isOnlyCoreApps()564     boolean isOnlyCoreApps();
isUpgrade()565     boolean isUpgrade();
566 
setPermissionEnforced(String permission, boolean enforced)567     void setPermissionEnforced(String permission, boolean enforced);
isPermissionEnforced(String permission)568     boolean isPermissionEnforced(String permission);
569 
570     /** Reflects current DeviceStorageMonitorService state */
isStorageLow()571     boolean isStorageLow();
572 
setApplicationHiddenSettingAsUser(String packageName, boolean hidden, int userId)573     boolean setApplicationHiddenSettingAsUser(String packageName, boolean hidden, int userId);
getApplicationHiddenSettingAsUser(String packageName, int userId)574     boolean getApplicationHiddenSettingAsUser(String packageName, int userId);
575 
getPackageInstaller()576     IPackageInstaller getPackageInstaller();
577 
setBlockUninstallForUser(String packageName, boolean blockUninstall, int userId)578     boolean setBlockUninstallForUser(String packageName, boolean blockUninstall, int userId);
getBlockUninstallForUser(String packageName, int userId)579     boolean getBlockUninstallForUser(String packageName, int userId);
580 
getKeySetByAlias(String packageName, String alias)581     KeySet getKeySetByAlias(String packageName, String alias);
getSigningKeySet(String packageName)582     KeySet getSigningKeySet(String packageName);
isPackageSignedByKeySet(String packageName, in KeySet ks)583     boolean isPackageSignedByKeySet(String packageName, in KeySet ks);
isPackageSignedByKeySetExactly(String packageName, in KeySet ks)584     boolean isPackageSignedByKeySetExactly(String packageName, in KeySet ks);
585 
addOnPermissionsChangeListener(in IOnPermissionsChangeListener listener)586     void addOnPermissionsChangeListener(in IOnPermissionsChangeListener listener);
removeOnPermissionsChangeListener(in IOnPermissionsChangeListener listener)587     void removeOnPermissionsChangeListener(in IOnPermissionsChangeListener listener);
grantDefaultPermissionsToEnabledCarrierApps(in String[] packageNames, int userId)588     void grantDefaultPermissionsToEnabledCarrierApps(in String[] packageNames, int userId);
grantDefaultPermissionsToEnabledImsServices(in String[] packageNames, int userId)589     void grantDefaultPermissionsToEnabledImsServices(in String[] packageNames, int userId);
590 
isPermissionRevokedByPolicy(String permission, String packageName, int userId)591     boolean isPermissionRevokedByPolicy(String permission, String packageName, int userId);
592 
getPermissionControllerPackageName()593     String getPermissionControllerPackageName();
594 
getInstantApps(int userId)595     ParceledListSlice getInstantApps(int userId);
getInstantAppCookie(String packageName, int userId)596     byte[] getInstantAppCookie(String packageName, int userId);
setInstantAppCookie(String packageName, in byte[] cookie, int userId)597     boolean setInstantAppCookie(String packageName, in byte[] cookie, int userId);
getInstantAppIcon(String packageName, int userId)598     Bitmap getInstantAppIcon(String packageName, int userId);
isInstantApp(String packageName, int userId)599     boolean isInstantApp(String packageName, int userId);
600 
setRequiredForSystemUser(String packageName, boolean systemUserApp)601     boolean setRequiredForSystemUser(String packageName, boolean systemUserApp);
602 
603     /**
604      * Sets whether or not an update is available. Ostensibly for instant apps
605      * to force exteranl resolution.
606      */
setUpdateAvailable(String packageName, boolean updateAvaialble)607     void setUpdateAvailable(String packageName, boolean updateAvaialble);
608 
getServicesSystemSharedLibraryPackageName()609     String getServicesSystemSharedLibraryPackageName();
getSharedSystemSharedLibraryPackageName()610     String getSharedSystemSharedLibraryPackageName();
611 
getChangedPackages(int sequenceNumber, int userId)612     ChangedPackages getChangedPackages(int sequenceNumber, int userId);
613 
isPackageDeviceAdminOnAnyUser(String packageName)614     boolean isPackageDeviceAdminOnAnyUser(String packageName);
615 
getPreviousCodePaths(in String packageName)616     List<String> getPreviousCodePaths(in String packageName);
617 
getInstallReason(String packageName, int userId)618     int getInstallReason(String packageName, int userId);
619 
getSharedLibraries(in String packageName, int flags, int userId)620     ParceledListSlice getSharedLibraries(in String packageName, int flags, int userId);
621 
canRequestPackageInstalls(String packageName, int userId)622     boolean canRequestPackageInstalls(String packageName, int userId);
623 
deletePreloadsFileCache()624     void deletePreloadsFileCache();
625 
getInstantAppResolverComponent()626     ComponentName getInstantAppResolverComponent();
627 
getInstantAppResolverSettingsComponent()628     ComponentName getInstantAppResolverSettingsComponent();
629 
getInstantAppInstallerComponent()630     ComponentName getInstantAppInstallerComponent();
631 
getInstantAppAndroidId(String packageName, int userId)632     String getInstantAppAndroidId(String packageName, int userId);
633 }
634