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