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