IPackageManager.aidl revision 2acf063da08dfff69f184c9a6a90a7a5fe60d818
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.EphemeralApplicationInfo;
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.VerificationParams;
50import android.content.pm.VerifierDeviceIdentity;
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    int getPackageUid(String packageName, int userId);
68    int getPackageUidEtc(String packageName, int flags, int userId);
69    int[] getPackageGids(String packageName, int userId);
70    int[] getPackageGidsEtc(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    List<PermissionInfo> queryPermissionsByGroup(String group, int flags);
78
79    PermissionGroupInfo getPermissionGroupInfo(String name, int flags);
80
81    List<PermissionGroupInfo> 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    String[] getPackagesForUid(int uid);
127
128    String getNameForUid(int uid);
129
130    int getUidForSharedUser(String sharedUserName);
131
132    int getFlagsForUid(int uid);
133
134    int getPrivateFlagsForUid(int uid);
135
136    boolean isUidPrivileged(int uid);
137
138    String[] getAppOpPermissionPackages(String permissionName);
139
140    ResolveInfo resolveIntent(in Intent intent, String resolvedType, int flags, int userId);
141
142    boolean canForwardTo(in Intent intent, String resolvedType, int sourceUserId, int targetUserId);
143
144    List<ResolveInfo> queryIntentActivities(in Intent intent,
145            String resolvedType, int flags, int userId);
146
147    List<ResolveInfo> queryIntentActivityOptions(
148            in ComponentName caller, in Intent[] specifics,
149            in String[] specificTypes, in Intent intent,
150            String resolvedType, int flags, int userId);
151
152    List<ResolveInfo> queryIntentReceivers(in Intent intent,
153            String resolvedType, int flags, int userId);
154
155    ResolveInfo resolveService(in Intent intent,
156            String resolvedType, int flags, int userId);
157
158    List<ResolveInfo> queryIntentServices(in Intent intent,
159            String resolvedType, int flags, int userId);
160
161    List<ResolveInfo> queryIntentContentProviders(in Intent intent,
162            String resolvedType, int flags, int userId);
163
164    /**
165     * This implements getInstalledPackages via a "last returned row"
166     * mechanism that is not exposed in the API. This is to get around the IPC
167     * limit that kicks in when flags are included that bloat up the data
168     * returned.
169     */
170    ParceledListSlice getInstalledPackages(int flags, in int userId);
171
172    /**
173     * This implements getPackagesHoldingPermissions via a "last returned row"
174     * mechanism that is not exposed in the API. This is to get around the IPC
175     * limit that kicks in when flags are included that bloat up the data
176     * returned.
177     */
178    ParceledListSlice getPackagesHoldingPermissions(in String[] permissions,
179            int flags, int userId);
180
181    /**
182     * This implements getInstalledApplications via a "last returned row"
183     * mechanism that is not exposed in the API. This is to get around the IPC
184     * limit that kicks in when flags are included that bloat up the data
185     * returned.
186     */
187    ParceledListSlice getInstalledApplications(int flags, int userId);
188
189    /**
190     * Retrieve all applications that are marked as persistent.
191     *
192     * @return A List&lt;applicationInfo> containing one entry for each persistent
193     *         application.
194     */
195    List<ApplicationInfo> getPersistentApplications(int flags);
196
197    ProviderInfo resolveContentProvider(String name, int flags, int userId);
198
199    /**
200     * Retrieve sync information for all content providers.
201     *
202     * @param outNames Filled in with a list of the root names of the content
203     *                 providers that can sync.
204     * @param outInfo Filled in with a list of the ProviderInfo for each
205     *                name in 'outNames'.
206     */
207    void querySyncProviders(inout List<String> outNames,
208            inout List<ProviderInfo> outInfo);
209
210    ParceledListSlice queryContentProviders(
211            String processName, int uid, int flags);
212
213    InstrumentationInfo getInstrumentationInfo(
214            in ComponentName className, int flags);
215
216    List<InstrumentationInfo> queryInstrumentation(
217            String targetPackage, int flags);
218
219    void installPackage(in String originPath,
220            in IPackageInstallObserver2 observer,
221            int flags,
222            in String installerPackageName,
223            in VerificationParams verificationParams,
224            in String packageAbiOverride);
225
226    void installPackageAsUser(in String originPath,
227            in IPackageInstallObserver2 observer,
228            int flags,
229            in String installerPackageName,
230            in VerificationParams verificationParams,
231            in String packageAbiOverride,
232            int userId);
233
234    void finishPackageInstall(int token);
235
236    void setInstallerPackageName(in String targetPackage, in String installerPackageName);
237
238    /** @deprecated rawr, don't call AIDL methods directly! */
239    void deletePackageAsUser(in String packageName, IPackageDeleteObserver observer,
240            int userId, int flags);
241
242    /**
243     * Delete a package for a specific user.
244     *
245     * @param packageName The fully qualified name of the package to delete.
246     * @param observer a callback to use to notify when the package deletion in finished.
247     * @param userId the id of the user for whom to delete the package
248     * @param flags - possible values: {@link #DONT_DELETE_DATA}
249     */
250    void deletePackage(in String packageName, IPackageDeleteObserver2 observer, int userId, int flags);
251
252    String getInstallerPackageName(in String packageName);
253
254    void addPackageToPreferred(String packageName);
255
256    void removePackageFromPreferred(String packageName);
257
258    List<PackageInfo> getPreferredPackages(int flags);
259
260    void resetApplicationPreferences(int userId);
261
262    ResolveInfo getLastChosenActivity(in Intent intent,
263            String resolvedType, int flags);
264
265    void setLastChosenActivity(in Intent intent, String resolvedType, int flags,
266            in IntentFilter filter, int match, in ComponentName activity);
267
268    void addPreferredActivity(in IntentFilter filter, int match,
269            in ComponentName[] set, in ComponentName activity, int userId);
270
271    void replacePreferredActivity(in IntentFilter filter, int match,
272            in ComponentName[] set, in ComponentName activity, int userId);
273
274    void clearPackagePreferredActivities(String packageName);
275
276    int getPreferredActivities(out List<IntentFilter> outFilters,
277            out List<ComponentName> outActivities, String packageName);
278
279    void addPersistentPreferredActivity(in IntentFilter filter, in ComponentName activity, int userId);
280
281    void clearPackagePersistentPreferredActivities(String packageName, int userId);
282
283    void addCrossProfileIntentFilter(in IntentFilter intentFilter, String ownerPackage,
284            int sourceUserId, int targetUserId, int flags);
285
286    void clearCrossProfileIntentFilters(int sourceUserId, String ownerPackage);
287
288    /**
289     * Backup/restore support - only the system uid may use these.
290     */
291    byte[] getPreferredActivityBackup(int userId);
292    void restorePreferredActivities(in byte[] backup, int userId);
293    byte[] getDefaultAppsBackup(int userId);
294    void restoreDefaultApps(in byte[] backup, int userId);
295    byte[] getIntentFilterVerificationBackup(int userId);
296    void restoreIntentFilterVerification(in byte[] backup, int userId);
297
298    /**
299     * Report the set of 'Home' activity candidates, plus (if any) which of them
300     * is the current "always use this one" setting.
301     */
302     ComponentName getHomeActivities(out List<ResolveInfo> outHomeCandidates);
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     * Set whether the given package should be considered stopped, making
328     * it not visible to implicit intents that filter out stopped packages.
329     */
330    void setPackageStoppedState(String packageName, boolean stopped, int userId);
331
332    /**
333     * Free storage by deleting LRU sorted list of cache files across
334     * all applications. If the currently available free storage
335     * on the device is greater than or equal to the requested
336     * free storage, no cache files are cleared. If the currently
337     * available storage on the device is less than the requested
338     * free storage, some or all of the cache files across
339     * all applications are deleted (based on last accessed time)
340     * to increase the free storage space on the device to
341     * the requested value. There is no guarantee that clearing all
342     * the cache files from all applications will clear up
343     * enough storage to achieve the desired value.
344     * @param freeStorageSize The number of bytes of storage to be
345     * freed by the system. Say if freeStorageSize is XX,
346     * and the current free storage is YY,
347     * if XX is less than YY, just return. if not free XX-YY number
348     * of bytes if possible.
349     * @param observer call back used to notify when
350     * the operation is completed
351     */
352     void freeStorageAndNotify(in String volumeUuid, in long freeStorageSize,
353             IPackageDataObserver observer);
354
355    /**
356     * Free storage by deleting LRU sorted list of cache files across
357     * all applications. If the currently available free storage
358     * on the device is greater than or equal to the requested
359     * free storage, no cache files are cleared. If the currently
360     * available storage on the device is less than the requested
361     * free storage, some or all of the cache files across
362     * all applications are deleted (based on last accessed time)
363     * to increase the free storage space on the device to
364     * the requested value. There is no guarantee that clearing all
365     * the cache files from all applications will clear up
366     * enough storage to achieve the desired value.
367     * @param freeStorageSize The number of bytes of storage to be
368     * freed by the system. Say if freeStorageSize is XX,
369     * and the current free storage is YY,
370     * if XX is less than YY, just return. if not free XX-YY number
371     * of bytes if possible.
372     * @param pi IntentSender call back used to
373     * notify when the operation is completed.May be null
374     * to indicate that no call back is desired.
375     */
376     void freeStorage(in String volumeUuid, in long freeStorageSize,
377             in IntentSender pi);
378
379    /**
380     * Delete all the cache files in an applications cache directory
381     * @param packageName The package name of the application whose cache
382     * files need to be deleted
383     * @param observer a callback used to notify when the deletion is finished.
384     */
385    void deleteApplicationCacheFiles(in String packageName, IPackageDataObserver observer);
386
387    /**
388     * Clear the user data directory of an application.
389     * @param packageName The package name of the application whose cache
390     * files need to be deleted
391     * @param observer a callback used to notify when the operation is completed.
392     */
393    void clearApplicationUserData(in String packageName, IPackageDataObserver observer, int userId);
394
395   /**
396     * Get package statistics including the code, data and cache size for
397     * an already installed package
398     * @param packageName The package name of the application
399     * @param userHandle Which user the size should be retrieved for
400     * @param observer a callback to use to notify when the asynchronous
401     * retrieval of information is complete.
402     */
403    void getPackageSizeInfo(in String packageName, int userHandle, IPackageStatsObserver observer);
404
405    /**
406     * Get a list of shared libraries that are available on the
407     * system.
408     */
409    String[] getSystemSharedLibraryNames();
410
411    /**
412     * Get a list of features that are available on the
413     * system.
414     */
415    FeatureInfo[] getSystemAvailableFeatures();
416
417    boolean hasSystemFeature(String name);
418
419    void enterSafeMode();
420    boolean isSafeMode();
421    void systemReady();
422    boolean hasSystemUidErrors();
423
424    /**
425     * Ask the package manager to fstrim the disk if needed.
426     */
427    void performFstrimIfNeeded();
428
429    /**
430     * Notify the package manager that a package is going to be used.
431     */
432    void notifyPackageUse(String packageName);
433
434    /**
435     * Ask the package manager to perform dex-opt (if needed) on the given
436     * package and for the given instruction set if it already hasn't done
437     * so.
438     *
439     * If the supplied instructionSet is null, the package manager will use
440     * the packages default instruction set.
441     *
442     * In most cases, apps are dexopted in advance and this function will
443     * be a no-op.
444     */
445    boolean performDexOptIfNeeded(String packageName, String instructionSet);
446
447    void forceDexOpt(String packageName);
448
449    /**
450     * Update status of external media on the package manager to scan and
451     * install packages installed on the external media. Like say the
452     * MountService uses this to call into the package manager to update
453     * status of sdcard.
454     */
455    void updateExternalMediaStatus(boolean mounted, boolean reportStatus);
456
457    PackageCleanItem nextPackageToClean(in PackageCleanItem lastPackage);
458
459    int getMoveStatus(int moveId);
460
461    void registerMoveCallback(in IPackageMoveObserver callback);
462    void unregisterMoveCallback(in IPackageMoveObserver callback);
463
464    int movePackage(in String packageName, in String volumeUuid);
465    int movePrimaryStorage(in String volumeUuid);
466
467    boolean addPermissionAsync(in PermissionInfo info);
468
469    boolean setInstallLocation(int loc);
470    int getInstallLocation();
471
472    int installExistingPackageAsUser(String packageName, int userId);
473
474    void verifyPendingInstall(int id, int verificationCode);
475    void extendVerificationTimeout(int id, int verificationCodeAtTimeout, long millisecondsToDelay);
476
477    void verifyIntentFilter(int id, int verificationCode, in List<String> failedDomains);
478    int getIntentVerificationStatus(String packageName, int userId);
479    boolean updateIntentVerificationStatus(String packageName, int status, int userId);
480    List<IntentFilterVerificationInfo> getIntentFilterVerifications(String packageName);
481    List<IntentFilter> getAllIntentFilters(String packageName);
482
483    boolean setDefaultBrowserPackageName(String packageName, int userId);
484    String getDefaultBrowserPackageName(int userId);
485
486    VerifierDeviceIdentity getVerifierDeviceIdentity();
487
488    boolean isFirstBoot();
489    boolean isOnlyCoreApps();
490    boolean isUpgrade();
491
492    void setPermissionEnforced(String permission, boolean enforced);
493    boolean isPermissionEnforced(String permission);
494
495    /** Reflects current DeviceStorageMonitorService state */
496    boolean isStorageLow();
497
498    boolean setApplicationHiddenSettingAsUser(String packageName, boolean hidden, int userId);
499    boolean getApplicationHiddenSettingAsUser(String packageName, int userId);
500
501    IPackageInstaller getPackageInstaller();
502
503    boolean setBlockUninstallForUser(String packageName, boolean blockUninstall, int userId);
504    boolean getBlockUninstallForUser(String packageName, int userId);
505
506    KeySet getKeySetByAlias(String packageName, String alias);
507    KeySet getSigningKeySet(String packageName);
508    boolean isPackageSignedByKeySet(String packageName, in KeySet ks);
509    boolean isPackageSignedByKeySetExactly(String packageName, in KeySet ks);
510
511    void addOnPermissionsChangeListener(in IOnPermissionsChangeListener listener);
512    void removeOnPermissionsChangeListener(in IOnPermissionsChangeListener listener);
513    void grantDefaultPermissionsToEnabledCarrierApps(in String[] packageNames, int userId);
514
515    boolean isPermissionRevokedByPolicy(String permission, String packageName, int userId);
516
517    String getPermissionControllerPackageName();
518
519    ParceledListSlice getEphemeralApplications(int userId);
520    byte[] getEphemeralApplicationCookie(String packageName, int userId);
521    boolean setEphemeralApplicationCookie(String packageName, in byte[] cookie, int userId);
522    Bitmap getEphemeralApplicationIcon(String packageName, int userId);
523    boolean isEphemeralApplication(String packageName, int userId);
524}
525