IPackageManager.aidl revision 5de7377feca5242fe7127e2d4dc7792d4886d365
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    void installPackage(in String originPath,
193            in IPackageInstallObserver2 observer,
194            int flags,
195            in String installerPackageName,
196            in VerificationParams verificationParams,
197            in String packageAbiOverride);
198
199    void finishPackageInstall(int token);
200
201    void setInstallerPackageName(in String targetPackage, in String installerPackageName);
202
203    /**
204     * Delete a package for a specific user.
205     *
206     * @param packageName The fully qualified name of the package to delete.
207     * @param observer a callback to use to notify when the package deletion in finished.
208     * @param userId the id of the user for whom to delete the package
209     * @param flags - possible values: {@link #DONT_DELETE_DATA}
210     */
211    void deletePackageAsUser(in String packageName, IPackageDeleteObserver observer,
212            int userId, int flags);
213
214    String getInstallerPackageName(in String packageName);
215
216    void addPackageToPreferred(String packageName);
217
218    void removePackageFromPreferred(String packageName);
219
220    List<PackageInfo> getPreferredPackages(int flags);
221
222    void resetPreferredActivities(int userId);
223
224    ResolveInfo getLastChosenActivity(in Intent intent,
225            String resolvedType, int flags);
226
227    void setLastChosenActivity(in Intent intent, String resolvedType, int flags,
228            in IntentFilter filter, int match, in ComponentName activity);
229
230    void addPreferredActivity(in IntentFilter filter, int match,
231            in ComponentName[] set, in ComponentName activity, int userId);
232
233    void replacePreferredActivity(in IntentFilter filter, int match,
234            in ComponentName[] set, in ComponentName activity);
235
236    void clearPackagePreferredActivities(String packageName);
237
238    int getPreferredActivities(out List<IntentFilter> outFilters,
239            out List<ComponentName> outActivities, String packageName);
240
241    void addPersistentPreferredActivity(in IntentFilter filter, in ComponentName activity, int userId);
242
243    void clearPackagePersistentPreferredActivities(String packageName, int userId);
244
245    void addCrossProfileIntentFilter(in IntentFilter intentFilter, int sourceUserId, int targetUserId,
246            int flags);
247
248    void addCrossProfileIntentsForPackage(in String packageName, int sourceUserId,
249            int targetUserId);
250
251    void clearCrossProfileIntentFilters(int sourceUserId);
252
253    /**
254     * Report the set of 'Home' activity candidates, plus (if any) which of them
255     * is the current "always use this one" setting.
256     */
257     ComponentName getHomeActivities(out List<ResolveInfo> outHomeCandidates);
258
259    /**
260     * As per {@link android.content.pm.PackageManager#setComponentEnabledSetting}.
261     */
262    void setComponentEnabledSetting(in ComponentName componentName,
263            in int newState, in int flags, int userId);
264
265    /**
266     * As per {@link android.content.pm.PackageManager#getComponentEnabledSetting}.
267     */
268    int getComponentEnabledSetting(in ComponentName componentName, int userId);
269
270    /**
271     * As per {@link android.content.pm.PackageManager#setApplicationEnabledSetting}.
272     */
273    void setApplicationEnabledSetting(in String packageName, in int newState, int flags,
274            int userId, String callingPackage);
275
276    /**
277     * As per {@link android.content.pm.PackageManager#getApplicationEnabledSetting}.
278     */
279    int getApplicationEnabledSetting(in String packageName, int userId);
280
281    /**
282     * Set whether the given package should be considered stopped, making
283     * it not visible to implicit intents that filter out stopped packages.
284     */
285    void setPackageStoppedState(String packageName, boolean stopped, int userId);
286
287    /**
288     * Free storage by deleting LRU sorted list of cache files across
289     * all applications. If the currently available free storage
290     * on the device is greater than or equal to the requested
291     * free storage, no cache files are cleared. If the currently
292     * available storage on the device is less than the requested
293     * free storage, some or all of the cache files across
294     * all applications are deleted (based on last accessed time)
295     * to increase the free storage space on the device to
296     * the requested value. There is no guarantee that clearing all
297     * the cache files from all applications will clear up
298     * enough storage to achieve the desired value.
299     * @param freeStorageSize The number of bytes of storage to be
300     * freed by the system. Say if freeStorageSize is XX,
301     * and the current free storage is YY,
302     * if XX is less than YY, just return. if not free XX-YY number
303     * of bytes if possible.
304     * @param observer call back used to notify when
305     * the operation is completed
306     */
307     void freeStorageAndNotify(in long freeStorageSize,
308             IPackageDataObserver observer);
309
310    /**
311     * Free storage by deleting LRU sorted list of cache files across
312     * all applications. If the currently available free storage
313     * on the device is greater than or equal to the requested
314     * free storage, no cache files are cleared. If the currently
315     * available storage on the device is less than the requested
316     * free storage, some or all of the cache files across
317     * all applications are deleted (based on last accessed time)
318     * to increase the free storage space on the device to
319     * the requested value. There is no guarantee that clearing all
320     * the cache files from all applications will clear up
321     * enough storage to achieve the desired value.
322     * @param freeStorageSize The number of bytes of storage to be
323     * freed by the system. Say if freeStorageSize is XX,
324     * and the current free storage is YY,
325     * if XX is less than YY, just return. if not free XX-YY number
326     * of bytes if possible.
327     * @param pi IntentSender call back used to
328     * notify when the operation is completed.May be null
329     * to indicate that no call back is desired.
330     */
331     void freeStorage(in long freeStorageSize,
332             in IntentSender pi);
333
334    /**
335     * Delete all the cache files in an applications cache directory
336     * @param packageName The package name of the application whose cache
337     * files need to be deleted
338     * @param observer a callback used to notify when the deletion is finished.
339     */
340    void deleteApplicationCacheFiles(in String packageName, IPackageDataObserver observer);
341
342    /**
343     * Clear the user data directory of an application.
344     * @param packageName The package name of the application whose cache
345     * files need to be deleted
346     * @param observer a callback used to notify when the operation is completed.
347     */
348    void clearApplicationUserData(in String packageName, IPackageDataObserver observer, int userId);
349
350   /**
351     * Get package statistics including the code, data and cache size for
352     * an already installed package
353     * @param packageName The package name of the application
354     * @param userHandle Which user the size should be retrieved for
355     * @param observer a callback to use to notify when the asynchronous
356     * retrieval of information is complete.
357     */
358    void getPackageSizeInfo(in String packageName, int userHandle, IPackageStatsObserver observer);
359
360    /**
361     * Get a list of shared libraries that are available on the
362     * system.
363     */
364    String[] getSystemSharedLibraryNames();
365
366    /**
367     * Get a list of features that are available on the
368     * system.
369     */
370    FeatureInfo[] getSystemAvailableFeatures();
371
372    boolean hasSystemFeature(String name);
373
374    void enterSafeMode();
375    boolean isSafeMode();
376    void systemReady();
377    boolean hasSystemUidErrors();
378
379    /**
380     * Ask the package manager to perform boot-time dex-opt of all
381     * existing packages.
382     */
383    void performBootDexOpt();
384
385    /**
386     * Ask the package manager to perform dex-opt (if needed) on the given
387     * package, if it already hasn't done mode.  Only does this if running
388     * in the special development "no pre-dexopt" mode.
389     */
390    boolean performDexOpt(String packageName);
391
392    /**
393     * Update status of external media on the package manager to scan and
394     * install packages installed on the external media. Like say the
395     * MountService uses this to call into the package manager to update
396     * status of sdcard.
397     */
398    void updateExternalMediaStatus(boolean mounted, boolean reportStatus);
399
400    PackageCleanItem nextPackageToClean(in PackageCleanItem lastPackage);
401
402    void movePackage(String packageName, IPackageMoveObserver observer, int flags);
403
404    boolean addPermissionAsync(in PermissionInfo info);
405
406    boolean setInstallLocation(int loc);
407    int getInstallLocation();
408
409    int installExistingPackageAsUser(String packageName, int userId);
410
411    void verifyPendingInstall(int id, int verificationCode);
412    void extendVerificationTimeout(int id, int verificationCodeAtTimeout, long millisecondsToDelay);
413
414    VerifierDeviceIdentity getVerifierDeviceIdentity();
415
416    boolean isFirstBoot();
417    boolean isOnlyCoreApps();
418
419    void setPermissionEnforced(String permission, boolean enforced);
420    boolean isPermissionEnforced(String permission);
421
422    /** Reflects current DeviceStorageMonitorService state */
423    boolean isStorageLow();
424
425    boolean setApplicationBlockedSettingAsUser(String packageName, boolean blocked, int userId);
426    boolean getApplicationBlockedSettingAsUser(String packageName, int userId);
427
428    IPackageInstaller getPackageInstaller();
429
430    boolean setBlockUninstallForUser(String packageName, boolean blockUninstall, int userId);
431    boolean getBlockUninstallForUser(String packageName, int userId);
432}
433