IPackageManager.aidl revision c13053bf1c05b980421611487ce67677c08db299
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.FeatureInfo;
27import android.content.pm.IPackageInstallObserver;
28import android.content.pm.IPackageInstallObserver2;
29import android.content.pm.IPackageInstaller;
30import android.content.pm.IPackageDeleteObserver;
31import android.content.pm.IPackageDataObserver;
32import android.content.pm.IPackageMoveObserver;
33import android.content.pm.IPackageStatsObserver;
34import android.content.pm.InstrumentationInfo;
35import android.content.pm.PackageInfo;
36import android.content.pm.ManifestDigest;
37import android.content.pm.PackageCleanItem;
38import android.content.pm.ParceledListSlice;
39import android.content.pm.ProviderInfo;
40import android.content.pm.PermissionGroupInfo;
41import android.content.pm.PermissionInfo;
42import android.content.pm.ResolveInfo;
43import android.content.pm.ServiceInfo;
44import android.content.pm.UserInfo;
45import android.content.pm.VerificationParams;
46import android.content.pm.VerifierDeviceIdentity;
47import android.net.Uri;
48import android.os.ParcelFileDescriptor;
49import android.content.IntentSender;
50
51/**
52 *  See {@link PackageManager} for documentation on most of the APIs
53 *  here.
54 *
55 *  {@hide}
56 */
57interface IPackageManager {
58    boolean isPackageAvailable(String packageName, int userId);
59    PackageInfo getPackageInfo(String packageName, int flags, int userId);
60    int getPackageUid(String packageName, int userId);
61    int[] getPackageGids(String packageName);
62
63    String[] currentToCanonicalPackageNames(in String[] names);
64    String[] canonicalToCurrentPackageNames(in String[] names);
65
66    PermissionInfo getPermissionInfo(String name, int flags);
67
68    List<PermissionInfo> queryPermissionsByGroup(String group, int flags);
69
70    PermissionGroupInfo getPermissionGroupInfo(String name, int flags);
71
72    List<PermissionGroupInfo> getAllPermissionGroups(int flags);
73
74    ApplicationInfo getApplicationInfo(String packageName, int flags ,int userId);
75
76    ActivityInfo getActivityInfo(in ComponentName className, int flags, int userId);
77
78    boolean activitySupportsIntent(in ComponentName className, in Intent intent,
79            String resolvedType);
80
81    ActivityInfo getReceiverInfo(in ComponentName className, int flags, int userId);
82
83    ServiceInfo getServiceInfo(in ComponentName className, int flags, int userId);
84
85    ProviderInfo getProviderInfo(in ComponentName className, int flags, int userId);
86
87    int checkPermission(String permName, String pkgName);
88
89    int checkUidPermission(String permName, int uid);
90
91    boolean addPermission(in PermissionInfo info);
92
93    void removePermission(String name);
94
95    void grantPermission(String packageName, String permissionName);
96
97    void revokePermission(String packageName, String permissionName);
98
99    boolean isProtectedBroadcast(String actionName);
100
101    int checkSignatures(String pkg1, String pkg2);
102
103    int checkUidSignatures(int uid1, int uid2);
104
105    String[] getPackagesForUid(int uid);
106
107    String getNameForUid(int uid);
108
109    int getUidForSharedUser(String sharedUserName);
110
111    int getFlagsForUid(int uid);
112
113    ResolveInfo resolveIntent(in Intent intent, String resolvedType, int flags, int userId);
114
115    boolean canForwardTo(in Intent intent, String resolvedType, int sourceUserId, int targetUserId);
116
117    List<ResolveInfo> queryIntentActivities(in Intent intent,
118            String resolvedType, int flags, int userId);
119
120    List<ResolveInfo> queryIntentActivityOptions(
121            in ComponentName caller, in Intent[] specifics,
122            in String[] specificTypes, in Intent intent,
123            String resolvedType, int flags, int userId);
124
125    List<ResolveInfo> queryIntentReceivers(in Intent intent,
126            String resolvedType, int flags, int userId);
127
128    ResolveInfo resolveService(in Intent intent,
129            String resolvedType, int flags, int userId);
130
131    List<ResolveInfo> queryIntentServices(in Intent intent,
132            String resolvedType, int flags, int userId);
133
134    List<ResolveInfo> queryIntentContentProviders(in Intent intent,
135            String resolvedType, int flags, int userId);
136
137    /**
138     * This implements getInstalledPackages via a "last returned row"
139     * mechanism that is not exposed in the API. This is to get around the IPC
140     * limit that kicks in when flags are included that bloat up the data
141     * returned.
142     */
143    ParceledListSlice getInstalledPackages(int flags, in int userId);
144
145    /**
146     * This implements getPackagesHoldingPermissions via a "last returned row"
147     * mechanism that is not exposed in the API. This is to get around the IPC
148     * limit that kicks in when flags are included that bloat up the data
149     * returned.
150     */
151    ParceledListSlice getPackagesHoldingPermissions(in String[] permissions,
152            int flags, int userId);
153
154    /**
155     * This implements getInstalledApplications via a "last returned row"
156     * mechanism that is not exposed in the API. This is to get around the IPC
157     * limit that kicks in when flags are included that bloat up the data
158     * returned.
159     */
160    ParceledListSlice getInstalledApplications(int flags, int userId);
161
162    /**
163     * Retrieve all applications that are marked as persistent.
164     *
165     * @return A List&lt;applicationInfo> containing one entry for each persistent
166     *         application.
167     */
168    List<ApplicationInfo> getPersistentApplications(int flags);
169
170    ProviderInfo resolveContentProvider(String name, int flags, int userId);
171
172    /**
173     * Retrieve sync information for all content providers.
174     *
175     * @param outNames Filled in with a list of the root names of the content
176     *                 providers that can sync.
177     * @param outInfo Filled in with a list of the ProviderInfo for each
178     *                name in 'outNames'.
179     */
180    void querySyncProviders(inout List<String> outNames,
181            inout List<ProviderInfo> outInfo);
182
183    List<ProviderInfo> queryContentProviders(
184            String processName, int uid, int flags);
185
186    InstrumentationInfo getInstrumentationInfo(
187            in ComponentName className, int flags);
188
189    List<InstrumentationInfo> queryInstrumentation(
190            String targetPackage, int flags);
191
192    /**
193     * Install a package.
194     *
195     * @param packageURI The location of the package file to install.
196     * @param observer a callback to use to notify when the package installation in finished.
197     * @param flags - possible values: {@link #FORWARD_LOCK_PACKAGE},
198     * {@link #REPLACE_EXISITING_PACKAGE}
199     * @param installerPackageName Optional package name of the application that is performing the
200     * installation. This identifies which market the package came from.
201     */
202    void installPackage(in Uri packageURI, IPackageInstallObserver observer, int flags,
203            in String installerPackageName);
204
205    void finishPackageInstall(int token);
206
207    void setInstallerPackageName(in String targetPackage, in String installerPackageName);
208
209    /**
210     * Delete a package for a specific user.
211     *
212     * @param packageName The fully qualified name of the package to delete.
213     * @param observer a callback to use to notify when the package deletion in finished.
214     * @param userId the id of the user for whom to delete the package
215     * @param flags - possible values: {@link #DONT_DELETE_DATA}
216     */
217    void deletePackageAsUser(in String packageName, IPackageDeleteObserver observer,
218            int userId, int flags);
219
220    String getInstallerPackageName(in String packageName);
221
222    void addPackageToPreferred(String packageName);
223
224    void removePackageFromPreferred(String packageName);
225
226    List<PackageInfo> getPreferredPackages(int flags);
227
228    void resetPreferredActivities(int userId);
229
230    ResolveInfo getLastChosenActivity(in Intent intent,
231            String resolvedType, int flags);
232
233    void setLastChosenActivity(in Intent intent, String resolvedType, int flags,
234            in IntentFilter filter, int match, in ComponentName activity);
235
236    void addPreferredActivity(in IntentFilter filter, int match,
237            in ComponentName[] set, in ComponentName activity, int userId);
238
239    void replacePreferredActivity(in IntentFilter filter, int match,
240            in ComponentName[] set, in ComponentName activity);
241
242    void clearPackagePreferredActivities(String packageName);
243
244    int getPreferredActivities(out List<IntentFilter> outFilters,
245            out List<ComponentName> outActivities, String packageName);
246
247    void addPersistentPreferredActivity(in IntentFilter filter, in ComponentName activity, int userId);
248
249    void clearPackagePersistentPreferredActivities(String packageName, int userId);
250
251    void addCrossProfileIntentFilter(in IntentFilter intentFilter, int sourceUserId, int targetUserId,
252            int flags);
253
254    void addCrossProfileIntentsForPackage(in String packageName, int sourceUserId,
255            int targetUserId);
256
257    void clearCrossProfileIntentFilters(int sourceUserId);
258
259    /**
260     * Report the set of 'Home' activity candidates, plus (if any) which of them
261     * is the current "always use this one" setting.
262     */
263     ComponentName getHomeActivities(out List<ResolveInfo> outHomeCandidates);
264
265    /**
266     * As per {@link android.content.pm.PackageManager#setComponentEnabledSetting}.
267     */
268    void setComponentEnabledSetting(in ComponentName componentName,
269            in int newState, in int flags, int userId);
270
271    /**
272     * As per {@link android.content.pm.PackageManager#getComponentEnabledSetting}.
273     */
274    int getComponentEnabledSetting(in ComponentName componentName, int userId);
275
276    /**
277     * As per {@link android.content.pm.PackageManager#setApplicationEnabledSetting}.
278     */
279    void setApplicationEnabledSetting(in String packageName, in int newState, int flags,
280            int userId, String callingPackage);
281
282    /**
283     * As per {@link android.content.pm.PackageManager#getApplicationEnabledSetting}.
284     */
285    int getApplicationEnabledSetting(in String packageName, int userId);
286
287    /**
288     * Set whether the given package should be considered stopped, making
289     * it not visible to implicit intents that filter out stopped packages.
290     */
291    void setPackageStoppedState(String packageName, boolean stopped, int userId);
292
293    /**
294     * Free storage by deleting LRU sorted list of cache files across
295     * all applications. If the currently available free storage
296     * on the device is greater than or equal to the requested
297     * free storage, no cache files are cleared. If the currently
298     * available storage on the device is less than the requested
299     * free storage, some or all of the cache files across
300     * all applications are deleted (based on last accessed time)
301     * to increase the free storage space on the device to
302     * the requested value. There is no guarantee that clearing all
303     * the cache files from all applications will clear up
304     * enough storage to achieve the desired value.
305     * @param freeStorageSize The number of bytes of storage to be
306     * freed by the system. Say if freeStorageSize is XX,
307     * and the current free storage is YY,
308     * if XX is less than YY, just return. if not free XX-YY number
309     * of bytes if possible.
310     * @param observer call back used to notify when
311     * the operation is completed
312     */
313     void freeStorageAndNotify(in long freeStorageSize,
314             IPackageDataObserver observer);
315
316    /**
317     * Free storage by deleting LRU sorted list of cache files across
318     * all applications. If the currently available free storage
319     * on the device is greater than or equal to the requested
320     * free storage, no cache files are cleared. If the currently
321     * available storage on the device is less than the requested
322     * free storage, some or all of the cache files across
323     * all applications are deleted (based on last accessed time)
324     * to increase the free storage space on the device to
325     * the requested value. There is no guarantee that clearing all
326     * the cache files from all applications will clear up
327     * enough storage to achieve the desired value.
328     * @param freeStorageSize The number of bytes of storage to be
329     * freed by the system. Say if freeStorageSize is XX,
330     * and the current free storage is YY,
331     * if XX is less than YY, just return. if not free XX-YY number
332     * of bytes if possible.
333     * @param pi IntentSender call back used to
334     * notify when the operation is completed.May be null
335     * to indicate that no call back is desired.
336     */
337     void freeStorage(in long freeStorageSize,
338             in IntentSender pi);
339
340    /**
341     * Delete all the cache files in an applications cache directory
342     * @param packageName The package name of the application whose cache
343     * files need to be deleted
344     * @param observer a callback used to notify when the deletion is finished.
345     */
346    void deleteApplicationCacheFiles(in String packageName, IPackageDataObserver observer);
347
348    /**
349     * Clear the user data directory of an application.
350     * @param packageName The package name of the application whose cache
351     * files need to be deleted
352     * @param observer a callback used to notify when the operation is completed.
353     */
354    void clearApplicationUserData(in String packageName, IPackageDataObserver observer, int userId);
355
356   /**
357     * Get package statistics including the code, data and cache size for
358     * an already installed package
359     * @param packageName The package name of the application
360     * @param userHandle Which user the size should be retrieved for
361     * @param observer a callback to use to notify when the asynchronous
362     * retrieval of information is complete.
363     */
364    void getPackageSizeInfo(in String packageName, int userHandle, IPackageStatsObserver observer);
365
366    /**
367     * Get a list of shared libraries that are available on the
368     * system.
369     */
370    String[] getSystemSharedLibraryNames();
371
372    /**
373     * Get a list of features that are available on the
374     * system.
375     */
376    FeatureInfo[] getSystemAvailableFeatures();
377
378    boolean hasSystemFeature(String name);
379
380    void enterSafeMode();
381    boolean isSafeMode();
382    void systemReady();
383    boolean hasSystemUidErrors();
384
385    /**
386     * Ask the package manager to perform boot-time dex-opt of all
387     * existing packages.
388     */
389    void performBootDexOpt();
390
391    /**
392     * Ask the package manager to perform dex-opt (if needed) on the given
393     * package, if it already hasn't done mode.  Only does this if running
394     * in the special development "no pre-dexopt" mode.
395     */
396    boolean performDexOpt(String packageName);
397
398    /**
399     * Update status of external media on the package manager to scan and
400     * install packages installed on the external media. Like say the
401     * MountService uses this to call into the package manager to update
402     * status of sdcard.
403     */
404    void updateExternalMediaStatus(boolean mounted, boolean reportStatus);
405
406    PackageCleanItem nextPackageToClean(in PackageCleanItem lastPackage);
407
408    void movePackage(String packageName, IPackageMoveObserver observer, int flags);
409
410    boolean addPermissionAsync(in PermissionInfo info);
411
412    boolean setInstallLocation(int loc);
413    int getInstallLocation();
414
415    void installPackageWithVerification(in Uri packageURI, in IPackageInstallObserver observer,
416            int flags, in String installerPackageName, in Uri verificationURI,
417            in ManifestDigest manifestDigest, in ContainerEncryptionParams encryptionParams);
418
419    void installPackageWithVerificationAndEncryption(in Uri packageURI,
420            in IPackageInstallObserver observer, int flags, in String installerPackageName,
421            in VerificationParams verificationParams,
422            in ContainerEncryptionParams encryptionParams);
423
424    /** Expanded observer versions */
425    void installPackageEtc(in Uri packageURI, IPackageInstallObserver observer,
426            IPackageInstallObserver2 observer2, int flags, in String installerPackageName);
427
428    void installPackageWithVerificationEtc(in Uri packageURI,
429            in IPackageInstallObserver observer, IPackageInstallObserver2 observer2,
430            int flags, in String installerPackageName, in Uri verificationURI,
431            in ManifestDigest manifestDigest, in ContainerEncryptionParams encryptionParams);
432
433    void installPackageWithVerificationAndEncryptionEtc(in Uri packageURI,
434            in IPackageInstallObserver observer, in IPackageInstallObserver2 observer2,
435            int flags, in String installerPackageName,
436            in VerificationParams verificationParams,
437            in ContainerEncryptionParams encryptionParams);
438
439    void installPackageWithVerificationEncryptionAndAbiOverrideEtc(in Uri packageURI,
440            in IPackageInstallObserver observer, in IPackageInstallObserver2 observer2,
441            int flags, in String installerPackageName,
442            in VerificationParams verificationParams,
443            in ContainerEncryptionParams encryptionParams,
444        in String packageAbiOverride);
445
446    int installExistingPackageAsUser(String packageName, int userId);
447
448    void verifyPendingInstall(int id, int verificationCode);
449    void extendVerificationTimeout(int id, int verificationCodeAtTimeout, long millisecondsToDelay);
450
451    VerifierDeviceIdentity getVerifierDeviceIdentity();
452
453    boolean isFirstBoot();
454    boolean isOnlyCoreApps();
455
456    void setPermissionEnforced(String permission, boolean enforced);
457    boolean isPermissionEnforced(String permission);
458
459    /** Reflects current DeviceStorageMonitorService state */
460    boolean isStorageLow();
461
462    boolean setApplicationBlockedSettingAsUser(String packageName, boolean blocked, int userId);
463    boolean getApplicationBlockedSettingAsUser(String packageName, int userId);
464
465    IPackageInstaller getPackageInstaller();
466
467    boolean setBlockUninstallForUser(String packageName, boolean blockUninstall, int userId);
468    boolean getBlockUninstallForUser(String packageName, int userId);
469}
470